/* =========================================
   1. Variáveis e Base
   ========================================= */
:root {
    --cor-creme: #ffd78f;
    --cor-marrom: #766142;
    --cor-salmao: #e8a69a;
    --cor-fundo: #fffcf5;
    --cor-branco: #ffffff;
    --cinza-claro: #f0f0f0;
    --sombra: 0 4px 12px rgba(118, 97, 66, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Lato', sans-serif;
    background-color: var(--cor-fundo);
    color: var(--cor-marrom);
    /* Espaço extra no final para não esconder footer atrás do botão whats */
    padding-bottom: 100px; 
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

h1, h2, h3, h4 {
    font-family: 'Playfair Display', serif;
}

/* =========================================
   2. Cabeçalho do Cardápio
   ========================================= */
.menu-header {
    background-color: var(--cor-branco);
    padding: 20px 0;
    box-shadow: var(--sombra);
    margin-bottom: 30px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 15px;
}

.logo img {
    height: 60px;
    width: auto;
}

.back-link {
    font-size: 0.9rem;
    color: var(--cor-salmao);
    text-decoration: none;
    font-weight: bold;
}

.back-link:hover {
    color: var(--cor-marrom);
    text-decoration: underline;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* =========================================
   Filtros "Grudados" (Sticky)
   ========================================= */
.menu-categories {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    overflow-x: auto;
    padding: 15px 0;
    scrollbar-width: none;
    
    /* A MÁGICA ACONTECE AQUI */
    position: sticky;
    top: 85px; /* Ajuste conforme a altura do seu header */
    background-color: var(--cor-fundo); /* Fundo para não misturar com o texto atrás */
    z-index: 800;
    margin-left: -15px; /* Gambiarra técnica para cobrir sangria do container */
    margin-right: -15px;
    padding-left: 15px;
    padding-right: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.menu-categories::-webkit-scrollbar {
    display: none; /* Esconde barra de rolagem no Chrome/Safari */
}

.category-btn {
    background: var(--cor-branco);
    border: 1px solid var(--cor-marrom);
    color: var(--cor-marrom);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
    transition: 0.3s;
}

.category-btn:hover {
    background-color: var(--cor-creme);
}

.category-btn.active {
    background-color: var(--cor-marrom);
    color: var(--cor-branco);
    border-color: var(--cor-marrom);
}

/* =========================================
   4. Grid de Produtos
   ========================================= */
.category-title {
    margin: 40px 0 20px 0;
    border-bottom: 2px solid var(--cor-creme);
    display: inline-block;
    padding-bottom: 5px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.item {
    background: var(--cor-branco);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--sombra);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
}

.item:hover {
    transform: translateY(-5px);
}

.img-container {
    height: 200px;
    overflow: hidden;
    background-color: #eee;
}

.img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.item-header h4 {
    font-size: 1.1rem;
    margin: 0;
    color: var(--cor-marrom);
}

.weight {
    font-size: 0.8rem;
    color: #888;
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    margin-left: 10px;
}

/* Tags (Sem gluten, etc) */
.tags {
    margin-bottom: 10px;
}

.tag {
    font-size: 0.7rem;
    text-transform: uppercase;
    background-color: #e6fffa;
    color: #2c7a7b;
    padding: 3px 8px;
    border-radius: 10px;
    margin-right: 5px;
    font-weight: bold;
}

.short-desc {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 20px;
    flex-grow: 1;
}

/* Preço e Botão */
.actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.price {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--cor-marrom);
}

.add-btn {
    background-color: var(--cor-salmao);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.add-btn:hover {
    background-color: var(--cor-marrom);
}

/* =========================================
   5. Carrinho Lateral (Sidebar)
   ========================================= */
.cart-float {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    pointer-events: none; /* Permite clicar no site atrás se o carrinho estiver fechado */
}

/* Botão Flutuante do Carrinho */
.cart-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px; 
    background-color: var(--cor-marrom);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    pointer-events: auto;
    z-index: 1001; /* Fica acima do site normal, mas abaixo do carrinho aberto */
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-toggle span {
    background: var(--cor-salmao);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.9rem;
}

/* Painel Lateral (Corrigido: Classe Unificada) */
.cart-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transform: translateX(110%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    
    /* CORREÇÃO DO PROBLEMA DE SOBREPOSIÇÃO: */
    /* Z-Index 2100 garante que ele tape o botão do carrinho (1001) e o botão whats (950) */
    z-index: 2100; 
}

.cart-sidebar.open {
    transform: translateX(0);
}

.cart-header {
    padding: 20px;
    background: var(--cor-marrom);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    background: #f9f9f9;
    /* Adiciona área segura para iPhones (sem barra preta) */
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.cart-total {
    font-size: 1.3rem;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
}

#cart-note {
    width: 100%;
    height: 60px;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: none;
}

.send-whatsapp {
    width: 100%;
    background-color: #25D366;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 5px;
}

.send-whatsapp:hover {
    background-color: #128C7E;
}

/* Item dentro do Carrinho */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.cart-item-info h5 {
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.cart-item-controls button {
    background: #eee;
    border: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
}

/* =========================================
   6. Footer e Botão Whats
   ========================================= */
footer {
    background: var(--cor-creme);
    padding: 40px 0;
    margin-top: 60px;
    font-size: 0.9rem;
    color: var(--cor-marrom);
}

footer .alerta {
    color: #c0392b;
    font-weight: bold;
    margin-top: 10px;
}

.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 20px;
    right: 20px;
    background-color: #25d366;
    color: #FFF;
    border-radius: 50px;
    text-align: center;
    font-size: 30px;
    box-shadow: 2px 2px 3px #999;
    z-index: 950; /* Menor que o carrinho */
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* =========================================
   7. Modal de Zoom (Lightbox)
   ========================================= */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 3000; /* Acima até do carrinho */
    display: none; 
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

.lightbox-overlay.active {
    display: flex;
    animation: fadeIn 0.3s;
}

.lightbox-content {
    max-width: 95%;
    max-height: 90vh;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    object-fit: contain;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =========================================
   8. Responsividade (Mobile)
   ========================================= */
@media (max-width: 768px) {
    /* Compactar o Header */
    .menu-header {
        padding: 10px 0;
        margin-bottom: 20px;
    }

    .header-content {
        gap: 10px;
        margin-top: 5px;
    }

    /* Logo menor */
    .logo img {
        height: 45px;
    }

    /* Texto menor e esconder subtítulo */
    .header-content h1 {
        font-size: 1.1rem;
        margin-bottom: 0;
        line-height: 1.2;
    }

    .subtitle {
        display: none; 
    }

    .back-link {
        font-size: 0.8rem;
    }

    /* Carrinho ocupa tela toda */
    .cart-sidebar {
        width: 100%;
        z-index: 2100; /* Reforçando: Sidebar acima do botão toggle */
    }
    
    .grid {
        grid-template-columns: 1fr; /* 1 produto por linha */
    }
}
/* Animação de Entrada dos Itens */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.item {
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0; /* Começa invisível */
}

/* Efeito cascata (um aparece depois do outro) */
.item:nth-child(1) { animation-delay: 0.1s; }
.item:nth-child(2) { animation-delay: 0.2s; }
.item:nth-child(3) { animation-delay: 0.3s; }
.item:nth-child(4) { animation-delay: 0.4s; }
.item:nth-child(5) { animation-delay: 0.5s; }
/* ... e assim por diante para os primeiros itens */
/* =========================================
   10. Barra de Aviso (Loja Fechada)
   ========================================= */
.status-bar {
    background-color: #d9534f; /* Vermelho suave */
    color: white;
    text-align: center;
    padding: 10px;
    font-size: 0.9rem;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 2500; /* Acima de tudo */
    display: none; /* Escondido por padrão */
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.status-bar.visible {
    display: block;
}