/* ════════════════════════════════════════
   LUYỆN ĐỀ — hub, tạo đề AI, làm bài, kết quả
════════════════════════════════════════ */

/* ── Hub ─────────────────────────────── */
.exam-hub-wrap {
  padding: 16px 16px calc(var(--nav-h) + 20px);
  max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 12px;
}

.exam-create-fab {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px;
  background: var(--purple); color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 0.95rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: opacity 0.18s, transform 0.15s;
}
.exam-create-fab:hover { opacity: 0.88; transform: translateY(-1px); }

.exam-hub-label {
  font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px;
}

.exam-empty {
  text-align: center; color: var(--text-muted);
  font-size: 0.88rem; padding: 32px 16px;
  background: var(--surface); border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

/* Exam card (list item) */
.exam-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
  transition: border-color 0.15s;
}
.exam-card:hover { border-color: var(--purple); }
.exam-card-info { flex: 1; min-width: 0; }
.exam-card-title {
  font-size: 0.88rem; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.exam-card-meta {
  font-size: 0.72rem; color: var(--text-muted); margin-top: 3px;
}
.exam-card-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.exam-card-btn { padding: 8px 14px; font-size: 0.82rem; }
.exam-card-more {
  width: 32px; height: 32px; border: 1px solid var(--border);
  border-radius: 8px; background: none; cursor: pointer;
  font-size: 1rem; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.exam-card-more:hover { background: var(--bg); color: var(--red); border-color: var(--red); }

/* Best score badge */
.exam-best-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--purple-light); color: var(--purple);
  border-radius: 6px; padding: 2px 8px;
  font-size: 0.72rem; font-weight: 700;
}

/* ── Create ──────────────────────────── */
.exam-create-wrap {
  padding: 16px 16px calc(var(--nav-h) + 20px);
  max-width: 480px; margin: 0 auto;
}

.exam-section-label {
  font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
  margin: 16px 0 8px;
}

.exam-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.exam-field-label { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.exam-field input[type="text"], .exam-field .modal-select {
  width: 100%;
}

.exam-count-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.exam-count-btn {
  padding: 10px 0; border: 1.5px solid var(--border);
  border-radius: 8px; background: var(--bg);
  font-size: 0.88rem; font-weight: 700; color: var(--text);
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.exam-count-btn:hover { border-color: var(--purple); color: var(--purple); }
.exam-count-btn--active { background: var(--purple); border-color: var(--purple); color: #fff; }

/* Topic chips */
.exam-topic-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.exam-topic-chip {
  padding: 6px 12px;
  border: 1.5px solid var(--border); border-radius: 20px;
  background: var(--bg); font-size: 0.78rem; font-weight: 600; color: var(--text);
  cursor: pointer; font-family: inherit; transition: all 0.15s; white-space: nowrap;
}
.exam-topic-chip:hover { border-color: var(--purple); color: var(--purple); }
.exam-topic-chip--active { background: var(--purple); border-color: var(--purple); color: #fff; }

/* Part cards */
.exam-part-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.exam-part-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); cursor: pointer; transition: all 0.15s; user-select: none;
}
.exam-part-card input[type="checkbox"] { display: none; }
.exam-part-card:hover { border-color: var(--purple); }
.exam-part-card--active { border-color: var(--purple); background: var(--purple-light); }
.exam-part-name { font-size: 0.9rem; font-weight: 800; color: var(--text); }
.exam-part-card--active .exam-part-name { color: var(--purple); }
.exam-part-desc { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }

.exam-diff-row { display: flex; gap: 8px; }
.exam-diff-btn {
  flex: 1; padding: 10px; border: 1.5px solid var(--border);
  border-radius: 8px; background: var(--bg);
  font-size: 0.85rem; font-weight: 700; color: var(--text);
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.exam-diff-btn:hover { border-color: var(--purple); color: var(--purple); }
.exam-diff-btn--active { background: var(--purple); border-color: var(--purple); color: #fff; }

.exam-prompt-box {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px;
  font-size: 0.78rem; color: var(--text); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  max-height: 180px; overflow-y: auto; margin-bottom: 10px;
}

.exam-paste-area {
  width: 100%; min-height: 120px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px; font-family: monospace; font-size: 0.78rem;
  color: var(--text); background: var(--bg); resize: vertical;
  box-sizing: border-box; outline: none;
}
.exam-paste-area:focus { border-color: var(--purple); }

/* ── Session (exam-session page) ─────── */
.ex-wrap { padding: 0 16px 24px; max-width: 480px; margin: 0 auto; }

.ex-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 20px 16px;
  margin-bottom: 14px; text-align: center;
  box-shadow: var(--shadow-sm);
}
.ex-q-type-tag {
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  color: var(--purple); background: var(--purple-light);
  border-radius: 6px; padding: 3px 8px; margin-bottom: 10px;
}
.ex-prompt {
  font-size: 1.35rem; font-weight: 800; color: var(--text);
  line-height: 1.3; margin: 0;
}
.ex-sentence {
  font-size: 1rem; font-weight: 600; color: var(--text);
  line-height: 1.6;
}

.ex-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.ex-options .sess-opt {
  display: flex; align-items: center; gap: 10px; text-align: left;
}
.ex-opt-label {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%; background: var(--bg);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 800; color: var(--text-muted);
}
.sess-opt-correct .ex-opt-label { background: var(--green); border-color: var(--green); color: #fff; }
.sess-opt-wrong   .ex-opt-label { background: var(--red);   border-color: var(--red);   color: #fff; }

.ex-type-area { display: flex; flex-direction: column; gap: 0; }

/* ── Exam Sheet (thi thử — toàn bộ đề 1 trang) ─────────────────── */
.exs-progress-pill {
  font-size: 0.78rem; font-weight: 700;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.15); border-radius: 20px; padding: 3px 10px;
}

.exs-sheet {
  margin: -20px -16px -32px; /* cancel .focus-content padding */
  padding: 12px 16px calc(var(--nav-h) + 40px);
  display: flex; flex-direction: column; gap: 10px;
}

.exs-q {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 14px 12px;
  transition: border-color 0.2s;
}
.exs-q--answered { border-color: var(--green); }

.exs-q-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.exs-q-num {
  font-size: 0.7rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.exs-q-tag {
  font-size: 0.65rem; font-weight: 700; color: var(--purple);
  background: var(--purple-light); border-radius: 6px; padding: 2px 7px;
}

.exs-q-prompt {
  font-size: 0.9rem; font-weight: 600; color: var(--text);
  line-height: 1.55; margin-bottom: 10px;
}

.exs-q-options { display: flex; flex-direction: column; gap: 6px; }

.exs-opt {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 11px; border: 1.5px solid var(--border);
  border-radius: 8px; background: var(--bg);
  font-size: 0.84rem; font-weight: 500; color: var(--text);
  cursor: pointer; font-family: inherit; text-align: left; transition: all 0.13s;
}
.exs-opt:hover { border-color: var(--purple); }
.exs-opt--selected {
  border-color: var(--purple); background: var(--purple-light);
  color: var(--purple); font-weight: 700;
}
.exs-opt-label {
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 50%; border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 800;
}

.exs-fillin-input {
  width: 100%; border: 1.5px solid var(--border); border-radius: 8px;
  padding: 9px 12px; font-size: 0.88rem; font-family: inherit;
  color: var(--text); background: var(--bg); outline: none; box-sizing: border-box;
  transition: border-color 0.15s;
}
.exs-fillin-input:focus { border-color: var(--purple); }

.exs-submit-btn {
  width: 100%; padding: 15px; background: var(--purple); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 700; cursor: pointer; font-family: inherit;
  transition: opacity 0.15s; margin-top: 4px;
}
.exs-submit-btn:hover { opacity: 0.9; }

/* Dark mode */
.dark-mode .exs-q { background: var(--surface); }

/* ── Result ──────────────────────────── */
.exr-wrap {
  padding: 24px 16px calc(var(--nav-h) + 24px);
  max-width: 480px; margin: 0 auto; text-align: center;
}
.exr-hero   { font-size: 3.5rem; line-height: 1; margin-bottom: 8px; }
.exr-score  { font-size: 3rem; font-weight: 900; color: var(--purple); line-height: 1; margin-bottom: 4px; }
.exr-detail { font-size: 0.88rem; color: var(--text-muted); font-weight: 500; margin-bottom: 8px; }
.exr-delta  { font-size: 0.85rem; font-weight: 700; margin-bottom: 4px; }
.exr-delta--up   { color: var(--green); }
.exr-delta--down { color: var(--red); }
.exr-msg    { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 20px; }

.exr-section-label {
  font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
  text-align: left; margin: 16px 0 8px;
}

.exr-breakdown { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.exr-breakdown-row {
  display: flex; align-items: center; gap: 10px; text-align: left;
}
.exr-bd-label { font-size: 0.82rem; font-weight: 600; color: var(--text); width: 72px; flex-shrink: 0; }
.exr-bd-bar-wrap { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.exr-bd-bar { height: 100%; background: var(--purple); border-radius: 4px; transition: width 0.6s ease; }
.exr-bd-pct { font-size: 0.8rem; font-weight: 700; color: var(--purple); width: 36px; text-align: right; flex-shrink: 0; }

.exr-wrong-wrap {
  background: #FEF2F2; border: 1px solid #FECACA;
  border-radius: var(--radius-sm); padding: 12px;
  margin: 12px 0; text-align: left;
}
.exr-wrong-title { font-size: 0.78rem; font-weight: 700; color: #EF4444; margin-bottom: 8px; }
.exr-wrong-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid #FECACA; font-size: 0.82rem;
}
.exr-wrong-item:last-child { border-bottom: none; }
.exr-wrong-prompt { font-weight: 600; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exr-wrong-ans    { color: var(--green); font-weight: 700; flex-shrink: 0; }
.exr-wrong-more   { font-size: 0.72rem; color: var(--text-muted); margin-top: 6px; }

.exr-actions {
  display: flex; flex-direction: column; gap: 8px; margin-top: 20px;
}
.exr-actions .btn-primary,
.exr-actions .btn-outline { width: 100%; }

/* ── Dark mode ───────────────────────── */
.dark-mode .exam-card { background: var(--surface); }
.dark-mode .exam-create-fab { }
.dark-mode .exam-prompt-box { background: rgba(255,255,255,0.04); }
.dark-mode .exam-paste-area { background: rgba(255,255,255,0.04); }
.dark-mode .ex-card { background: var(--surface); }
.dark-mode .exr-wrong-wrap { background: rgba(220,38,38,0.08); border-color: rgba(220,38,38,0.2); }
