:root {
    --bg: #121212; /* Fundo levemente mais claro que preto puro */
    --card-bg: #1e1e1e; 
    --input-bg: #2c2c2c; 
    --gold: #d4af37; 
    --gold-hover: #f9d768; 
    --text: #ffffff;
    --text-muted: #b0b0b0;
    --border: #333333;
    --danger: #ff5252;
    --success: #00e676;
    --shadow-dark: 0 8px 20px rgba(0, 0, 0, 0.6); 
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

#app-container {
    width: 100%;
    max-width: 480px;
    background: var(--bg);
    position: relative;
    padding-bottom: 40px;
}

header {
    background-color: var(--card-bg);
    color: var(--text);
    
    /* --- ALTERAÇÃO ADAPTATIVA: PADDINGS SEGUROS --- */
    /* Volta o padding, mas adiciona o espaço da barra de status (safe-area-inset-top) */
    padding-top: calc(env(safe-area-inset-top) + 40px); /* 40px de respiro + Altura da barra */
    padding-right: 20px;
    padding-bottom: 20px;
    padding-left: 20px;
    
    text-align: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
}

.header-content { display: flex; align-items: center; }
.app-icon { width: 40px; height: 40px; border-radius: 10px; margin-right: 12px; }
.logo { font-size: 1.4rem; font-weight: 700; margin: 0; letter-spacing: 0.5px; }
.dourado { color: var(--gold); }

#home-screen { padding: 25px 20px; }
.intro { font-size: 0.95rem; color: var(--text-muted); text-align: center; margin-bottom: 25px; line-height: 1.5; }

/* GRID MAIS BONITO */
.grid-menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.card {
    background: linear-gradient(145deg, #252525, #1a1a1a);
    padding: 25px 15px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    border: 1px solid #333;
    transition: transform 0.1s, border-color 0.2s;
}

.card:active { transform: scale(0.98); }
.card:hover { border-color: var(--gold); }

.icon-circle {
    background: rgba(212, 175, 55, 0.1);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px auto;
}

.card i.icon { font-size: 1.5rem; color: var(--gold); }
.card h3 { margin: 0 0 5px 0; font-size: 1rem; color: #fff; font-weight: 600; }
.card p { font-size: 0.75rem; color: var(--text-muted); margin: 0; }

/* MODAL / POPUPS */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.92); z-index: 100;
    display: flex; justify-content: center; align-items: flex-start;
    padding: 20px; overflow-y: auto;
    
    /* --- ALTERAÇÃO ADAPTATIVA NO MODAL --- */
    /* Garante que o modal também respeite a barra de status */
    padding-top: calc(env(safe-area-inset-top) + 60px); 
    
    animation: fadeIn 0.2s ease-out;
}

.hidden { display: none !important; }

.modal-content {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-dark);
    position: relative;
    border: 1px solid var(--border);
}

.modal-content h2 {
    color: var(--gold); margin-top: 25px; font-size: 1.4rem;
    border-bottom: 1px solid var(--border); padding-bottom: 15px; margin-bottom: 25px;
    text-align: center;
}

.fechar {
    position: absolute; top: calc(env(safe-area-inset-top) + 15px); left: 15px; background: none; border: none;
    color: var(--text-muted); cursor: pointer; font-size: 0.9rem; font-weight: 600;
}

/* INPUTS */
.input-group { margin-bottom: 18px; }
.input-group label { display: block; margin-bottom: 8px; font-size: 0.9rem; color: #ccc; }
.input-group input, .input-group select {
    width: 100%; padding: 14px; border: 1px solid var(--border);
    background-color: var(--input-bg); color: #fff; border-radius: 10px;
    font-size: 1.1rem; outline: none; transition: border-color 0.2s;
}
.input-group input:focus { border-color: var(--gold); }

.checkbox-group { display: flex; align-items: center; margin: 20px 0; font-size: 0.95rem; color: #ccc; }
.checkbox-group input { margin-right: 12px; transform: scale(1.2); accent-color: var(--gold); }

/* BOTÃO */
.btn-calcular {
    width: 100%; background: var(--gold); color: #000; border: none;
    padding: 16px; border-radius: 10px; font-size: 1.1rem; font-weight: 700;
    cursor: pointer; margin-top: 10px; box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}
.btn-calcular:active { transform: translateY(2px); }

/* RESULTADOS */
.resultado-box { width: 100%; max-width: 420px; background: var(--card-bg); padding: 25px; border-radius: 16px; border: 1px solid var(--gold); }
.res-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed #333; font-size: 1rem; }
.res-row.total { font-weight: 700; font-size: 1.3rem; padding: 20px 0; border-top: 2px solid var(--gold); border-bottom: none; margin-top: 10px; color: var(--gold); }
.verde { color: var(--success); }
.vermelho { color: var(--danger); }
.obs { font-size: 0.8rem; color: #777; text-align: center; margin-top: 20px; }
.btn-fechar-resultado { width: 100%; background: #333; color: #fff; padding: 14px; border-radius: 10px; margin-top: 20px; border: none; font-weight: 600; cursor: pointer; }

/* LOADING */
#loading-overlay { z-index: 300; background: rgba(0,0,0,0.96); align-items: center; }
.spinner { font-size: 3rem; animation: spin 1.5s linear infinite; color: var(--gold); margin-bottom: 20px; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* POLICY */
.policy-link-box { text-align: center; margin-top: 40px; }
.btn-policy { color: #666; font-size: 0.8rem; text-decoration: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }


/* ------------------------------------------------------------------ */
/* --- INÍCIO: ESTILOS PARA MODAL DE FALHA NA CONEXÃO (#offline-modal) --- */
/* ------------------------------------------------------------------ */

/* Estilos de Fundo Animado e Modal de Cobertura Total */
#offline-modal {
    /* Sobrescreve o fundo padrão do .modal para adicionar o gradiente animado do 404 */
    background: linear-gradient(-45deg, #111, #0c0c0c, #1a1a1a, #000);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    
    /* Centraliza o conteúdo no meio da tela */
    align-items: center; 
    
    /* Remove o padding-top adaptativo do modal genérico, centralizando melhor o conteúdo */
    padding-top: 20px; 
}

/* ANIMAÇÃO DE FUNDO */
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Estilo da Caixa de Aviso (.offline-box) */
.offline-box {
    max-width: 400px;
    padding: 40px;
    margin: 20px;
    background: rgba(24, 24, 24, 0.8); /* Fundo translúcido do 404 */
    border-radius: 20px;
    border: 1px solid rgba(212, 175, 55, 0.15); /* Borda sutil dourada */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-align: center;
    animation: fadeIn 1s ease-out forwards; /* Reutiliza a animação fadeIn */
    opacity: 1; 
    color: var(--text);
}

/* Ícone SVG */
.offline-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    color: var(--gold); /* Usando variável do app principal */
}

.offline-box h2, .offline-box h1 { /* Adiciona h1 e h2 para o título do modal */
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 10px;
    color: var(--text); 
    /* Remove a borda inferior do h2 genérico do modal para este modal */
    border-bottom: none; 
    padding-bottom: 0;
    margin-bottom: 10px;
}

.offline-box p {
    line-height: 1.7;
    margin: 0 0 30px;
    font-size: 15px;
    color: var(--text-muted); /* Usando variável do app principal */
}

/* BOTÃO MELHORADO (Estilo do 404) */
/* Usa a classe .btn para o link "TENTAR NOVAMENTE" */
.offline-box .btn { 
    display: inline-block;
    background: var(--gold);
    color: #0c0c0c;
    padding: 14px 35px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);
    border: none;
}

.offline-box .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

/* ------------------------------------------------------------------ */
/* --- FIM: ESTILOS PARA MODAL DE FALHA NA CONEXÃO --- */
/* ------------------------------------------------------------------ */