/* ============================================
   Digital Confidence Centre — Quiz Styles
   ============================================ */

.quiz-page-wrapper {
  min-height: 100vh;
  background: var(--bg-primary);
}

.quiz-locked-screen {
  max-width: 640px;
  margin: 80px auto;
  text-align: center;
  padding: 60px 40px;
  background: var(--bg-card);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}
.quiz-locked-icon  { font-size: 80px; margin-bottom: 24px; }
.quiz-locked-screen h1 { margin: 0 0 16px 0; font-size: 28px; }
.quiz-locked-screen p  { color: var(--text-secondary); font-size: 18px; margin-bottom: 12px; }
.quiz-locked-screen a  { color: var(--accent-primary); font-weight: 600; }
.module-checklist {
  text-align: left;
  display: inline-block;
  margin: 24px auto;
  font-size: 17px;
}
.module-checklist li { padding: 6px 0; list-style: none; }
.module-checklist li.done  { color: var(--accent-success); }
.module-checklist li.pending { color: var(--text-muted); }

/* ── Quiz Container ── */
.quiz-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ── Quiz Header ── */
.quiz-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 32px;
  background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
  border-radius: 16px;
}
.quiz-header h1 {
  margin: 0 0 12px 0;
  font-size: 26px;
  color: #1565C0;
}
.quiz-progress-bar-wrap {
  background: rgba(255,255,255,0.6);
  border-radius: 20px;
  height: 12px;
  overflow: hidden;
  margin: 12px 0 8px;
}
.quiz-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #2196F3, #4CAF50);
  border-radius: 20px;
  transition: width 0.4s ease;
}
.quiz-progress-label {
  font-size: 15px;
  color: #455A64;
}

/* ── Quiz Question ── */
.quiz-question {
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  border-radius: 16px;
  padding: 40px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
}
.quiz-module-tag {
  display: inline-block;
  background: #E3F2FD;
  color: #1565C0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}
.quiz-question h3 {
  color: var(--text-primary);
  font-size: 22px;
  margin: 0 0 32px 0;
  line-height: 1.5;
}

/* ── Answer Options ── */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.quiz-option {
  background: var(--bg-secondary);
  border: 3px solid var(--border-color);
  border-radius: 12px;
  padding: 20px 24px;
  font-size: 18px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-primary);
  font-family: inherit;
}
.quiz-option-letter {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border-color);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.quiz-option:hover:not(:disabled) {
  background: #E3F2FD;
  border-color: #2196F3;
  transform: translateX(4px);
}
.quiz-option:hover:not(:disabled) .quiz-option-letter {
  background: #2196F3;
  color: white;
}
.quiz-option.selected {
  background: #E3F2FD;
  border-color: #2196F3;
}
.quiz-option.selected .quiz-option-letter {
  background: #2196F3;
  color: white;
}
.quiz-option.correct {
  background: #E8F5E9;
  border-color: #4CAF50;
}
.quiz-option.correct .quiz-option-letter {
  background: #4CAF50;
  color: white;
}
.quiz-option.incorrect {
  background: #FFEBEE;
  border-color: #F44336;
}
.quiz-option.incorrect .quiz-option-letter {
  background: #F44336;
  color: white;
}
.quiz-option:disabled { cursor: default; transform: none; }

/* ── Feedback ── */
.quiz-feedback {
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.6;
  display: none;
}
.quiz-feedback.show { display: block; }
.quiz-feedback.correct-fb {
  background: #E8F5E9;
  border-left: 4px solid #4CAF50;
  color: #2E7D32;
}
.quiz-feedback.incorrect-fb {
  background: #FFEBEE;
  border-left: 4px solid #F44336;
  color: #C62828;
}

/* ── Navigation ── */
.quiz-nav {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}
.quiz-btn {
  padding: 16px 40px;
  font-size: 18px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 160px;
  font-family: inherit;
}
.quiz-btn-primary {
  background: #2196F3;
  color: white;
}
.quiz-btn-primary:hover { background: #1565C0; transform: translateY(-2px); }
.quiz-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Results Screen ── */
.quiz-results {
  text-align: center;
  padding: 60px 40px;
  background: var(--bg-card);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}
.quiz-results-icon { font-size: 96px; margin-bottom: 24px; display: block; }
.quiz-results h2 { font-size: 32px; margin: 0 0 16px 0; }
.quiz-results-score {
  font-size: 72px;
  font-weight: 700;
  color: #2196F3;
  margin: 16px 0;
  line-height: 1;
}
.quiz-results-score.passing { color: #4CAF50; }
.quiz-results-score.failing { color: #F44336; }
.quiz-results-message {
  font-size: 20px;
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}
.quiz-results-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.quiz-btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
}
.quiz-btn-secondary:hover { background: var(--border-color); }

/* ── Name Input ── */
.name-input-section {
  margin: 32px 0;
  padding: 24px;
  background: var(--bg-highlight);
  border-radius: 12px;
}
.name-input-section label {
  display: block;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.name-input-section input[type="text"] {
  width: 100%;
  padding: 16px 20px;
  font-size: 20px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  box-sizing: border-box;
}
.name-input-section input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(52,152,219,0.2);
}

/* ── Dark Mode ── */
[data-theme="dark"] .quiz-header {
  background: linear-gradient(135deg, #1E3A5F 0%, #2C5282 100%);
}
[data-theme="dark"] .quiz-header h1 { color: #90CAF9; }
[data-theme="dark"] .quiz-progress-label { color: #B0BEC5; }
[data-theme="dark"] .quiz-question {
  background: #2A2A2A;
  border-color: #424242;
}
[data-theme="dark"] .quiz-module-tag {
  background: #1E3A5F;
  color: #90CAF9;
}
[data-theme="dark"] .quiz-question h3 { color: #FFFFFF; }
[data-theme="dark"] .quiz-option {
  background: #1E1E1E;
  border-color: #424242;
  color: #E8E8E8;
}
[data-theme="dark"] .quiz-option-letter {
  background: #424242;
  color: #B0BEC5;
}
[data-theme="dark"] .quiz-option:hover:not(:disabled) {
  background: #1E3A5F;
  border-color: #5DADE2;
}
[data-theme="dark"] .quiz-option:hover:not(:disabled) .quiz-option-letter {
  background: #5DADE2;
  color: #1E1E1E;
}
[data-theme="dark"] .quiz-feedback.correct-fb {
  background: #1A2E25;
  color: #A5D6A7;
}
[data-theme="dark"] .quiz-feedback.incorrect-fb {
  background: #2E1A1A;
  color: #EF9A9A;
}
[data-theme="dark"] .quiz-results { background: #2A2A2A; }
[data-theme="dark"] .quiz-locked-screen { background: #2A2A2A; }
[data-theme="dark"] .name-input-section { background: #1B2631; }

/* ── Header row (score tracker) ── */
.quiz-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.quiz-header-row h1 {
  margin: 0 0 12px 0;
  font-size: 26px;
  color: #1565C0;
}

.quiz-score-tracker {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1565C0;
  background: rgba(255,255,255,0.7);
  border-radius: 100px;
  padding: 0.3rem 0.9rem;
  white-space: nowrap;
  margin-bottom: 12px;
}

[data-theme="dark"] .quiz-score-tracker {
  background: rgba(255,255,255,0.1);
  color: #90CAF9;
}

/* ── Milestone banner ── */
.quiz-milestone {
  background: linear-gradient(135deg, #FFF8E1 0%, #FFFDE7 100%);
  border: 2px solid #FFC107;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin: 0 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #795548;
  text-align: center;
  animation: milestone-in 0.4s ease;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

[data-theme="dark"] .quiz-milestone {
  background: #2c1f00;
  border-color: #f59e0b;
  color: #fbbf24;
}

@keyframes milestone-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Module breakdown table ── */
.quiz-breakdown {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 0.5rem 1rem 1rem;
  background: var(--bg-secondary);
}

.quiz-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.quiz-breakdown-table th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-light);
}

.quiz-breakdown-table td {
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  font-size: 0.88rem;
  line-height: 1.3;
}

.quiz-breakdown-table tr:last-child td { border-bottom: none; }

.quiz-breakdown-table tr.mod-pass td:first-child {
  color: #166534;
}

.quiz-breakdown-table tr.mod-review td:first-child {
  color: #92400E;
}

[data-theme="dark"] .quiz-breakdown-table tr.mod-pass td:first-child {
  color: #86efac;
}

[data-theme="dark"] .quiz-breakdown-table tr.mod-review td:first-child {
  color: #fdba74;
}

/* ── Print styles ── */
@media print {
  .quiz-score-tracker,
  .quiz-milestone,
  .quiz-nav,
  .quiz-results-actions,
  .quiz-breakdown summary,
  .accessibility-bar,
  .top-bar,
  .sidebar,
  .sidebar-overlay,
  .skip-link { display: none !important; }

  .quiz-breakdown { border: none; }
  .quiz-breakdown-table { font-size: 10pt; }
  .quiz-results-score { font-size: 48pt; }
  .quiz-results h2 { font-size: 20pt; }
  .quiz-results-message { font-size: 12pt; }
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .quiz-question { padding: 24px 20px; }
  .quiz-question h3 { font-size: 18px; }
  .quiz-option { padding: 16px; font-size: 16px; min-height: 60px; }
  .quiz-btn { padding: 14px 24px; font-size: 16px; min-width: 120px; }
  .quiz-results-score { font-size: 56px; }
  .quiz-results h2 { font-size: 24px; }
}
