/* TCCD Exam Preparation — app.css (compiled from app.scss) */

/* ─── Design Tokens ───────────────────────────────────────────────────────── */
:root {
  --primary:       #F49700;
  --primary-dark:  #d4820a;
  --primary-light: #fef3e2;
  --bg:            #f0f2f5;
  --surface:       #ffffff;
  --dark:          #1a1a2e;
  --text:          #2c3e50;
  --text-muted:    #7f8c8d;
  --correct:       #27ae60;
  --correct-bg:    #eafaf1;
  --incorrect:     #e74c3c;
  --incorrect-bg:  #fdedec;
  --border:        #e1e8ed;
  --shadow:        0 2px 16px rgba(0,0,0,0.08);
  --radius:        12px;
  --radius-sm:     6px;
}

/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */
.app-header {
  background: var(--dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.header-logo  { flex-shrink: 0; }
.header-text  { display: flex; flex-direction: column; }
.header-title    { font-size: 1rem; font-weight: 700; color: white; line-height: 1.2; }
.header-subtitle { font-size: 0.7rem; color: rgba(255,255,255,0.6); }

/* ─── Language Toggle ──────────────────────────────────────────────────────── */
.lang-toggle { display: flex; gap: 4px; }
.lang-btn {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.6);
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s;
}
.lang-btn:hover  { border-color: var(--primary); color: var(--primary); }
.lang-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ─── Layout ───────────────────────────────────────────────────────────────── */
.main-content {
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 16px;
}

/* ─── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

/* ─── Setup ────────────────────────────────────────────────────────────────── */
.setup-heading { font-size: 1.4rem; font-weight: 700; color: var(--dark); margin: 0 0 28px; }
.section-label { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.topics-section { margin-bottom: 28px; }
.topics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }

.topic-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.topic-checkbox input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.topic-checkbox:hover { border-color: var(--primary); background: var(--primary-light); }

.checkbox-custom {
  width: 18px; height: 18px; flex-shrink: 0;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  background: white;
}
.topic-checkbox.checked .checkbox-custom,
.topic-checkbox:has(input:checked) .checkbox-custom {
  background: var(--primary);
  border-color: var(--primary);
}
.topic-checkbox.checked .checkbox-custom::after,
.topic-checkbox:has(input:checked) .checkbox-custom::after {
  content: '';
  width: 5px; height: 9px;
  border: 2px solid white;
  border-top: none; border-left: none;
  transform: rotate(45deg) translate(-1px,-1px);
  display: block;
}
.topic-checkbox.checked,
.topic-checkbox:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.checkbox-label { font-size: 0.9rem; }

.topic-actions { display: flex; align-items: center; gap: 8px; }
.link-btn { background: none; border: none; cursor: pointer; color: var(--primary); font-size: 0.8rem; font-weight: 600; padding: 2px 4px; }
.link-btn:hover { text-decoration: underline; }
.separator { color: var(--text-muted); }

.count-section { margin-bottom: 28px; }
.count-buttons { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.count-btn {
  padding: 10px 24px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
}
.count-btn:hover  { border-color: var(--primary); color: var(--primary); }
.count-btn.active { background: var(--primary); border-color: var(--primary); color: white; }

.btn-primary {
  display: block;
  width: 100%;
  padding: 14px 28px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-start { font-size: 1.05rem; padding: 16px; }

.error-msg {
  background: var(--incorrect-bg);
  color: var(--incorrect);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* ─── Quiz ─────────────────────────────────────────────────────────────────── */
.quiz-main { padding-top: 24px; }

.quiz-progress-bar {
  height: 5px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}
.quiz-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 10px;
  transition: width 0.3s ease;
}

.quiz-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 8px; }
.quiz-counter { font-size: 0.9rem; color: var(--text-muted); }
.quiz-counter strong { color: var(--text); }

.quiz-timer {
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  white-space: nowrap;
}
.quiz-timer.timer-low {
  color: #e67e22;
  border-color: #f39c12;
  background: #fff8e1;
}
.quiz-timer.timer-warning {
  color: var(--incorrect);
  border-color: var(--incorrect);
  background: var(--incorrect-bg);
  animation: timer-pulse 1s ease-in-out infinite;
}
@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

.topic-badge {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  max-width: 220px;
  text-align: right;
}

.question-card { margin-bottom: 20px; }
.question-text { font-size: 1.1rem; font-weight: 600; color: var(--dark); margin: 0 0 24px; line-height: 1.5; }
.answers-list { display: flex; flex-direction: column; gap: 10px; }

.answer-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}
.answer-option input[type=radio],
.answer-option input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.answer-option:hover { border-color: var(--primary); background: var(--primary-light); }
.answer-option.selected,
.answer-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
}
.answer-option.selected .radio-custom,
.answer-option:has(input:checked) .radio-custom {
  border-color: var(--primary);
  border-width: 6px;
  background: white;
}
.answer-option.selected .checkbox-custom,
.answer-option:has(input[type=checkbox]:checked) .checkbox-custom {
  background: var(--primary);
  border-color: var(--primary);
}
.answer-option.selected .checkbox-custom::after,
.answer-option:has(input[type=checkbox]:checked) .checkbox-custom::after {
  content: '';
  width: 5px; height: 9px;
  border: 2px solid white;
  border-top: none; border-left: none;
  transform: rotate(45deg) translate(-1px,-1px);
  display: block;
}
.radio-custom {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 2px solid var(--border);
  border-radius: 50%;
  transition: all 0.15s;
}
.multi-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 10px;
  font-style: italic;
}
.answer-text { font-size: 0.95rem; }

.quiz-navigation { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.btn-nav {
  padding: 10px 20px;
  border: 2px solid var(--border);
  background: white;
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-nav:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-nav:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-nav-next { background: var(--dark); color: white; border-color: var(--dark); }
.btn-nav-next:hover:not(:disabled) { background: var(--primary); border-color: var(--primary); color: white; }

.dots-nav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; flex: 1; }
.nav-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: none;
  background: var(--border);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s;
}
.nav-dot.answered { background: rgba(244,151,0,0.55); }
.nav-dot.current  { background: var(--primary); transform: scale(1.3); }

.quiz-answered-count { text-align: center; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 12px; }
.submit-row { margin-top: 8px; }
.submit-row .btn-submit { width: 100%; }
.quiz-navigation .btn-submit { width: auto; flex-shrink: 0; }

/* ─── Results ──────────────────────────────────────────────────────────────── */
.results-main { padding-top: 24px; }

.score-card { text-align: center; margin-bottom: 28px; padding: 40px; }
.score-pass { border-top: 4px solid var(--correct); }
.score-fail { border-top: 4px solid var(--incorrect); }
.score-heading { font-size: 1.1rem; color: var(--text-muted); margin: 0 0 12px; font-weight: 600; }
.score-value   { font-size: 2.4rem; font-weight: 800; color: var(--dark); margin-bottom: 12px; }
.score-badge {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 12px;
}
.badge-pass { background: var(--correct-bg); color: var(--correct); }
.badge-fail { background: var(--incorrect-bg); color: var(--incorrect); }
.score-msg { color: var(--text-muted); margin: 0; }

.results-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; }
.result-item { padding: 20px 24px; }
.result-item-correct { border-left: 4px solid var(--correct); }
.result-item-wrong   { border-left: 4px solid var(--incorrect); }

.result-item-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.result-num   { font-weight: 800; font-size: 0.85rem; color: var(--text-muted); }
.result-topic { flex: 1; font-size: 0.75rem; color: var(--text-muted); font-style: italic; }
.result-status { font-size: 0.8rem; font-weight: 700; padding: 2px 10px; border-radius: 12px; }
.status-correct { background: var(--correct-bg); color: var(--correct); }
.status-wrong   { background: var(--incorrect-bg); color: var(--incorrect); }

.result-question { font-weight: 600; font-size: 1rem; margin: 0 0 14px; color: var(--dark); }
.result-answers { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.result-answer {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
}
.result-answer.result-correct { background: var(--correct-bg); border-color: var(--correct); color: #1e8449; font-weight: 600; }
.result-answer.result-wrong   { background: var(--incorrect-bg); border-color: var(--incorrect); color: #c0392b; font-weight: 600; }
.result-answer.result-missed  { background: #fff8e1; border-color: #f39c12; color: #e67e22; font-weight: 600; }
.answer-badge { font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.correct-badge { background: var(--correct); color: white; }
.wrong-badge   { background: var(--incorrect); color: white; }
.missed-badge  { background: #f39c12; color: white; }

.result-explanation { background: var(--bg); padding: 14px 16px; border-radius: var(--radius-sm); font-size: 0.9rem; }
.result-explanation strong { color: var(--dark); }
.result-explanation p { margin: 6px 0 8px; color: var(--text-muted); }
.result-reference { color: var(--primary); text-decoration: none; font-weight: 600; font-size: 0.85rem; }
.result-reference:hover { text-decoration: underline; }

.results-actions { text-align: center; padding-bottom: 40px; }
.results-actions .btn-primary { width: auto; padding: 14px 48px; display: inline-block; }

/* ─── Loading Splash ───────────────────────────────────────────────────────── */
.loading-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 16px;
  color: var(--text-muted);
}
.loading-logo { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.95); }
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .main-content    { padding: 16px 12px; }
  .card            { padding: 20px 16px; }
  .topics-grid     { grid-template-columns: 1fr; }
  .quiz-navigation { flex-wrap: wrap; }
  .score-value     { font-size: 1.7rem; }
  .topic-badge     { max-width: 140px; font-size: 0.65rem; }
  .app-header      { padding: 10px 16px; }
  .header-subtitle { display: none; }
}
