@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ==========================================================================
   1. VARIÁVEIS GLOBAIS (TEMA PRATINHOS DA MARI - RESTAURANTE)
   ========================================================================== */
:root {
    --bg: #f9fafb;          /* Fundo cinza super claro, estilo app moderno */
    --card: #ffffff;        /* Cartões brancos para destacar a comida */
    --input-bg: #f3f4f6;    
    --text: #1f2937;        /* Texto escuro e legível */
    --text-muted: #6b7280;
    --border: #e5e7eb;
    
    /* Cores principais: Laranja Apetitoso (Estimula a fome) */
    --primary: #ea580c;        
    --primary-hover: #c2410c;  
    --primary-light: #fff7ed;
    
    --accent: #ef4444;        /* Vermelho para alertas/fechado */
    --accent-hover: #dc2626;
    
    --success: #10b981;        
    --whatsapp: #25d366;
    --whatsapp-hover: #1da851;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 15px 35px rgba(234, 88, 12, 0.15);

    --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ==========================================================================
   2. CONFIGURAÇÕES GERAIS E RESETS
   ========================================================================== */
html { scroll-behavior: smooth; }

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    -webkit-tap-highlight-color: transparent; 
}

body { 
    background: var(--bg); 
    color: var(--text); 
    overflow-x: clip; 
    padding-bottom: 120px; 
    line-height: 1.5;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* ==========================================================================
   3. MODAIS E OVERLAYS (BLINDADOS CONTRA CONGELAMENTO)
   ========================================================================== */
.modal-overlay-custom {
    display: none; 
    position: fixed; 
    inset: 0; 
    background: rgba(17, 24, 39, 0.7); 
    backdrop-filter: blur(4px);
    z-index: 9999; 
    align-items: center; 
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none; /* Não bloqueia cliques quando invisível */
}

.modal-overlay-custom.active { 
    display: flex; 
    opacity: 1; 
    pointer-events: auto; /* Capta cliques quando visível */
}

.modal-box-custom {
    background: var(--card); 
    border: 1px solid var(--border);
    padding: 35px 25px; 
    border-radius: 24px; 
    width: 90%; 
    max-width: 360px;
    text-align: center; 
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: transform var(--transition);
}

.modal-overlay-custom.active .modal-box-custom { transform: scale(1); }

.modal-box-custom h2 { color: var(--text); margin-bottom: 12px; font-size: 1.4rem; font-weight: 800; }
.modal-box-custom p { color: var(--text-muted); margin-bottom: 25px; font-size: 0.95rem; }

.icon-closed { font-size: 3.5rem; color: var(--accent); margin-bottom: 20px; }
.icon-warning { font-size: 3.5rem; color: #f59e0b; margin-bottom: 20px; }

/* ==========================================================================
   4. CABEÇALHO E CATEGORIAS
   ========================================================================== */
header { 
    position: sticky; 
    top: 0; 
    background: rgba(255, 255, 255, 0.98); 
    backdrop-filter: blur(12px); 
    z-index: 1000; 
    padding: 20px 0 10px 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.logo { 
    text-align: center; 
    font-weight: 800; 
    font-size: 1.4rem; 
    margin-bottom: 15px; 
    letter-spacing: -0.5px; 
    color: var(--text);
}
.logo span { color: var(--primary); }

.cat-scroll { 
    display: flex; 
    overflow-x: auto; 
    gap: 12px; 
    padding: 5px 15px 18px; 
    scrollbar-width: none; 
}
.cat-scroll::-webkit-scrollbar { display: none; }

.cat-tab { 
    padding: 10px 22px; 
    border-radius: 30px; 
    font-size: 0.9rem; 
    font-weight: 700; 
    white-space: nowrap; 
    color: var(--text-muted); 
    background: var(--input-bg); 
    border: 1px solid transparent; 
    transition: all var(--transition); 
    cursor: pointer;
    user-select: none;
}

header.header-custom .cat-tab {
    padding: 6px 16px;
    font-size: 0.8rem;
}

.cat-tab:hover { background: #e5e7eb; color: var(--text); }
.cat-tab.active { 
    background: var(--primary); 
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
    transform: translateY(-2px);
}

/* ==========================================================================
   5. CONTEÚDO E GRID DO CARDÁPIO
   ========================================================================== */
.content { padding: 20px 15px; max-width: 800px; margin: 0 auto; }

.section-title { 
    margin: 35px 0 20px; 
    font-size: 1.3rem; 
    font-weight: 800; 
    color: var(--text); 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    scroll-margin-top: 140px; 
}
.section-title::after { content: ''; flex: 1; height: 2px; background: var(--input-bg); border-radius: 2px;}

.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }

.p-card { 
    background: var(--card); 
    border-radius: 20px; 
    overflow: hidden; 
    border: 1px solid rgba(0,0,0,0.03); 
    position: relative;
    cursor: pointer;
    box-shadow: var(--shadow-sm); 
    transition: all var(--transition);
    animation: fadeIn 0.5s ease forwards; 
}

.p-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}
.p-card:active { transform: scale(0.97); }

.p-img { width: 100%; height: 150px; object-fit: cover; }
.p-info { padding: 16px; }

.p-name { 
    font-size: 0.95rem; 
    font-weight: 700; 
    color: var(--text);
    margin-bottom: 6px; 
    line-height: 1.3;
    height: 2.6em; 
    overflow: hidden; 
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
}

.p-price { color: var(--primary); font-weight: 800; font-size: 1.15rem; }

.btn-add-small {
    position: absolute; 
    bottom: 14px; 
    right: 14px;
    background: var(--primary); 
    color: #ffffff; 
    border: none;
    width: 36px; 
    height: 36px; 
    border-radius: 12px; /* Mais moderno que o círculo perfeito */
    font-size: 1.1rem; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 800; 
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    cursor: pointer;
}
.btn-add-small:hover { background: var(--primary-hover); transform: scale(1.08); }

/* ==========================================================================
   6. CARRINHO (CART BAR)
   ========================================================================== */
.cart-bar {
    position: fixed; 
    bottom: 100px; /* Dá um respiro perfeito acima da nova nav bar flutuante */
    left: 50%; 
    /* Aqui está a mágica: 150px garante que ele afunde além do final da tela */
    transform: translate(-50%, 150px); 
    opacity: 0; /* Totalmente invisível por padrão */
    pointer-events: none; /* Não bloqueia cliques na nav bar quando estiver escondido */
    width: calc(100% - 30px);
    max-width: 570px;
    background: var(--primary); 
    color: #ffffff; 
    padding: 16px 24px;
    border-radius: 18px; 
    display: flex; 
    justify-content: space-between;
    align-items: center; 
    box-shadow: var(--shadow-lg);
    z-index: 1100; 
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.cart-bar.show { 
    transform: translate(-50%, 0); /* Sobe para a posição correta (bottom: 90px) */
    opacity: 1; /* Fica visível */
    pointer-events: auto; /* Fica clicável novamente */
}

.cart-bar:hover { background: var(--primary-hover); }
.cart-bar strong { font-size: 1.15rem; }

/* ==========================================================================
   7. DRAWER (MODAL DESLIZANTE)
   ========================================================================== */
.drawer { 
    position: fixed; 
    inset: 0; 
    background: rgba(17, 24, 39, 0.6); 
    backdrop-filter: blur(4px);
    z-index: 2000; 
    display: flex; 
    align-items: flex-end; 
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.drawer.active { opacity: 1; pointer-events: all; }

.drawer-content { 
    background: #ffffff; 
    width: 100%; 
    max-width: 600px; 
    border-radius: 28px 28px 0 0; 
    padding: 35px 25px; 
    position: relative; 
    transform: translateY(100%); 
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); 
    max-height: 90vh; 
    overflow-y: auto; 
    color: var(--text);
}
.drawer.active .drawer-content { transform: translateY(0); }

/* Tracinho no topo do modal para dar ideia de arrastar */
.drawer-content::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 5px;
    background: #e5e7eb;
    border-radius: 10px;
}

.qty-selector { display: flex; align-items: center; justify-content: center; gap: 25px; margin: 25px 0; }
.qty-btn { 
    width: 50px; height: 50px; border-radius: 16px; 
    border: 2px solid var(--border); background: var(--card); 
    color: var(--primary); font-size: 1.5rem; cursor: pointer; font-weight: bold;
    transition: all var(--transition);
}
.qty-btn:hover { background: var(--primary-light); border-color: var(--primary); }
.qty-btn:active { transform: scale(0.9); }

.success-icon {
    width: 80px; height: 80px; background: var(--success); color: white;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; margin: 0 auto 20px; animation: bounceIn 0.8s;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   8. FORMULÁRIOS E BOTÕES
   ========================================================================== */
.input-group { margin-bottom: 20px; }
.input-group label { display: block; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 8px; font-weight: 700; }

input, select, textarea { 
    width: 100%; padding: 16px; background: var(--input-bg); 
    border: 2px solid transparent; color: var(--text); 
    border-radius: 14px; font-size: 1rem; transition: all var(--transition);
    outline: none;
}
input:focus, select:focus, textarea:focus { 
    border-color: var(--primary); 
    background: #fff; 
    box-shadow: 0 0 0 4px var(--primary-light); 
}

select:required:invalid { color: var(--text-muted); }
option { color: var(--text); background: #fff; }

.delivery-toggle {
    display: flex; background: var(--input-bg); padding: 6px; 
    border-radius: 16px; margin-bottom: 25px; border: 1px solid var(--border);
}
.dt-option {
    flex: 1; padding: 14px; text-align: center; border-radius: 12px;
    font-weight: 700; cursor: pointer; transition: all var(--transition); color: var(--text-muted);
}
.dt-option:hover:not(.active) { background: #e5e7eb; }
.dt-option.active { 
    background: var(--primary); color: #ffffff; 
    box-shadow: 0 4px 10px rgba(234, 88, 12, 0.2); 
}

.btn-main { 
    width: 100%; padding: 18px; border-radius: 16px; border: none; 
    background: var(--primary); color: #ffffff; font-weight: 800; font-size: 1.05rem;
    cursor: pointer; transition: all var(--transition); display: flex; 
    align-items: center; justify-content: center; gap: 10px;
}
.btn-main:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.btn-main:active { transform: translateY(0) scale(0.98); }
.btn-main.whatsapp { background: var(--whatsapp); }
.btn-main.whatsapp:hover { background: var(--whatsapp-hover); }

.btn-sec { 
    width: 100%; background: none; border: none; color: var(--text-muted); 
    margin-top: 10px; padding: 12px; cursor: pointer; font-weight: 700;
    transition: color var(--transition);
}
.btn-sec:hover { color: var(--text); background: var(--input-bg); border-radius: 12px; }

/* ==========================================================================
   9. PEDIDOS E HISTÓRICO
   ========================================================================== */
.header-pedidos {
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid var(--border);
}
.header-pedidos h2 { color: var(--text); font-weight: 800; }

.order-card {
    background: var(--card); 
    border-radius: 16px; 
    padding: 20px;
    margin-bottom: 18px; 
    border: 1px solid var(--border);
    border-left: 6px solid var(--primary); 
    box-shadow: var(--shadow-sm); 
    transition: transform var(--transition);
}
.order-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.order-header { 
    display: flex; justify-content: space-between; 
    margin-bottom: 15px; font-size: 0.9rem; color: var(--text-muted); 
    border-bottom: 1px dashed var(--border); 
    padding-bottom: 10px;
    font-weight: 600;
}
.order-items { 
    font-size: 0.95rem; margin-bottom: 18px; line-height: 1.6; color: var(--text); 
}

.status-badge { 
    display: inline-block; padding: 6px 14px; border-radius: 10px; font-size: 0.75rem; 
    font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; 
}

/* ==========================================================================
   10. ANIMAÇÕES E LOADING
   ========================================================================== */
.spinner {
    width: 40px; height: 40px; border: 4px solid var(--primary-light);
    border-top: 4px solid var(--primary); border-radius: 50%;
    animation: spin 1s linear infinite; margin: 30px auto;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes bounceIn { 
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 1; }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   11. CONTADORES DE COMPLEMENTOS E EFEITO DE TREMER (LIMITE ATINGIDO)
   ========================================================================== */
.comp-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 0; border-bottom: 1px solid var(--border);
}
.comp-row:last-child { border-bottom: none; }

.comp-info { flex: 1; display: flex; flex-direction: column; }
.comp-name { font-weight: 600; font-size: 0.95rem; color: var(--text); }
.comp-price { font-size: 0.85rem; color: var(--primary); margin-top: 4px; font-weight: 700; }

.comp-controls {
    display: flex; align-items: center; gap: 12px;
    background: var(--input-bg); padding: 4px;
    border-radius: 12px; border: 1px solid transparent;
}

.btn-comp-qty {
    width: 32px; height: 32px; border-radius: 10px; border: none;
    background: var(--card); color: var(--primary); font-weight: bold;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: all var(--transition);
}
.btn-comp-qty:hover { background: var(--primary); color: #fff; }
.btn-comp-qty:active { transform: scale(0.9); }

.comp-qty-display { font-weight: 800; min-width: 24px; text-align: center; color: var(--text); }

/* --- A MÁGICA DA TREMIDA COM AVISO VISUAL (VERMELHO) --- */
.shake { 
    animation: tremerForte 0.4s cubic-bezier(.36,.07,.19,.97) both !important; 
    border-color: var(--accent) !important; /* Borda fica vermelha */
    background-color: #fff0f0 !important; /* Fundo pisca vermelho claro */
}

@keyframes tremerForte {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
  40%, 60% { transform: translate3d(8px, 0, 0); }
}

/* ==========================================================================
   12. BARRA DE NAVEGAÇÃO INFERIOR (MODERNA ESTILO IFOOD)
   ========================================================================== */
.bottom-nav {
    position: fixed; 
    bottom: 20px; 
    left: 50%;
    transform: translateX(-50%);
    width: auto; 
    min-width: 250px;
    height: 65px; 
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    display: flex; 
    justify-content: space-around; 
    align-items: center; 
    border-radius: 40px;
    border: 1px solid rgba(0, 0, 0, 0.05); 
    z-index: 1000;
    padding: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.bottom-nav-item {
    text-align: center; 
    color: var(--text-muted) !important; 
    cursor: pointer; 
    transition: 0.3s;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 25px;
    border-radius: 30px;
}

.bottom-nav-item i { font-size: 1.3rem; margin-bottom: 4px; transition: transform 0.3s; color: var(--text-muted); }
.bottom-nav-item p { font-size: 0.65rem; margin: 0; font-weight: 700; letter-spacing: 0.5px; }

/* Aba Ativa = Laranja vibrante com texto branco */
.bottom-nav-item.active {
    background: var(--primary);
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(234, 88, 12, 0.3);
}
.bottom-nav-item.active i {
    transform: translateY(-1px);
    color: #fff;
}

/* ==========================================================================
   13. SKELETON LOADERS
   ========================================================================== */
.skeleton {
    background: #e2e5e7;
    background-image: linear-gradient(90deg, #e2e5e7 0px, #f0f2f4 40px, #e2e5e7 80px);
    background-size: 200vw 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 8px;
    height: 100%;
    width: 100%;
}

.skeleton-text { height: 16px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-img { height: 150px; border-radius: 20px 20px 0 0; }
.skeleton-card { background: var(--card); border-radius: 20px; overflow: hidden; border: 1px solid rgba(0,0,0,0.03); box-shadow: var(--shadow-sm); }
.skeleton-info { padding: 16px; }
.skeleton-price { height: 24px; width: 60%; margin-top: 10px; }

@keyframes shimmer {
    0% { background-position: -200vw 0; }
    100% { background-position: 200vw 0; }
}

/* =========================================
   HEADER IDENTIDADE VISUAL
========================================= */
header.header-custom {
    padding: 0;
    margin-bottom: 20px;
}

.header-visual {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.header-banner-container {
    width: 100%;
    height: 120px;
    overflow: hidden;
    position: relative;
    border-bottom: 3px solid var(--primary);
}

.header-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.header-info-overlay {
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 15px;
    margin-top: 15px;
}

.header-info-overlay.has-banner {
    margin-top: -40px;
    position: relative;
    z-index: 10;
}

.header-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
    background: #fff;
}

.header-texts {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 20px;
}
.header-info-overlay.has-banner .header-texts {
    padding-top: 40px;
}
header.no-logo .header-info-overlay.has-banner .header-texts {
    padding-top: 55px;
}

.header-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 5px 0;
    font-family: 'Inter', sans-serif;
    line-height: 1.2;
}

.status-modern {
    display: inline-block;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 500;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

header.no-banner .status-badge {
    padding: 5px 14px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.open {
    background: rgba(46, 204, 113, 0.1);
    color: #27ae60;
    border-color: rgba(46, 204, 113, 0.3);
}

.status-badge.closed {
    background: rgba(231, 76, 60, 0.1);
    color: #c0392b;
    border-color: rgba(231, 76, 60, 0.3);
}

@media (min-width: 768px) {
    .header-banner-container {
        height: 180px;
    }
    .header-logo {
        width: 110px;
        height: 110px;
        border-width: 4px;
    }
    .header-info-overlay.has-banner {
        margin-top: -55px;
    }
    .header-title {
        font-size: 1.8rem;
    }
    .header-info-overlay.has-banner .header-texts {
        padding-top: 55px;
    }
    header.no-logo .header-info-overlay.has-banner .header-texts {
        padding-top: 70px;
    }
}