:root {
  --color-primary: #0F172A;
  --color-secondary: #2563EB;
  --color-success: #16A34A;
  --color-warning: #F59E0B;
  --color-danger: #DC2626;
  --color-bg: #F8FAFC;
}

body {
  background-color: var(--color-bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

a { color: var(--color-secondary); text-decoration: none; }
a:hover { text-decoration: underline; }

.btn-primary {
  background-color: var(--color-secondary);
  border-color: var(--color-secondary);
}
.btn-success { background-color: var(--color-success); border-color: var(--color-success); }
.btn-danger  { background-color: var(--color-danger);  border-color: var(--color-danger); }

/* ===================== AUTH PAGES ===================== */
.auth-body { background: linear-gradient(135deg, var(--color-primary), var(--color-secondary)); min-height: 100vh; }
.auth-wrapper { min-height: 100vh; padding: 2rem 1rem; }
.auth-card { max-width: 420px; width: 100%; border-radius: 16px; }
.auth-icon { color: var(--color-secondary); }

/* ===================== APP LAYOUT (logged-in) ===================== */
.app-topbar {
  background-color: var(--color-primary);
  height: 60px;
  z-index: 1030;
}
.btn-topbar { color: #fff; border: none; background: transparent; }
.btn-topbar:hover { color: #cbd5e1; }

.app-sidebar {
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  width: 230px;
  background-color: #fff;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  z-index: 1020;
}
.app-sidebar .nav-link { color: #475569; padding: 0.65rem 1.25rem; border-radius: 0; font-size: 0.92rem; }
.app-sidebar .nav-link.active,
.app-sidebar .nav-link:hover { background-color: #eff6ff; color: var(--color-secondary); border-left: 3px solid var(--color-secondary); }

.app-content { margin-left: 230px; margin-top: 60px; padding: 1.75rem; min-height: calc(100vh - 60px); }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .app-sidebar.show { transform: translateX(0); }
  .app-content { margin-left: 0; }
}

.stat-card { border-radius: 14px; }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }

.info-box { background: #f1f5f9; border-radius: 10px; padding: 0.75rem; display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 600; font-size: 0.9rem; }
.info-box i { color: var(--color-secondary); }

/* ===================== EXAM (LOCKDOWN) MODE ===================== */
.exam-body { background-color: var(--color-bg); }
.no-select { -webkit-user-select: none; user-select: none; }
#qAnswer { user-select: text; }

.fs-gate {
  position: fixed; inset: 0; background: var(--color-primary); color: #fff; z-index: 2000;
}

.exam-topbar { background-color: var(--color-primary); height: 56px; }
.timer-pill, .qtimer-pill {
  background: rgba(255,255,255,0.12); color: #fff; padding: 6px 14px; border-radius: 20px; font-weight: 600; font-size: 0.9rem;
}
.qtimer-pill { background: #eef2ff; color: var(--color-secondary); }
.timer-pill.danger { background: var(--color-danger); }
.qtimer-pill.danger { background: var(--color-danger); color: #fff; }

.exam-layout { display: flex; gap: 1.25rem; padding: 1.25rem; max-width: 1200px; margin: 0 auto; }
.exam-main { flex: 1; min-width: 0; }
.exam-sidebar { width: 260px; flex-shrink: 0; }
@media (max-width: 900px) {
  .exam-layout { flex-direction: column; }
  .exam-sidebar { width: 100%; }
}

.question-card { border-radius: 14px; }
.question-img { max-width: 100%; max-height: 260px; border-radius: 8px; border: 1px solid #e2e8f0; }

.palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.palette-item {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-weight: 600; font-size: 0.85rem; color: #fff; background: #cbd5e1;
}
.palette-item.answered { background: var(--color-success); }
.palette-item.skipped { background: var(--color-warning); }
.palette-item.timed_out { background: var(--color-danger); }
.palette-item.current { background: var(--color-secondary); box-shadow: 0 0 0 3px rgba(37,99,235,0.3); }
.palette-item.not_visited { background: #cbd5e1; color: #475569; }

.palette-legend { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.palette-legend .dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.palette-legend .dot.answered { background: var(--color-success); }
.palette-legend .dot.skipped { background: var(--color-warning); }
.palette-legend .dot.current { background: var(--color-secondary); }
.palette-legend .dot.not_visited { background: #cbd5e1; }
