/* SupperAnh Portal — hệ thiết kế chung cho trang học viên (index.html) + trang quản lý (admin.html) */
:root {
  --brand: #1d4ed8;          /* xanh trường học */
  --brand-dark: #1e3a8a;
  --brand-soft: #dbeafe;
  --accent: #f59e0b;         /* vàng hổ phách — điểm nhấn mèo SupperCat */
  --good: #16a34a;
  --good-soft: #dcfce7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 16px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Be Vietnam Pro", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: .35em 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }

/* ---- nút ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; cursor: pointer;
  padding: 9px 16px; font: inherit; font-weight: 600; font-size: .92rem;
  background: var(--brand); color: #fff; transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.good { background: var(--good); }
.btn.danger { background: var(--bad); }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.sm { padding: 5px 10px; font-size: .82rem; border-radius: 8px; }
.btn.block { width: 100%; }

/* ---- thẻ ---- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.card h2 { display: flex; align-items: center; gap: 8px; }

/* ---- form ---- */
label.field { display: block; margin-bottom: 12px; font-weight: 600; font-size: .88rem; }
label.field span.req { color: var(--bad); }
input, select, textarea {
  width: 100%; margin-top: 5px; padding: 10px 12px; font: inherit;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form-error { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 9px 12px; font-size: .88rem; margin: 10px 0; display: none; }
.form-ok { background: var(--good-soft); color: var(--good); border-radius: 10px; padding: 9px 12px; font-size: .88rem; margin: 10px 0; display: none; }

/* ---- badge ---- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 700; }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.approved { background: var(--good-soft); color: var(--good); }
.badge.rejected, .badge.locked { background: var(--bad-soft); color: var(--bad); }
.badge.guest { background: #e2e8f0; color: var(--muted); }
.badge.level { background: var(--brand-soft); color: var(--brand-dark); }
.badge.admin { background: #ede9fe; color: #6d28d9; }
.badge.teacher { background: #cffafe; color: #0e7490; }

/* ---- bảng ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 2px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #f8fafc; }
tr.clickable { cursor: pointer; }

/* ---- tab ---- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button {
  border: 1px solid var(--line); background: #fff; color: var(--muted); font: inherit;
  font-weight: 600; font-size: .85rem; padding: 7px 14px; border-radius: 99px; cursor: pointer;
}
.tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---- modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 50;
  display: none; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.25); width: 100%; max-width: 680px; padding: 22px; }
.modal.wide { max-width: 900px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-head .close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--muted); }

/* ---- stat card ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat .num { font-size: 1.55rem; font-weight: 800; color: var(--brand-dark); }
.stat .lbl { font-size: .78rem; color: var(--muted); font-weight: 600; }
.stat.alert .num { color: var(--warn); }

/* ---- thanh ngang mini ---- */
.hbar { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.hbar .bar { height: 10px; border-radius: 6px; background: var(--brand); min-width: 2px; }
.hbar .lbl { min-width: 130px; font-size: .84rem; }
.hbar .val { font-size: .8rem; color: var(--muted); }

/* ---- layout admin ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; background: var(--brand-dark); color: #dbeafe; padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.sidebar .logo { font-size: 1.05rem; font-weight: 800; color: #fff; padding: 4px 10px 16px; display: flex; gap: 8px; align-items: center; }
.sidebar button.nav {
  display: flex; gap: 10px; align-items: center; width: 100%; text-align: left;
  background: none; border: none; color: #bfdbfe; font: inherit; font-weight: 600; font-size: .92rem;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
}
.sidebar button.nav:hover { background: rgba(255,255,255,.08); }
.sidebar button.nav.active { background: rgba(255,255,255,.16); color: #fff; }
.sidebar .foot { margin-top: auto; padding: 10px; font-size: .78rem; color: #93c5fd; }
.main { flex: 1; padding: 22px; max-width: 1180px; min-width: 0; }
.main-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type="search"] { max-width: 260px; margin-top: 0; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; align-items: center; padding: 8px; }
  .sidebar .logo { padding: 4px 10px; white-space: nowrap; }
  .sidebar button.nav { width: auto; white-space: nowrap; padding: 8px 10px; }
  .sidebar .foot { display: none; }
  .main { padding: 14px; }
}

/* ---- trang học viên ---- */
.student-wrap { max-width: 640px; margin: 0 auto; padding: 20px 14px 60px; }
.topbar {
  background: var(--brand-dark); color: #fff; padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.topbar .logo { font-weight: 800; font-size: 1.1rem; display: flex; gap: 8px; align-items: center; }
.hero { text-align: center; padding: 26px 10px 10px; }
.hero .cat { font-size: 3rem; }
.quiz-item { border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.quiz-item.correct { border-color: var(--good); background: #f0fdf4; }
.quiz-item.wrong { border-color: var(--bad); background: #fef2f2; }
.quiz-item .stem { font-weight: 700; font-size: 1.02rem; margin: 4px 0 10px; }
.quiz-opt { display: flex; gap: 9px; align-items: center; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 10px; margin-bottom: 7px; cursor: pointer; }
.quiz-opt:hover { border-color: var(--brand); }
.quiz-opt.picked { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.quiz-opt input { width: auto; margin: 0; }
.result-level { font-size: 2.4rem; font-weight: 800; color: var(--brand-dark); }
.spin { display: inline-block; width: 16px; height: 16px; border: 2.5px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
