/* ═══════════════════════════════════════════════════════
   SKD DRILLING APP — Premium Design System
   Inspired by Pahamify / Ruangguru
   ═══════════════════════════════════════════════════════ */

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

:root {
  --primary: #6C5CE7;
  --primary-dark: #5A4BD1;
  --primary-light: rgba(108,92,231,0.1);
  --secondary: #00B894;
  --secondary-dark: #00A381;
  --accent: #FD79A8;
  --warning: #FDCB6E;
  --danger: #E17055;
  --success: #00B894;
  --bg: #F8F9FE;
  --surface: #FFFFFF;
  --surface-2: #F1F2F6;
  --text: #2D3436;
  --text-secondary: #636E72;
  --text-muted: #B2BEC3;
  --border: #E8ECF1;
  --shadow-sm: 0 2px 8px rgba(108,92,231,0.06);
  --shadow-md: 0 8px 30px rgba(108,92,231,0.1);
  --shadow-lg: 0 20px 60px rgba(108,92,231,0.15);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --font: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --gradient: linear-gradient(135deg, #6C5CE7 0%, #a29bfe 100%);
  --gradient-warm: linear-gradient(135deg, #FD79A8 0%, #FDCB6E 100%);
  --gradient-cool: linear-gradient(135deg, #00B894 0%, #00CEC9 100%);
}

[data-theme="dark"] {
  --bg: #0D1117;
  --surface: #161B22;
  --surface-2: #21262D;
  --text: #E6EDF3;
  --text-secondary: #8B949E;
  --text-muted: #484F58;
  --border: #30363D;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 30px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
  --primary-light: rgba(108,92,231,0.15);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

/* ─── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: 280px; height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 100;
  display: flex; flex-direction: column;
  transition: var(--transition);
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .logo-icon {
  width: 44px; height: 44px;
  background: var(--gradient);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: white; font-weight: 800;
}

.sidebar-brand h1 {
  font-size: 1.1rem; font-weight: 800; color: var(--text);
  line-height: 1.2;
}

.sidebar-brand span { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }

.sidebar-nav { padding: 16px 12px; flex: 1; }

.nav-section-label {
  font-size: 0.7rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.5px;
  padding: 16px 12px 8px; margin-top: 8px;
}

.nav-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 16px;
  background: transparent; border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.9rem;
  font-weight: 600; cursor: pointer;
  transition: var(--transition); font-family: var(--font);
  text-align: left;
}

.nav-btn:hover { background: var(--primary-light); color: var(--primary); }
.nav-btn.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.nav-btn i { font-size: 1.1rem; width: 24px; text-align: center; }

.nav-btn .badge-count {
  margin-left: auto;
  background: var(--primary);
  color: white; font-size: 0.7rem;
  padding: 2px 8px; border-radius: 20px;
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}

.sidebar-footer .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gradient-warm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: white; font-size: 0.9rem;
}

.sidebar-footer .user-info { flex: 1; }
.sidebar-footer .user-info .name { font-weight: 700; font-size: 0.85rem; }
.sidebar-footer .user-info .role { font-size: 0.75rem; color: var(--text-secondary); }

#theme-toggle {
  background: transparent; border: 1px solid var(--border);
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary);
  font-size: 0.9rem; transition: var(--transition);
  font-family: var(--font);
}
#theme-toggle:hover { background: var(--primary-light); color: var(--primary); }

/* ─── MAIN CONTENT ────────────────────────────────────── */
.main { margin-left: 280px; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(248,249,254,0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex; align-items: center; justify-content: space-between;
}

[data-theme="dark"] .topbar { background: rgba(13,17,23,0.8); }

.topbar h2 { font-size: 1.3rem; font-weight: 800; }

.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px; width: 320px;
  transition: var(--transition);
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.search-box i { color: var(--text-muted); }
.search-box input {
  border: none; background: transparent; outline: none;
  font-family: var(--font); font-size: 0.9rem;
  color: var(--text); width: 100%;
}

.content { padding: 32px; }
.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

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

/* ─── DASHBOARD STATS ─────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px; margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex; align-items: center; gap: 16px;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 52px; height: 52px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: white;
}
.stat-icon.purple { background: var(--gradient); }
.stat-icon.green { background: var(--gradient-cool); }
.stat-icon.pink { background: var(--gradient-warm); }
.stat-icon.yellow { background: linear-gradient(135deg, #FDCB6E, #E17055); }

.stat-info h3 { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-info p { font-size: 0.8rem; color: var(--text-secondary); font-weight: 600; margin-top: 4px; }

/* ─── TRYOUT CARDS ────────────────────────────────────── */
.section-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 20px;
}
.section-header h3 { font-size: 1.2rem; font-weight: 800; }

.tryout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.tryout-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}
.tryout-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: var(--primary); }

.tryout-card-header {
  padding: 24px 24px 16px;
  position: relative;
}

.tryout-card-header .tryout-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-light); color: var(--primary);
  padding: 4px 12px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700;
  margin-bottom: 12px;
}

.tryout-card-header h4 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.tryout-card-header p { font-size: 0.8rem; color: var(--text-secondary); }

.tryout-card-stats {
  display: flex; gap: 16px; padding: 0 24px;
  margin-bottom: 16px;
}

.tryout-card-stats .ts {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.8rem; color: var(--text-secondary); font-weight: 600;
}
.tryout-card-stats .ts i { color: var(--primary); font-size: 0.85rem; }

.tryout-card-actions {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font); font-weight: 700;
  font-size: 0.85rem; border: none;
  cursor: pointer; transition: var(--transition);
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(108,92,231,0.3); }
.btn-secondary { background: var(--primary-light); color: var(--primary); }
.btn-secondary:hover { background: var(--primary); color: white; }
.btn-success { background: var(--secondary); color: white; }
.btn-success:hover { background: var(--secondary-dark); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 8px 14px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ─── QUIZ MODE ───────────────────────────────────────── */
.quiz-container { max-width: 900px; margin: 0 auto; }

.quiz-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex; align-items: center; justify-content: space-between;
}

.quiz-progress { flex: 1; margin: 0 24px; }
.quiz-progress-bar {
  height: 8px; background: var(--surface-2);
  border-radius: 10px; overflow: hidden;
}
.quiz-progress-fill {
  height: 100%; background: var(--gradient);
  border-radius: 10px; transition: width 0.5s ease;
}
.quiz-progress-text { font-size: 0.8rem; color: var(--text-secondary); font-weight: 600; margin-top: 6px; }

.quiz-timer {
  display: flex; align-items: center; gap: 8px;
  background: var(--primary-light); color: var(--primary);
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 1.1rem;
}

.quiz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.quiz-mapel-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 14px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700;
  margin-bottom: 16px;
}
.badge-twk { background: #EBF5FB; color: #2E86C1; }
.badge-tiu { background: #E8F8F5; color: #1ABC9C; }
.badge-tkp { background: #FDEDEC; color: #E74C3C; }
[data-theme="dark"] .badge-twk { background: rgba(46,134,193,0.15); }
[data-theme="dark"] .badge-tiu { background: rgba(26,188,156,0.15); }
[data-theme="dark"] .badge-tkp { background: rgba(231,76,60,0.15); }

.quiz-question {
  font-size: 1.05rem; font-weight: 600;
  line-height: 1.7; margin-bottom: 24px;
}

.quiz-options { display: flex; flex-direction: column; gap: 12px; }

.quiz-option {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px 20px;
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition);
  font-size: 0.95rem; line-height: 1.5;
}
.quiz-option:hover { border-color: var(--primary); background: var(--primary-light); }
.quiz-option.selected { border-color: var(--primary); background: var(--primary-light); }
.quiz-option.correct { border-color: var(--success); background: rgba(0,184,148,0.08); }
.quiz-option.wrong { border-color: var(--danger); background: rgba(225,112,85,0.08); }

.option-label {
  width: 32px; height: 32px; min-width: 32px;
  border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.85rem;
  color: var(--text-secondary); transition: var(--transition);
}
.quiz-option.selected .option-label { background: var(--primary); color: white; border-color: var(--primary); }
.quiz-option.correct .option-label { background: var(--success); color: white; border-color: var(--success); }
.quiz-option.wrong .option-label { background: var(--danger); color: white; border-color: var(--danger); }

.option-text { flex: 1; padding-top: 4px; }

.option-score {
  margin-left: auto; padding: 4px 10px;
  background: var(--warning); color: #2D3436;
  border-radius: 20px; font-size: 0.75rem;
  font-weight: 800; white-space: nowrap;
  display: none; min-width: 32px; text-align: center;
}
.quiz-option.show-score .option-score { display: inline-block; }

.pembahasan-box {
  margin-top: 24px; padding: 24px;
  background: linear-gradient(135deg, rgba(0,184,148,0.06), rgba(0,206,201,0.06));
  border: 1px solid rgba(0,184,148,0.2);
  border-radius: var(--radius-md);
  display: none;
}
.pembahasan-box.show { display: block; animation: fadeIn 0.4s ease; }
.pembahasan-box h5 {
  font-size: 0.85rem; font-weight: 800;
  color: var(--success); margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.pembahasan-box p { font-size: 0.9rem; line-height: 1.7; color: var(--text-secondary); }

.quiz-nav {
  display: flex; justify-content: space-between;
  align-items: center;
}

/* ─── SOAL NUMBER GRID ────────────────────────────────── */
.soal-nav-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 24px;
}

.soal-num-btn {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-weight: 700; font-size: 0.85rem;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font); color: var(--text-secondary);
}
.soal-num-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.soal-num-btn.answered { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.soal-num-btn.correct-mark { background: rgba(0,184,148,0.15); color: var(--success); border-color: var(--success); }
.soal-num-btn.wrong-mark { background: rgba(225,112,85,0.15); color: var(--danger); border-color: var(--danger); }

/* ─── MAPEL SELECTOR ──────────────────────────────────── */
.mapel-tabs {
  display: flex; gap: 12px;
  margin-bottom: 24px; flex-wrap: wrap;
}

.mapel-tab {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-weight: 700; font-size: 0.85rem;
  cursor: pointer; transition: var(--transition);
  font-family: var(--font); color: var(--text-secondary);
}
.mapel-tab:hover { border-color: var(--primary); color: var(--primary); }
.mapel-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ─── RESULT SCREEN ───────────────────────────────────── */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px; text-align: center;
  max-width: 600px; margin: 0 auto;
  box-shadow: var(--shadow-lg);
}

.result-emoji { font-size: 4rem; margin-bottom: 16px; }
.result-card h2 { font-size: 1.8rem; font-weight: 800; margin-bottom: 8px; }
.result-card .result-subtitle { color: var(--text-secondary); margin-bottom: 32px; }

.result-scores {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 16px; margin-bottom: 32px;
}

.result-score-item {
  padding: 20px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
}
.result-score-item .score-value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.result-score-item .score-label { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); margin-top: 4px; }

/* ─── EMPTY STATE ─────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state i { font-size: 3rem; color: var(--text-muted); margin-bottom: 16px; }
.empty-state h3 { font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }

/* ─── LOADING ─────────────────────────────────────────── */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; flex-direction: column; gap: 16px;
}
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── MOBILE RESPONSIVE ───────────────────────────────── */
.mobile-topbar { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); z-index: 200; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 150; }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0; }
  .mobile-topbar {
    display: flex; position: sticky; top: 0; z-index: 50;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 12px 16px; align-items: center; gap: 12px;
  }
  .mobile-topbar .hamburger {
    background: none; border: none; font-size: 1.3rem;
    color: var(--text); cursor: pointer; font-family: var(--font);
  }
  .mobile-topbar h2 { font-size: 1rem; font-weight: 800; }
  .topbar { display: none; }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .tryout-grid { grid-template-columns: 1fr; }
  .quiz-header { flex-wrap: wrap; gap: 12px; }
  .quiz-card { padding: 20px; }
  .result-scores { grid-template-columns: 1fr; }
}

/* ─── RAGU-RAGU FEATURE ──────────────────────────────── */
.ragu-mark {
  background: #fff3cd !important;
  color: #856404 !important;
  border-color: #ffeeba !important;
}
.ragu-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--warning);
  cursor: pointer;
  background: rgba(253, 203, 110, 0.1);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warning);
  transition: var(--transition);
}
.ragu-checkbox:hover {
  background: rgba(253, 203, 110, 0.2);
}
.ragu-checkbox input {
  accent-color: var(--warning);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ─── BKN SIMULATION MODE ────────────────────────────── */
body.bkn-mode {
  --font: 'Arial', sans-serif;
  --bg: #EAEAEA;
  --surface: #FFFFFF;
  --surface-2: #F0F0F0;
  --primary: #004D96;
  --primary-light: #E6F0FA;
  --border: #CCCCCC;
  --radius-sm: 4px;
  --radius-md: 4px;
  --radius-lg: 4px;
  --radius-xl: 4px;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
}
body.bkn-mode .sidebar { display: none !important; }
body.bkn-mode .main { margin-left: 0 !important; }
body.bkn-mode .topbar {
  background: #004D96 !important;
  color: white !important;
}
body.bkn-mode .topbar h2 { color: white !important; font-weight: normal; font-size: 1.1rem; }
body.bkn-mode .btn-exit-bkn { display: inline-flex !important; }
body.bkn-mode .quiz-header {
  background: #DDDDDD;
  border: 1px solid #999;
  border-radius: 0;
}
body.bkn-mode .quiz-timer {
  background: white;
  color: #D32F2F;
  border: 1px solid #999;
  border-radius: 0;
  font-family: monospace;
  font-size: 1.5rem;
  padding: 4px 12px;
}
body.bkn-mode .quiz-card {
  border: 1px solid #999;
  border-radius: 0;
  box-shadow: none;
}
body.bkn-mode .soal-num-btn {
  border-radius: 0;
  border: 1px solid #999;
}
body.bkn-mode .btn {
  border-radius: 0;
  text-transform: uppercase;
  font-weight: bold;
}

/* ─── STREAK BADGE 🔥 ─── */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(255, 159, 67, 0.1));
  border: 1px solid rgba(255, 107, 107, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  color: #ff9f43;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.1);
  transition: all 0.3s ease;
  user-select: none;
}
.streak-badge i {
  color: #ee5253;
  font-size: 1rem;
  animation: fireGlow 1.5s ease-in-out infinite alternate;
}
.streak-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.2);
  border-color: rgba(255, 107, 107, 0.4);
}

@keyframes fireGlow {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 1px #ff9f43) brightness(1);
  }
  100% {
    transform: scale(1.15) rotate(-3deg);
    filter: drop-shadow(0 0 8px #ee5253) brightness(1.2);
  }
}

/* ─── GROQ AI PREMIUM ECOSYSTEM STYLES ─── */
.ai-panel {
  margin-top: 24px;
  padding: 24px;
  background: var(--primary-light);
  border: 1.5px solid rgba(108, 92, 231, 0.2);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.4s ease;
}

[data-theme="dark"] .ai-panel {
  background: rgba(108, 92, 231, 0.08);
  border-color: rgba(108, 92, 231, 0.3);
}

.ai-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient);
}

.ai-panel-header {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.ai-btn {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid transparent;
  flex: 1;
  min-width: 140px;
}

/* Button variants styling */
.ai-btn-tutor {
  background: rgba(108, 92, 231, 0.1);
  color: var(--primary);
  border-color: rgba(108, 92, 231, 0.2);
}
.ai-btn-tutor:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.2);
}

.ai-btn-debat {
  background: rgba(225, 112, 85, 0.1);
  color: var(--danger);
  border-color: rgba(225, 112, 85, 0.2);
}
.ai-btn-debat:hover {
  background: var(--danger);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(225, 112, 85, 0.2);
}

.ai-btn-mnemonic {
  background: rgba(253, 121, 168, 0.1);
  color: var(--accent);
  border-color: rgba(253, 121, 168, 0.2);
}
.ai-btn-mnemonic:hover {
  background: var(--accent);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(253, 121, 168, 0.2);
}

.ai-cooldown {
  background: var(--surface-2) !important;
  color: var(--text-muted) !important;
  border-color: var(--border) !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
  opacity: 0.6;
}

.ai-response-box {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.4s ease;
  overflow: hidden;
}

.ai-response-header {
  padding: 12px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-response-content {
  padding: 20px;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text);
}

.ai-response-content p {
  margin-bottom: 12px;
}

.ai-response-content ul, .ai-response-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.ai-response-content li {
  margin-bottom: 6px;
}

.ai-response-content h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  margin: 18px 0 8px;
}

.ai-response-content h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  margin: 22px 0 10px;
}

.ai-loading {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
}

.ai-loading p {
  margin-top: 12px;
  color: var(--text-secondary);
}

.spinner-ai {
  border-top-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-light);
  display: inline-block;
}

.ai-error-box {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: rgba(225, 112, 85, 0.08);
  border: 1px solid rgba(225, 112, 85, 0.2);
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 16px;
}

/* GitHub Alert/Callout Styles for AI blockquotes */
.ai-blockquote {
  padding: 12px 18px;
  margin: 16px 0;
  border-left: 4px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.blockquote-note {
  border-left-color: #2f80ed;
  background: rgba(47, 128, 237, 0.05);
}

.blockquote-tip {
  border-left-color: #27ae60;
  background: rgba(39, 174, 96, 0.05);
}

.blockquote-important {
  border-left-color: #8e44ad;
  background: rgba(142, 68, 173, 0.05);
}

.blockquote-warning {
  border-left-color: #f39c12;
  background: rgba(243, 156, 18, 0.05);
}

.blockquote-caution {
  border-left-color: #c0392b;
  background: rgba(192, 57, 43, 0.05);
}

/* AI Evaluator Card */
.ai-evaluator-card {
  transition: var(--transition);
}
.ai-evaluator-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md) !important;
}

[data-theme="dark"] .ai-blockquote {
  background: rgba(255,255,255,0.02);
}

/* Responsive Premium Images for Soal, Opsi, and Pembahasan */
.quiz-question img,
.option-text img,
.pembahasan-text img,
.pembahasan-box p img,
.pembahasan-box img {
  max-width: 100%;
  height: auto !important;
  display: block;
  margin: 14px auto;
  border-radius: var(--radius-sm, 8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  background: #ffffff; /* In dark mode, transparent background formulas/images remain highly readable */
  padding: 8px;
  border: 1px solid var(--border);
}

/* Ensure images fit well in mobile screens */
@media (max-width: 768px) {
  .quiz-question img,
  .option-text img,
  .pembahasan-text img,
  .pembahasan-box img {
    margin: 8px auto;
    padding: 6px;
  }
}

/* AI Custom Query input container */
.ai-custom-query {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  background: var(--surface);
  padding: 8px;
  border-radius: var(--radius-md, 12px);
  border: 1.5px solid var(--border);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  align-items: center;
}

.ai-custom-query:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.ai-custom-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 8px 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none !important;
  box-shadow: none !important;
}

.ai-custom-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.ai-custom-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: var(--radius-sm, 8px);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.ai-custom-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(108, 92, 231, 0.25);
}

.ai-custom-btn:active {
  transform: translateY(0);
}

.ai-custom-btn:disabled,
.ai-custom-btn.ai-cooldown {
  background: var(--surface-2) !important;
  color: var(--text-muted) !important;
  border-color: var(--border) !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
  opacity: 0.7;
}

/* ─── STUDY MODE PREMIUM CUSTOM STYLES ─── */
.study-filter-card {
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.65) !important;
  border: 1px solid rgba(108, 92, 231, 0.15) !important;
  transition: var(--transition);
}
[data-theme="dark"] .study-filter-card {
  background: rgba(22, 27, 34, 0.65) !important;
  border-color: rgba(108, 92, 231, 0.25) !important;
}

.study-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  animation: fadeIn 0.4s ease;
  position: relative;
  overflow: hidden;
}

.study-card:hover {
  border-color: rgba(108, 92, 231, 0.3);
  box-shadow: var(--shadow-md);
}

.study-option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface-2);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 12px;
}

.study-option:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateX(4px);
}

.study-option.selected-correct {
  border-color: var(--success);
  background: rgba(0, 184, 148, 0.08);
}

.study-option.selected-wrong {
  border-color: var(--danger);
  background: rgba(225, 112, 85, 0.08);
}

.study-option.reveal-correct {
  border-color: var(--success);
  background: rgba(0, 184, 148, 0.04);
}

.study-reveal-btn {
  background: linear-gradient(135deg, var(--secondary) 0%, #00cec9 100%);
  color: white;
  border: none;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 184, 148, 0.25);
}

.study-reveal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
}

.study-progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 700;
}

.study-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-2);
  border-radius: 10px;
  overflow: hidden;
}

.study-progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 10px;
  transition: width 0.3s ease;
}

/* ─── ACTIVATION PAGE ─── */
.activation-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.activation-container {
  width: 100%;
  max-width: 480px;
  display: flex;
  justify-content: center;
}
.activation-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 480px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}
.activation-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: var(--gradient);
}
.activation-icon {
  width: 72px;
  height: 72px;
  background: var(--gradient);
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(108, 92, 231, 0.25);
  animation: keyGlow 2s infinite alternate;
}
.activation-card h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}
.activation-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 32px;
  line-height: 1.5;
}
.input-group {
  position: relative;
  margin-bottom: 16px;
  text-align: left;
}
.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  transition: var(--transition);
}
.input-group input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}
.input-group input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-light);
}
.input-group input:focus + .input-icon {
  color: var(--primary);
}
.activation-error {
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 20px;
  text-align: left;
  display: none;
  animation: shake 0.3s ease-in-out;
}
.activation-footer {
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.setup-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}
.setup-link:hover {
  text-decoration: underline;
}

@keyframes keyGlow {
  0% {
    transform: scale(1);
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.25);
  }
  100% {
    transform: scale(1.05);
    box-shadow: 0 8px 32px rgba(108, 92, 231, 0.45);
  }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}




