:root {
    --primary: #10b981; /* Verde menta da calculadora */
    --primary-dark: #059669;
    --admin-primary: #3b82f6; /* Azul do painel admin */
    --admin-dark: #1e3a8a;
    --bg-color: #0f172a;
    --card-bg: #ffffff;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.08) 0%, transparent 40%);
    min-height: 100vh;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
}

/* Barra de Navegação Superior (Header Web) */
.navbar {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 800;
}

.brand-logo {
    height: 38px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
}

.navbar-nav {
    display: flex;
    gap: 8px;
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.nav-link.active-admin {
    color: #ffffff;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-dark));
}

/* Container Principal do Conteúdo */
.main-container {
    max-width: 1200px;
    margin: 32px auto;
    width: 100%;
    padding: 0 24px;
    flex: 1;
    position: relative;
}

/* Estrutura de Grid Responsiva (2 Colunas no Desktop) */
.layout-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }
}

/* Barra de Navegação Inferior (Mobile Footer / Rodapé) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 68px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: none;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding: 8px 16px;
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.5);
}

.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: #94a3b8;
    text-decoration: none;
    width: 45%;
    height: 100%;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 12px;
}

.bottom-nav-link i {
    font-size: 20px;
}

.bottom-nav-link:hover {
    color: #ffffff;
}

.bottom-nav-link.active {
    color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
}

.bottom-nav-link.active-admin {
    color: var(--admin-primary);
    background: rgba(59, 130, 246, 0.1);
}

@media (max-width: 768px) {
    .navbar-nav {
        display: none !important;
    }
    .bottom-nav {
        display: flex !important;
    }
    body {
        padding-bottom: 80px; /* Evita que o rodapé sobreponha o conteúdo */
    }
    .navbar-container {
        justify-content: center;
    }
}

/* Cards Estilizados */
.card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
    margin-bottom: 24px;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-dark);
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}

/* Inputs e Botões Estilizados */
.input-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 14px;
    color: var(--text-light);
    font-size: 16px;
}

.form-control {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    background-color: #ffffff;
    color: var(--text-dark);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.admin-focus:focus {
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
}

.btn-primary:hover {
    opacity: 0.95;
    transform: scale(0.99);
}

.btn-admin {
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-dark));
    color: #ffffff;
}

.btn-admin:hover {
    opacity: 0.95;
    transform: scale(0.99);
}

/* Widgets da Calculadora */
.progress-circle-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 20px;
}

.progress-text h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 38px;
    font-weight: 800;
    color: var(--primary-dark);
    margin: 4px 0;
}

.progress-circle {
    position: relative;
    width: 100px;
    height: 100px;
}

.progress-circle svg {
    width: 100px;
    height: 100px;
    transform: rotate(-90deg);
}

.progress-circle circle {
    fill: none;
    stroke-width: 10;
}

.progress-circle circle.bg {
    stroke: #e2e8f0;
}

.progress-circle circle.val {
    stroke: var(--primary);
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 0.8s ease-in-out;
    stroke-linecap: round;
}

.progress-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: 800;
    color: var(--text-dark);
}

/* Lista de Autocomplete de Alimentos */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    border: 1px solid #cbd5e1;
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.autocomplete-item {
    padding: 12px 16px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: var(--transition);
}

.autocomplete-item:hover {
    background-color: #f8fafc;
    color: var(--primary-dark);
}

/* Histórico de Consumo */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 5px solid var(--primary);
    border-top: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
    transition: var(--transition);
}

.history-item:hover {
    transform: translateX(2px);
}

.history-item-details {
    display: flex;
    flex-direction: column;
}

.history-item-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.history-item-meta {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 2px;
}

.history-item-carbs {
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 15px;
}

.history-remove-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 6px;
    font-size: 16px;
    transition: var(--transition);
}

.history-remove-btn:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

/* Painel Administrativo Header */
.admin-header-panel {
    background: linear-gradient(135deg, var(--admin-dark), var(--admin-primary));
    color: white;
    padding: 20px 24px;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.admin-header-title h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 750;
}

.admin-header-title span {
    font-size: 13px;
    opacity: 0.9;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.9);
}

/* Scanner de Câmera */
.scanner-container {
    position: relative;
    background: #000000;
    border-radius: 16px;
    overflow: hidden;
    width: 100%;
    height: 250px;
    margin-bottom: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px dashed #cbd5e1;
}

#qr-reader {
    width: 100% !important;
    height: 100% !important;
}

.scanner-placeholder {
    position: absolute;
    color: white;
    text-align: center;
    padding: 20px;
}

.scanner-placeholder i {
    font-size: 48px;
    margin-bottom: 12px;
    color: var(--admin-primary);
}

/* Grid de Códigos de Barras no Simulador */
.sim-codes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.btn-sim-code {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 12px;
    font-size: 12px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
    color: var(--text-dark);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-sim-code:hover {
    background: var(--admin-primary);
    color: white;
    border-color: var(--admin-primary);
}

/* Resultados OFF */
.results-off {
    background: #f8fafc;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #cbd5e1;
    display: none;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.off-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}

.nutriscore-badge {
    padding: 6px 14px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
}

.nutrition-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    font-size: 13px;
}

.nutrition-table td {
    padding: 8px 0;
    border-bottom: 1px solid #cbd5e1;
}

.nutrition-table td:last-child {
    text-align: right;
    font-weight: 700;
}

/* Loading Overlay Web */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-admin {
    border-top: 5px solid var(--admin-primary);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Alertas */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    display: none;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Seções de Telas */
.screen-section {
    display: none;
    width: 100%;
}

.screen-section.active {
    display: block;
}

/* Container centralizado para telas de login ou menores */
.small-container {
    max-width: 500px;
    margin: 40px auto;
    width: 100%;
}
