/* pages/ex-exam.css — Thi thử JLPT giao diện mới (templates/pages/ex/exam.html + _exam_full.html).
   Bản vẽ: TT_1_List (bảng đề), TT_1b_Detail (2 thẻ phần thi), TT_2_Room / TT_2b_Listen (đề PDF + phiếu tô),
   TT_3_Result (ô điểm + bảng đối chiếu). Khung toàn màn hình ở ex-common.css. */

.exi-exam-page { max-width: 900px; }
.exi-admin-links { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 18px; }

/* Tab cấp độ (gạch chân như bảng database) */
.exi-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.exi-tab {
  height: 34px; padding: 0 2px; border: 0; background: none; flex-shrink: 0;
  font: inherit; font-size: 14px; color: var(--muted); cursor: pointer;
}
.exi-tab:hover { color: var(--ink); }
.exi-tab.is-on { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink); }

/* Bảng đề */
.exi-erow {
  display: grid; grid-template-columns: minmax(0, 1fr) 100px 90px 140px 100px; align-items: center;
  min-height: 48px; padding: 0 8px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.exi-ehead { min-height: 36px; font-size: 13px; color: var(--muted); }
.exi-ename { display: flex; align-items: center; gap: 8px; font-weight: 500; min-width: 0; }
.exi-ename .icon { color: var(--muted); }
.exi-ename span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exi-emuted { color: var(--muted); }
.exi-ego { text-align: right; }
.exi-go { height: 30px; padding: 0 12px; }
.exi-table-note { margin: 0; padding: 18px 8px; font-size: 14px; color: var(--muted); }
.exi-exam-callout { margin-top: 28px; align-items: flex-start; }
.exi-exam-callout .callout-text { font-size: 14px; }

/* ── Chi tiết đề ── */
.exi-detail { max-width: 820px; margin: 0 auto; padding: 56px 40px 48px; }
.exi-detail .exi-h1 { margin-bottom: 8px; }
.exi-detail .page-lead { margin-bottom: 28px; }
.exi-parts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.exi-part { border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.exi-part.is-locked { background: var(--bg-side); }
.exi-part-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.exi-part-tile { width: 40px; height: 40px; }
/* Tên phần dài + nhãn "Lần trước: 3/5 câu đúng" → nhãn xuống dòng, tên không bị bóp thành 3 dòng. */
.exi-part-info { flex: 1 1 220px; min-width: 0; }
.exi-part-head > .tag { flex-shrink: 0; white-space: nowrap; }
.exi-part-name { margin: 0; font-size: 16px; font-weight: 600; }
.exi-part-meta { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.exi-part-warn { margin: 0; font-size: 13px; color: var(--amber); }
.exi-part-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Phòng thi ── */
.exi-timer {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 12px;
  border: 1px solid var(--line); border-radius: var(--r); color: var(--muted);
}
.exi-timer span { font-size: 15px; font-weight: 600; color: var(--ink); }
.exi-timer.is-warn { border-color: var(--red); }
.exi-timer.is-warn span { color: var(--red); }
.exi-timer.is-paused span { color: var(--faint); }
.exi-timer-btn {
  width: 24px; height: 24px; border: 0; border-radius: var(--r-sm); background: none;
  color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.exi-timer-btn:hover { background: var(--bg-soft); }

.exi-audio {
  height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 16px;
  padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--bg-side);
}
.exi-audio[hidden] { display: none; }
.exi-audio-play {
  width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); display: grid; place-items: center; cursor: pointer;
}
.exi-audio-label { font-size: 14px; font-weight: 600; white-space: nowrap; }
.exi-audio-track { flex-grow: 1; padding: 10px 0; cursor: pointer; }
.exi-audio-track::before { content: ""; display: block; height: 4px; border-radius: 2px; background: var(--line); }
.exi-audio-fill { height: 4px; margin-top: -4px; border-radius: 2px; background: var(--accent); width: 0; }
.exi-audio-time { font-size: 13px; color: var(--muted); white-space: nowrap; }

.exi-room-body { flex-grow: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: minmax(0, 1fr); }
.exi-pdf { background: var(--bg-soft); padding: 16px; display: flex; min-height: 0; }
.exi-pdf iframe { flex-grow: 1; width: 100%; height: 100%; border: 0; background: var(--bg); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }
.exi-sheet { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.exi-sheet-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.exi-sheet-title { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.exi-sheet-body { flex-grow: 1; min-height: 0; padding-bottom: 16px; }
.exi-sheet-sec { margin: 12px 16px 4px; font-size: 12px; font-weight: 600; color: var(--faint); }
.exi-qrow { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 12px; }
.exi-qno { width: 26px; font-size: 13px; color: var(--muted); text-align: right; flex-shrink: 0; }
.exi-bubbles { display: flex; gap: 8px; }
.exi-bubble {
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  border: 1.5px solid var(--faint); background: var(--bg); color: var(--muted);
  display: grid; place-items: center; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer;
}
.exi-bubble:hover { border-color: var(--accent); }
.exi-bubble.is-on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

/* ── Kết quả ── */
.exi-exam-result { max-width: 860px; margin: 0 auto; padding: 44px 40px 40px; }
.exi-score-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.exi-stat.is-total { border-color: var(--accent); background: var(--callout); }
.exi-stat-pct { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.exi-res-other { margin-bottom: 14px; }
.exi-res-note { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0 14px; font-size: 13px; color: var(--muted); }
.exi-res-note .icon { margin-top: 2px; }
.exi-h2 { margin: 28px 0 8px; font-size: 20px; font-weight: 700; }
.exi-rrow {
  display: grid; grid-template-columns: 60px minmax(0, 1fr) 100px 100px 100px; align-items: center;
  min-height: 42px; padding: 0 8px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.exi-rhead { min-height: 34px; font-size: 13px; color: var(--muted); }
.exi-rsec { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 8px; }
.exi-rchosen { font-weight: 600; }
.exi-rchosen.is-right { color: var(--green); }
.exi-rchosen.is-wrong { color: var(--red); }
.exi-tag-red { background: var(--red-bg); color: var(--red); }

@media (max-width: 860px) {
  .exi-erow { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; padding: 10px 4px; }
  .exi-ehead { display: none; }
  .exi-erow > .exi-emuted { display: none; }
  .exi-estatus { grid-column: 1; }
  .exi-ego { grid-column: 2; grid-row: 1 / span 2; }
  .exi-detail { padding: 28px 16px 32px; }
  .exi-parts { grid-template-columns: minmax(0, 1fr); }
  .exi-timer { padding: 0 6px; }
  .exi-audio { padding: 0 12px; gap: 10px; }
  .exi-audio-label { display: none; }
  .exi-room-body { display: flex; flex-direction: column; overflow-y: auto; }
  .exi-pdf { height: 62vh; flex-shrink: 0; padding: 8px; }
  .exi-sheet { border-left: 0; border-top: 1px solid var(--line); }
  .exi-sheet-body { overflow: visible; }
  .exi-bubble { width: 32px; height: 32px; font-size: 13px; }
  .exi-qrow { min-height: 42px; }
  .exi-exam-result { padding: 28px 16px 32px; }
  .exi-rrow { grid-template-columns: 44px minmax(0, 1fr) 56px 56px 72px; font-size: 13px; }
  .exi-hide-sm { display: none; }
}
