/* ── Quiz App Styles ── */

:root {
  --quiz-bg: #faf9f7;
  --quiz-navy: #1a2744;
  --quiz-gold: #e8a838;
  --quiz-green: #15803d;
  --quiz-red: #b91c1c;
  --quiz-green-bg: #dcfce7;
  --quiz-red-bg: #fde8e8;
}

/* ── Nav ── */
.quiz-nav { background: var(--quiz-navy); padding: 0; }
.quiz-nav-inner { max-width: 900px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 56px; }
.quiz-logo { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 700; color: var(--white); text-decoration: none; }
.quiz-nav-link { font-size: 14px; color: rgba(255,255,255,0.7); text-decoration: none; transition: color 0.2s; }
.quiz-nav-link:hover { color: var(--quiz-gold); }

/* ── Main Layout ── */
.quiz-main { min-height: calc(100vh - 56px - 64px); background: var(--quiz-bg); }

.quiz-header { background: var(--quiz-navy); padding: 56px 0 48px; }
.quiz-header-inner { max-width: 900px; margin: 0 auto; padding: 0 24px; }
.quiz-page-title { font-family: 'Playfair Display', serif; font-size: clamp(28px, 4vw, 44px); font-weight: 700; color: var(--white); margin-bottom: 12px; line-height: 1.2; }
.quiz-page-sub { font-size: 16px; color: rgba(255,255,255,0.7); max-width: 540px; line-height: 1.6; }
.section-label { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--quiz-gold); margin-bottom: 8px; }

.quiz-meta { display: flex; gap: 12px; align-items: center; margin-top: 16px; }
.quiz-meta-item { font-size: 13px; color: rgba(255,255,255,0.6); }

/* ── Content Area ── */
.quiz-content { max-width: 900px; margin: 0 auto; padding: 40px 24px; }

/* ── Quiz Listing ── */
.topic-section { margin-bottom: 48px; }
.topic-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 2px solid var(--quiz-navy); }
.topic-title { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; color: var(--quiz-navy); }
.topic-count { font-size: 13px; color: #5c5c5c; }

.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.quiz-card-link { text-decoration: none; }
.quiz-card { background: var(--white); border: 1px solid #e2dfd8; border-radius: 18px; padding: 24px; transition: box-shadow 0.2s, transform 0.2s; height: 100%; display: flex; flex-direction: column; }
.quiz-card-link:hover .quiz-card { box-shadow: 0 8px 30px rgba(26,39,68,0.12); transform: translateY(-3px); }

.qc-difficulty { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 10px; border-radius: 20px; margin-bottom: 12px; align-self: flex-start; }
.qc-difficulty-fácil { background: #dcfce7; color: #15803d; }
.qc-difficulty-médio { background: #fef9c3; color: #854d0e; }
.qc-difficulty-difícil { background: #fee2e2; color: #b91c1c; }

.qc-title { font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 700; color: var(--quiz-navy); margin-bottom: 8px; line-height: 1.3; }
.qc-desc { font-size: 13px; color: #5c5c5c; line-height: 1.55; flex: 1; margin-bottom: 16px; }
.qc-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 16px; border-top: 1px solid #e2dfd8; }
.qc-questions { font-size: 12px; color: #5c5c5c; }
.qc-cta { font-size: 13px; font-weight: 600; color: var(--quiz-navy); }

/* ── Take Quiz Form ── */
.question-block { background: var(--white); border: 1px solid #e2dfd8; border-radius: 16px; padding: 28px; margin-bottom: 20px; }
.question-number { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--quiz-gold); margin-bottom: 12px; }
.question-text { font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 600; color: var(--quiz-navy); margin-bottom: 20px; line-height: 1.35; }

.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .options-grid { grid-template-columns: 1fr; } }

.option-label { cursor: pointer; }
.option-label input { display: none; }
.option-btn { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 2px solid #e2dfd8; border-radius: 10px; font-size: 14px; color: #1a1a1a; transition: border-color 0.15s, background 0.15s; line-height: 1.4; }
.option-label input:checked + .option-btn { border-color: var(--quiz-navy); background: rgba(26,39,68,0.05); }
.option-label:hover .option-btn { border-color: #aaa; }
.opt-letter { font-weight: 700; color: var(--quiz-navy); min-width: 18px; }

.submit-section { text-align: center; padding: 24px 0; }
.submit-btn { display: inline-block; background: var(--quiz-navy); color: var(--white); font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 600; padding: 14px 40px; border-radius: 12px; text-decoration: none; border: none; cursor: pointer; transition: background 0.2s; }
.submit-btn:hover { background: #2a3a5c; }

/* ── Results Page ── */
.result-score-display { display: flex; align-items: baseline; gap: 16px; margin: 24px 0 8px; }
.result-number { font-family: 'Playfair Display', serif; font-size: 64px; font-weight: 700; color: var(--white); line-height: 1; }
.result-pct { font-size: 32px; font-weight: 700; color: var(--quiz-gold); }
.result-message { font-size: 16px; color: rgba(255,255,255,0.8); margin-bottom: 20px; }

.retry-btn, .more-btn { display: inline-block; font-size: 14px; font-weight: 600; padding: 10px 20px; border-radius: 8px; text-decoration: none; margin-right: 12px; transition: opacity 0.2s; }
.retry-btn { background: rgba(255,255,255,0.15); color: var(--white); border: 1px solid rgba(255,255,255,0.3); }
.more-btn { background: var(--quiz-gold); color: var(--quiz-navy); }
.retry-btn:hover, .more-btn:hover { opacity: 0.85; }

.result-block { background: var(--white); border: 1px solid #e2dfd8; border-radius: 16px; padding: 24px; margin-bottom: 16px; }
.result-correct { border-left: 4px solid var(--quiz-green); }
.result-wrong { border-left: 4px solid var(--quiz-red); }

.result-q-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.result-q-num { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: #5c5c5c; }
.result-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.result-badge-correct { background: #dcfce7; color: #15803d; }
.result-badge-wrong { background: #fee2e2; color: #b91c1c; }

.your-answer { font-size: 14px; color: #b91c1c; margin-bottom: 6px; }
.correct-answer { font-size: 14px; color: #15803d; margin-bottom: 12px; }
.wrong-val { color: #b91c1c; }
.correct-val { color: #15803d; font-weight: 600; }

.explanation-box { background: #faf9f7; border-left: 3px solid var(--quiz-gold); padding: 12px 16px; border-radius: 0 8px 8px 0; }
.exp-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--quiz-gold); margin-bottom: 6px; }
.exp-text { font-size: 13px; color: #1a1a1a; line-height: 1.6; }

/* ── 404 Page ── */
.not-found-page { text-align: center; padding: 80px 24px; }
.not-found-number { font-family: 'Playfair Display', serif; font-size: 96px; font-weight: 700; color: var(--quiz-navy); line-height: 1; margin-bottom: 16px; }
.not-found-title { font-family: 'Playfair Display', serif; font-size: 28px; color: var(--quiz-navy); margin-bottom: 12px; }
.not-found-text { font-size: 16px; color: #5c5c5c; margin-bottom: 32px; }

/* ── Footer ── */
.quiz-footer { background: #f2f0ec; border-top: 1px solid #e2dfd8; padding: 20px 0; }
.quiz-footer-inner { max-width: 900px; margin: 0 auto; padding: 0 24px; font-size: 13px; color: #5c5c5c; }

/* ── PDF Print Styles ── */
.pdf-controls { background: var(--quiz-navy); padding: 12px 24px; display: flex; gap: 16px; align-items: center; position: sticky; top: 0; z-index: 10; }
.pdf-controls button, .pdf-controls a { background: rgba(255,255,255,0.15); color: var(--white); border: 1px solid rgba(255,255,255,0.3); font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block; }
.pdf-controls button:hover, .pdf-controls a:hover { background: rgba(255,255,255,0.25); }

.pdf-body { background: var(--white); }

.pdf-document { max-width: 800px; margin: 0 auto; padding: 40px; }

.pdf-header { border-bottom: 3px solid var(--quiz-navy); padding-bottom: 24px; margin-bottom: 32px; }
.pdf-logo { font-family: 'Playfair Display', serif; font-size: 14px; font-weight: 700; color: #5c5c5c; margin-bottom: 8px; }
.pdf-title { font-family: 'Playfair Display', serif; font-size: 26px; font-weight: 700; color: var(--quiz-navy); margin-bottom: 8px; }
.pdf-meta { font-size: 13px; color: #5c5c5c; }

.pdf-question { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 20px 0; border-bottom: 1px solid #e2dfd8; page-break-inside: avoid; }
.pdf-q-number { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 700; color: var(--quiz-navy); padding-top: 2px; }
.pdf-q-text { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 600; color: var(--quiz-navy); margin-bottom: 12px; line-height: 1.35; }
.pdf-options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pdf-opt { font-size: 13px; color: #1a1a1a; padding: 6px 10px; background: #faf9f7; border-radius: 6px; }
.pdf-opt-letter { font-weight: 700; color: var(--quiz-navy); margin-right: 6px; }

.pdf-footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid #e2dfd8; display: flex; justify-content: space-between; font-size: 12px; color: #5c5c5c; }
.pdf-url { color: var(--quiz-navy); }
.pdf-date { font-weight: 500; }

/* ── Print overrides ── */
@media print {
  .pdf-controls { display: none; }
  .pdf-body { background: white; }
  .pdf-document { padding: 20px; }
  .pdf-question { page-break-inside: avoid; }
  @page { margin: 20mm; }
}