/* =========================================
   IMPORTAÇÃO DE FONTES (VIP & RÚSTICO)
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Ubuntu:wght@400;500&display=swap');

/* =========================================
   VARIÁVEIS DE CORES - TEMA BRASA VIP
   ========================================= */
:root {
    --bg-dark: #0f0806;          
    --bg-panel: #1e100c;         
    --primary: #d84315;          
    --primary-hover: #ff5722;    
    --accent: #ff9800;           
    --text-light: #fbe9e7;       
    --text-muted: #bcaaa4;       
    --border-wood: #5d4037;      
    --glow-brasa: 0 0 15px rgba(255, 87, 34, 0.4);
    --glow-forte: 0 0 25px rgba(255, 152, 0, 0.6);
}

/* =========================================
   CONFIGURAÇÕES GERAIS E RESET
   ========================================= */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: radial-gradient(circle at center, #1a0f0b 0%, var(--bg-dark) 100%);
    color: var(--text-light);
    font-family: 'Ubuntu', sans-serif;
    min-height: 100vh;
}

h1, h2, h3, h4, h5 {
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =========================================
   CORREÇÃO: FORÇAR CAIXA ALTA (UPPERCASE)
   ========================================= */
.input-maiusculo {
    text-transform: uppercase !important;
}

/* =========================================
   CABEÇALHO (HEADER) E MENU DA ENGRENAGEM
   ========================================= */
.header-rustico {
    background-color: rgba(15, 8, 6, 0.95);
    border-bottom: 3px solid var(--primary);
    padding: 15px 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    text-align: center;
    color: var(--accent);
    margin: 0 0 15px 0;
    font-size: 2.2em;
    letter-spacing: 3px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9), var(--glow-brasa);
}

.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
}

.left-controls {
    display: flex;
    gap: 10px;
}

.btn-sm {
    background: linear-gradient(145deg, #3e2723, #2b1812);
    color: var(--text-light);
    border: 1px solid var(--border-wood);
    border-radius: 6px;
    padding: 8px 15px;
    cursor: pointer;
    font-family: 'Ubuntu', sans-serif;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}

.btn-sm:hover {
    background: linear-gradient(145deg, #5d4037, #3e2723);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.gear-wrapper { position: relative; }

#gear-icon {
    font-size: 28px;
    cursor: pointer;
    display: inline-block;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 5px rgba(255, 152, 0, 0.5));
}

#gear-icon.spin { transform: rotate(180deg); }

#gear-menu {
    position: absolute;
    right: 0;
    top: 45px;
    background: var(--bg-panel);
    border: 1px solid var(--primary);
    list-style: none;
    padding: 0;
    margin: 0;
    width: 260px;
    z-index: 1000;
    box-shadow: 0 8px 20px rgba(0,0,0,0.95);
    border-radius: 8px;
    overflow: hidden;
}

#gear-menu.hidden { display: none; }

#gear-menu li {
    padding: 15px;
    border-bottom: 1px solid var(--border-wood);
    cursor: pointer;
    font-family: 'Oswald', sans-serif;
    font-size: 1.1em;
    transition: 0.2s;
}

#gear-menu li:last-child { border-bottom: none; }
#gear-menu li:hover { background: var(--primary); color: #fff; padding-left: 20px; }

/* =========================================
   ESTRUTURA DE TELAS E ALINHAMENTO
   ========================================= */
.tela {
    display: none;
    padding: 30px 15px;
    animation: fadeIn 0.4s ease-out;
}

.tela.ativa { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.centralizado {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

/* =========================================
   BOTÕES RÚSTICOS (BRASA)
   ========================================= */
.btn-rustico {
    background: linear-gradient(145deg, var(--primary), #a6330b);
    border: 2px solid var(--accent);
    border-radius: 8px;
    color: #fff;
    padding: 16px;
    margin: 10px 0;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    font-size: 1.2em;
    letter-spacing: 1px;
    cursor: pointer;
    width: 100%;
    max-width: 400px;
    box-shadow: 4px 4px 10px rgba(0,0,0,0.7), inset 0 0 5px rgba(255,255,255,0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-rustico:hover {
    background: linear-gradient(145deg, var(--primary-hover), var(--primary));
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.8), var(--glow-brasa);
    border-color: #fff;
}

.btn-rustico:active { transform: translateY(1px); box-shadow: 2px 2px 5px rgba(0,0,0,0.8); }
.btn-gigante { padding: 30px; font-size: 1.6em; max-width: 450px; border-width: 3px; }
.btn-sucesso { background: linear-gradient(145deg, #2e7d32, #1b5e20); border-color: #81c784; }
.btn-sucesso:hover { background: linear-gradient(145deg, #388e3c, #2e7d32); box-shadow: 0 8px 15px rgba(0,0,0,0.8), 0 0 15px rgba(76, 175, 80, 0.4); }
.btn-cancelar { background: linear-gradient(145deg, #546e7a, #37474f); border-color: #90a4ae; }
.btn-secundario { background: linear-gradient(145deg, #4e342e, #3e2723); border-color: var(--border-wood); }

.gestao-lista { display: flex; flex-direction: column; align-items: center; width: 100%; gap: 5px; }

/* =========================================
   FORMULÁRIOS E INPUTS
   ========================================= */
.form-grupo {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 25px;
    background: var(--bg-panel);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-wood);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.input-rustico {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-wood);
    color: var(--text-light);
    padding: 15px;
    border-radius: 6px;
    font-family: 'Ubuntu', sans-serif;
    font-size: 1.05em;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

/* CORREÇÃO 1: Corrigindo a leitura das categorias no campo de seleção */
select.input-rustico option {
    background-color: var(--bg-panel);
    color: var(--text-light);
}

.input-rustico::placeholder { color: var(--text-muted); }
.input-rustico:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow-brasa); background: rgba(0, 0, 0, 0.8); }

.rodape-mesa { margin-top: 25px; padding-top: 20px; border-top: 2px dashed var(--border-wood); width: 100%; max-width: 400px; }
.destaque { color: var(--accent); font-size: 1.8em; text-shadow: 1px 1px 3px rgba(0,0,0,0.8); margin-bottom: 15px; }
.lista-itens { width: 100%; max-width: 450px; margin-top: 20px; }

.item-historico {
    background: var(--bg-panel);
    border-left: 6px solid var(--primary);
    padding: 15px 20px;
    margin-bottom: 12px;
    border-radius: 0 8px 8px 0;
    text-align: left;
    cursor: pointer;
    user-select: none;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.5);
    transition: 0.2s;
}

.item-historico:hover { background: #271610; transform: translateX(5px); border-left-color: var(--accent); }
.nota { font-size: 0.85em; color: var(--text-muted); font-style: italic; background: rgba(0,0,0,0.3); padding: 5px 10px; border-radius: 4px; }

/* =========================================
   PRODUTOS E CATEGORIAS (SUBMENU E CARDÁPIO)
   ========================================= */
.submenu { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 25px; background: var(--bg-panel); padding: 10px; border-radius: 8px; border: 1px solid var(--border-wood); }
.submenu button { padding: 10px 18px; background-color: transparent; color: var(--text-light); border: 1px solid var(--border-wood); border-radius: 5px; font-family: 'Oswald', sans-serif; font-size: 1em; cursor: pointer; transition: 0.3s; }
.submenu button:hover, .submenu button:focus { background-color: var(--primary); border-color: var(--accent); box-shadow: var(--glow-brasa); }

.categoria-bloco { background: var(--bg-panel); margin-top: 20px; padding: 20px; border-radius: 10px; border: 1px solid var(--border-wood); width: 100%; text-align: left; box-shadow: 0 4px 10px rgba(0,0,0,0.4); }
.produto-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid var(--border-wood); background-color: rgba(0, 0, 0, 0.4); margin: 8px 0; border-radius: 6px; cursor: grab; transition: background 0.2s; }
.produto-item:hover { background-color: rgba(0, 0, 0, 0.6); }
.produto-item:active { cursor: grabbing; }

/* =========================================
   PAGAMENTO E FORMAS
   ========================================= */
.formas-pagamento label { display: flex; align-items: center; justify-content: space-between; margin: 12px 0; font-size: 1.1em; background: var(--bg-panel); padding: 15px; border-radius: 8px; border: 1px solid var(--border-wood); box-shadow: 2px 2px 5px rgba(0,0,0,0.4); cursor: pointer; transition: 0.2s; }
.formas-pagamento label:hover { border-color: var(--primary); }
.formas-pagamento input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--primary); }
.input-valor-pgto { width: 130px; padding: 10px; margin-left: 10px; }

/* =========================================
   MODAIS (SENHAS E GOD MODE)
   ========================================= */
.modal { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.9); backdrop-filter: blur(5px); align-items: center; justify-content: center; z-index: 2000; }
.modal-content { background: var(--bg-panel); padding: 30px; border: 2px solid var(--accent); border-radius: 12px; width: 90%; max-width: 400px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.8), var(--glow-forte); animation: scaleIn 0.3s ease-out; }

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@media (max-width: 480px) {
    .btn-gigante { padding: 20px; font-size: 1.3em; }
    .logo { font-size: 1.8em; }
    .produto-item { flex-direction: column; align-items: flex-start; gap: 10px; }
    .formas-pagamento label { flex-direction: column; align-items: flex-start; gap: 10px; }
    .input-valor-pgto { width: 100%; margin-left: 0; }
}

/* =========================================
   MOTOR DE IMPRESSÃO DO CARDÁPIO
   ========================================= */
@media print {
    body > *:not(#area-impressao) { display: none !important; }
    body { background: #fff !important; color: #000; margin: 0; padding: 0; }
    
    #area-impressao {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: #fff;
    }

    .cardapio-impresso {
        font-family: 'Oswald', sans-serif;
        background: #fff;
        color: #1a0f0b;
        border: 2px solid #000; 
        border-radius: 8px;
        padding: 30px;
        text-align: center;
        box-sizing: border-box;
        box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 6px #d84315;
        position: relative;
    }

    .cardapio-impresso::before {
        content: "MENU";
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 10pt;
        letter-spacing: 5px;
        color: #777;
    }

    .cardapio-impresso h1 {
        color: #d84315;
        font-size: 32pt;
        margin-top: 15px;
        margin-bottom: 25px;
        letter-spacing: 2px;
        text-shadow: 1px 1px 0px #000;
    }

    .cardapio-categoria-print {
        font-size: 18pt;
        color: #000;
        margin-top: 30px;
        margin-bottom: 15px;
        text-transform: uppercase;
        display: flex;
        align-items: center;
        justify-content: center;
        letter-spacing: 2px;
    }
    
    .cardapio-categoria-print::before,
    .cardapio-categoria-print::after {
        content: "";
        flex: 1;
        border-bottom: 1px solid #d84315;
        margin: 0 10px;
    }

    .cardapio-item-print {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        font-size: 13pt;
        margin: 10px 0;
        font-family: 'Ubuntu', sans-serif;
        text-transform: uppercase;
        font-weight: 500;
    }

    .cardapio-item-print .nome-prod { background: #fff; padding-right: 5px; z-index: 1; }
    .cardapio-item-print .preco-prod { background: #fff; padding-left: 5px; z-index: 1; font-weight: bold; color: #d84315; }

    .cardapio-item-print::after {
        content: "";
        flex-grow: 1;
        border-bottom: 2px dotted #ccc;
        margin: 0 5px;
        position: relative;
        top: -5px;
        z-index: 0;
    }

    /* PADRÃO 100% (A4 Retrato - 1 por folha) */
    body.print-100 { @page { size: portrait; margin: 1cm; } }
    body.print-100 #area-impressao { display: flex; justify-content: center; }
    body.print-100 .cardapio-impresso { width: 90%; min-height: 90vh; }

    /* PADRÃO 50% (A4 Paisagem - 2 por folha) */
    body.print-50 { @page { size: landscape; margin: 0; } }
    body.print-50 #area-impressao { position: relative; width: 100%; height: 98vh; page-break-inside: avoid; }
    body.print-50 .cardapio-impresso { position: absolute; width: 46%; height: 94vh; top: 2vh; padding: 20px; overflow: hidden; }
    body.print-50 .cardapio-impresso:nth-child(1) { left: 2%; }
    body.print-50 .cardapio-impresso:nth-child(2) { right: 2%; }
    body.print-50 .cardapio-impresso h1 { font-size: 22pt; margin-bottom: 15px; }
    body.print-50 .cardapio-categoria-print { font-size: 14pt; margin-top: 15px; margin-bottom: 10px; }
    body.print-50 .cardapio-item-print { font-size: 10pt; margin: 8px 0; }

    /* PADRÃO 25% (A4 Retrato - 4 por folha) */
    body.print-25 { @page { size: portrait; margin: 0; } }
    body.print-25 #area-impressao { position: relative; width: 100%; height: 98vh; page-break-inside: avoid; }
    body.print-25 .cardapio-impresso { position: absolute; width: 46%; height: 46vh; padding: 10px; box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px #d84315; overflow: hidden; }
    body.print-25 .cardapio-impresso:nth-child(1) { top: 2vh; left: 2%; }
    body.print-25 .cardapio-impresso:nth-child(2) { top: 2vh; right: 2%; }
    body.print-25 .cardapio-impresso:nth-child(3) { bottom: 2vh; left: 2%; }
    body.print-25 .cardapio-impresso:nth-child(4) { bottom: 2vh; right: 2%; }
    body.print-25 .cardapio-impresso::before { display: none; }
    body.print-25 .cardapio-impresso h1 { font-size: 14pt; margin-bottom: 5px; margin-top: 0; text-shadow: none; letter-spacing: 0px; }
    body.print-25 .cardapio-categoria-print { font-size: 11pt; margin-top: 10px; margin-bottom: 5px; letter-spacing: 0px; }
    body.print-25 .cardapio-item-print { font-size: 8pt; margin: 4px 0; }
}

/* =========================================
   TEMA GOD MODE (AZUL HACKER)
   ========================================= */
body.tema-god-mode {
    --bg-base: #000c1a;
    --bg-panel: #002244;
    --bg-dark: #001122;
    --primary: #00aaff;
    --accent: #00ffcc;
    --text-light: #e0f7ff;
    --text-muted: #6699cc;
    --border-wood: #004080;
    --glow-brasa: 0 0 15px rgba(0, 255, 204, 0.4);
}

body.tema-god-mode .header-rustico {
    border-bottom: 3px solid var(--accent);
    box-shadow: 0 5px 20px rgba(0, 170, 255, 0.3);
}

body.tema-god-mode .btn-sucesso {
    background: linear-gradient(145deg, #005580, #00334d);
    border-color: #00aaff;
}

body.tema-god-mode h1.logo::after {
    content: " (GOD MODE)";
    color: var(--accent);
    font-size: 0.5em;
    vertical-align: middle;
}
/* =========================================
   TEMA TEST MODE (AMARELO ALERTA)
   ========================================= */
body.tema-test-mode {
    --bg-base: #1a1600;
    --bg-panel: #515e0d;
    --bg-dark: #141100;
    --primary: #ffca28;
    --accent: #ffee58;
    --text-light: #fffde7;
    --text-muted: #cddc39;
    --border-wood: #178244;
    --glow-brasa: 0 0 15px rgba(90, 255, 40, 0.349);
}

body.tema-test-mode .header-rustico {
    border-bottom: 3px solid var(--primary);
    box-shadow: 0 5px 20px rgba(108, 255, 40, 0.315);
}

body.tema-test-mode h1.logo::after {
    content: " (TEST MODE)";
    color: var(--primary);
    font-size: 0.5em;
    vertical-align: middle;
}

/* =========================================
   TEMA CLARO (MADEIRA E FUMAÇA)
   ========================================= */
body.tema-claro {
    --bg-dark: #e6dcd8;
    --bg-panel: #fdfbf7;
    --primary: #d84315;
    --primary-hover: #bf360c;
    --accent: #e65100;
    --text-light: #2e150d;
    --text-muted: #6d4c41;
    --border-wood: #bcaaa4;
    --glow-brasa: 0 0 10px rgba(216, 67, 21, 0.3);
    --glow-forte: 0 0 20px rgba(230, 81, 0, 0.4);
    background: radial-gradient(circle at center, #fdfbf7 0%, var(--bg-dark) 100%);
}

body.tema-claro .header-rustico {
    background-color: rgba(253, 251, 247, 0.98);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

body.tema-claro .item-historico, 
body.tema-claro .categoria-bloco,
body.tema-claro .formas-pagamento label,
body.tema-claro .form-grupo {
    background: #ffffff;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.05);
}

body.tema-claro .input-rustico {
    background: #ffffff;
    color: #2e150d;
}

body.tema-claro .input-rustico:focus {
    background: #fffcf0;
}

body.tema-claro .btn-sm {
    background: linear-gradient(145deg, #d7ccc8, #a1887f);
    color: #fff;
}

/* =========================================
   AJUSTES PARA CELULAR (MOBILE FIXES)
   ========================================= */
@media (max-width: 600px) {
    .header-rustico h1.logo {
        font-size: 1.4em !important;
        white-space: nowrap !important;
    }
    .produto-item {
        flex-direction: row !important;
        text-align: left !important;
    }
}