/* ============================================================
   PSIKOTES ONLINE - Main Stylesheet
   PT. Jet Executive Travya
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
  --primary:       #1e40af;
  --primary-dark:  #1e3a8a;
  --primary-light: #3b82f6;
  --accent:        #0ea5e9;
  --success:       #16a34a;
  --warning:       #d97706;
  --danger:        #dc2626;
  --info:          #0891b2;

  --bg:            #f1f5f9;
  --bg-card:       #ffffff;
  --bg-sidebar:    #0f172a;
  --sidebar-width: 260px;

  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;
  --border:        #e2e8f0;
  --border-dark:   #cbd5e1;

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);
  --shadow-xl:  0 20px 60px rgba(0,0,0,.15);

  --transition: all .2s cubic-bezier(.4,0,.2,1);
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary); }

img { max-width: 100%; }

/* ── Auth Layout ─────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
}

.auth-panel-brand {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #1e40af 100%);
  color: white;
  flex-direction: column;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.auth-panel-brand::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(59,130,246,.3) 0%, transparent 70%);
  top: -200px; right: -200px;
}

.auth-panel-brand::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(14,165,233,.2) 0%, transparent 70%);
  bottom: -100px; left: -100px;
}

.brand-content { position: relative; z-index: 1; }
.brand-logo { width: 80px; height: 80px; background: rgba(255,255,255,.15); border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; font-size: 2rem; backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.2); }
.brand-title { font-size: 2rem; font-weight: 800; margin-bottom: .5rem; }
.brand-sub { font-size: .95rem; opacity: .8; line-height: 1.7; }
.brand-features { margin-top: 2.5rem; display: flex; flex-direction: column; gap: .75rem; text-align: left; }
.brand-feature { display: flex; align-items: center; gap: .75rem; background: rgba(255,255,255,.08); padding: .75rem 1rem; border-radius: var(--radius); border: 1px solid rgba(255,255,255,.1); font-size: .875rem; }
.brand-feature i { color: #60a5fa; font-size: 1rem; }

.auth-form-wrap { width: 100%; max-width: 420px; }
.auth-form-title { font-size: 1.75rem; font-weight: 800; margin-bottom: .5rem; color: var(--text); }
.auth-form-sub { color: var(--text-muted); margin-bottom: 2rem; font-size: .9rem; }

/* ── App Layout ───────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand-logo { display: flex; align-items: center; gap: .75rem; }
.sidebar-brand-icon { width: 40px; height: 40px; background: var(--primary); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.sidebar-brand-text { line-height: 1.2; }
.sidebar-brand-name { font-weight: 700; font-size: .95rem; }
.sidebar-brand-tagline { font-size: .7rem; opacity: .5; text-transform: uppercase; letter-spacing: .05em; }

.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-section { padding: .5rem 1.25rem .25rem; font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.3); margin-top: .75rem; }
.nav-item { display: flex; align-items: center; gap: .75rem; padding: .65rem 1.25rem; color: rgba(255,255,255,.6); font-size: .875rem; font-weight: 500; transition: var(--transition); position: relative; }
.nav-item:hover { color: white; background: rgba(255,255,255,.07); }
.nav-item.active { color: white; background: rgba(59,130,246,.2); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary-light); border-radius: 0 3px 3px 0; }
.nav-item i { width: 18px; text-align: center; opacity: .9; }

.sidebar-user {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: .75rem;
}
.user-avatar { width: 36px; height: 36px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .65rem; opacity: .5; text-transform: capitalize; }

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: .875rem 1.75rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }

.page-body { padding: 1.75rem; flex: 1; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: #f8fafc; }

/* ── Stat cards ───────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; margin-bottom: 1.75rem; }

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex; align-items: center; gap: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-icon { width: 52px; height: 52px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-icon.blue   { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.yellow { background: #fef9c3; color: #ca8a04; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.cyan   { background: #cffafe; color: #0891b2; }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--text); }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: .83rem; font-weight: 600; color: var(--text); margin-bottom: .4rem; }
.form-label span.req { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: .65rem .9rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .875rem;
  color: var(--text);
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.form-control::placeholder { color: var(--text-light); }
.form-control:disabled { background: #f1f5f9; cursor: not-allowed; }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.25rem;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-sm { padding: .4rem .85rem; font-size: .8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: .8rem 1.75rem; font-size: .95rem; }

.btn-primary   { background: var(--primary); color: white; }
.btn-primary:hover   { background: var(--primary-dark); color: white; }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success   { background: var(--success); color: white; }
.btn-success:hover   { background: #15803d; }
.btn-danger    { background: var(--danger);  color: white; }
.btn-danger:hover    { background: #b91c1c; }
.btn-warning   { background: var(--warning); color: white; }
.btn-outline   { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover   { background: var(--primary); color: white; }
.btn-ghost     { background: transparent; color: var(--text-muted); }
.btn-ghost:hover     { background: #f1f5f9; color: var(--text); }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .25rem;
  padding: .2rem .6rem;
  border-radius: 100px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-green   { background: #dcfce7; color: #16a34a; }
.badge-yellow  { background: #fef9c3; color: #a16207; }
.badge-red     { background: #fee2e2; color: #b91c1c; }
.badge-gray    { background: #f1f5f9; color: #64748b; }
.badge-cyan    { background: #cffafe; color: #0e7490; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: .75rem 1rem; background: #f8fafc; border-bottom: 2px solid var(--border); text-align: left; white-space: nowrap; }
.table td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); font-size: .875rem; color: var(--text); vertical-align: middle; }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Alerts ───────────────────────────────────────────────── */
.alert { display: flex; align-items: flex-start; gap: .75rem; padding: .9rem 1.1rem; border-radius: var(--radius); font-size: .875rem; margin-bottom: 1.25rem; border: 1px solid transparent; }
.alert i { margin-top: .05rem; flex-shrink: 0; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-error   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.page-btn { display: flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 .5rem; border-radius: var(--radius-sm); font-size: .8rem; font-weight: 600; transition: var(--transition); color: var(--text-muted); background: var(--bg-card); border: 1.5px solid var(--border); text-decoration: none; }
.page-btn:hover   { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn.active  { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn.disabled{ opacity: .4; pointer-events: none; }

/* ── Exam UI ──────────────────────────────────────────────── */
.exam-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; min-height: calc(100vh - 80px); }

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.question-num { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--primary-light); margin-bottom: 1rem; }
.question-text { font-size: 1.05rem; line-height: 1.7; color: var(--text); margin-bottom: 1.75rem; font-weight: 500; }

.question-image { margin: 1rem 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.question-image img { width: 100%; max-height: 300px; object-fit: contain; background: #f8fafc; }

.options-list { display: flex; flex-direction: column; gap: .65rem; }

.option-item {
  display: flex; align-items: flex-start; gap: .9rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-card);
  position: relative;
}
.option-item:hover { border-color: var(--primary-light); background: #eff6ff; }
.option-item.selected { border-color: var(--primary); background: #eff6ff; }
.option-item.selected .option-label { background: var(--primary); color: white; }

.option-label {
  min-width: 30px; height: 30px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem;
  transition: var(--transition);
  flex-shrink: 0;
  color: var(--text-muted);
}
.option-text { font-size: .9rem; line-height: 1.5; color: var(--text); padding-top: .05rem; }

/* ── Exam sidebar ─────────────────────────────────────────── */
.exam-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }

.timer-card {
  background: var(--primary-dark);
  color: white;
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  text-align: center;
}
.timer-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .7; margin-bottom: .5rem; }
.timer-display { font-family: var(--font-mono); font-size: 2.5rem; font-weight: 700; letter-spacing: .05em; }
.timer-display.warning { color: #fbbf24; }
.timer-display.danger  { color: #f87171; animation: pulse 1s infinite; }
.timer-progress { height: 4px; background: rgba(255,255,255,.2); border-radius: 2px; margin-top: 1rem; }
.timer-bar { height: 100%; background: white; border-radius: 2px; transition: width .5s ease; }

.question-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.q-dot {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.q-dot:hover { background: var(--primary-light); color: white; border-color: var(--primary-light); }
.q-dot.answered { background: #dcfce7; color: var(--success); border-color: #86efac; }
.q-dot.current  { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Utility ──────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: .83rem; }
.text-xs     { font-size: .73rem; }
.fw-600      { font-weight: 600; }
.fw-700      { font-weight: 700; }
.fw-800      { font-weight: 800; }

.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: .75rem; }
.gap-3 { gap: 1rem; }

.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: .75rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: .75rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.p-0 { padding: 0; }

.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }

/* ── Loading overlay ─────────────────────────────────────── */
#loading-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
#loading-overlay.show { opacity: 1; pointer-events: all; }
.spinner { width: 44px; height: 44px; border: 3px solid rgba(255,255,255,.2); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }

@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes pulse   { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes fadeIn  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }

.fade-in  { animation: fadeIn  .35s ease forwards; }
.slide-in { animation: slideIn .35s ease forwards; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; }
  .exam-layout { grid-template-columns: 1fr; }
  .exam-sidebar { order: -1; }
}

@media (max-width: 768px) {
  .auth-wrapper { grid-template-columns: 1fr; }
  .auth-panel-brand { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-body { padding: 1rem; }
  .question-card { padding: 1.25rem; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .auth-panel { padding: 1.5rem; }
  .topbar { padding: .75rem 1rem; }
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  z-index: 9999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  padding: 2rem 1rem !important;
  height: 100vh !important;
  width: 100vw !important;
  max-width: 100% !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
}
.modal-overlay.open { opacity: 1 !important; pointer-events: all !important; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  transform: scale(.95);
  transition: transform .25s;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { padding: 1.5rem 1.5rem 1rem; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: .75rem; justify-content: flex-end; background: #f8fafc; }

/* ── Custom scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ── Result page ──────────────────────────────────────────── */
.result-hero { text-align: center; padding: 3rem 2rem; }
.result-score-ring {
  width: 160px; height: 160px;
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
  border: 6px solid;
}
.result-score-ring.passed  { border-color: var(--success); color: var(--success); }
.result-score-ring.failed  { border-color: var(--danger);  color: var(--danger); }
.result-score-num  { font-size: 2.8rem; font-weight: 800; line-height: 1; }
.result-score-label{ font-size: .75rem; opacity: .7; }
.result-status-badge { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem 1.25rem; border-radius: 100px; font-weight: 700; font-size: .9rem; margin-top: .75rem; }
.result-status-badge.passed { background: #dcfce7; color: var(--success); }
.result-status-badge.failed { background: #fee2e2; color: var(--danger); }

/* ── No-data state ────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-muted); }
.empty-state i { font-size: 3rem; opacity: .3; display: block; margin-bottom: 1rem; }
.empty-state p { font-size: .9rem; }
