/* ParaPrep, Mock Exams (Brief 8) page styles.
   Reuses the design tokens + base components from styles.css and the app-shell
   bits from dashboard.css; only adds what the config, timed papers, self-marking
   and results need. */

/* ---- Accessibility helper ---- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Shared chrome (matches tracks.css / pricing.css) ---- */
.footer-rich {
  max-width: 1000px; margin: 0 auto; padding: 1.5rem; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between;
  color: var(--muted); font-size: .8rem;
}
.footer-rich a { color: var(--muted); }
.footer-rich a:hover { color: var(--teal-dark); }
.footer-rich .legal-links { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ---- Demo dev bar (only shown in demo mode) ---- */
.demo-bar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: #eef5f4; border: 1px dashed var(--teal); color: var(--teal-dark);
  border-radius: var(--radius); padding: .6rem .9rem; margin-bottom: 1.5rem; font-size: .82rem;
}
.demo-bar strong { font-weight: 700; }
.demo-bar .spacer { margin-left: auto; }
.btn.tiny { padding: .35rem .7rem; font-size: .8rem; }

/* ---- Upgrade prompt (paid gate), same look as tracks.css ---- */
.gate {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff; border-radius: var(--radius); padding: 2.2rem; box-shadow: var(--shadow);
}
.gate .lock { font-size: 2rem; }
.gate h2 { margin: .4rem 0 .5rem; font-size: 1.6rem; }
.gate p { margin: 0 0 1.2rem; opacity: .95; max-width: 60ch; }
.gate .gate-actions { display: flex; gap: .7rem; flex-wrap: wrap; }
.btn.on-teal { background: #fff; color: var(--teal-dark); }
.btn.on-teal:hover { background: #eef3ff; }
.gate .btn.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); }
.gate .btn.ghost:hover { background: rgba(255,255,255,.12); }
.gate ul.preview { margin: 1.3rem 0 0; padding: 0 0 0 1.1rem; opacity: .95; font-size: .92rem; }
.gate ul.preview li { margin: .25rem 0; }

/* ---- TBD / info note ---- */
.tbd-note {
  display: flex; gap: .6rem; align-items: flex-start;
  background: var(--amber-bg); border: 1px solid #f0e3c4; color: var(--amber);
  border-radius: 10px; padding: .7rem .9rem; font-size: .85rem; margin: 0 0 1.4rem;
}

/* ---- Config / start screen ---- */
.config { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); max-width: 760px; }
.config legend { padding: 0; font-weight: 700; font-size: 1rem; color: var(--ink); }
.config .step { border: 0; padding: 0; margin: 0 0 1.5rem; }
.config .hint { color: var(--muted); font-size: .85rem; margin: .15rem 0 .8rem; }

.choice-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.choice {
  display: flex; align-items: center; gap: .5rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; background: #fff;
  font-size: .92rem; font-weight: 600; user-select: none;
}
.choice:hover { background: var(--teal-soft); }
.choice input { accent-color: var(--teal); width: 18px; height: 18px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }
.choice:focus-within { outline: 2px solid var(--teal); outline-offset: 2px; }
.choice .sub { font-weight: 500; color: var(--muted); font-size: .78rem; }
.choice input:disabled { cursor: not-allowed; }
.choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }

/* Paper summary cards on the config screen */
.paper-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: .9rem; }
.paper-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; background: #fff; }
.paper-card h4 { margin: 0 0 .35rem; font-size: 1rem; }
.paper-card .meta { color: var(--muted); font-size: .85rem; margin: 0; }
.paper-card .clamp { color: var(--amber); font-size: .78rem; margin: .4rem 0 0; }
.paper-card.off { opacity: .5; }

.config-error { color: var(--red); font-size: .88rem; margin: .2rem 0 .8rem; min-height: 1.1em; }
.config-actions { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }

/* ---- Previous attempts ---- */
.attempts { margin-top: 2.2rem; }
.attempts h3 { font-size: 1.1rem; margin: 0 0 .6rem; }
.attempt-row {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: .7rem .9rem; margin-bottom: .5rem; box-shadow: var(--shadow);
}
.attempt-score { font-weight: 800; color: var(--teal-dark); font-size: 1.05rem; min-width: 3rem; font-variant-numeric: tabular-nums; }
.attempt-meta { color: var(--muted); font-size: .82rem; }
.attempt-meta strong { color: var(--ink); font-weight: 700; }
.attempt-row .spacer { margin-left: auto; }

/* ---- Paper run: sticky exam bar with the countdown timer ---- */
.exam-bar {
  position: sticky; top: 64px; z-index: 5;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem 1.1rem; margin-bottom: 1.2rem; box-shadow: var(--shadow);
}
.exam-bar .paper-name { font-weight: 800; font-size: 1rem; }
.exam-bar .answered { color: var(--muted); font-size: .85rem; }
.exam-bar .spacer { margin-left: auto; }
.timer {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.3rem;
  background: var(--teal-soft); color: var(--teal-dark);
  padding: .3rem .8rem; border-radius: 9px; letter-spacing: .02em;
}
.timer.warn { background: var(--amber-bg); color: var(--amber); border: 2px solid currentColor; }
.timer.danger { background: #fbe9e7; color: var(--red); border: 2px solid currentColor; }
.timer.warn::before, .timer.danger::before { content: "\26A0\FE0E "; }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: no-preference) { .timer.danger { animation: pulse 1s ease-in-out infinite; } }

/* ---- MCQ question card ---- */
.exam-q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.q-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; flex-wrap: wrap; }
.q-counter { color: var(--muted); font-size: .82rem; font-weight: 700; }
.q-topic { font-size: .72rem; font-weight: 800; padding: .15rem .5rem; border-radius: 999px; background: var(--teal-soft); color: var(--teal-dark); }
.q-head .spacer { margin-left: auto; }
.flag-btn {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 8px; padding: .35rem .7rem; font-size: .8rem; font-weight: 700; cursor: pointer;
}
.flag-btn:hover { background: var(--amber-bg); color: var(--amber); }
.flag-btn.on { background: var(--amber-bg); color: var(--amber); border-color: #f0e3c4; }
.q-text { font-size: 1.12rem; font-weight: 600; margin: 0 0 1.1rem; }

/* Selectable options, no correctness shown until results */
.opt {
  display: block; width: 100%; text-align: left; padding: .8rem 1rem; margin-bottom: .6rem;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer;
  font-size: .95rem; transition: background .1s, border-color .1s;
}
.opt:hover { background: var(--teal-soft); }
.opt.chosen { background: var(--teal-soft); border-color: var(--teal); font-weight: 600; }
.opt .key { display:inline-grid; place-items:center; width: 1.5rem; height: 1.5rem; border-radius: 6px; background: #eef2f4; color: var(--muted); font-weight: 800; font-size: .8rem; margin-right: .6rem; vertical-align: middle; }
.opt.chosen .key { background: var(--teal); color: #fff; }

.q-nav-btns { display: flex; gap: .7rem; margin-top: 1.1rem; flex-wrap: wrap; }

/* Question navigator grid */
.navigator { margin-top: 1.4rem; }
.navigator h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 .5rem; }
.nav-grid { display: flex; flex-wrap: wrap; gap: .4rem; }
.nav-cell {
  width: 2.5rem; height: 2.5rem; min-width: 2.5rem; min-height: 2.5rem;
  border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 700; font-size: .82rem; cursor: pointer;
  position: relative; font-variant-numeric: tabular-nums;
}
.nav-cell:hover { border-color: var(--teal); }
.nav-cell.answered { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-dark); }
.nav-cell.current { outline: 2px solid var(--teal-dark); outline-offset: 1px; }
.nav-cell.flagged::after {
  content: ""; position: absolute; top: 2px; right: 2px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--amber);
}
.nav-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .7rem; color: var(--muted); font-size: .76rem; }
.nav-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.swatch { width: .9rem; height: .9rem; border-radius: 4px; border: 1px solid var(--line); display: inline-block; }
.swatch.answered { background: var(--teal-soft); border-color: var(--teal); }
.swatch.flag { background: var(--amber); border-color: var(--amber); }

.submit-bar { margin-top: 1.4rem; display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.submit-note { color: var(--muted); font-size: .82rem; }

/* ---- SWA paper ---- */
.swa-q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.swa-q .prompt { font-size: 1.02rem; font-weight: 600; margin: .4rem 0 .8rem; }
.swa-q textarea {
  width: 100%; min-height: 120px; resize: vertical; padding: .7rem .9rem;
  border: 1px solid var(--line); border-radius: 9px; font: inherit; font-size: .95rem; background: #fff;
}
.swa-q textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; }

/* SWA self-marking */
.mark-intro { background: var(--teal-soft); border-radius: 10px; padding: .9rem 1.1rem; font-size: .9rem; margin-bottom: 1.2rem; }
.answer-block { margin: .6rem 0; }
.answer-block .label { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; display: block; margin-bottom: .25rem; }
.your-answer, .model-answer { white-space: pre-wrap; border: 1px solid var(--line); border-radius: 9px; padding: .8rem 1rem; font-size: .92rem; }
.your-answer { background: #f8fbfb; }
.your-answer.empty { color: var(--muted); font-style: italic; }
.model-answer { background: var(--teal-soft); border-color: #cfe7e4; }
.markpoints { list-style: none; margin: .8rem 0 0; padding: 0; }
.markpoint { display: flex; align-items: flex-start; gap: .6rem; padding: .5rem .2rem; border-top: 1px dashed var(--line); }
.markpoint:first-child { border-top: 0; }
.markpoint input { width: 19px; height: 19px; margin-top: .15rem; accent-color: var(--green); cursor: pointer; flex: none; }
.markpoint label { cursor: pointer; font-size: .9rem; }
.swa-q .self-score { font-weight: 700; color: var(--teal-dark); font-size: .85rem; margin-top: .6rem; }

/* ---- Results ---- */
.results-head { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; margin-bottom: 1.4rem; }
.score-ring {
  width: 116px; height: 116px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--teal-soft); color: var(--teal-dark); text-align: center;
}
.score-ring .big { font-size: 2.1rem; font-weight: 800; line-height: 1; }
.score-ring .lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }
.results-head .headline h2 { margin: 0 0 .2rem; }
.results-head .headline p { margin: 0; color: var(--muted); font-size: .9rem; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin: .4rem 0 0; }
.chip { background: var(--teal-soft); color: var(--teal-dark); font-size: .76rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; }
.chip.level { background: var(--teal-dark); color: #fff; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: .8rem; margin-bottom: 1.6rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.stat .num { font-size: 1.5rem; font-weight: 800; color: var(--teal-dark); line-height: 1.1; }
.stat .lbl { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.section-title { font-size: 1.15rem; margin: 1.8rem 0 .8rem; letter-spacing: -.01em; }

/* Per-topic breakdown */
.topic-row { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; margin-bottom: .5rem; box-shadow: var(--shadow); }
.topic-row .top { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; margin-bottom: .4rem; }
.topic-row .top .name { font-weight: 700; }
.topic-row .top .val { color: var(--muted); font-variant-numeric: tabular-nums; }
.tbar { height: 9px; background: var(--line); border-radius: 999px; overflow: hidden; }
.tbar > span { display: block; height: 100%; border-radius: 999px; background: var(--green); }
.tbar > span.low { background: var(--red); }
.tbar > span.mid { background: var(--amber); }

/* Per-question review */
.review-q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-bottom: .8rem; box-shadow: var(--shadow); }
.review-q.correct { border-left: 4px solid var(--green); }
.review-q.wrong { border-left: 4px solid var(--red); }
.review-q.partial { border-left: 4px solid var(--amber); }
.review-q .rq-head { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.review-q .verdict { font-size: .72rem; font-weight: 800; padding: .12rem .5rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.verdict.correct { background: #e6f5ec; color: var(--green); }
.verdict.wrong { background: #fbe9e7; color: var(--red); }
.verdict.partial { background: var(--amber-bg); color: var(--amber); }
.review-q .rq-text { font-weight: 600; margin: 0 0 .7rem; }
.review-opt { padding: .5rem .8rem; border: 1px solid var(--line); border-radius: 8px; margin-bottom: .4rem; font-size: .9rem; }
.review-opt.correct { background: #e6f5ec; border-color: var(--green); }
.review-opt.chosen-wrong { background: #fbe9e7; border-color: var(--red); }
.review-opt .tagword { font-size: .72rem; font-weight: 800; margin-left: .4rem; }
.review-opt.correct .tagword { color: var(--green); }
.review-opt.chosen-wrong .tagword { color: var(--red); }
.review-explain { margin-top: .6rem; padding: .8rem 1rem; background: var(--teal-soft); border-radius: 9px; font-size: .88rem; }
.review-explain strong { color: var(--teal-dark); }

.results-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.6rem; }

.loading-msg { color: var(--muted); padding: 1rem 0; }

@media (max-width: 620px) {
  .exam-bar { top: 0; }
}
