/* ================= CONFIGURAÇÕES GERAIS E VARIÁVEIS ================= */
:root {
    --bg-body: #050505;
    --bg-sidebar: #0a0a0a;
    --bg-card: #121212;
    --bg-input: #1E1E1E;
    
    --gold: #D4AF37;
    --gold-bright: #FFD700;
    --gold-dark: #B8860B;
    --green: #25D366;
    --red: #FF5C5C;
    --blue-ice: #88CCFF;
    --text-main: #FAFAFA;
    --text-muted: #A0A0A0;

    --theme-gradient: linear-gradient(135deg, var(--gold-dark), var(--gold));
    --theme-accent: var(--gold);
    --theme-glow: rgba(212, 175, 55, 0.3);
    
    --font-display: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    
    /* Variável para área segura do iPhone (Notch) */
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);
}

/* MODO CONGELADA (AZUL) */
body.mode-frozen {
    --theme-accent: var(--blue-ice);
    --theme-gradient: linear-gradient(135deg, #4da6ff, var(--blue-ice));
    --theme-glow: rgba(136, 204, 255, 0.3);
    background-image: radial-gradient(circle at 50% 10%, #0a1a2a 0%, #000 100%);
}

/* MODO FECHADO (VERMELHO/ESCURO) */
body.mode-closed {
    --theme-accent: var(--red);
    --theme-gradient: linear-gradient(135deg, #a64d4d, var(--red));
    --theme-glow: rgba(255, 92, 92, 0.3);
    background-color: #000;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { font-family: var(--font-body); background-color: var(--bg-body); color: var(--text-main); height: 100vh; overflow: hidden; }

/* ================= LAYOUT PRINCIPAL ================= */
.app-shell { display: grid; grid-template-columns: 260px 1fr; height: 100vh; width: 100vw; }

/* SIDEBAR (CORREÇÃO DE SCROLL) */
.sidebar-menu { 
    background: var(--bg-sidebar); 
    border-right: 1px solid rgba(255,255,255,0.05); 
    display: flex; 
    flex-direction: column; 
    padding: 30px 20px; 
    z-index: 50;
    overflow: hidden; /* TRAVA O CONTAINER */
    height: 100vh;
}

.nav-list::-webkit-scrollbar { width: 4px; }
.nav-list::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.brand-area { text-align: center; margin-bottom: 40px; flex-shrink: 0; }
.brand-logo { width: 90px; height: 90px; border-radius: 50%; border: 2px solid var(--theme-accent); padding: 3px; box-shadow: 0 0 20px var(--theme-glow); }

.nav-list { 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    flex: 1; 
    min-height: 0; 
    overflow-y: auto; /* SCROLL SÓ AQUI */
    padding-right: 5px;
}

.nav-btn { display: flex; align-items: center; gap: 15px; background: transparent; border: none; color: var(--text-muted); padding: 15px 20px; border-radius: 16px; font-size: 1rem; font-weight: 500; cursor: pointer; transition: 0.3s; width: 100%; text-align: left; flex-shrink: 0; }
.nav-btn:hover { background: rgba(255,255,255,0.03); color: #fff; }
.nav-btn.active { background: rgba(255, 255, 255, 0.05); color: var(--theme-accent); font-weight: 700; border-left: 3px solid var(--theme-accent); }

.sidebar-footer { margin-top: auto; padding-top: 20px; flex-shrink: 0; }

/* CONTEÚDO */
.content-area { position: relative; overflow-y: auto; background: var(--bg-body); scroll-behavior: smooth; height: 100vh; }
.page-header { position: sticky; top: 0; z-index: 40; background: rgba(5,5,5,0.9); backdrop-filter: blur(10px); padding: 20px 30px; border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; justify-content: space-between; align-items: center; }

.welcome-text h2 { font-family: var(--font-display); font-size: 1.5rem; margin: 0; }
.welcome-text span { font-size: 0.8rem; color: var(--theme-accent); text-transform: uppercase; letter-spacing: 1px; font-weight: bold; }

.store-status-badge { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: #fff; background: rgba(255,255,255,0.05); padding: 5px 12px; border-radius: 20px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #ccc; } 

/* CORES DOS STATUS */
.status-dot.open { background: var(--green); box-shadow: 0 0 10px var(--green); }
.status-dot.frozen { background: var(--blue-ice); box-shadow: 0 0 10px var(--blue-ice); }
.status-dot.closed { background: var(--red); box-shadow: 0 0 10px var(--red); }

/* TABS E GRIDS */
.tab-content { display: none; padding: 20px 30px 120px 30px; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.section-title h3 { font-family: var(--font-display); color: var(--theme-accent); margin-bottom: 20px; font-size: 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px; }

/* ================= COMPONENTES VISUAIS ================= */
/* CARDS DE PRODUTO */
.pizza-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; transition: 0.3s; box-shadow: 0 2px 10px rgba(0,0,0,0.2); min-height: 380px; }
.pizza-card:hover { border-color: var(--theme-accent); transform: translateY(-5px); background: rgba(255,255,255,0.05); }

.pizza-image-container { height: 180px; background: #1a1a1a; position: relative; overflow: hidden; }
.pizza-image { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.pizza-card:hover .pizza-image { transform: scale(1.1); }

.sold-out-badge-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; letter-spacing: 2px; z-index: 5; backdrop-filter: blur(2px); }

.pizza-content { padding: 15px; display: flex; flex-direction: column; flex: 1; }
.pizza-title { font-family: var(--font-display); color: var(--theme-accent); margin-bottom: 8px; font-size: 1.2rem; font-weight: 700; line-height: 1.2; }
.pizza-desc { color: #888; font-size: 0.85rem; line-height: 1.5; margin-bottom: 15px; flex: 1; }

.action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; }
.btn-size { background: transparent; border: 1px solid rgba(212, 175, 55, 0.3); border-radius: 10px; padding: 12px 8px; cursor: pointer; transition: 0.3s; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; }
.btn-size:hover:not(:disabled) { background: rgba(212, 175, 55, 0.15); border-color: var(--theme-accent); }
.btn-size:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-size .label { font-size: 0.7rem; color: var(--theme-accent); text-transform: uppercase; font-weight: 700; }
.btn-size .price { font-size: 1rem; font-weight: 800; }
.sold-out-card { filter: grayscale(100%); opacity: 0.6; pointer-events: none; }

/* FRETE GRÁTIS BAR */
.shipping-goal-container { background: rgba(20, 20, 20, 0.8); border: 1px solid rgba(212, 175, 55, 0.3); border-radius: 12px; padding: 15px; margin-bottom: 25px; backdrop-filter: blur(5px); }
.goal-text { font-size: 0.9rem; text-align: center; margin-bottom: 10px; color: var(--text-muted); }
.goal-highlight { color: var(--gold-bright); font-weight: 700; }
.progress-track { background: #333; height: 10px; border-radius: 10px; overflow: hidden; width: 100%; }
.progress-fill { background: var(--theme-gradient); height: 100%; width: 0%; border-radius: 10px; transition: width 0.6s ease; box-shadow: 0 0 10px var(--theme-glow); }
.progress-fill.success { background: linear-gradient(90deg, #25D366, #128C7E); box-shadow: 0 0 15px rgba(37, 211, 102, 0.5); }

/* ================= MODAL DE CARRINHO ================= */
.modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); 
    z-index: 300; display: none; align-items: flex-end; justify-content: center; 
}
.modal-overlay.active { display: flex; }

.cart-modal { 
    background: #121212; width: 100%; max-width: 600px; 
    max-height: 90vh; 
    height: auto;
    border-top-left-radius: 25px; border-top-right-radius: 25px; 
    border-top: 2px solid var(--theme-accent); 
    display: flex; flex-direction: column; 
    overflow: hidden; 
    animation: slideUp 0.4s ease; 
    box-shadow: 0 -10px 50px rgba(0,0,0,0.8); 
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.cart-header { padding: 20px 25px; background: #0a0a0a; border-bottom: 1px solid #222; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.cart-header h3 { color: var(--theme-accent); font-family: var(--font-display); margin: 0; font-size: 1.4rem; }
.btn-close-modal { background: none; border: none; color: #666; font-size: 1.5rem; cursor: pointer; padding: 10px; }

.cart-body { 
    padding: 20px 25px; 
    overflow-y: auto; 
    flex: 1; 
    overscroll-behavior: contain; 
}

.cart-footer { padding: 20px 25px; background: #080808; border-top: 1px solid #222; flex-shrink: 0; padding-bottom: max(20px, var(--safe-area-bottom)); }

/* ITENS CARRINHO & FORMS */
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; background: #1a1a1a; border-radius: 12px; margin-bottom: 12px; border: 1px solid #333; }
.item-info strong { display: block; color: #fff; margin-bottom: 4px; }
.item-price { color: var(--theme-accent); font-weight: 700; }
.btn-remove { color: var(--red); background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 5px; }

.form-section { margin-bottom: 25px; }
.form-section h4 { color: var(--theme-accent); margin-bottom: 12px; font-size: 0.85rem; font-weight: 700; text-transform: uppercase; border-bottom: 1px solid #333; padding-bottom: 8px; }

.form-input { 
    width: 100%; background: #1a1a1a; border: 1px solid #333; padding: 14px; 
    color: #fff; border-radius: 8px; margin-bottom: 10px; outline: none; transition: 0.3s;
    font-size: 16px; 
}
.form-input:focus { border-color: var(--theme-accent); background: #222; }

.toggle-options { display: flex; gap: 10px; margin-bottom: 15px; }
.toggle-opt { flex: 1; position: relative; }
.toggle-opt input { display: none; }
.toggle-opt span { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 15px; background: #1a1a1a; border: 1px solid #333; border-radius: 10px; color: #888; cursor: pointer; font-weight: 600; transition: 0.3s; height: 100%; text-align: center; }
.toggle-opt input:checked + span { background: rgba(212, 175, 55, 0.1); border-color: var(--theme-accent); color: var(--theme-accent); }

.btn-whatsapp-final { width: 100%; background: var(--green); color: #fff; border: none; padding: 18px; border-radius: 50px; font-weight: 800; font-size: 1.1rem; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 10px; text-transform: uppercase; transition: 0.3s; }
.btn-whatsapp-final:hover { transform: translateY(-2px); box-shadow: 0 5px 20px rgba(37, 211, 102, 0.3); }

#toast { visibility: hidden; min-width: 250px; background-color: var(--theme-accent); color: #000; text-align: center; border-radius: 50px; padding: 14px 20px; position: fixed; z-index: 10000; left: 50%; bottom: 100px; transform: translateX(-50%); font-weight: 800; opacity: 0; transition: 0.3s; }
#toast.show { visibility: visible; opacity: 1; bottom: 110px; }

/* ================= MOBILE RESPONSIVE ================= */
.mobile-bottom-nav { display: none; }

@media (max-width: 768px) {
    .app-shell { display: block; height: auto; }
    .sidebar-menu { display: none; }
    
    .content-area { 
        height: 100vh; 
        overflow-y: auto; 
        padding-bottom: calc(70px + var(--safe-area-bottom)); 
    }
    
    .mobile-bottom-nav { 
        display: flex; 
        justify-content: space-around; 
        align-items: center; 
        position: fixed; 
        bottom: 0; 
        left: 0; 
        width: 100%; 
        height: calc(60px + var(--safe-area-bottom)); 
        background: #111; 
        border-top: 1px solid rgba(255,255,255,0.1); 
        z-index: 100; 
        padding-bottom: var(--safe-area-bottom);
    }
    
    .mob-btn { 
        background: none; border: none; color: #666; 
        display: flex; 
        flex-direction: column; 
        align-items: center; 
        justify-content: center; 
        flex: 1; 
        height: 100%; 
        padding: 0;
        transition: 0.2s;
    }

    .mob-btn > span {
        display: none;
    }

    .mob-btn i { 
        font-size: 1.4rem; 
        margin: 0; 
    }

    .mob-btn.active { color: var(--theme-accent); }
    .mob-btn.active i {
        transform: scale(1.15);
        filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.4));
    }
    
    .cart-modal { max-width: 100%; border-radius: 25px 25px 0 0; }
    .action-buttons { grid-template-columns: 1fr; }
}

/* CARD ESGOTADO */
.sold-out-card {
    opacity: 0.7;
    filter: grayscale(1);
    pointer-events: none;
    position: relative;
}

.sold-out-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.sold-out-overlay span {
    background: #ff5c5c;
    color: #fff;
    padding: 5px 15px;
    font-weight: 800;
    font-size: 1rem;
    transform: rotate(-10deg);
    border: 2px solid #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* BADGE DE ESTOQUE BAIXO */
.stock-badge {
    position: absolute;
    bottom: 5px; right: 5px;
    background: rgba(0,0,0,0.8);
    color: #ffcc00;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
    border: 1px solid #ffcc00;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* FROZEN STYLES */
.frozen-btn {
    border-color: var(--ice) !important;
    color: var(--ice) !important;
}

.frozen-btn:hover {
    background: rgba(0, 210, 255, 0.1) !important;
}

.frozen-tag {
    font-size: 0.6em;
    color: var(--ice);
    background: rgba(0,210,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 8px;
    border: 1px solid rgba(0,210,255,0.3);
}

.btn-size {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
}

.price-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
    text-align: right;
}

.stock-alert-inline {
    font-size: 0.65rem;
    color: #ffcc00;
    font-weight: 600;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; text-shadow: 0 0 5px rgba(255, 204, 0, 0.3); }
    100% { opacity: 0.7; }
}

/* ================= CORREÇÕES MOBILE (Fix Layout Horrível) ================= */
@media (max-width: 768px) {

    /* --- 1. CABEÇALHO MAIS LIMPO --- */
    .page-header {
        padding: 15px 15px; /* Menos padding lateral */
        gap: 10px;
    }

    /* Diminui o texto "Fornarte" para caber tudo */
    .welcome-text h2 {
        font-size: 1.2rem; 
    }
    
    /* Esconde o "BENVENUTI/CONGELADAS" texto pequeno ao lado do logo para limpar a vista */
    .welcome-text span#status-text {
        display: none;
    }

    /* Botão Membro mais compacto */
    .btn-family-header {
        font-size: 0.65rem;
        padding: 5px 10px;
        white-space: nowrap; /* Não deixa quebrar linha */
    }

    /* Ajuste dos ícones do topo */
    .page-header > div {
        gap: 5px !important; /* Aproxima os botões da direita */
    }

    /* --- 2. CARDS DE PRODUTO OTIMIZADOS --- */
    .menu-grid {
        gap: 15px; /* Menos espaço entre os cards */
        padding-bottom: 20px;
    }

    .pizza-card {
        min-height: auto !important; /* REMOVE A ALTURA FIXA GIGANTE */
        height: auto;
    }

    .pizza-image-container {
        height: 150px; /* Imagem um pouco mais baixa para focar no conteúdo */
    }

    .pizza-content {
        padding: 12px;
    }

    .pizza-title {
        font-size: 1.1rem;
        margin-bottom: 5px;
    }

    .pizza-desc {
        font-size: 0.8rem;
        margin-bottom: 12px;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2; /* Limita descrição a 2 linhas */
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* --- 3. BOTÃO DE COMPRA HORIZONTAL (A grande mudança) --- */
    /* Transforma o botão de "Pilha" (texto em cima, preço embaixo) para "Linha" (lado a lado) */
    .btn-size {
        flex-direction: row; 
        justify-content: space-between;
        align-items: center;
        padding: 8px 12px;
        height: 45px; /* Altura fixa confortável para o dedo */
        width: 100%;
    }

    /* Ajusta o label (ex: "Unidade") */
    .btn-size .label {
        font-size: 0.8rem;
        margin-bottom: 0; /* Tira margem inferior */
        text-align: left;
    }

    /* Ajusta o grupo de preço */
    .price-group {
        align-items: flex-end;
        text-align: right;
    }

    .btn-size .price {
        font-size: 1rem;
    }

    /* Badge de estoque "Restam X" */
    .stock-alert-inline {
        font-size: 0.6rem;
        margin-top: 0;
    }

    /* --- 4. TÍTULOS DAS SEÇÕES --- */
    .section-title h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
        display: flex;
        align-items: center;
    }

    .frozen-tag {
        font-size: 0.5em;
        padding: 2px 5px;
        margin-left: 5px;
    }
}
