/* ==========================================================
   ExamOnline — dashboard.css
   ระบบสอบออนไลน์
   ========================================================== */

/* ── Google Fonts (default) ── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700&family=Poppins:wght@600;700&display=swap');

/* ── CSS Variables ── */
:root {
  --bg:     #f2f0fb;
  --card:   #ffffff;
  --border: #e9e5f7;

  --p1:   #6e62f0;   --p1l: #edeaff;  --p1d: #5750cc;
  --p2:   #f4607a;   --p2l: #fff0f3;
  --p3:   #2ec4a0;   --p3l: #e5faf6;
  --p4:   #f5a623;   --p4l: #fff7ea;
  --p5:   #44b8f5;   --p5l: #eaf7ff;

  --txt:  #252240;
  --txt2: #6b6882;
  --txt3: #aaa8c0;

  --rx: 22px;
  --rl: 16px;
  --rm: 12px;
  --rs: 8px;

  --sh:    0 2px 10px rgba(110,98,240,.08);
  --sh-md: 0 6px 28px rgba(110,98,240,.13);
  --sh-lg: 0 12px 48px rgba(110,98,240,.18);

  --sw: 256px;
  --t: .2s cubic-bezier(.4,0,.2,1);

  --font-main: 'Noto Sans Thai', sans-serif;
  --font-num:  'Poppins', sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: clip; }
body {
  min-height: 100vh;
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--txt);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--p1); text-decoration: none; }
a:hover { color: var(--p1d); }

/* ════════════════════════════════════════
   ANIMATION
════════════════════════════════════════ */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ════════════════════════════════════════
   LAYOUT
════════════════════════════════════════ */
.app { display: flex; min-height: 100vh; }

/* ════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════ */
.sidebar {
  width: var(--sw);
  background: var(--card);
  border-right: 1px solid var(--border);
  box-shadow: none;
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0;
  z-index: 200;
  padding-bottom: 20px;
  overflow-y: auto;
  transition: transform .28s cubic-bezier(.22,1,.36,1);
}

.s-brand {
  display: flex; align-items: center;
  padding: 16px 14px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; gap: 10px;
}
.s-logo-wrap {
  flex: 1; display: flex; align-items: center;
  text-decoration: none; min-width: 0; overflow: hidden;
}
.s-logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--p1), var(--p2));
  border-radius: var(--rm);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; font-weight: 700;
  flex-shrink: 0;
}
.s-logo-img {
  max-width: 100%; max-height: 48px;
  border-radius: var(--rm);
  object-fit: contain;
  flex-shrink: 0;
}
.s-info { margin-left: 10px; min-width: 0; }
.s-name { font-weight: 700; font-size: .95rem; color: var(--txt); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-sub  { font-size: .7rem; color: var(--txt3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-close {
  display: none;
  width: 32px; height: 32px;
  border: none; background: var(--bg);
  border-radius: var(--rs);
  color: var(--txt2); font-size: 1rem;
  cursor: pointer; place-items: center;
}

/* menu */
.s-menu { flex: 1; padding: 10px 8px; }
.s-group-title {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--txt3); padding: 12px 12px 4px; font-weight: 600;
}
.s-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 4px; border-radius: var(--rm);
  color: var(--txt2); font-size: .85rem; font-weight: 500;
  transition: var(--t); cursor: pointer;
  text-decoration: none;
}
.s-link:hover { background: var(--p1l); color: var(--p1); }
.s-link.active { background: var(--p1l); color: var(--p1); font-weight: 600; }
.s-link i { font-size: 1.1rem; width: 22px; text-align: center; }
.s-logout { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--p2); }
.s-logout:hover { background: var(--p2l); color: var(--p2); }
.s-badge {
  margin-left: auto;
  background: var(--p2);
  color: #fff;
  font-size: .65rem; font-weight: 700;
  padding: 2px 7px; border-radius: 10px;
  font-family: var(--font-num);
}

/* sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 199;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
}

/* ════════════════════════════════════════
   TOPBAR
════════════════════════════════════════ */
.main-content {
  flex: 1; margin-left: var(--sw);
  display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin-left .28s cubic-bezier(.22,1,.36,1);
}

.topbar {
  display: flex; align-items: center;
  padding: 12px 24px;
  gap: 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.hamburger {
  display: none;
  width: 36px; height: 36px;
  border: none; background: var(--bg);
  border-radius: var(--rs);
  color: var(--txt2); font-size: 1.1rem;
  cursor: pointer; place-items: center;
}
.page-title-area { flex: 1; }
.page-title {
  font-size: 1.15rem; font-weight: 700; color: var(--txt);
  display: flex; align-items: center; gap: 8px;
}
.page-title .icon-box {
  width: 34px; height: 34px;
  border-radius: var(--rs);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: #fff; flex-shrink: 0;
}
.page-subtitle { font-size: .75rem; color: var(--txt3); margin-top: 1px; }

.top-actions { display: flex; align-items: center; gap: 8px; }
.top-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--border); background: var(--card);
  border-radius: var(--rs);
  color: var(--txt2); font-size: 1rem;
  cursor: pointer; transition: var(--t);
  position: relative;
}
.top-btn:hover { background: var(--p1l); color: var(--p1); border-color: var(--p1l); }

.user-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px 6px 6px;
  border: 1px solid var(--border); background: var(--card);
  border-radius: 50px; cursor: pointer; transition: var(--t);
}
.user-btn:hover { background: var(--p1l); border-color: var(--p1l); }
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--p1), var(--p3));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .75rem; font-weight: 700;
}
.user-name { font-size: .8rem; font-weight: 600; color: var(--txt); }
.user-role { font-size: .65rem; color: var(--txt3); }

/* ════════════════════════════════════════
   CONTENT AREA
════════════════════════════════════════ */
.content { flex: 1; padding: 24px; animation: rise .3s ease-out; }

/* ════════════════════════════════════════
   STAT CARDS
════════════════════════════════════════ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--card);
  border-radius: var(--rl);
  padding: 20px;
  box-shadow: var(--sh);
  display: flex; align-items: center; gap: 14px;
  transition: var(--t);
  animation: rise .35s ease-out both;
}
.stat-card:nth-child(1) { animation-delay: .0s; }
.stat-card:nth-child(2) { animation-delay: .05s; }
.stat-card:nth-child(3) { animation-delay: .1s; }
.stat-card:nth-child(4) { animation-delay: .15s; }
.stat-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--rm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff; flex-shrink: 0;
}
.stat-icon.c1 { background: linear-gradient(135deg, var(--p1), #9b8aff); }
.stat-icon.c2 { background: linear-gradient(135deg, var(--p2), #ff8da3); }
.stat-icon.c3 { background: linear-gradient(135deg, var(--p3), #5de0c9); }
.stat-icon.c4 { background: linear-gradient(135deg, var(--p4), #ffc55c); }
.stat-icon.c5 { background: linear-gradient(135deg, var(--p5), #7ad0ff); }
.stat-info { min-width: 0; }
.stat-num  { font-family: var(--font-num); font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .78rem; color: var(--txt3); margin-top: 2px; }

/* ════════════════════════════════════════
   CARDS (Generic)
════════════════════════════════════════ */
.card {
  background: var(--card);
  border: none;
  border-radius: var(--rl);
  box-shadow: var(--sh);
  transition: var(--t);
}
.card:hover { box-shadow: var(--sh-md); }
.card-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.card-hdr h3 {
  font-size: .95rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 20px; }

/* ════════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px;
  border-radius: var(--rm);
  font-size: .82rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: var(--t);
  text-decoration: none;
  font-family: var(--font-main);
  line-height: 1.5;
}
.btn i { font-size: .95rem; }
.btn-p { background: var(--p1); color: #fff; }
.btn-p:hover { background: var(--p1d); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(110,98,240,.35); }
.btn-s { background: var(--p1l); color: var(--p1); }
.btn-s:hover { background: #ddd8ff; }
.btn-ok { background: var(--p3); color: #fff; }
.btn-ok:hover { background: #25a988; color: #fff; }
.btn-del { background: var(--p2l); color: var(--p2); }
.btn-del:hover { background: #ffe0e6; }
.btn-out { background: var(--card); color: var(--txt2); border: 1px solid var(--border); }
.btn-out:hover { background: var(--bg); color: var(--txt); }
.btn-warn { background: var(--p4); color: #fff; }
.btn-warn:hover { background: #e09518; color: #fff; }
.btn-info { background: var(--p5l); color: var(--p5); }
.btn-info:hover { background: #d5efff; }
.btn-sm { padding: 5px 12px; font-size: .75rem; border-radius: var(--rs); }
.btn-lg { padding: 12px 28px; font-size: .92rem; border-radius: var(--rl); }

/* ════════════════════════════════════════
   FORM ELEMENTS
════════════════════════════════════════ */
.form-label { font-size: .8rem; font-weight: 600; color: var(--txt); margin-bottom: 4px; display: block; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--rm);
  font-size: .85rem;
  font-family: var(--font-main);
  color: var(--txt);
  background: var(--card);
  transition: var(--t);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--p1);
  box-shadow: 0 0 0 3px rgba(110,98,240,.12);
}
.form-input::placeholder { color: var(--txt3); }
.form-group { margin-bottom: 16px; }
.input-icon-wrap {
  position: relative; display: flex; align-items: center;
}
.input-icon-wrap i {
  position: absolute; left: 12px; color: var(--txt3); font-size: .9rem;
}
.input-icon-wrap .form-input { padding-left: 36px; }

/* ════════════════════════════════════════
   TABLES
════════════════════════════════════════ */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.tbl th {
  padding: 10px 14px; text-align: left;
  background: var(--bg); color: var(--txt2);
  font-weight: 600; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
}
table.tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.tbl tbody tr { transition: var(--t); }
table.tbl tbody tr:hover { background: var(--p1l); }
table.tbl tbody tr:last-child td { border-bottom: none; }

/* ════════════════════════════════════════
   BADGE
════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: .7rem; font-weight: 600;
}
.badge-ok  { background: var(--p3l); color: var(--p3); }
.badge-err { background: var(--p2l); color: var(--p2); }
.badge-warn { background: var(--p4l); color: var(--p4); }
.badge-info { background: var(--p5l); color: var(--p5); }
.badge-p   { background: var(--p1l); color: var(--p1); }
.badge-off { background: var(--bg); color: var(--txt3); }

/* ════════════════════════════════════════
   EXAM CARDS
════════════════════════════════════════ */
.exam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

.exam-card {
  background: var(--card);
  border-radius: var(--rl);
  box-shadow: var(--sh);
  border-left: 4px solid var(--p1);
  transition: var(--t);
  animation: rise .35s ease-out both;
  overflow: hidden;
}
.exam-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); border-left-color: var(--p2); }
.exam-card-body { padding: 18px 20px; }
.exam-card-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.exam-card-title { font-size: .95rem; font-weight: 700; color: var(--txt); line-height: 1.3; }
.exam-card-desc { font-size: .78rem; color: var(--txt3); margin-bottom: 12px; line-height: 1.5; }
.exam-card-meta { display: flex; gap: 14px; font-size: .75rem; color: var(--txt2); margin-bottom: 12px; }
.exam-card-meta i { margin-right: 3px; }
.exam-card-code { font-size: .78rem; color: var(--txt3); margin-bottom: 14px; }
.exam-card-code strong { font-family: var(--font-num); color: var(--p1); font-size: .85rem; letter-spacing: 2px; }
.exam-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.exam-card-foot {
  padding: 10px 20px;
  background: var(--bg);
  font-size: .72rem; color: var(--txt3);
  border-top: 1px solid var(--border);
}

/* ════════════════════════════════════════
   QUESTION EDITOR
════════════════════════════════════════ */
.q-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  padding: 18px 20px;
  margin-bottom: 12px;
  transition: var(--t);
}
.q-item:hover { border-color: var(--p1); box-shadow: var(--sh); }
.q-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--p1), #9b8aff);
  color: #fff; border-radius: 50%;
  font-size: .78rem; font-weight: 700;
  font-family: var(--font-num);
}
.q-text { font-weight: 600; font-size: .88rem; margin: 8px 0; }

/* ════════════════════════════════════════
   CHOICE ITEMS (exam taking)
════════════════════════════════════════ */
.choice-item {
  display: flex; align-items: center;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--rm);
  margin-bottom: 8px;
  cursor: pointer; transition: var(--t);
  gap: 10px;
}
.choice-item:hover { border-color: var(--p1); background: var(--p1l); }
.choice-item.selected { border-color: var(--p1); background: var(--p1l); }
.choice-item.correct  { border-color: var(--p3); background: var(--p3l); }
.choice-item.incorrect { border-color: var(--p2); background: var(--p2l); }
.choice-label {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .78rem;
  flex-shrink: 0; transition: var(--t);
}
.choice-item.selected .choice-label { background: var(--p1); color: #fff; }
.choice-item.correct  .choice-label { background: var(--p3); color: #fff; }
.choice-item.incorrect .choice-label { background: var(--p2); color: #fff; }

/* ════════════════════════════════════════
   TIMER
════════════════════════════════════════ */
.exam-timer {
  position: fixed; top: 80px; right: 20px;
  background: var(--card);
  border-radius: var(--rl);
  padding: 14px 20px;
  box-shadow: var(--sh-md);
  z-index: 1000; text-align: center;
}
.exam-timer .time-label { font-size: .72rem; color: var(--txt3); }
.exam-timer .time {
  font-family: var(--font-num);
  font-size: 1.5rem; font-weight: 700; color: var(--p1);
}
.exam-timer .time.warning { color: var(--p4); }
.exam-timer .time.danger  { color: var(--p2); animation: pulse 1s infinite; }

/* ════════════════════════════════════════
   RESULT
════════════════════════════════════════ */
.result-circle {
  width: 150px; height: 150px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  margin: 0 auto; font-weight: 800;
}
.result-circle.passed {
  background: var(--p3l); border: 4px solid var(--p3); color: #059669;
}
.result-circle.failed {
  background: var(--p2l); border: 4px solid var(--p2); color: var(--p2);
}
.result-circle .percentage { font-family: var(--font-num); font-size: 2.5rem; line-height: 1; }
.result-circle .label { font-size: .75rem; font-weight: 600; }

/* ════════════════════════════════════════
   ACCESS CODE & SHARE
════════════════════════════════════════ */
.access-code {
  font-family: var(--font-num);
  font-size: 2rem; font-weight: 800;
  letter-spacing: 8px; color: var(--p1);
  background: var(--p1l);
  padding: 12px 28px;
  border-radius: var(--rl);
  display: inline-block;
}
.share-link-box {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--rm);
  padding: 12px 16px;
  word-break: break-all;
  font-family: monospace; font-size: .82rem;
  color: var(--txt2);
}

/* ════════════════════════════════════════
   PROGRESS BAR
════════════════════════════════════════ */
.progress-bar-wrap {
  width: 100%; height: 8px;
  background: var(--bg);
  border-radius: 4px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; border-radius: 4px;
  transition: width .4s ease;
}
.progress-bar-fill.ok { background: var(--p3); }
.progress-bar-fill.err { background: var(--p2); }

/* ════════════════════════════════════════
   EMPTY STATE
════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--txt3);
}
.empty-state i { font-size: 3rem; opacity: .4; margin-bottom: 12px; }
.empty-state h4 { font-weight: 600; color: var(--txt2); margin: 8px 0; }
.empty-state p { font-size: .82rem; margin-bottom: 16px; }

/* ════════════════════════════════════════
   ALERT
════════════════════════════════════════ */
.alert {
  padding: 12px 16px;
  border-radius: var(--rm);
  font-size: .82rem;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px;
}
.alert i { font-size: 1rem; flex-shrink: 0; }
.alert-ok  { background: var(--p3l); color: #1a7a5c; }
.alert-err { background: var(--p2l); color: #c93d57; }
.alert-warn { background: var(--p4l); color: #a87316; }
.alert-info { background: var(--p5l); color: #2d7fab; }

/* ════════════════════════════════════════
   AUTH PAGES (Login / Register)
════════════════════════════════════════ */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 30%, #f97316 70%, #fb923c 100%);
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--card);
  border-radius: var(--rx);
  box-shadow: var(--sh-lg);
  padding: 36px;
  animation: rise .4s ease-out;
}
.auth-logo {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--p1), var(--p2));
  border-radius: var(--rl);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.6rem;
  margin: 0 auto 16px;
}

/* ════════════════════════════════════════
   HERO / LANDING
════════════════════════════════════════ */
.hero-section {
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 30%, #f97316 70%, #fb923c 100%);
  min-height: 100vh;
  display: flex; align-items: center;
  position: relative; overflow: hidden;
}
.hero-section::before {
  content: ''; position: absolute;
  top: -30%; right: -15%;
  width: 500px; height: 500px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}
.hero-section::after {
  content: ''; position: absolute;
  bottom: -20%; left: -10%;
  width: 400px; height: 400px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
}
.hero-title { font-size: 3rem; font-weight: 800; color: #fff; line-height: 1.2; }
.hero-sub { font-size: 1.1rem; color: rgba(255,255,255,.85); margin-top: 12px; line-height: 1.7; }

.feature-box {
  background: rgba(255,255,255,.1);
  border-radius: var(--rl);
  padding: 24px 20px;
  text-align: center; color: #fff;
  backdrop-filter: blur(4px);
  transition: var(--t);
}
.feature-box:hover { background: rgba(255,255,255,.18); transform: translateY(-3px); }
.feature-box i { font-size: 2rem; margin-bottom: 8px; }
.feature-box h5 { font-weight: 700; font-size: .9rem; margin-bottom: 4px; }
.feature-box small { opacity: .8; font-size: .75rem; }

/* ════════════════════════════════════════
   SETTINGS PAGE
════════════════════════════════════════ */
.settings-section {
  margin-bottom: 28px;
}
.settings-card {
  background: var(--card);
  border-radius: var(--rl);
  box-shadow: var(--sh);
  overflow: hidden;
}
.settings-card-hdr {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.settings-card-hdr .s-icon {
  width: 38px; height: 38px;
  border-radius: var(--rm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.settings-card-hdr h3 { font-size: .92rem; font-weight: 700; }
.settings-card-hdr .s-desc { font-size: .72rem; color: var(--txt3); margin-top: 1px; }
.settings-card-body { padding: 20px 24px; }

/* ── Themes ── */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.theme-item {
  border: 2px solid var(--border);
  border-radius: var(--rm);
  padding: 16px;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  display: flex; align-items: center; gap: 14px;
}
.theme-item:hover {
  border-color: var(--p1);
  box-shadow: 0 2px 12px rgba(110,98,240,.1);
  transform: translateY(-1px);
}
.theme-item.active {
  border-color: var(--p1);
  background: var(--p1l);
}
.theme-item.active::after {
  content: '\2713';
  position: absolute; top: 8px; right: 10px;
  background: var(--p1); color: #fff;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700;
}
.theme-preview {
  width: 52px; height: 38px;
  border-radius: 8px;
  position: relative; overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.theme-preview-bg {
  position: absolute; inset: 0;
}
.theme-preview-sidebar {
  position: absolute; left: 0; top: 0; bottom: 0; width: 14px;
  border-right: 1px solid rgba(255,255,255,.15);
}
.theme-preview-dot {
  width: 5px; height: 5px; border-radius: 50%;
  position: absolute;
}
.theme-info { min-width: 0; }
.theme-name {
  font-size: .82rem; font-weight: 700; color: var(--txt);
  line-height: 1.2;
}
.theme-tag {
  font-size: .65rem; color: var(--txt3); margin-top: 2px;
}

/* ── Font Size ── */
.size-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.size-item {
  min-width: 72px; height: 52px;
  border: 2px solid var(--border);
  border-radius: var(--rm);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: all .2s;
  gap: 2px;
}
.size-item:hover {
  border-color: var(--p1);
  transform: translateY(-1px);
}
.size-item.active {
  border-color: var(--p1);
  background: var(--p1l);
  color: var(--p1);
  box-shadow: 0 2px 8px rgba(110,98,240,.12);
}
.size-item .size-label {
  font-weight: 800; font-family: var(--font-num); font-size: .9rem;
}
.size-item .size-px {
  font-size: .58rem; color: var(--txt3); font-family: var(--font-num);
}
.size-item.active .size-px { color: var(--p1); opacity: .7; }

/* ── Fonts ── */
.font-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.font-item {
  border: 2px solid var(--border);
  border-radius: var(--rm);
  padding: 16px 18px;
  cursor: pointer;
  transition: all .2s;
  display: flex; align-items: center; gap: 14px;
  position: relative;
}
.font-item:hover {
  border-color: var(--p1);
  transform: translateY(-1px);
  box-shadow: 0 2px 12px rgba(110,98,240,.1);
}
.font-item.active {
  border-color: var(--p1);
  background: var(--p1l);
}
.font-item.active::after {
  content: '\2713';
  position: absolute; top: 8px; right: 10px;
  background: var(--p1); color: #fff;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700;
}
.font-sample {
  width: 44px; height: 44px;
  border-radius: var(--rm);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 700;
  color: var(--p1); flex-shrink: 0;
  border: 1px solid var(--border);
}
.font-item.active .font-sample { background: var(--card); border-color: var(--p1); }
.font-info { min-width: 0; }
.font-info .font-label { font-size: .82rem; font-weight: 700; line-height: 1.2; }
.font-info .font-tag {
  display: inline-block; margin-top: 3px;
  font-size: .6rem; font-weight: 600;
  padding: 1px 8px; border-radius: 10px;
  background: var(--bg); color: var(--txt3);
  border: 1px solid var(--border);
}

/* ════════════════════════════════════════
   FOOTER
════════════════════════════════════════ */
.footer {
  margin-top: auto;
  padding: 16px 24px;
  text-align: center;
  font-size: .72rem; color: var(--txt3);
  border-top: 1px solid var(--border);
}

/* ════════════════════════════════════════
   DARK THEME OVERRIDES
════════════════════════════════════════ */
body.theme-dark {
  --bg:     #14141e;
  --card:   #1e1e2e;
  --border: #2e2e44;
  --txt:    #e4e4f0;
  --txt2:   #9999b0;
  --txt3:   #666680;
  --sh:     0 2px 10px rgba(0,0,0,.2);
  --sh-md:  0 6px 28px rgba(0,0,0,.3);
  --sh-lg:  0 12px 48px rgba(0,0,0,.4);
}
body.theme-dark .form-input,
body.theme-dark .form-select,
body.theme-dark .form-textarea { background: #262638; border-color: var(--border); color: var(--txt); }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); border-radius: 0; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: grid; }
  .sidebar-overlay.show { display: block; }
  .hamburger { display: grid; }
  .main-content { margin-left: 0; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .exam-grid { grid-template-columns: 1fr; }
  .exam-timer { top: auto; bottom: 16px; right: 12px; left: 12px; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 2rem; }
  .auth-card { padding: 24px; }
  .theme-grid { grid-template-columns: 1fr; }
  .font-grid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════
   USER DROPDOWN
════════════════════════════════════════ */
.dropdown { position: relative; }
.dropdown-menu {
  display: none;
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rm);
  box-shadow: var(--sh-md);
  min-width: 180px;
  padding: 6px;
  z-index: 300;
  animation: rise .15s ease-out;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: var(--rs);
  font-size: .82rem; color: var(--txt2);
  cursor: pointer; transition: var(--t);
  text-decoration: none;
}
.dropdown-item:hover { background: var(--p1l); color: var(--p1); }
.dropdown-item i { font-size: .9rem; width: 18px; text-align: center; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ════════════════════════════════════════
   CUSTOM MODAL
════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn .15s ease-out;
}
.modal-box {
  background: var(--card);
  border-radius: var(--rl);
  box-shadow: var(--sh-lg);
  width: 100%; max-width: 400px;
  overflow: hidden;
  animation: modalPop .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(.9) translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.modal-box.closing {
  animation: modalClose .15s ease-in forwards;
}
@keyframes modalClose {
  to { opacity: 0; transform: scale(.95) translateY(6px); }
}
.modal-header {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 24px 0;
}
.modal-icon {
  width: 44px; height: 44px;
  border-radius: var(--rm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.modal-icon.danger { background: var(--p2l); color: var(--p2); }
.modal-icon.warning { background: var(--p4l); color: var(--p4); }
.modal-icon.info { background: var(--p5l); color: var(--p5); }
.modal-icon.success { background: var(--p3l); color: var(--p3); }
.modal-title {
  font-weight: 700; font-size: 1rem;
  color: var(--txt);
}
.modal-body {
  padding: 12px 24px 0;
  font-size: .85rem; color: var(--txt2);
  line-height: 1.6;
}
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 20px 24px;
}
.modal-footer .btn { min-width: 90px; justify-content: center; }
