/* ═══════════════════════════════════════════════
   PAETS — Global Stylesheet
   Bootstrap 5.3 + Custom
═══════════════════════════════════════════════ */

:root {
  --paets-primary:    #082F91;
  --paets-primary-dk: #1d4ed8;
  --paets-sidebar:    #0f172a;
  --paets-sidebar-hover: rgba(255,255,255,.08);
  --paets-radius:     12px;
  --paets-shadow:     0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --paets-shadow-lg:  0 8px 32px rgba(0,0,0,.12);
}

/* ── Base ───────────────────────────────────── */
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
}

/* ── Navbar ─────────────────────────────────── */
.paets-navbar {
  background: #082F91;
  box-shadow: 0 2px 8px rgba(8,47,145,.35);
  padding: .65rem 0;
}
.paets-navbar .navbar-brand {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.3px;
  color: #fff !important;
  font-family: 'Times New Roman', serif;
}
.paets-navbar .nav-link { color: rgba(255,255,255,.85) !important; font-size: .9rem; }
.paets-navbar .nav-link:hover { color: #fff !important; }

/* ── Sidebar backdrop (mobile) ──────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 1020;
  background: rgba(0,0,0,.4);
}
.sidebar-backdrop.show { display: block; }
body.sidebar-open { overflow: hidden; }

/* ── Sidebar ─────────────────────────────────── */
.paets-sidebar {
  width: 240px;
  position: fixed;
  top: 56px;
  bottom: 0;
  background: var(--paets-sidebar);
  left: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1030;
  transition: width .25s;
  scrollbar-width: thin;
}
.paets-sidebar::-webkit-scrollbar { width: 4px; }
.paets-sidebar::-webkit-scrollbar-track { background: transparent; }
.paets-sidebar::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
.paets-sidebar::-webkit-scrollbar-thumb:hover { background: #64748b; }
.paets-sidebar::-webkit-scrollbar { width: 4px; }
.paets-sidebar::-webkit-scrollbar-track { background: transparent; }
.paets-sidebar::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }
.paets-sidebar::-webkit-scrollbar-thumb:hover { background: #64748b; }
.paets-sidebar .nav-link {
  color: #94a3b8;
  padding: .6rem 1.25rem;
  border-radius: 8px;
  margin: 2px 10px;
  font-size: .875rem;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all .15s;
}
.paets-sidebar .nav-link:hover,
.paets-sidebar .nav-link.active {
  background: var(--paets-sidebar-hover);
  color: #fff;
}
.paets-sidebar .nav-link.active { border-left: 3px solid var(--paets-primary); padding-left: calc(1.25rem - 3px); }
.paets-sidebar .sidebar-section {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #475569;
  padding: 1rem 1.5rem .4rem;
}
.paets-content { margin-left: 240px; padding: 2rem; min-height: calc(100vh - 56px); max-width: calc(100vw - 240px); overflow-x: hidden; }

/* Extend sidebar background full document height when content scrolls */
body > .d-flex {
  min-height: calc(100vh - 56px);
  max-width: 100vw;
  overflow-x: hidden;
  background: linear-gradient(90deg, #0f172a 0px, #0f172a 240px, #f1f5f9 240px, #f1f5f9 100%);
}

/* ── Cards ───────────────────────────────────── */
.paets-card {
  background: #fff;
  border-radius: var(--paets-radius);
  box-shadow: var(--paets-shadow);
  border: 1px solid #e2e8f0;
}
.paets-card .card-header {
  background: transparent;
  border-bottom: 1px solid #f1f5f9;
  padding: 1.1rem 1.5rem;
  font-weight: 600;
  font-size: .95rem;
}
.paets-card .card-body { padding: 1.5rem; }

/* ── Stat cards ──────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: var(--paets-radius);
  box-shadow: var(--paets-shadow);
  border: 1px solid #e2e8f0;
  padding: 1.4rem 1.5rem;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--accent, var(--paets-primary));
  border-radius: 4px 0 0 4px;
}
.stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  background: var(--icon-bg, #dbeafe);
  color: var(--icon-color, #2563eb);
}
.stat-card .stat-value { font-size: 2rem; font-weight: 700; line-height: 1; color: #0f172a; }
.stat-card .stat-label { font-size: .8rem; color: #64748b; margin-top: 4px; }

/* ── Auth pages ──────────────────────────────── */
.auth-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #082F91 0%, #0a3ea8 50%, #0f4fc4 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  overflow: hidden;
  width: 100%;
  max-width: 480px;
}
.auth-card .auth-header {
  background: linear-gradient(135deg, #082F91 0%, #0a3ea8 100%);
  padding: 2rem;
  text-align: center;
  color: #fff;
}
.auth-card .auth-header .logo-box {
  width: 60px; height: 60px;
  background: rgba(255,255,255,.18);
  border-radius: 16px;
  margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
}
.auth-card .auth-body { padding: 2rem; }
.auth-card .form-control, .auth-card .form-select {
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  padding: .65rem 1rem;
  font-size: .9rem;
  transition: border-color .15s, box-shadow .15s;
}
.auth-card .form-control:focus, .auth-card .form-select:focus {
  border-color: var(--paets-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.btn-paets {
  background: #082F91;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: .72rem 1.5rem;
  font-weight: 600;
  font-size: .92rem;
  transition: all .2s;
  width: 100%;
}
.btn-paets:hover { background: #0a3ea8; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(8,47,145,.3); color: #fff; }

/* ── Form controls (global) ──────────────────── */
.form-control, .form-select {
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  font-size: .9rem;
  padding: .6rem .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--paets-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-label { font-size: .875rem; font-weight: 500; color: #374151; margin-bottom: 5px; }

/* ── Buttons ─────────────────────────────────── */
.btn { border-radius: 8px; font-size: .875rem; font-weight: 500; }
.btn-primary { background: var(--paets-primary); border-color: var(--paets-primary); }
.btn-primary:hover { background: var(--paets-primary-dk); border-color: var(--paets-primary-dk); }
.btn-sm { border-radius: 6px; }

/* ── Tables ──────────────────────────────────── */
.paets-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.paets-table thead th {
  background: #f8fafc;
  color: #475569;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: .9rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}
.paets-table tbody td { padding: .9rem 1rem; border-bottom: 1px solid #f1f5f9; font-size: .875rem; vertical-align: middle; }
.paets-table tbody tr:last-child td { border-bottom: none; }
.paets-table tbody tr:hover td { background: #f8fafc; }

/* ── Badges ──────────────────────────────────── */
.badge { font-weight: 500; border-radius: 6px; padding: .35em .7em; font-size: .75rem; }
.badge-upcoming  { background: #dbeafe; color: #1e40af; }
.badge-active    { background: #d1fae5; color: #065f46; }
.badge-completed { background: #f1f5f9; color: #475569; }
.badge-published { background: #ede9fe; color: #5b21b6; }

/* ── Test engine ─────────────────────────────── */
.test-wrapper { max-width: 780px; margin: 0 auto; }
.timer-bar {
  position: sticky; top: 0; z-index: 200;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: .75rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.timer-bar .timer-display {
  font-size: 1.4rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  display: flex; align-items: center; gap: 8px;
}
.timer-bar.warning .timer-display { color: #d97706; }
.timer-bar.danger  .timer-display { color: #dc2626; animation: pulse-text 1s infinite; }
@keyframes pulse-text { 0%,100%{opacity:1} 50%{opacity:.6} }

.question-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: var(--paets-shadow);
  overflow: hidden;
}
.question-card .q-header {
  background: #082F91;
  color: #fff; padding: 1.25rem 1.5rem;
}
.question-card .q-body { padding: 1.75rem; }
.question-card .q-text { font-size: 1.05rem; font-weight: 500; line-height: 1.6; color: #1e293b; }

.option-item { margin-bottom: .65rem; cursor: pointer; }
.option-item input[type="radio"] { display: none; }
.option-label {
  display: flex; align-items: center; gap: 14px;
  padding: .9rem 1.1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s;
  background: #fff;
  position: relative;
}
.option-label:hover { border-color: #93c5fd; background: #eff6ff; }
.option-indicator {
  width: 34px; height: 34px; min-width: 34px;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; color: #64748b;
  transition: all .15s;
}
.option-item input:checked + .option-label { border-color: var(--paets-primary); background: #eff6ff; }
.option-item input:checked + .option-label .option-indicator {
  background: var(--paets-primary); border-color: var(--paets-primary); color: #fff;
}

/* Question navigator pills */
.q-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.q-nav .q-pill {
  width: 34px; height: 34px;
  border-radius: 8px; border: 1.5px solid #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 600; cursor: pointer;
  transition: all .15s; background: #fff; color: #64748b;
}
.q-pill.answered    { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.q-pill.flagged     { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.q-pill.current     { background: var(--paets-primary); border-color: var(--paets-primary); color: #fff; }
.q-pill.unanswered  { background: #fff; }

/* ── Result page ─────────────────────────────── */
.result-stat { text-align: center; }
.result-stat .val { font-size: 1.6rem; font-weight: 700; }
.result-stat .lbl { font-size: .75rem; color: #64748b; }

.review-item { border-radius: 10px; padding: 1rem 1.2rem; margin-bottom: .75rem; border: 1.5px solid transparent; }
.review-item.correct   { background: #f0fdf4; border-color: #bbf7d0; }
.review-item.incorrect { background: #fef2f2; border-color: #fecaca; }
.review-item.skipped   { background: #f8fafc; border-color: #e2e8f0; }

/* ── Merit list ──────────────────────────────── */
.merit-rank-1 { background: #fefce8; }
.merit-rank-2 { background: #f8fafc; }
.merit-rank-3 { background: #fff7ed; }
.rank-badge {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}
.rank-1 { background: #fde68a; color: #92400e; }
.rank-2 { background: #e5e7eb; color: #374151; }
.rank-3 { background: #fed7aa; color: #92400e; }
.rank-default { background: #f1f5f9; color: #475569; }

/* ── Progress bar ────────────────────────────── */
.progress { height: 6px; border-radius: 99px; }

/* ── Result card print styling ─────────────── */
@media print {
  body * { visibility: hidden; }
  #resultCard, #resultCard * { visibility: visible; }
  #resultCard { position: absolute; left: 0; top: 0; width: 100%; border: none; box-shadow: none; }
  .paets-navbar, .paets-sidebar, .btn, .review-item { display: none !important; }
  .paets-content { margin-left: 0 !important; }
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 768px) {
  .paets-sidebar { transform: translateX(-100%); width: 75vw; max-width: 280px; }
  .paets-sidebar.open { transform: translateX(0); }
  .paets-content { margin-left: 0; padding: 1rem; }
  .stat-card .stat-value { font-size: 1.5rem; }
  .stat-card .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; }
  .score-circle { width: 120px; height: 120px; }
  .score-circle .score-pct { font-size: 1.6rem; }
  .question-card .q-header { padding: 1rem; }
  .q-timer-wrap { width: 60px; height: 60px; }
  .q-timer-svg { width: 60px; height: 60px; }
  #q-timer-value { font-size: 1rem; }
  .option-indicator { width: 28px; height: 28px; min-width: 28px; font-size: .75rem; }
  .q-pill { width: 28px; height: 28px; font-size: .75rem; }
  .review-item { padding: .75rem 1rem; }
  .timer-bar { flex-wrap: wrap; gap: .5rem; padding: .5rem 1rem; }
  .timer-bar > div { flex: 1 1 auto; min-width: 0; }
  .security-notice { font-size: .65rem; padding: 6px 10px; gap: 6px; bottom: 10px; left: 10px; }
  .fullscreen-btn { width: 40px; height: 40px; bottom: 10px; right: 10px; font-size: 1rem; }
  .auth-card { padding: 1.5rem; }
}

@media (max-width: 576px) {
  .stat-card .stat-value { font-size: 1.25rem; }
  .score-circle { width: 100px; height: 100px; }
  .score-circle .score-pct { font-size: 1.3rem; }
  .q-timer-wrap { width: 50px; height: 50px; }
  .q-timer-svg { width: 50px; height: 50px; }
  .security-notice span:nth-child(3) { display: none; }
  .password-wrapper .form-input { padding-right: 2.5rem; }
}

/* ── Filter tabs ─────────────────────────────── */
.filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-tabs .btn-filter {
  padding: .4rem 1rem;
  border-radius: 99px;
  font-size: .8rem;
  font-weight: 500;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.filter-tabs .btn-filter:hover { border-color: #93c5fd; color: var(--paets-primary); background: #eff6ff; }
.filter-tabs .btn-filter.active { border-color: var(--paets-primary); background: var(--paets-primary); color: #fff; }

/* ── Search box ──────────────────────────────── */
.search-box { position: relative; }
.search-box .search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: #94a3b8; font-size: .9rem;
}
.search-box input { padding-left: 36px; border-radius: 99px; }

/* ── Empty state ─────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-state .empty-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2rem;
  color: #94a3b8;
}
.empty-state h6 { color: #475569; font-weight: 600; }
.empty-state p { color: #94a3b8; font-size: .875rem; max-width: 360px; margin: 0 auto; }

/* ── Medal badges ────────────────────────────── */
.medal { font-size: 1.1rem; }
.medal-gold    { color: #f59e0b; }
.medal-silver  { color: #94a3b8; }
.medal-bronze  { color: #cd7f32; }

/* ── Score circle (used in result page & elsewhere) ─ */
.score-circle {
  width: 160px; height: 160px;
  border-radius: 50%;
  border: 8px solid var(--paets-primary);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  margin: 0 auto;
  background: linear-gradient(135deg, #eff6ff, #fff);
  box-shadow: 0 0 0 16px rgba(37,99,235,.08);
}
.score-circle .score-pct { font-size: 2.2rem; font-weight: 800; color: var(--paets-primary); line-height: 1; }
.score-circle .score-lbl { font-size: .7rem; color: #64748b; margin-top: 2px; }

.score-circle.pass { border-color: #059669; box-shadow: 0 0 0 16px rgba(5,150,105,.08); }
.score-circle.pass .score-pct { color: #059669; }
.score-circle.fail { border-color: #dc2626; box-shadow: 0 0 0 16px rgba(220,38,38,.08); }
.score-circle.fail .score-pct { color: #dc2626; }

/* ── Utilities ───────────────────────────────── */
.text-paets { color: var(--paets-primary) !important; }
.bg-paets   { background: var(--paets-primary) !important; }
.fw-600     { font-weight: 600; }
.fs-13      { font-size: .8125rem; }
.gap-10     { gap: 10px; }
.rounded-10 { border-radius: 10px; }
.shadow-sm-paets { box-shadow: var(--paets-shadow); }
