/* ═══════════════════════════════════════════════════════════
   SEHAGO – Dashboard & Auth Styles
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --bg: #0b0f1a;
  --surface: #131929;
  --card: #1a2236;
  --card-hover: #1f2a42;
  --border: rgba(255,255,255,0.07);
  --primary: #10d9a0;
  --primary-dim: rgba(16,217,160,0.15);
  --primary-dark: #0bb882;
  --secondary: #6366f1;
  --secondary-dim: rgba(99,102,241,0.15);
  --amber: #f59e0b;
  --amber-dim: rgba(245,158,11,0.15);
  --danger: #ef4444;
  --danger-dim: rgba(239,68,68,0.15);
  --text: #e2e8f0;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --sidebar-w: 260px;
  --radius: 14px;
  --radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ══════════════════════════════════════════════════════════
   AUTH PAGES
══════════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 80% 60% at 20% -10%, rgba(16,217,160,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 110%, rgba(99,102,241,0.15) 0%, transparent 60%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(26,34,54,0.85);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 44px 40px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
}

.auth-logo {
  text-align: center;
  margin-bottom: 8px;
}
.auth-logo .logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-dim);
  border: 1px solid rgba(16,217,160,0.3);
  border-radius: 99px;
  padding: 6px 16px 6px 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.5px;
  margin-bottom: 20px;
}
.auth-logo .logo-badge .dot {
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); opacity:1; }
  50% { transform: scale(1.4); opacity:.6; }
}

.auth-title {
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 6px;
}
.auth-subtitle {
  font-size: 13.5px;
  color: var(--text-soft);
  text-align: center;
  margin-bottom: 32px;
}

/* Form */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}
.form-input {
  width: 100%;
  padding: 13px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,217,160,0.15);
}
.form-input::placeholder { color: var(--text-muted); }

.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 44px; }
.input-icon {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); cursor: pointer; font-size: 18px;
  transition: color .2s;
}
.input-icon:hover { color: var(--primary); }

.btn-auth {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none; border-radius: var(--radius-sm);
  color: #0b1a14; font-family: inherit;
  font-size: 15px; font-weight: 700;
  cursor: pointer; transition: opacity .2s, transform .15s;
  margin-top: 8px;
}
.btn-auth:hover { opacity: .9; transform: translateY(-1px); }
.btn-auth:active { transform: translateY(0); }
.btn-auth:disabled { opacity: .5; cursor: not-allowed; }

.auth-error {
  background: var(--danger-dim);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fca5a5;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.auth-error.show { display: block; animation: fadeIn .3s; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity:1; transform: none; } }

.auth-back {
  display: block; text-align: center;
  color: var(--text-muted); font-size: 13px;
  margin-top: 20px; text-decoration: none;
  transition: color .2s;
}
.auth-back:hover { color: var(--primary); }

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

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  padding: 0;
  transition: transform .3s;
}
.sidebar-head {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  font-size: 20px; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #7ee8cc);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1px;
}
.sidebar-role {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px; text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-user {
  padding: 14px 20px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.sidebar-username { font-size: 13.5px; font-weight: 600; }
.sidebar-tag { font-size: 11.5px; color: var(--text-muted); }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section-label {
  font-size: 10.5px; font-weight: 700; color: var(--text-muted);
  letter-spacing: 1.2px; text-transform: uppercase;
  padding: 8px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  color: var(--text-soft); font-size: 14px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: background .18s, color .18s;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active {
  background: var(--primary-dim);
  color: var(--primary); font-weight: 600;
}
.nav-item .nav-icon { font-size: 20px; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}

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

.dash-topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,15,26,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.dash-content { padding: 28px; flex: 1; }

/* ── Stat Cards ────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  position: relative; overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent-color, var(--primary));
}
.stat-icon {
  width: 44px; height: 44px;
  background: var(--accent-dim, var(--primary-dim));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 14px;
}
.stat-value { font-size: 30px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat-delta {
  font-size: 12px; font-weight: 600; margin-top: 8px;
  display: flex; align-items: center; gap: 4px;
}

/* ── Grid Panels ───────────────────────────────────────── */
.panels-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) { .panels-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-title { font-size: 15px; font-weight: 700; }
.panel-body { padding: 20px; }

/* ── Table ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 10px 14px;
  font-size: 11.5px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 14px; font-size: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
tbody tr:hover td { background: rgba(255,255,255,0.02); }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.3px;
}
.badge::before {
  content: ''; width: 6px; height: 6px;
  border-radius: 50%; background: currentColor;
}
.badge-selesai { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-aktif   { background: rgba(99,102,241,0.15);  color: #818cf8; }
.badge-invalid { background: var(--danger-dim); color: #f87171; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: none; transition: all .18s;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #0b1a14;
}
.btn-primary:hover { opacity: .88; transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
}
.btn-ghost:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.btn-danger { background: var(--danger-dim); color: var(--danger); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-amber { background: var(--amber-dim); color: var(--amber); }
.btn-amber:hover { background: rgba(245,158,11,0.25); }

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  width: 100%; max-width: 460px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
  transform: translateY(16px);
  transition: transform .25s;
}
.modal-overlay.open .modal { transform: none; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  background: rgba(255,255,255,0.06); border: none;
  width: 32px; height: 32px; border-radius: 8px;
  color: var(--text-soft); cursor: pointer; font-size: 18px;
  transition: background .18s;
}
.modal-close:hover { background: var(--danger-dim); color: var(--danger); }

/* ── Kode Badge ────────────────────────────────────────── */
.kode-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-dim);
  border: 1px solid rgba(16,217,160,0.25);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 13px; font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px; font-family: monospace;
}

/* ── Chart container ───────────────────────────────────── */
.chart-wrap { height: 200px; position: relative; }

/* ── Empty state ───────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 50px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; }

/* ── Ranking list ──────────────────────────────────────── */
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
}
.rank-num {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 50%; background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}
.rank-num.gold   { background: rgba(245,158,11,0.2); color: var(--amber); }
.rank-num.silver { background: rgba(148,163,184,0.2); color: #94a3b8; }
.rank-num.bronze { background: rgba(180,120,80,0.2);  color: #cd7f32; }
.rank-name { flex: 1; font-size: 13.5px; font-weight: 600; }
.rank-kelas { font-size: 12px; color: var(--text-muted); }
.rank-score {
  font-size: 14px; font-weight: 800; color: var(--primary);
}

/* ── Toast ─────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: flex; align-items: center; gap: 10px;
  animation: slideUp .3s ease;
  max-width: 320px;
}
.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.error   { border-color: rgba(239,68,68,0.4); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ── Loader ────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loader {
  position: fixed; inset: 0; z-index: 999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
}
.page-loader .logo {
  font-size: 28px; font-weight: 900;
  background: linear-gradient(135deg, var(--primary), #7ee8cc);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
