/* ============================================================
   STYLE.CSS — Core Styles
   Ultra-premium Python Learning Platform
   ============================================================ */

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Colors */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --secondary: #10b981;
  --accent: #f59e0b;
  --danger: #ef4444;
  --warning: #f97316;
  --info: #0ea5e9;

  /* Dark theme (default) */
  --bg-base: #0a0a0f;
  --bg-surface: #111118;
  --bg-card: #16161f;
  --bg-elevated: #1e1e2e;
  --bg-overlay: rgba(0,0,0,0.8);

  --text-primary: #f0f0ff;
  --text-secondary: #a0a0b8;
  --text-muted: #606078;
  --text-accent: #818cf8;

  --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --glass: rgba(255,255,255,0.03);
  --glass-hover: rgba(255,255,255,0.06);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 30px rgba(99,102,241,0.3);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-width: 260px;
  --topbar-height: 64px;
}

/* Light theme */
[data-theme="light"] {
  --bg-base: #f8f9ff;
  --bg-surface: #ffffff;
  --bg-card: #f1f5f9;
  --bg-elevated: #e2e8f0;
  --bg-overlay: rgba(255,255,255,0.9);

  --text-primary: #0f0f1a;
  --text-secondary: #4a4a6a;
  --text-muted: #8888aa;
  --text-accent: #6366f1;

  --border: rgba(0,0,0,0.07);
  --border-hover: rgba(0,0,0,0.12);
  --glass: rgba(255,255,255,0.7);
  --glass-hover: rgba(255,255,255,0.9);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
  --shadow-glow: 0 0 30px rgba(99,102,241,0.15);
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ─── Typography ─────────────────────────────────────────────── */
h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: clamp(1.2rem, 2vw, 1.75rem); font-weight: 600; }
h4 { font-size: 1.25rem; font-weight: 600; }
h5 { font-size: 1.1rem; font-weight: 600; }
h6 { font-size: 1rem; font-weight: 600; }
p { line-height: 1.8; }
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-light); }
code { font-family: var(--font-mono); font-size: 0.9em; }

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Layout ─────────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr;
  min-height: 100vh;
}

.app-layout.sidebar-collapsed {
  grid-template-columns: 72px 1fr;
}

/* ─── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  grid-row: 1 / -1;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: var(--transition-slow);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-height);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow);
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

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

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 12px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(139,92,246,0.1));
  color: var(--primary-light);
  border: 1px solid rgba(99,102,241,0.2);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

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

.xp-display {
  padding: 12px;
  background: var(--glass);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.xp-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.xp-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.xp-bar {
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin-top: 6px;
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #fbbf24);
  border-radius: var(--radius-full);
  transition: width 1s ease;
}

/* ─── Topbar ──────────────────────────────────────────────────── */
.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(20px);
}

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  flex: 1;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  width: 280px;
  transition: var(--transition);
}

.topbar-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
  width: 320px;
}

.topbar-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  width: 100%;
  font-family: var(--font-sans);
}

.topbar-search input::placeholder { color: var(--text-muted); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--glass);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-size: 1rem;
}

.icon-btn:hover {
  background: var(--glass-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(249,115,22,0.2), rgba(234,88,12,0.1));
  border: 1px solid rgba(249,115,22,0.3);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--warning);
}

/* ─── Main Content ────────────────────────────────────────────── */
.main-content {
  overflow-y: auto;
  height: calc(100vh - var(--topbar-height));
  padding: 0;
}

.page {
  display: none;
  padding: 32px;
  max-width: 1400px;
  margin: 0 auto;
  animation: fadeInUp 0.3s ease;
}

.page.active { display: block; }

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

/* ─── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-glass {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
}

.card-gradient {
  border: none;
  position: relative;
  overflow: hidden;
}

.card-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.05));
  z-index: 0;
}

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-family: var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 14px rgba(99,102,241,0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.5);
}

.btn-secondary {
  background: var(--glass);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--glass-hover);
  border-color: var(--border-hover);
}

.btn-success {
  background: linear-gradient(135deg, var(--secondary), #059669);
  color: white;
  box-shadow: 0 4px 14px rgba(16,185,129,0.3);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
}

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md); justify-content: center; }

/* ─── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-primary { background: rgba(99,102,241,0.15); color: var(--primary-light); border: 1px solid rgba(99,102,241,0.2); }
.badge-success { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.2); }
.badge-warning { background: rgba(245,158,11,0.15); color: #fde68a; border: 1px solid rgba(245,158,11,0.2); }
.badge-danger { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.2); }
.badge-info { background: rgba(14,165,233,0.15); color: #7dd3fc; border: 1px solid rgba(14,165,233,0.2); }
.badge-expert { background: rgba(217,70,239,0.15); color: #e879f9; border: 1px solid rgba(217,70,239,0.2); }

/* ─── Progress Bars ───────────────────────────────────────────── */
.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.primary { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.progress-fill.success { background: linear-gradient(90deg, var(--secondary), #34d399); }
.progress-fill.accent { background: linear-gradient(90deg, var(--accent), #fbbf24); }

.progress-circle {
  position: relative;
  display: inline-block;
}

.progress-circle svg { transform: rotate(-90deg); }
.progress-circle-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

/* ─── Stats Cards ─────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient, linear-gradient(90deg, var(--primary), #8b5cf6));
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat-icon { font-size: 1.5rem; }
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }
.stat-change { font-size: 0.75rem; color: var(--secondary); }

/* ─── Code Blocks ─────────────────────────────────────────────── */
.code-block {
  background: #0d1117;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 16px 0;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.code-lang {
  font-size: 0.75rem;
  color: #7d8590;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.code-dots {
  display: flex;
  gap: 6px;
}

.code-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.code-dots span:nth-child(1) { background: #ff5f57; }
.code-dots span:nth-child(2) { background: #febc2e; }
.code-dots span:nth-child(3) { background: #28c840; }

.code-body {
  padding: 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.8;
  color: #e6edf3;
}

.code-body pre { margin: 0; }

.copy-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #7d8590;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-sans);
}

.copy-btn:hover { background: rgba(255,255,255,0.1); color: white; }

/* ─── Tabs ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  overflow-x: auto;
}

.tab {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  white-space: nowrap;
}

.tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.tab:hover:not(.active) {
  background: var(--glass-hover);
  color: var(--text-primary);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeInUp 0.2s ease; }

/* ─── Timeline ────────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--primary), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 32px;
}

.timeline-dot {
  position: absolute;
  left: -27px;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: var(--bg-base);
  z-index: 1;
}

.timeline-dot.completed {
  background: var(--secondary);
  border-color: var(--secondary);
}

.timeline-dot.current {
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(99,102,241,0.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(99,102,241,0.2); }
  50% { box-shadow: 0 0 0 8px rgba(99,102,241,0.1); }
}

/* ─── Toast Notifications ─────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.hiding { animation: slideOutRight 0.3s ease forwards; }

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(120%); opacity: 0; }
}

.toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.toast-msg { flex: 1; font-size: 0.875rem; font-weight: 500; }
.toast.success { border-left: 3px solid var(--secondary); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
.toast.warning { border-left: 3px solid var(--warning); }

/* ─── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  z-index: 1;
}

.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 12px; justify-content: flex-end; }

/* ─── Search Results ──────────────────────────────────────────── */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 500;
  max-height: 400px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
}

.search-result-item:hover { background: var(--glass-hover); }
.search-result-item:last-child { border-bottom: none; }

/* ─── Flashcard ───────────────────────────────────────────────── */
.flashcard-container {
  perspective: 1000px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  height: 300px;
  cursor: pointer;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard.flipped { transform: rotateY(180deg); }

.flashcard-front, .flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  border: 1px solid var(--border);
}

.flashcard-front {
  background: var(--bg-card);
}

.flashcard-back {
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.05));
  transform: rotateY(180deg);
  border-color: rgba(99,102,241,0.2);
}

/* ─── Heatmap ─────────────────────────────────────────────────── */
.heatmap {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  gap: 2px;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--border);
  transition: var(--transition);
  cursor: pointer;
}

.heatmap-cell:hover { transform: scale(1.3); }
.heatmap-cell.level-1 { background: rgba(16,185,129,0.2); }
.heatmap-cell.level-2 { background: rgba(16,185,129,0.4); }
.heatmap-cell.level-3 { background: rgba(16,185,129,0.6); }
.heatmap-cell.level-4 { background: rgba(16,185,129,0.9); }

/* ─── Achievement Badges ──────────────────────────────────────── */
.achievement-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition);
  text-align: center;
}

.achievement-badge.earned {
  border-color: rgba(245,158,11,0.3);
  background: linear-gradient(135deg, rgba(245,158,11,0.05), rgba(251,191,36,0.03));
}

.achievement-badge:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.badge-icon { font-size: 2.5rem; }
.badge-title { font-size: 0.8rem; font-weight: 600; }
.badge-desc { font-size: 0.7rem; color: var(--text-muted); }

.achievement-badge.locked {
  opacity: 0.4;
  filter: grayscale(1);
}

/* ─── Quiz Styles ─────────────────────────────────────────────── */
.quiz-option {
  padding: 16px 20px;
  background: var(--glass);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

.quiz-option:hover {
  border-color: var(--primary);
  background: rgba(99,102,241,0.05);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: rgba(99,102,241,0.1);
}

.quiz-option.correct {
  border-color: var(--secondary);
  background: rgba(16,185,129,0.1);
}

.quiz-option.incorrect {
  border-color: var(--danger);
  background: rgba(239,68,68,0.1);
}

.option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ─── Phase Cards ─────────────────────────────────────────────── */
.phase-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.phase-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.phase-card-header {
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.phase-card-body { padding: 20px 24px 24px; }

.phase-number {
  font-size: 4rem;
  font-weight: 900;
  opacity: 0.08;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  line-height: 1;
}

/* ─── Note Editor ─────────────────────────────────────────────── */
.note-editor {
  width: 100%;
  min-height: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.8;
  resize: vertical;
  transition: var(--transition);
  outline: none;
}

.note-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* ─── Pomodoro Timer ──────────────────────────────────────────── */
.pomodoro-display {
  font-size: 6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--primary-light), #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  line-height: 1;
}

.pomodoro-ring {
  position: relative;
  display: inline-block;
}

.pomodoro-ring svg {
  transform: rotate(-90deg);
}

.pomodoro-ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

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

.interview-card-q {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.interview-card-q:hover { background: var(--glass); }

.interview-card-a {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s ease;
  color: var(--text-secondary);
  line-height: 1.8;
}

.interview-card.open .interview-card-a {
  max-height: 500px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.interview-card .chevron {
  transition: transform 0.3s ease;
}

.interview-card.open .chevron { transform: rotate(180deg); }

/* ─── Grid Layouts ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.grid-auto-sm { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }

/* ─── Syntax Highlighting ─────────────────────────────────────── */
.token-keyword { color: #ff79c6; }
.token-string { color: #f1fa8c; }
.token-comment { color: #6272a4; font-style: italic; }
.token-function { color: #50fa7b; }
.token-number { color: #bd93f9; }
.token-operator { color: #ff79c6; }
.token-decorator { color: #ffb86c; }
.token-class { color: #8be9fd; }
.token-builtin { color: #ff79c6; }

/* ─── Animations ──────────────────────────────────────────────── */
.animate-float {
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.animate-glow {
  animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(99,102,241,0.3); }
  50% { box-shadow: 0 0 40px rgba(99,102,241,0.6); }
}

.animate-slide-up {
  animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

.animate-count {
  animation: countUp 1s ease forwards;
}

/* ─── Confetti ────────────────────────────────────────────────── */
.confetti-piece {
  position: fixed;
  width: 8px;
  height: 8px;
  top: -20px;
  z-index: 9999;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ─── Loading Screen ──────────────────────────────────────────── */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-base);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  transition: opacity 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  font-size: 4rem;
  animation: float 2s ease-in-out infinite;
}

.loading-text {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), #c4b5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loading-bar {
  width: 200px;
  height: 3px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  border-radius: var(--radius-full);
  animation: loadingBar 1.5s ease forwards;
}

@keyframes loadingBar {
  from { width: 0%; }
  to { width: 100%; }
}

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .app-layout { grid-template-columns: 72px 1fr; }
  .sidebar { width: 72px; }
  .logo-text, .nav-item span, .nav-badge, .nav-section-title, .xp-display { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-icon { width: auto; }
  .sidebar-footer { padding: 8px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -72px;
    z-index: 200;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.mobile-open { left: 0; width: var(--sidebar-width); }
  .sidebar.mobile-open .logo-text,
  .sidebar.mobile-open .nav-item span,
  .sidebar.mobile-open .nav-section-title { display: block; }
  .sidebar.mobile-open .nav-item { justify-content: flex-start; }
  .main-content { grid-column: 1; }
  .page { padding: 20px 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  h1 { font-size: 2rem; }
}

@media (min-width: 1600px) {
  .page { max-width: 1600px; }
  .grid-4 { grid-template-columns: repeat(5, 1fr); }
}

/* ─── Utility Classes ─────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-primary { color: var(--primary-light); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--secondary); }
.text-warning { color: var(--accent); }
.text-danger { color: var(--danger); }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rounded { border-radius: var(--radius-md); }
.rounded-full { border-radius: var(--radius-full); }
.w-full { width: 100%; }
.opacity-50 { opacity: 0.5; }
.cursor-pointer { cursor: pointer; }
.hidden { display: none !important; }
.visible { display: block !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ─── Gradient Text ───────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, var(--primary-light), #c4b5fd, #f0abfc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-green {
  background: linear-gradient(135deg, #34d399, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Section Headers ─────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state-desc { font-size: 0.875rem; }

/* ─── Divider ─────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ─── Chip/Tag ────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: default;
}
