@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;800&display=swap');

/* ==========================================================================
   1. VARIÁVEIS GLOBAIS (TEMA CLARO)
   ========================================================================== */
:root {
    /* Cores principais */
    --bg: #fdfdfd;          /* Fundo quase branco */
    --card: #ffffff;        /* Cartões brancos */
    --input-bg: #f4f4f4;    /* Fundo cinza claro para inputs */
    --text: #2d3436;        /* Texto cinza escuro (quase preto) */
    --text-muted: #636e72;  /* Texto secundário cinza médio */
    --border: #e0e0e0;      /* Bordas suaves */
    
    /* Cores de destaque */
    --primary: #FFC107;       /* AMARELO */
    --primary-hover: #ffb300; 
    
    --accent: #e74c3c;        /* VERMELHO */
    
    --success: #2ecc71;
    --whatsapp: #25D366;
}

/* ==========================================================================
   2. CONFIGURAÇÕES GERAIS E RESETS
   ========================================================================== */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    -webkit-tap-highlight-color: transparent; 
    outline: none; 
}

body { 
    background: var(--bg); 
    color: var(--text); 
    overflow-x: hidden; 
    padding-bottom: 100px; 
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

/* ==========================================================================
   3. MODAIS E OVERLAYS (Corrigido e Unificado)
   ========================================================================== */
.modal-overlay-custom {
    display: none; 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); /* Fundo escuro focado */
    backdrop-filter: blur(4px);
    z-index: 9999; align-items: center; justify-content: center;
}

.modal-overlay-custom.active { display: flex; }

.modal-box-custom {
    background: var(--card); 
    border: 1px solid var(--border);
    padding: 30px 25px; border-radius: 25px; width: 90%; max-width: 350px;
    text-align: center; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    animation: zoomIn 0.3s ease;
}

.modal-box-custom h2 { color: var(--text); margin-bottom: 10px; font-size: 1.4rem; }
.modal-box-custom p { color: var(--text-muted); margin-bottom: 25px; font-size: 0.95rem; line-height: 1.5; }

.icon-closed { font-size: 3.5rem; color: var(--accent); margin-bottom: 20px; }
.icon-warning { font-size: 3.5rem; color: #f1c40f; margin-bottom: 20px; }

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   4. CABEÇALHO (HEADER)
   ========================================================================== */
header { 
    position: sticky; top: 0; 
    background: rgba(255, 255, 255, 0.95); 
    backdrop-filter: blur(10px); 
    z-index: 1000; 
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.logo { 
    text-align: center; font-weight: 800; font-size: 1.2rem; 
    margin-bottom: 15px; letter-spacing: -1px; color: var(--text);
}
.logo span { color: var(--primary); text-shadow: 1px 1px 0px rgba(0,0,0,0.1); }

.cat-scroll { 
    display: flex; overflow-x: auto; gap: 12px; padding: 0 15px; 
    scrollbar-width: none; 
}
.cat-scroll::-webkit-scrollbar { display: none; }

.cat-tab { 
    padding: 8px 16px; border-radius: 12px; 
    font-size: 0.85rem; font-weight: 600; white-space: nowrap; 
    color: var(--text-muted); background: var(--input-bg); 
    border: 1px solid var(--border); transition: 0.3s; cursor: pointer;
}
.cat-tab.active { 
    background: var(--primary); color: #000; 
    border-color: var(--primary); transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(255, 193, 7, 0.3);
}

/* ==========================================================================
   5. CONTEÚDO E GRID
   ========================================================================== */
.content { padding: 15px; max-width: 600px; margin: 0 auto; }

.section-title { 
    margin: 25px 0 15px; font-size: 1.1rem; font-weight: 800; 
    color: var(--text); display: flex; align-items: center; gap: 10px; 
    scroll-margin-top: 110px; 
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.p-card { 
    background: var(--card); border-radius: 20px; overflow: hidden; 
    border: 1px solid var(--border); position: relative;
    animation: fadeIn 0.5s ease forwards; cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); transition: transform 0.2s;
}
.p-card:active { transform: scale(0.98); }

.p-img { width: 100%; height: 120px; object-fit: cover; }
.p-info { padding: 12px; }

.p-name { 
    font-size: 0.85rem; font-weight: 600; color: var(--text);
    margin-bottom: 5px; height: 34px; overflow: hidden; 
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; 
}

.p-price { color: #d35400; font-weight: 800; font-size: 1rem; }

.btn-add-small {
    position: absolute; bottom: 10px; right: 10px;
    background: var(--primary); color: #000; border: none;
    width: 30px; height: 30px; border-radius: 10px; 
    font-size: 1.2rem; display: flex; align-items: center; justify-content: center; 
    font-weight: 800; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* ==========================================================================
   6. CARRINHO (CART BAR)
   ========================================================================== */
.cart-bar {
    position: fixed; bottom: 85px; left: 15px; right: 15px;
    background: var(--primary); color: #000; padding: 16px 20px;
    border-radius: 18px; display: flex; justify-content: space-between;
    align-items: center; box-shadow: 0 10px 30px rgba(255, 193, 7, 0.4);
    z-index: 1100; transform: translateY(200px); 
    transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 570px; margin: 0 auto; cursor: pointer;
}
.cart-bar.show { transform: translateY(0); }
.cart-bar strong { font-size: 1.1rem; }

/* ==========================================================================
   7. DRAWER (MODAL DESLIZANTE)
   ========================================================================== */
.drawer { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.6); z-index: 2000; 
    display: none; align-items: flex-end; justify-content: center;
}
.drawer-content { 
    background: #ffffff; width: 100%; max-width: 600px; 
    border-radius: 30px 30px 0 0; padding: 30px 20px; 
    position: relative; transform: translateY(100%); 
    transition: 0.4s; max-height: 90vh; overflow-y: auto; color: var(--text);
}
.drawer.active { display: flex; }
.drawer.active .drawer-content { transform: translateY(0); }

/* Quantidade */
.qty-selector { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 25px 0; }
.qty-btn { 
    width: 45px; height: 45px; border-radius: 15px; 
    border: 1px solid var(--border); background: var(--input-bg); 
    color: var(--text); font-size: 1.5rem; cursor: pointer;
}

/* Sucesso */
.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;
}

/* ==========================================================================
   8. FORMULÁRIOS
   ========================================================================== */
.input-group { margin-bottom: 15px; }
.input-group label { display: block; color: var(--text-muted); font-size: 0.8rem; margin-bottom: 5px; margin-left: 5px; }

input, select, textarea { 
    width: 100%; padding: 15px; background: var(--input-bg); 
    border: 1px solid var(--border); color: var(--text); 
    border-radius: 12px; font-size: 1rem; transition: 0.3s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); background: #fff; }

select:required:invalid { color: var(--text-muted); }
option { color: var(--text); background: #fff; }

.delivery-toggle {
    display: flex; background: var(--input-bg); padding: 5px; 
    border-radius: 15px; margin-bottom: 20px; border: 1px solid var(--border);
}
.dt-option {
    flex: 1; padding: 12px; text-align: center; border-radius: 10px;
    font-weight: 600; cursor: pointer; transition: 0.3s; color: var(--text-muted);
}
.dt-option.active { 
    background: var(--primary); color: #000; 
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
}

/* Botões */
.btn-main { 
    width: 100%; padding: 18px; border-radius: 15px; border: none; 
    background: var(--primary); color: #000; font-weight: 800; font-size: 1rem;
    cursor: pointer; transition: 0.2s; display: flex; 
    align-items: center; justify-content: center; gap: 10px;
}
.btn-main:active { transform: scale(0.98); }
.btn-main.whatsapp { background: var(--whatsapp); color: #fff; }

.btn-sec { 
    width: 100%; background: none; border: none; color: var(--text-muted); 
    margin-top: 15px; padding: 10px; cursor: pointer; 
}

.btn-limpar {
    background: rgba(231, 76, 60, 0.1); border: 1px solid var(--accent);
    color: var(--accent); padding: 8px 15px; border-radius: 8px;
    cursor: pointer; transition: 0.3s; font-weight: 500;
}
.btn-limpar:hover { background: var(--accent); color: white; }

/* ==========================================================================
   9. PEDIDOS E HISTÓRICO
   ========================================================================== */
.header-pedidos {
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 20px; padding-bottom: 10px; border-bottom: 2px solid var(--border);
}
.header-pedidos h2 { color: var(--text); }
.sem-pedidos { text-align: center; padding: 40px; color: var(--text-muted); }

.order-card {
    background: var(--card); border-radius: 15px; padding: 15px;
    margin-bottom: 15px; border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.order-header { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 0.9rem; color: var(--text-muted); }
.order-items { font-size: 0.95rem; margin-bottom: 10px; line-height: 1.4; color: var(--text); }

.status-badge { display: inline-block; padding: 5px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; }
.st-aguardando { background: #e67e22; color: #fff; }
.st-finalizado { background: #2ecc71; color: #fff; }

/* ==========================================================================
   10. ANIMAÇÕES E LOADING
   ========================================================================== */
.spinner {
    width: 40px; height: 40px; border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--primary); border-radius: 50%;
    animation: spin 1s linear infinite; margin: 30px auto;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ==========================================================================
   11. CONTADORES DE COMPLEMENTOS (AJUSTADO PARA TEMA CLARO)
   ========================================================================== */
.comp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border); /* Suavizado para tema claro */
}
.comp-row:last-child { border-bottom: none; }

.comp-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}
/* Corrigido para var(--text) pois o fundo é branco */
.comp-name { font-weight: 600; font-size: 0.95rem; color: var(--text); }
.comp-price { font-size: 0.85rem; color: var(--primary); margin-top: 2px; }

.comp-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--input-bg);
    padding: 5px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.btn-comp-qty {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: none;
    background: #333; /* Mantido escuro para contraste do botão */
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.btn-comp-qty:active { transform: scale(0.9); }
.btn-comp-qty.disabled { opacity: 0.3; cursor: not-allowed; }

/* Corrigido para var(--text) */
.comp-qty-display {
    font-weight: bold;
    min-width: 20px;
    text-align: center;
    color: var(--text);
}

/* Feedback visual (Shake) */
.shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}