/* --- 1. IMPORTAÇÃO DA FONTE MODERNA (POPPINS) E VARIÁVEIS DE TEMA --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    /* Identidade Visual - Verde Lima */
    --primary-color: #a3e635; /* Verde Lima Principal */
    --primary-hover: #84cc16; /* Verde Lima Escuro (Hover) */
    --primary-light: rgba(163, 230, 53, 0.15); /* Fundo transparente para foco */
    --primary-shadow: rgba(163, 230, 53, 0.4);
    --btn-text: #121212; /* Texto escuro para botões verde lima (contraste) */

    /* Tema Claro (Light Mode) - Padrão */
    --bg-body: #f0f2f5;
    --bg-dashboard: #f7f9fc;
    --bg-body-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --bg-card: #ffffff;
    --text-main: #333333;
    --text-heading: #2c3e50;
    --text-muted: #7f8c8d;
    --text-muted-alt: #5a6e83;
    --border-color: #eef2f6;
    --border-input: #dcdcdc;
    --input-bg: #f9f9f9;
    --hover-bg: #f4ffe6; /* Fundo suave esverdeado para hover */
    --modal-overlay: rgba(0, 0, 0, 0.6);
    --icon-bg-protein: #eaf3ff;
    --icon-bg-carb: #fff8e1;
    --icon-bg-fat: #f3e5f5;
    --toast-bg: #6d6867;
}

body.dark-theme {
    /* Tema Escuro (Dark Mode) */
    --bg-body: #121212;
    --bg-dashboard: #18181b; /* Fundo principal dark */
    --bg-body-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --bg-card: #27272a; /* Cor dos cards no dark mode */
    --text-main: #f4f4f5; /* Texto branco fosco */
    --text-heading: #ffffff; /* Texto branco puro para ênfase */
    --text-muted: #a1a1aa; /* Cinza claro para textos de apoio */
    --text-muted-alt: #d4d4d8;
    --border-color: #3f3f46; /* Bordas escuras */
    --border-input: #52525b;
    --input-bg: #18181b; /* Inputs escuros */
    --hover-bg: #3f3f46; /* Hover genérico escuro */
    --modal-overlay: rgba(0, 0, 0, 0.85);
    --icon-bg-protein: #1e3a8a;
    --icon-bg-carb: #78350f;
    --icon-bg-fat: #4c1d95;
    --toast-bg: #3f3f46;
}

/* --- GERAL E FONTES --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Poppins', sans-serif; background: var(--bg-body); color: var(--text-main); min-height: 100vh; overflow-x: hidden; transition: background-color 0.3s ease, color 0.3s ease; }
body:not(.dashboard-body) { background: var(--bg-body-gradient); display: flex; justify-content: center; align-items: center; padding: 1rem; }

/* --- FORÇA a seleção de texto em todo o site --- */
*,
*::before,
*::after {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

/* --- 2. SCROLLBAR PERSONALIZADA --- */
::-webkit-scrollbar { width: 4px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-heading); }

/* --- FORMULÁRIOS DE AUTH --- */
.form-container { width: 100%; max-width: 420px; background-color: var(--bg-card); padding: 2.5rem; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); transition: background-color 0.3s ease; }
.styled-form h2 { text-align: center; margin-bottom: 0.5rem; font-size: 1.8rem; color: var(--text-heading); font-weight: 600; }
.styled-form p { text-align: center; margin-bottom: 2rem; color: var(--text-muted); }
.input-group { margin-bottom: 1.2rem; position: relative; }
.input-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--text-heading); }
.input-group input, .input-group select { width: 100%; padding: 12px 15px; border: 1px solid var(--border-input); border-radius: 8px; font-size: 1rem; transition: all 0.3s ease; background-color: var(--input-bg); color: var(--text-main); }
.input-group input:focus, .input-group select:focus { outline: none; border-color: var(--primary-color); background-color: var(--bg-card); box-shadow: 0 0 0 3px var(--primary-light); }
.input-group input[type="password"] { padding-right: 45px; }
.password-toggle-icon { position: absolute; bottom: 0; right: 15px; height: 45px; display: flex; align-items: center; cursor: pointer; color: var(--text-muted); }
.checkbox-group { display: flex; align-items: center; margin-bottom: 1.5rem; font-size: 0.9rem; color: var(--text-main); }
.checkbox-group input { margin-right: 0.5rem; }
.btn { width: 100%; padding: 15px; border: none; border-radius: 8px; background: var(--primary-color); color: var(--btn-text); font-size: 1.1rem; font-weight: 700; cursor: pointer; transition: all 0.3s ease; text-transform: uppercase; letter-spacing: 0.5px; }
.btn:hover { background: var(--primary-hover); box-shadow: 0 4px 15px var(--primary-shadow); transform: translateY(-2px); }
.form-footer { text-align: center; margin-top: 1.5rem; }
.form-footer a { color: var(--primary-color); text-decoration: none; font-weight: 600; }
.form-footer a:hover { text-decoration: underline; }

/* --- SPINNER DE CARREGAMENTO --- */
#spinner-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--modal-overlay); display: none; justify-content: center; align-items: center; z-index: 1000; backdrop-filter: blur(4px); }
.spinner { width: 50px; height: 50px; border: 5px solid var(--border-color); border-top: 5px solid var(--primary-color); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- NOTIFICAÇÕES (TOAST) --- */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 1003; display: flex; flex-direction: column; gap: 10px; }
.toast { background-color: var(--toast-bg); padding: 15px 10px; border-radius: 8px; color: #fff; font-size: 0.95rem; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); opacity: 0; transform: translateX(100%); transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); }
.toast.show { opacity: 1; transform: translateX(0); }
.toast-error { background-color: #e74c3c; color: #fff; }
.toast-success { background-color: #2ecc71; color: #fff; }
.toast-icon { float: left; padding: 0 5px; }

/* --- OTIMIZAÇÃO PARA CELULARES (AUTH) --- */
@media (max-width: 480px) {
    body:not(.dashboard-body) { padding: 0; align-items: flex-start; }
    .form-container { width: 100%; max-width: none; min-height: 100vh; border-radius: 0; box-shadow: none; padding: 2rem 1.5rem; }
    #toast-container { right: 5px; }
}

.logo-link { text-decoration: none; }

/* =====================================================
            ESTILOS DO DASHBOARD
===================================================== */
.page-wrapper { display: flex; width: 100%; min-height: 100vh; }
body.dashboard-body { background-color: var(--bg-dashboard); }
.sidebar { width: 260px; background-color: var(--bg-card); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), background-color 0.3s ease; flex-shrink: 0; }
.main-container { flex: 1; display: flex; flex-direction: column; overflow-x: hidden; }
.main-content { padding: 1.5rem 2rem; }

/* --- SIDEBAR --- */
.sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem; border-bottom: 1px solid var(--border-color); }
.sidebar-header h3 { font-size: 1.5rem; color: var(--primary-color); }
.sidebar-close-btn { display: none; }
.sidebar-menu { list-style: none; padding: 1rem 0; }
.menu-item a { display: flex; align-items: center; padding: 0.9rem 1.5rem; color: var(--text-muted-alt); text-decoration: none; font-weight: 500; transition: all 0.3s ease; border-left: 3px solid transparent; }
.menu-item a svg { width: 20px; height: 20px; margin-right: 1rem; }
.menu-item.active a, .menu-item a:hover { background-color: var(--hover-bg); color: var(--primary-color); border-left-color: var(--primary-color); }

/* --- TOPBAR --- */
.topbar { display: flex; align-items: center; padding: 1.35rem 2rem; background-color: var(--bg-card); border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 999; transition: background-color 0.3s ease; }
.menu-toggle { display: none; }
.search-bar { position: relative; flex-grow: 1; max-width: 400px; }
.search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-bar input { width: 100%; padding: 10px 15px 10px 45px; border-radius: 20px; border: 1px solid var(--border-color); background-color: var(--bg-dashboard); color: var(--text-main); transition: all 0.3s ease; }
.search-bar input:focus { outline: none; border-color: var(--primary-color); background-color: var(--bg-card); box-shadow: 0 0 0 2px var(--primary-light); }
.user-profile { position: relative; margin-left: auto; display: flex; align-items: center; gap: 1rem;}
.profile-avatar { width: 40px; height: 40px; border-radius: 50%; background-color: var(--primary-color); color: var(--btn-text); display: flex; justify-content: center; align-items: center; font-size: 1.2rem; font-weight: 600; cursor: pointer; }
.profile-dropdown { position: absolute; top: calc(100% + 10px); right: 0; background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 5px 20px rgba(0,0,0,0.1); width: 160px; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.3s ease; z-index: 1000; }
.profile-dropdown.show { opacity: 1; visibility: visible; transform: translateY(0); }
.profile-dropdown a { display: block; padding: 12px 10px; color: var(--text-main); text-decoration: none; transition: background-color 0.2s; }
.profile-dropdown a:hover { background-color: var(--hover-bg); color: var(--primary-color); }
.profile-dropdown a:first-child { border-top-left-radius: 8px; border-top-right-radius: 8px; }
.profile-dropdown a:last-child { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }

/* --- CONTEÚDO PRINCIPAL E CARDS --- */
.page-header { display: flex; justify-content: space-between; align-items: end; margin-bottom: 2rem; flex-wrap: wrap; gap: 1.5rem; }
.welcome-message h1 { font-size: 2rem; font-weight: 600; color: var(--text-heading); }
.welcome-message p { color: var(--text-muted); font-size: 1.1rem; }
.dashboard-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); }
.card { background-color: var(--bg-card); max-height: 450px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); padding: 1.5rem; display: flex; flex-direction: column; transition: background-color 0.3s ease; }
.card-header h3 { margin: 0; font-size: 1rem; color: var(--text-heading); font-weight: 500; }
.card-body { flex-grow: 1; display: flex; flex-direction: column; }
.chart-container, .chart-container-donut { position: relative; margin-top: 1rem; flex-grow: 1; min-height: 300px; }
.chart-center-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.chart-center-text span { display: block; font-size: 2.5rem; font-weight: 600; color: var(--text-heading); }
.chart-center-text small { font-size: 1rem; color: var(--text-muted); }
.no-data-message { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; color: var(--text-muted); text-align: center; flex-grow: 1; }
.no-data-message svg { width: 48px; height: 48px; margin-bottom: 1rem; }

/* --- ANIMAÇÕES DE ENTRADA (FADE IN) --- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.animate-on-load { opacity: 0; animation-name: fadeInUp; animation-duration: 0.7s; animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94); animation-fill-mode: forwards; }
.delay-1 { animation-delay: 0.1s; } .delay-2 { animation-delay: 0.2s; } .delay-3 { animation-delay: 0.3s; } .delay-4 { animation-delay: 0.4s; }

/* --- TABELA DE HISTÓRICO --- */
.table-responsive { width: 100%; overflow-x: auto; }
.styled-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.styled-table thead tr { background-color: var(--border-color); color: var(--text-muted-alt); text-align: left; }
.styled-table th, .styled-table td { padding: 12px 15px; border-bottom: 1px solid var(--border-color); color: var(--text-main); }
.styled-table tbody tr { border-bottom: 1px solid var(--border-color); transition: background-color 0.2s; }
.styled-table tbody tr:hover { background-color: var(--hover-bg); }
.styled-table tbody tr:last-of-type { border-bottom: none; }

/* --- PÁGINA DE ATIVIDADES / ALIMENTAÇÃO --- */
.page-header .btn { display: inline-flex; align-items: center; gap: 0.5rem; width: auto; }
.atividades-grid { display: flex; flex-direction: column; gap: 1.5rem; }
.interactive-card { cursor: pointer; transition: transform 0.2s ease-in-out, box-shadow 0.2s ease; }
.interactive-card:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0,0,0,0.15); }

/* --- MODAIS --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--modal-overlay); z-index: 1002; display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: all 0.3s ease-in-out; backdrop-filter: blur(2px); }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background-color: var(--bg-card); border-radius: 12px; width: 90%; max-width: 500px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); transform: scale(0.95); transition: all 0.3s ease-in-out; max-height: 90vh; display: flex; flex-direction: column; border: 1px solid var(--border-color); }
#new-food-modal-overlay, #add-food-list-modal-overlay, #edit-food-modal-overlay { z-index: 1003; }
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem; border-bottom: 1px solid var(--border-color); }
.modal-header h2 { font-size: 1.3rem; color: var(--text-heading); }
.close-modal-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 0; font-size: 1.2rem; }
.close-modal-btn:hover { color: var(--text-heading); }
.modal-body { padding: 1.5rem; overflow-y: auto; color: var(--text-main); }
.modal .styled-form .btn { margin-top: 1rem; }

/* --- MODAIS DE CONFIRMAÇÃO E AÇÕES --- */
.action-buttons { white-space: nowrap; }
.action-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); margin: 0 0.2rem; padding: 0.3rem; transition: color 0.3s; }
.action-btn:hover { color: var(--primary-color); }
.action-btn.delete-btn:hover { color: #e74c3c; }
.modal-confirm { max-width: 450px; max-height: none; }
.modal-confirm p { margin-bottom: 1.5rem; line-height: 1.6; color: var(--text-muted-alt); }

/* CORREÇÃO DOS BOTÕES DO MODAL DE EXCLUSÃO */
.confirm-buttons { display: flex; justify-content: flex-end; gap: 15px; margin-top: 10px; }
.btn-secondary { background-color: var(--border-color); color: var(--text-main); }
.btn-secondary:hover { background-color: var(--border-input); color: var(--text-heading); box-shadow: none; }
.btn-danger { background-color: #e74c3c; color: #fff; }
.btn-danger:hover { background-color: #c0392b; box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4); }

/* =====================================================
            ESTILOS DE CABEÇALHO E MÉTRICAS
===================================================== */
.welcome-metrics { display: flex; gap: 1rem; flex-shrink: 0; }
.metric-card { display: flex; align-items: center; background-color: var(--bg-card); padding: 0.75rem 1rem; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); border: 1px solid var(--border-color); }
.metric-icon { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-right: 0.75rem; background-color: var(--hover-bg); color: var(--primary-color); }
.metric-card .metric-icon svg { width: 18px; height: 18px; }
.metric-info .metric-value { display: block; font-size: 1.1rem; font-weight: 600; color: var(--text-heading); }
.metric-info .metric-label { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* =====================================================
            ESTILOS DE ALIMENTAÇÃO
===================================================== */
.macros-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.macro-card { background-color: var(--bg-card); border-radius: 8px; padding: 1.5rem; display: flex; align-items: center; gap: 1rem; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid var(--border-color); }
.macro-card .metric-icon { padding: 12px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.macro-card .metric-icon svg { width: 24px; height: 24px; }
.macro-card .metric-info .metric-value { font-size: 1.5rem; font-weight: 600; color: var(--text-heading); }
.macro-card .metric-info .metric-label { font-size: 0.9rem; color: var(--text-muted-alt); }
.protein-card .metric-icon { background-color: var(--icon-bg-protein); color: #3b82f6; }
.carb-card .metric-icon { background-color: var(--icon-bg-carb); color: #f59e0b; }
.fat-card .metric-icon { background-color: var(--icon-bg-fat); color: #8b5cf6; }
.macros-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.macros-summary { font-size: 0.8rem; color: var(--text-muted-alt); margin-top: 4px; }
.macros-summary span { margin-right: 10px; }
.macros-summary span b { color: var(--text-heading); }
.view-macros-summary { font-weight: 500; padding: 10px 15px; background-color: var(--bg-dashboard); border-top: 1px solid var(--border-color); margin-top: 10px; display: flex; justify-content: space-around; flex-wrap: wrap; gap: 10px; color: var(--text-main); }
#food-items-container .food-item-row { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; align-items: flex-start; margin-bottom: 1.5rem; }
#food-items-container .food-item-row .input-group { margin-bottom: 0; }
.autocomplete-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card); border: 1px solid var(--border-color); border-top: none; border-radius: 0 0 8px 8px; z-index: 1004; max-height: 150px; overflow-y: auto; display: none; margin-top: -8px; padding-top: 8px; }
.autocomplete-results div { padding: 10px 15px; cursor: pointer; color: var(--text-main); }
.autocomplete-results div:hover { background-color: var(--hover-bg); color: var(--primary-color); }
.add-new-food-link { font-size: 0.85rem; margin-top: 5px; }
.add-new-food-link a { color: var(--primary-color); cursor: pointer; text-decoration: underline; }
.meal-details-list { list-style: none; padding: 0; margin: 0; }
.meal-details-list li { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-color); color: var(--text-main); }
.meal-details-list li .food-name { font-weight: 500; }
.meal-details-list li .food-info { color: var(--text-muted); display: block; }
.meal-details-list li .food-macros { display: flex; gap: 10px; font-size: 0.85rem; color: var(--text-muted-alt); }
.meal-details-total { margin-top: 1.5rem; padding-top: 1rem; border-top: 2px solid var(--border-input); display: flex; justify-content: space-between; font-weight: 600; font-size: 1.1rem; color: var(--text-heading); }
.modal-header div { display: flex; align-items: center; gap: 0.5rem; }
#paste-meal-btn, #paste-edit-meal-btn { opacity: 0.4; cursor: not-allowed; transition: opacity 0.3s; color: var(--text-main); }
#paste-meal-btn.active, #paste-edit-meal-btn.active { opacity: 1; cursor: pointer; color: var(--primary-color); }
#food-catalog-list { list-style: none; padding: 0; margin: 0; max-height: 400px; overflow-y: auto; }
.food-list-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 10px; border-bottom: 1px solid var(--border-color); }
.food-list-item span { font-weight: 500; color: var(--text-heading); }
.modal-sub-header { display: flex; justify-content: flex-end; padding: 0 1.5rem 1rem; border-bottom: 1px solid var(--border-color); }

/* =====================================================
            RESPONSIVIDADE GERAL E MOBILE
===================================================== */
@media (max-width: 992px) {
    .sidebar { position: fixed; top: 0; left: 0; height: 100%; z-index: 1001; transform: translateX(-100%);}
    .sidebar.open { transform: translateX(0); }
    .sidebar-header { position: relative; }
    
    /* CORREÇÃO: Botão X visível APENAS no mobile */
    .sidebar-close-btn { display: block; background: none; border: none; cursor: pointer; color: var(--text-muted-alt); position: absolute; right: 1.5rem; }
    
    .topbar { width: 100%; }
    .menu-toggle { display: flex; flex-direction: column; justify-content: space-between; width: 24px; height: 18px; background: transparent; border: none; cursor: pointer; margin-right: 1.5rem; padding: 0; }
    .menu-toggle span { width: 100%; height: 2px; background-color: var(--text-heading); border-radius: 3px; transition: all 0.3s ease-in-out; }
    .menu-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .menu-toggle.active span:nth-child(2) { opacity: 0; }
    .menu-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}

@media (max-width: 1050px) {
    .page-header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 600px) {
    .main-content { padding: 1.5rem 0; }
    .topbar { padding: 1.35rem 1rem; }
    .search-bar { display: none; }
    
    /* --- REGRA GLOBAL PARA CENTRALIZAÇÃO EM DISPOSITIVOS MÓVEIS --- */
    .dashboard-grid, .atividades-grid, .macros-summary-grid, .page-header-buttons, .page-header .welcome-message {
        width: 95%; max-width: 95%; margin-left: auto; margin-right: auto; align-items: center;
    }

    /* BOTÕES DO HEADER AFASTADOS */
    .page-header-buttons { flex-direction: column; gap: 12px; }

    .card { width: 95%; max-width: 95%; margin-left: auto; margin-right: auto; margin-bottom: 1.5rem; }
    .page-header { flex-direction: column; align-items: center; }
    .page-header .welcome-message { text-align: center; margin-bottom: 1.5rem; }
    .page-header .btn { width: 95%; justify-content: center; }
    
    .welcome-metrics { flex-direction: column; width: 95%; margin-left: auto; margin-right: auto; gap: 0.75rem; }
    .metric-card { width: 95%; padding: 1rem 1.25rem; margin-left: auto; margin-right: auto;}
    .metric-icon { width: 40px; height: 40px; }
    .metric-card .metric-icon svg { width: 20px; height: 20px; }
    .metric-info .metric-value { font-size: 1.2rem; }
    .metric-info .metric-label { font-size: 0.8rem; }

    .styled-table { font-size: 0.8rem; }
    .styled-table th, .styled-table td { padding: 10px 8px; }
    
    /* CORREÇÃO: Modal Centralizado no Mobile */
    .modal { width: 95%; align-self: center; margin-top: 0; }
    #food-items-container .food-item-row { grid-template-columns: 1fr; gap: 0; }
    #food-items-container .food-item-row .input-group { margin-bottom: 1.2rem; }
    
    /* CORREÇÃO: Botões de Confirmação (Lado a Lado e Afastados) */
    .confirm-buttons { display: flex; flex-direction: row; justify-content: flex-end; gap: 15px; width: 100%; }
}

/* ==========================================================
   == ESTILOS PARA A PESQUISA UNIVERSAL
   ========================================================== */
.search-bar { position: relative; }
.search-results-container { position: absolute; top: 110%; left: 0; width: 100%; background-color: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); z-index: 1000; overflow: hidden; opacity: 0; transform: translateY(-10px); visibility: hidden; transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s; }
.search-results-container.active { opacity: 1; transform: translateY(0); visibility: visible; }
@media (max-width: 600px) {
    .disp{ display: grid !important; margin-right: inherit !important; }
}
.search-results-container ul { list-style: none; padding: 0.5rem; margin: 0; }
.search-results-container li a { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; color: var(--text-main); text-decoration: none; font-size: 0.9rem; border-radius: 6px; transition: background-color 0.2s ease; }
.search-results-container li a svg { width: 18px; height: 18px; color: var(--text-muted-alt); }
.search-results-container li a:hover { background-color: var(--hover-bg); color: var(--primary-color); }
.search-results-container li a:hover svg { color: var(--primary-color); }
.search-results-container .no-results { padding: 1rem; text-align: center; font-size: 0.9rem; color: var(--text-muted); }

/* --- BOTÃO DE TEMA HEADER (NOVO) --- */
.theme-toggle-btn { background: transparent; border: none; cursor: pointer; color: var(--text-muted); padding: 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; }
.theme-toggle-btn:hover { background-color: var(--hover-bg); color: var(--primary-color); }
.theme-toggle-btn svg { width: 22px; height: 22px; }