/* CSS Variables para Dark Mode Nativo */
:root {
    --bg-color: #f1f5f9;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --primary: #2563eb;
    --btn-alt-bg: #ffffff;
    --btn-alt-hover: #eff6ff;
    --top-bar-bg: #2563eb;
}

.dark-mode {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: #1e293b;
    --border-color: #334155;
    --primary: #3b82f6;
    --btn-alt-bg: #1e293b;
    --btn-alt-hover: #334155;
    --top-bar-bg: #1e293b;
}

/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; transition: background-color 0.3s, color 0.3s; }
body { background-color: var(--bg-color); color: var(--text-color); display: flex; justify-content: center; min-height: 100vh; }
#app-container { width: 100%; max-width: 480px; background-color: var(--card-bg); min-height: 100vh; position: relative; overflow-x: hidden; box-shadow: 0 0 20px rgba(0,0,0,0.05); }

/* Views System */
.view { display: none; min-height: 100vh; flex-direction: column; animation: fadeIn 0.3s ease-in-out; }
.view.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Utils */
.content-padding { padding: 20px; }
.hidden { display: none !important; }
.center-text { text-align: center; }
.mt-20 { margin-top: 20px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Top Bar */
.top-bar { background-color: var(--top-bar-bg); color: white; padding: 20px; display: flex; justify-content: space-between; align-items: center; border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; }
.top-bar h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; color: white; }
.top-bar .subtitle { font-size: 0.9rem; color: #bfdbfe; }
.streak { background-color: rgba(255,255,255,0.2); padding: 5px 10px; border-radius: 20px; font-weight: bold; font-size: 0.9rem; color: white;}
.quiz-header { border-radius: 0; padding: 15px 20px; }
.btn-icon { background: rgba(255,255,255,0.2); border: none; color: white; border-radius: 50%; width: 35px; height: 35px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1.1rem; }
.btn-back { background: none; border: none; color: white; font-weight: bold; font-size: 1rem; cursor: pointer; }
.tema-badge { background: #1e40af; padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: bold; color: white; }

/* Acessibilidade & Cronômetro */
.tools-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; background-color: var(--bg-color); border-bottom: 1px solid var(--border-color); }
.font-controls button { background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-color); padding: 4px 10px; border-radius: 6px; cursor: pointer; font-weight: bold; margin-right: 5px;}
.timer-badge { background-color: #ef4444; color: white; padding: 4px 10px; border-radius: 12px; font-weight: bold; font-size: 0.9rem; display: flex; align-items: center; gap: 5px; }

/* Progress Bar */
.progress-bar-container { width: 100%; height: 6px; background-color: var(--border-color); }
.progress-bar-fill { height: 100%; background-color: #10b981; width: 0%; transition: width 0.3s ease; }

/* Login Box */
.login-box { padding: 40px 20px; text-align: center; display: flex; flex-direction: column; justify-content: center; height: 100vh; background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%); color: white; }
.logo { font-size: 2rem; font-weight: 800; margin-bottom: 20px; }
.login-box h2 { font-size: 1.5rem; margin-bottom: 10px; color: white;}
.login-box p { color: #dbeafe; margin-bottom: 30px; font-size: 0.95rem; }
.login-box input { width: 100%; padding: 15px; border-radius: 10px; border: none; font-size: 1rem; margin-bottom: 20px; outline: none; }
.login-box input:focus { box-shadow: 0 0 0 3px rgba(255,255,255,0.3); }

/* Buttons & Cards */
.btn-primary { width: 100%; padding: 15px; background-color: #10b981; color: white; border: none; border-radius: 10px; font-size: 1.1rem; font-weight: bold; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2); display: flex; justify-content: center; align-items: center; gap: 10px;}
.btn-primary:active { transform: translateY(2px); box-shadow: none; }
.btn-primary.whatsapp { background-color: #25D366; box-shadow: 0 4px 6px rgba(37, 211, 102, 0.2); }
.btn-danger { width: 100%; padding: 15px; background-color: #ef4444; color: white; border: none; border-radius: 10px; font-size: 1rem; font-weight: bold; cursor: margin-top: 30px; }

.card-stats { background-color: var(--bg-color); border: 1px solid var(--border-color); border-radius: 12px; padding: 15px; margin-bottom: 25px; cursor: pointer; }
.card-stats h3 { color: var(--text-color); margin-bottom: 5px; font-size: 1.1rem; }
.card-stats p { color: var(--text-muted); font-size: 0.9rem; }

.section-title { font-size: 1.1rem; color: var(--text-color); margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }

.grid-temas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-tema { background-color: var(--btn-alt-bg); border: 2px solid var(--border-color); border-radius: 12px; padding: 20px 10px; font-size: 1rem; font-weight: 600; color: var(--text-color); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 10px; transition: 0.2s; position: relative; overflow: hidden; }
.btn-tema:active { border-color: var(--primary); background-color: var(--btn-alt-hover); }
.btn-tema .icon { font-size: 1.8rem; }
.btn-tema.simulado { grid-column: 1 / -1; background-color: var(--btn-alt-hover); border-color: var(--primary); flex-direction: row; justify-content: center; padding: 15px; }
.btn-tema.locked { opacity: 0.7; cursor: not-allowed; background-color: var(--bg-color); border-color: var(--border-color); }
.btn-tema.locked::after { content: "🔒"; position: absolute; top: 10px; right: 10px; font-size: 1rem; }
.btn-tema.simulado.locked { border-color: var(--border-color); color: var(--text-muted); }

/* Quiz Area */
.question-container { padding: 20px 0; position: relative; }
.enunciado { font-size: 1.1rem; font-weight: 600; color: var(--text-color); line-height: 1.6; transition: font-size 0.2s; }
.btn-fav { position: absolute; top: -10px; right: 0; background: none; border: none; font-size: 1.5rem; cursor: pointer; filter: grayscale(100%); opacity: 0.4; transition: 0.2s; }
.btn-fav.active { filter: none; opacity: 1; transform: scale(1.1); }

.alternativas { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.btn-alt { width: 100%; text-align: left; background-color: var(--btn-alt-bg); border: 2px solid var(--border-color); padding: 15px; border-radius: 10px; font-size: 1rem; color: var(--text-color); cursor: pointer; display: flex; align-items: center; transition: 0.2s; }
.btn-alt .letra { display: inline-flex; justify-content: center; align-items: center; width: 30px; height: 30px; background-color: var(--bg-color); border-radius: 50%; font-weight: bold; margin-right: 12px; color: var(--text-muted); flex-shrink: 0; }
.btn-alt .texto { line-height: 1.4; }

.btn-alt.selected { border-color: var(--primary); background-color: var(--btn-alt-hover); }
.btn-alt.correct { border-color: #10b981; background-color: rgba(16, 185, 129, 0.1); color: #059669; }
.btn-alt.correct .letra { background-color: #10b981; color: white; }
.btn-alt.wrong { border-color: #ef4444; background-color: rgba(239, 68, 68, 0.1); color: #dc2626; }
.btn-alt.wrong .letra { background-color: #ef4444; color: white; }
.btn-alt:disabled { cursor: not-allowed; opacity: 0.9; }

.dark-mode .btn-alt.correct { color: #34d399; }
.dark-mode .btn-alt.wrong { color: #f87171; }

/* Feedback Box */
.feedback { padding: 15px; border-radius: 10px; margin-bottom: 20px; animation: fadeIn 0.3s; }
.feedback.success { background-color: rgba(16, 185, 129, 0.1); border: 1px solid #10b981; }
.feedback.error { background-color: rgba(239, 68, 68, 0.1); border: 1px solid #ef4444; }
.feedback h4 { font-size: 1.1rem; margin-bottom: 5px; }
.feedback.success h4 { color: #059669; }
.feedback.error h4 { color: #dc2626; }
.dark-mode .feedback.success h4 { color: #34d399; }
.dark-mode .feedback.error h4 { color: #f87171; }
.feedback p { color: var(--text-color); font-size: 0.95rem; margin-bottom: 15px; line-height: 1.4; }

/* Result Box */
.result-box { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 80vh; position: relative; }
.score-circle { width: 120px; height: 120px; border-radius: 50%; background-color: var(--btn-alt-hover); border: 8px solid var(--primary); display: flex; justify-content: center; align-items: center; font-size: 2rem; font-weight: 800; color: var(--primary); margin: 30px 0; z-index: 10; background: var(--card-bg);}
#score-msg { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 20px; text-align: center; z-index: 10;}
#confetti-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

/* Stats View & Review Box */
.stat-item { margin-bottom: 15px; }
.stat-header { display: flex; justify-content: space-between; margin-bottom: 5px; font-weight: 600; color: var(--text-color); }
.stat-bar-bg { width: 100%; height: 10px; background-color: var(--border-color); border-radius: 5px; overflow: hidden; }
.stat-bar-fill { height: 100%; background-color: var(--primary); border-radius: 5px; }

.review-suggestion { background-color: rgba(245, 158, 11, 0.1); border-left: 4px solid #f59e0b; padding: 15px; margin: 25px 0 10px 0; border-radius: 4px; color: #b45309; font-size: 0.95rem; line-height: 1.5; }
.review-suggestion.perfect { background-color: rgba(16, 185, 129, 0.1); border-color: #10b981; color: #047857; }
.dark-mode .review-suggestion { color: #fcd34d; }
.dark-mode .review-suggestion.perfect { color: #6ee7b7; }