/* ══════════════════════════════════════════════════════════
   exams/exams.css — CSS trang DANH SÁCH đề thi
   Dùng cho: exams/index.html
   KHÔNG dùng cho trang làm bài → xem exams/style.css
   ══════════════════════════════════════════════════════════ */

/* ─── CSS vars dùng cho free-card (thi thử) ─── */
.thi-thu  { --cA: #16a34a; --cB: #22c55e; --cBg: rgba(22,163,74,.09);  }

/* ══════════════════════════════════════════════════════════
   FREE BOX — khung đề thi thử miễn phí
   ══════════════════════════════════════════════════════════ */
.free-box {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  margin-bottom: 10px;
  background: var(--bg-card);
}

.free-box-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #16a34a;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
}

.free-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .free-card:hover { background: var(--bg-hover); }
  .free-card:hover .free-card-btn {
    background: #15803d;
    border-color: #15803d;
  }
}

.free-card:active { transform: scale(.99); }

.free-card-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--border-2);
  min-width: 34px;
  line-height: 1;
}

.free-card-body { flex: 1; min-width: 0; }

.free-card-title {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
}

.free-card-meta {
  font-size: .76rem;
  color: var(--text-3);
}

.free-card-btn {
  flex-shrink: 0;
  padding: 8px 18px;
  background: #16a34a;
  color: #fff;
  border: 1.5px solid #16a34a;
  border-radius: var(--radius-pill);
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   SERIES SELECTOR CARDS — chọn bộ đề
   ══════════════════════════════════════════════════════════ */
.series-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.series-tabs::-webkit-scrollbar { display: none; }

.series-tab {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, opacity .2s, transform .1s;
  outline: none;
  font-family: inherit;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  opacity: .5;
}

.series-tab.active {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(29,111,242,.18);
  opacity: 1;
}

@media (hover: hover) {
  .series-tab:not(.active):hover {
    opacity: .75;
    border-color: var(--border-2);
  }
}

.series-tab:active { transform: scale(.985); }

.series-tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.st-name {
  font-size: .84rem;
  font-weight: 800;
  color: var(--text-2);
  transition: color .2s;
  white-space: nowrap;
}

.series-tab.active .st-name { color: var(--primary); }

/* ══════════════════════════════════════════════════════════
   EXAM PANEL — khung chứa grid, có animation fade
   ══════════════════════════════════════════════════════════ */
.exam-panel[hidden] { display: none; }

@keyframes panelFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.panel-in { animation: panelFadeIn .22s ease both; }

/* ══════════════════════════════════════════════════════════
   EXAM ROWS — danh sách đề dạng hàng ngang
   ══════════════════════════════════════════════════════════ */
.exam-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.exam-loading {
  color: var(--text-3);
  padding: 20px 0;
}

.exam-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, border-color .18s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .exam-row:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-mid);
    transform: translateY(-2px);
  }
}
.exam-row:active { transform: scale(.995); }

.er-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  text-align: center;
}

.er-info { min-width: 0; }
.er-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.er-title {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text);
}
.er-meta {
  font-size: .76rem;
  color: var(--text-3);
  margin-top: 3px;
}

.er-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .66rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.er-status.new     { background: var(--bg); color: var(--text-3); }
.er-status.progress{ background: var(--warning-light); color: var(--warning); }
.er-status.done     { background: var(--success-light); color: var(--success); }

/* ── Nút chọn mode + rail icon ── */
.er-actions { display: flex; align-items: center; gap: 10px; }

.mode-btns { display: flex; gap: 6px; }
.mode-btn {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--primary);
  background: var(--bg-card);
  color: var(--primary);
  font-family: inherit;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}
@media (hover: hover) {
  .mode-btn:hover { background: var(--primary-light); }
  .mode-btn.test:hover { background: #fff8dc; }
}
.mode-btn.test {
  border-color: var(--gold);
  color: #8a6400;
}

.er-divider {
  width: 1px;
  height: 26px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Icon rail ── */
.er-icons { display: flex; align-items: center; gap: 4px; }
.er-icon {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.er-icon svg { width: 17px; height: 17px; }
.er-icon-label { display: none; }
/* Icon dùng được phải nổi màu ngay cả khi không hover được (di động), để phân biệt
   rõ với icon disabled thay vì cả hai cùng xám như trước. */
.er-icon.enabled {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-mid);
}
@media (hover: hover) {
  .er-icon.enabled:hover {
    background: var(--primary-mid);
    color: var(--primary);
  }
  /* Máy tính (có chuột) mới thấy chữ chú thích — học sinh làm quen trên máy,
     qua điện thoại thì đã hiểu icon nên không cần hiện chữ nữa. */
  .er-icons { gap: 6px; }
  .er-icon {
    width: auto;
    height: auto;
    flex-direction: column;
    flex-shrink: 0;
    gap: 3px;
    padding: 7px 12px;
  }
  .er-icon svg { width: 19px; height: 19px; }
  .er-icon-label {
    display: block;
    flex-shrink: 0;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-2);
    white-space: nowrap;
  }
  .er-icon.enabled:hover .er-icon-label { color: var(--primary); }
  .er-icon.disabled .er-icon-label { opacity: .35; }
}
/* Nút disabled: chỉ làm mờ icon (đủ báo hiệu không có gì), giữ tooltip rõ nét để đọc thông báo */
.er-icon.disabled { cursor: not-allowed; }
.er-icon.disabled svg { opacity: .35; }

.er-icon.soon::before {
  content: '';
  position: absolute;
  top: 4px; right: 4px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  border: 1.5px solid var(--bg-card);
}

.er-icon .count {
  position: absolute;
  top: -6px; right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  font-size: .6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--bg-card);
  font-variant-numeric: tabular-nums;
}

.er-icon[data-tip],
.er-status[data-tip],
.mode-btn[data-tip] { position: relative; }
.er-icon[data-tip]::after,
.er-status[data-tip]::after,
.mode-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg-card);
  font-size: .68rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  box-shadow: var(--shadow-md);
  z-index: 5;
}
.er-icon[data-tip]:hover::after,
.er-icon[data-tip]:focus-visible::after,
.er-status[data-tip]:hover::after,
.er-status[data-tip]:focus-visible::after,
.mode-btn[data-tip]:hover::after,
.mode-btn[data-tip]:focus-visible::after { opacity: 1; }

/* ══════════════════════════════════════════════════════════
   UPGRADE BANNER
   ══════════════════════════════════════════════════════════ */
.upgrade-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.ub-title {
  font-size: .9rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 3px;
}

.ub-sub {
  font-size: .76rem;
  color: #b45309;
}

.ub-btn {
  flex-shrink: 0;
  padding: 10px 22px;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, transform .1s;
}
.ub-btn:hover { background: #d97706; transform: translateY(-1px); }

/* ── Tablet ≥ 768px ── */
@media (min-width: 768px) {
  .er-num { font-size: 1.7rem; }
  .er-title { font-size: .96rem; }
  .series-tabs { gap: 8px; }
  .series-tab { padding: 10px 20px; }
  .st-name { font-size: .92rem; }
}

/* ── Mobile < 640px — hàng xuống 2 dòng, icon xuống hàng riêng ── */
@media (max-width: 640px) {
  .exam-row {
    grid-template-columns: 36px 1fr;
    grid-template-areas:
      "num info"
      "actions actions";
    row-gap: 12px;
  }
  .er-num     { grid-area: num; }
  .er-info    { grid-area: info; }
  /* Xếp cột: hàng nút mode rồi tới hàng icon, thay vì để chúng bọc lộn xộn
     trên cùng 1 dòng flex-wrap (vạch chia bị trôi ra giữa chừng rất xấu). */
  .er-actions { grid-area: actions; flex-direction: column; align-items: stretch; gap: 10px; }
  .mode-btns  { gap: 8px; }
  .mode-btn   { flex: 1; text-align: center; }
  .er-divider { display: none; }
  .er-icons   { justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--border); }
}

.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 24px;
  color: var(--text-3);
  font-size: .77rem;
  font-weight: 600;
  text-align: center;
}
.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ══════════════════════════════════════════════════════════
   EXAM HERO — dải thống kê đầu trang
   ══════════════════════════════════════════════════════════ */
.exam-hero {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.exam-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #16a34a, var(--primary), #6366f1);
}
.exam-hero-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.ehs-n {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.ehs-icon {
  color: var(--success);
  display: flex;
  align-items: center;
  line-height: 1;
}
.ehs-l {
  font-size: .64rem;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: center;
  white-space: nowrap;
}
.exam-hero-div {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}


/* ══════════════════════════════════════════════════════════
   FREE BOX — subtle glow animation
   ══════════════════════════════════════════════════════════ */
@keyframes freeGlow {
  0%, 100% { box-shadow: var(--shadow-sm); }
  50% { box-shadow: var(--shadow-sm), 0 0 0 5px rgba(22,163,74,.12); }
}
.free-box { animation: freeGlow 3.5s ease-in-out infinite; }

/* ── Responsive hero ── */
@media (min-width: 768px) {
  .exam-hero { padding: 18px 24px; }
  .ehs-n { font-size: 1.4rem; }
  .ehs-l { font-size: .7rem; }
  .exam-hero-div { height: 34px; }
}

/* ── Badge quyền truy cập (FREE/PAID) trên exam card ── */
.exam-access-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  margin-left: 6px;
  vertical-align: middle;
}
.exam-access-badge.paid {
  background: #fee2e2;
  color: #dc2626;
}
.exam-access-badge.mixed {
  background: #fef9c3;
  color: #92400e;
}

/* ══════════════════════════════════════════════════════════
   LIST MODAL — dùng chung cho lịch sử (toàn cục/theo đề) và
   danh sách từ vựng đã lưu theo đề (.gh-*)
   ══════════════════════════════════════════════════════════ */
.gh-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.gh-modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.gh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.gh-title {
  font-size: .96rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
}
.gh-close {
  background: var(--bg);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.gh-close:hover { background: var(--border); color: var(--text); }
.gh-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 18px 18px; }
.gh-placeholder {
  padding: 36px 0;
  text-align: center;
  color: var(--text-3);
  font-size: .88rem;
}
.gh-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.gh-row:last-child { border-bottom: none; }
.gh-row-info { flex: 1; min-width: 0; }
.gh-row-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.gh-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: .74rem;
  color: var(--text-3);
  align-items: center;
}
.gh-badge {
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: .68rem;
  font-weight: 700;
  white-space: nowrap;
}
.gh-badge.test     { background: var(--primary-light); color: var(--primary); }
.gh-badge.practice { background: var(--success-light); color: var(--success); }
.gh-score {
  font-weight: 800;
  font-size: .92rem;
  text-align: center;
  flex-shrink: 0;
  min-width: 52px;
  line-height: 1.3;
}
.gh-score small { display: block; font-weight: 600; font-size: .68rem; color: var(--text-3); }
.gh-score.good { color: var(--success); }
.gh-score.mid  { color: var(--warning); }
.gh-score.low  { color: var(--danger); }
.gh-btn-review {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.gh-btn-review:hover { background: var(--primary-dark); }
.gh-no-review { flex-shrink: 0; color: var(--text-3); font-size: .8rem; }

.gh-vocab-row { gap: 10px; }
.gh-vr-idx {
  flex-shrink: 0;
  width: 20px;
  text-align: center;
  font-size: .74rem;
  font-weight: 700;
  color: var(--text-3);
}
.gh-vr-word {
  flex-shrink: 0;
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gh-vr-meaning {
  flex: 1;
  min-width: 0;
  font-size: .84rem;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gh-footer {
  flex-shrink: 0;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.gh-footer-link {
  font-size: .82rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}
.gh-footer-link:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════
   PART-SELECT MODAL — chọn Part/thời gian trước khi vào đề
   (dùng chung khung .gh-overlay/.gh-modal/.gh-header/.gh-close)
   ══════════════════════════════════════════════════════════ */
.gh-title-wrap { min-width: 0; }
.gh-title-sub {
  font-weight: 600;
  color: var(--text-3);
  font-size: .74rem;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ps-mode-note {
  font-size: .8rem;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.ps-mode-note.practice { background: var(--primary-light); color: var(--primary); }
.ps-mode-note.test { background: #fff8dc; color: #8a6400; }

.ps-label {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}
.ps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 6px;
}
.ps-chip {
  padding: 10px 4px;
  text-align: center;
  border-radius: var(--radius-md, 10px);
  border: 1.5px solid var(--border-2);
  background: var(--bg-card);
  font-family: inherit;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
@media (hover: hover) { .ps-chip:not(.sel):hover { border-color: var(--primary-mid); background: var(--bg-hover); } }
.ps-chip.sel { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

.ps-selectall {
  display: block;
  width: 100%;
  margin: 0 0 16px;
  padding: 8px 14px;
  border-radius: var(--radius-md, 10px);
  border: 1.5px dashed var(--border-2);
  background: var(--bg-hover);
  font-family: inherit;
  font-size: .76rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.ps-selectall.active { border-style: solid; border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.ps-note {
  display: none;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md, 10px);
  padding: 10px 12px;
  font-size: .78rem;
  color: #92400e;
  margin-bottom: 16px;
}
.ps-note.visible { display: block; }

.ps-time-group { display: none; margin-bottom: 16px; }
.ps-time-group.visible { display: block; }
.ps-timer-mode { display: flex; gap: 6px; margin-bottom: 8px; }
.ps-timer-btn {
  flex: 1;
  padding: 8px;
  border-radius: var(--radius-md, 10px);
  border: 1.5px solid var(--border-2);
  background: var(--bg-card);
  font-family: inherit;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  text-align: center;
}
.ps-timer-btn.sel { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.ps-time-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ps-time {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-2);
  background: var(--bg-card);
  font-family: inherit;
  font-size: .76rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
}
.ps-time.sel { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

.ps-start {
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-md, 10px);
  border: none;
  background: var(--border-2);
  color: #fff;
  font-size: .88rem;
  font-weight: 800;
  cursor: not-allowed;
  transition: background .2s, box-shadow .2s;
}
.ps-start.ready {
  background: var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow-blue);
}
.ps-start.ready:hover { background: var(--primary-dark); }

