/* Importar fonte moderna e redonda */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    /* --- PALETA "HEALTHY LIFESTYLE" --- */
    --primary-color: #5D9B3E;      
    --primary-dark: #3A6B25;       
    --secondary-color: #E6B33E;    
    --accent-color: #1A3C28;       
    
    --gradiente-principal: linear-gradient(135deg, #5D9B3E 0%, #3A6B25 100%);
    --gradiente-botao: linear-gradient(135deg, #60a845 0%, #4a8533 100%);
    --gradiente-ai: linear-gradient(135deg, #E6B33E 0%, #D49B2A 100%);
    
    --bg-body: #F3F0E9;            
    --bg-card: #FFFFFF;            
    --text-main: #1A3C28;          
    --text-muted: #6B8572;         
    --border-light: #D6D1C5;       
    
    --radius-card: 20px;           
    --radius-btn: 12px;
    
    --shadow-soft: 0 10px 20px -5px rgba(93, 155, 62, 0.15);
    --shadow-hover: 0 15px 30px -5px rgba(93, 155, 62, 0.25);
}

/* =========================================
   RESET E BASE
   ========================================= */
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-y: auto; 
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Scrollbar personalizada */
::-webkit-scrollbar { width: 10px; } 
::-webkit-scrollbar-track { background: rgba(93, 155, 62, 0.05); }
::-webkit-scrollbar-thumb { 
    background: #9BC786; 
    border-radius: 6px; 
    border: 3px solid transparent; 
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--primary-color); }

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -0.5px; }

/* =========================================
   MENU LATERAL
   ========================================= */
.menu-lateral {
    position: fixed; top: 0; left: -300px; width: 300px; height: 100%;
    background: var(--bg-card);
    box-shadow: 5px 0 25px rgba(26, 60, 40, 0.05);
    z-index: 2000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: 
    flex; 
    flex-direction: column; 
    padding: 1.8rem;
    border-right: 1px solid var(--border-light);
}
.menu-lateral.menu-lateral-ativo { left: 0; }

.menu-lateral-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2.5rem; }
.menu-lateral-title { font-weight: 800; font-size: 1.5rem; color: var(--primary-color); text-transform: uppercase; letter-spacing: 1px; }

.btn-close-custom {
    background: var(--bg-body); border: none; width: 36px; height: 36px; border-radius: 50%;
    color: var(--text-main); display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s;
}
.btn-close-custom:hover { background: #e2dfd6; transform: rotate(90deg); }

.menu-lateral-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(26, 60, 40, 0.4); backdrop-filter: blur(4px);
    z-index: 1990; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.menu-lateral-backdrop.ativo { opacity: 1; pointer-events: auto; }

.menu-lateral .list-group-item {
    border: none; border-radius: var(--radius-btn); margin-bottom: 0.8rem;
    color: var(--text-main); 
    font-weight: 600; 
    padding: 0.8rem 1rem;
    transition: all 0.2s; background: transparent;
}
.menu-lateral .list-group-item i { margin-right: 15px; color: var(--primary-color); font-size: 1.2rem; }
.menu-lateral .list-group-item:hover { background-color: var(--bg-body); color: var(--primary-dark); transform: translateX(5px); }
.menu-lateral .list-group-item.active { background: var(--primary-color); color: white; box-shadow: 0 8px 15px -5px rgba(93, 155, 62, 0.4); }
.menu-lateral .list-group-item.active i { color: white; }


/* =========================================
   HEADER FIXO
   ========================================= */
.header-fixed {
    position: fixed; top: 0; left: 0; right: 0; height: 80px;
    background: var(--bg-body); 
    display: flex; align-items: center; padding: 0 2rem; z-index: 1050;
}
.page-title { font-weight: 800; font-size: 1.8rem; margin: 0 auto; color: var(--primary-color); }

.Btn_Menu {
    background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 50px;
    padding: 0.6rem 1.2rem; color: var(--text-main); font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-soft); transition: all 0.2s;
}
.Btn_Menu:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); color: var(--primary-color); }


/* =========================================
   LAYOUT GERAL
   ========================================= */
.full-height-container {
    margin-top: 80px; 
    min-height: calc(100vh - 80px); 
    height: auto; 
    padding: 1rem 2rem 2rem 2rem;
    display: grid;
    grid-template-columns: 1fr 2fr 1.1fr;
    gap: 2rem;
    overflow: visible; 
}

@media (max-width: 992px) {
    .full-height-container { grid-template-columns: 1fr; padding: 1rem; display: block; }
    .sticky-carrinho { position: relative !important; top: 0 !important; max-height: none !important; margin-top: 2rem; }
    #containerItensPrato { overflow-y: visible !important; max-height: none !important; }
}


/* =========================================
   CARTÕES GERAIS
   ========================================= */
.modern-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
    display: flex; flex-direction: column; 
    height: auto; 
    border: 1px solid rgba(255,255,255,0.5);
}

.card-header-modern {
    padding: 1.5rem; font-weight: 700; color: var(--text-main);
    background: transparent; display: flex; align-items: center; font-size: 1.1rem;
    flex-shrink: 0;
}
.card-header-modern i {
    color: var(--secondary-color); background: rgba(230, 179, 62, 0.15);
    padding: 8px; border-radius: 10px; margin-right: 12px;
}

.card-body-modern {
    padding: 0 1.5rem 1.5rem 1.5rem;
    flex-grow: 1;
    display: flex; flex-direction: column;
    overflow: hidden;
}

/* --- CARRINHO COMPACTO E FIXO --- */
.sticky-carrinho {
    position: sticky; 
    top: 100px; 
    /* Altura ajustada para o ecrã */
    height: calc(100vh - 120px);
    max-height: calc(100vh - 120px);
    
    display: flex;
    flex-direction: column;
    overflow: hidden; 
}

/* Cabeçalho do Carrinho Compacto */
.sticky-carrinho .card-header-modern {
    padding: 1rem 1.5rem; /* Menos altura no topo */
    font-size: 1rem;
}

/* Corpo do Carrinho Compacto */
.sticky-carrinho .card-body-modern {
    padding: 0 1rem 1rem 1rem; /* Padding reduzido */
}

/* Lista com scroll */
#containerItensPrato {
    flex-grow: 1; 
    overflow-y: auto; 
    min-height: 0;
    padding-right: 5px; 
    margin-bottom: 0; 
}

/* ITENS COMPACTOS */
.item-carrinho {
    background: #FAFAFA; 
    border-radius: 10px; 
    padding: 0.6rem 0.8rem; /* Muito mais compacto */
    margin-bottom: 0.5rem; /* Margem reduzida */
    border-left: 4px solid var(--secondary-color); 
    transition: transform 0.2s;
    font-size: 0.85rem; /* Letra ligeiramente menor */
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.item-carrinho small {
    font-size: 0.75rem;
    opacity: 0.8;
}
.item-carrinho:hover { transform: translateX(3px); }

/* Separador de Dias Compacto */
.dia-separator {
    background: var(--primary-color); 
    color: white; 
    padding: 0.4rem 0.8rem; /* Mais fino */
    border-radius: 8px; 
    font-weight: 700; 
    margin: 0.8rem 0 0.4rem 0; /* Margem reduzida */
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 2px 5px rgba(93, 155, 62, 0.2);
    font-size: 0.85rem;
}

/* RODAPÉ DO CARRINHO (Sempre Visível) */
.cart-footer-section {
    flex-shrink: 0; 
    margin-top: 0;
    background: var(--bg-card); 
    padding-top: 0.8rem;
    border-top: 2px dashed var(--border-light);
    z-index: 10;
}

/* Totais Compactos */
.total-box {
    background: var(--bg-body); 
    border-radius: 12px; 
    padding: 0.8rem; /* Padding reduzido */
    margin-bottom: 0.8rem;
}
.total-box h6 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}
.total-row {
    display: flex; justify-content: space-between; 
    font-size: 0.85rem;
    margin-bottom: 2px;
}
.total-val { font-weight: 700; }
.text-p { color: var(--primary-color); }
.text-h { color: #D49B2A; }
.text-c { color: #E76F51; }

/* Botões de Ação Compactos */
.btn-action-group { display: flex; gap: 8px; margin-bottom: 10px; }
.btn-custom {
    flex: 1; border: none; border-radius: 10px; 
    padding: 0.5rem; /* Mais fino */
    font-weight: 700; font-size: 0.85rem;
    transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* Botão AI Compacto */
.btn-ai {
    width: 100%; height: 45px; /* Altura reduzida */
    border-radius: 12px; border: none; cursor: pointer;
    background: var(--gradiente-ai); color: white; position: relative; overflow: hidden;
    transition: transform 0.2s; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px -2px rgba(230, 179, 62, 0.4);
}
.btn-ai:hover { transform: translateY(-2px); box-shadow: 0 8px 15px -3px rgba(230, 179, 62, 0.5); }


/* =========================================
   INPUTS & ACORDEÃO
   ========================================= */
.form-control, .form-select {
    border-radius: 15px; border: 2px solid var(--bg-body); padding: 0.8rem 1.2rem;
    background: var(--bg-body); color: var(--text-main); font-weight: 500; transition: all 0.3s;
}
.form-control:focus, .form-select:focus {
    background: white; border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(93, 155, 62, 0.15);
}
.form-label { color: var(--text-muted); font-size: 0.75rem; letter-spacing: 1px; margin-bottom: 0.5rem; }

.accordion-item { border: none; background: transparent; margin-bottom: 1rem; }
.accordion-button {
    border-radius: 15px !important; background: white; border: 1px solid var(--border-light);
    font-weight: 600; color: var(--text-main); padding: 1.2rem;
}
.accordion-button:not(.collapsed) {
    background: var(--primary-color); color: white; border-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(93, 155, 62, 0.3);
}
.accordion-button:not(.collapsed)::after { filter: brightness(0) invert(1); }

.btn-add {
    background: var(--bg-body); color: var(--primary-dark); border: none;
    border-radius: 50px; padding: 0.4rem 1.2rem; font-size: 0.85rem; font-weight: 700; transition: 0.2s;
}
.btn-add:hover { background: var(--secondary-color); color: white; }

.btn-blue-outline { background: white; border: 2px solid var(--bg-body); color: var(--text-main); }
.btn-blue-outline:hover { background: var(--bg-body); border-color: var(--primary-color); color: var(--primary-color); }
.btn-red-outline { background: #FFF5F5; color: #E76F51; border: 2px solid transparent; }
.btn-red-outline:hover { background: #FFE3E3; border-color: #E76F51; }

.btn-svg { width: 20px; margin-right: 10px; fill: none; stroke: white; stroke-width: 2.5; }
.txt-wrapper { position: relative; height: 20px; width: 110px; overflow: hidden; }
.txt-1, .txt-2 { position: absolute; top: 0; left: 0; transition: transform 0.3s; display: flex; font-weight: 800; letter-spacing: 2px; font-size: 0.9rem; text-transform: uppercase; align-items: center; height: 100%; text-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.txt-2 { transform: translateY(100%); }
.btn-ai:hover .txt-1 { transform: translateY(-100%); }
.btn-ai:hover .txt-2 { transform: translateY(0%); }


/* =========================================
   MODAL
   ========================================= */
.modal-content { border-radius: 25px; border: none; background: var(--bg-card); }
.modal-header { border-bottom: none; padding: 2rem 2rem 1rem 2rem; }
.modal-title { color: var(--primary-color); font-weight: 800; }
.modal-body { padding: 1rem 2rem 2rem 2rem; }
.bg-light-subtle { background-color: var(--bg-body) !important; }


/* =========================================
   DARK MODE
   ========================================= */
body.dark-mode {
    --bg-body: #0B1410; --bg-card: #15221A; --text-main: #E3F2E6; --text-muted: #C5E1CE;
    --border-light: #2A4530; --primary-color: #76C056; --secondary-color: #F2C94C;
}
body.dark-mode .text-muted, body.dark-mode .form-label, body.dark-mode .small { color: #C5E1CE !important; }
body.dark-mode .header-fixed { background: var(--bg-body); border-bottom: 1px solid var(--border-light); }
body.dark-mode .modern-card { border: 1px solid var(--border-light); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
body.dark-mode .card-header-modern i { background: rgba(242, 201, 76, 0.1); }
body.dark-mode .form-control, body.dark-mode .form-select { background-color: #0B1410; border-color: #2A4530; color: white; }
body.dark-mode .form-control:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(118, 192, 86, 0.2); }
body.dark-mode .accordion-button { background: #1A2B21; color: var(--text-main); border-color: var(--border-light); }
body.dark-mode .list-group-item { background: #15221A; color: #E3F2E6; border-bottom-color: #2A4530; }
body.dark-mode .btn-add { background: #2A4530; color: #76C056; }
body.dark-mode .btn-add:hover { background: var(--primary-color); color: #0B1410; }
body.dark-mode .item-carrinho { background: #1A2B21; border-color: #2A4530; border-left-color: var(--secondary-color); }
body.dark-mode .total-box { background: #0F1C15; }
body.dark-mode .btn-blue-outline { background: transparent; border-color: var(--text-muted); color: var(--text-muted); }
body.dark-mode .btn-blue-outline:hover { border-color: var(--primary-color); color: var(--primary-color); }
body.dark-mode .modal-content { background: #15221A; border: 1px solid #2A4530; }
body.dark-mode .bg-body-secondary { background-color: #0B1410 !important; border-color: #2A4530 !important; color: #E3F2E6 !important; }

/* =========================================
    ESTILOS PARA SUBFILTROS (TAGS)
   ========================================= */
.filter-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    max-height: 150px; /* Limite para não ocupar muito espaço se houver muitos tipos */
    overflow-y: auto;
    padding-right: 5px;
}

/* Scrollbar fina para a área de tags */
.filter-tags-container::-webkit-scrollbar { width: 4px; }
.filter-tags-container::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

.filter-tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-light);
    background-color: var(--bg-body);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-tag:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: white;
}

/* Estado Ativo (Selecionado) */
.filter-tag.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(93, 155, 62, 0.3);
}

/* Dark Mode Ajustes */
body.dark-mode .filter-tag {
    background-color: #1A2B21;
    border-color: #2A4530;
    color: var(--text-muted);
}
body.dark-mode .filter-tag:hover {
    border-color: var(--primary-color);
    color: white;
}
body.dark-mode .filter-tag.active {
    background-color: var(--primary-color);
    color: #0B1410; /* Texto escuro no verde brilhante */
}

/* ... (CÓDIGO ANTERIOR MANTIDO) ... */

/* =========================================
   CARRINHO REESTRUTURADO (DIAS COMO CONTENTORES)
   ========================================= */
   
/* Contentor do Dia (Agrupa título e lista de itens) */
.dia-container {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: border-color 0.2s;
}

/* Quando se está a arrastar algo por cima de um dia */
.dia-container.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(93, 155, 62, 0.05);
}

/* Cabeçalho do Dia */
.dia-header {
    background: var(--primary-color);
    color: white;
    padding: 0.6rem 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Lista de Itens DENTRO do dia */
.dia-lista-itens {
    min-height: 50px; /* Garante espaço para largar mesmo se vazio */
    padding: 0.5rem;
    background: #FAFAFA;
}

/* Item Individual (Agora dentro da lista do dia) */
.item-carrinho {
    background: white;
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--secondary-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab; /* Mãozinha para agarrar */
}
.item-carrinho:last-child { margin-bottom: 0; }
.item-carrinho:active { cursor: grabbing; }

/* Placeholder (espaço vazio enquanto arrasta) */
.sortable-ghost {
    opacity: 0.4;
    background: #e2e8f0;
    border: 1px dashed #cbd5e0;
}

/* Ajustes Dark Mode */
body.dark-mode .dia-container {
    background: #15221A;
    border-color: #2A4530;
}
body.dark-mode .dia-lista-itens {
    background: #0B1410;
}
body.dark-mode .item-carrinho {
    background: #1A2B21;
    border-color: #2A4530;
    color: var(--text-main);
}

/* Atualização para Menu Dividido */
.menu-lateral .list-group {
    /* Removemos a borda e sombra do grupo para ficar limpo como na imagem */
    border: none;
    box-shadow: none;
    background: transparent;
}

.menu-lateral .list-group-item {
    background: transparent !important; /* Transparente por defeito */
    color: var(--text-main) !important;
    border: none !important;
    margin-bottom: 5px;
    border-radius: 10px !important; /* Cantos arredondados individuais */
    font-weight: 600;
    opacity: 0.8;
    transition: all 0.2s;
}

/* Item Ativo (O Verde Brilhante da Imagem) */
.menu-lateral .list-group-item.active {
    background-color: #76C056 !important; /* Verde "Healthy" */
    color: white !important;
    opacity: 1;
    box-shadow: 0 4px 15px rgba(118, 192, 86, 0.4);
}

.menu-lateral .list-group-item:hover:not(.active) {
    background-color: rgba(0,0,0,0.05) !important;
    opacity: 1;
    transform: translateX(5px);
}

/* Dark Mode Ajustes */
body.dark-mode .menu-lateral .list-group-item {
    color: #E3F2E6 !important;
}
body.dark-mode .menu-lateral .list-group-item:hover:not(.active) {
    background-color: rgba(255,255,255,0.1) !important;
}