/* =============================================
   RESET & VARIABLES
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0f1117;
  --bg2:         #1a1d27;
  --bg3:         #222536;
  --surface:     #2a2d3e;
  --border:      #353850;
  --text:        #e2e4f0;
  --text-muted:  #8b8fa8;
  --text-dim:    #5a5e7a;
  --accent:      #6366f1;
  --accent-glow: rgba(99,102,241,0.25);
  --green:       #10b981;
  --amber:       #f59e0b;
  --red:         #ef4444;
  --blue:        #3b82f6;
  --purple:      #8b5cf6;
  --radius:      10px;
  --radius-lg:   16px;
  --sidebar-w:   260px;
  --topbar-h:    56px;
  --transition:  0.2s ease;
}

[data-theme="light"] {
  --bg:          #f8f9fc;
  --bg2:         #ffffff;
  --bg3:         #f1f3f9;
  --surface:     #e8eaf5;
  --border:      #d1d5e8;
  --text:        #1a1d2e;
  --text-muted:  #5a5e7a;
  --text-dim:    #9ea3c0;
  --accent-glow: rgba(99,102,241,0.12);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.6;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--transition);
  overflow: hidden;
  position: relative;
  z-index: 100;
}

.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-progress,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-item-title,
.sidebar.collapsed .nav-phase-title { display: none; }
.sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }
.sidebar.collapsed .nav-item { padding: 10px; justify-content: center; }
.sidebar.collapsed .nav-icon { margin-right: 0; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 22px; }
.logo-text { font-weight: 700; font-size: 15px; white-space: nowrap; }

.sidebar-toggle {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 18px; padding: 4px 6px;
  border-radius: 6px; transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--surface); color: var(--text); }

.sidebar-progress {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.progress-label {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-muted);
  margin-bottom: 6px;
}
.progress-bar {
  height: 4px; background: var(--surface); border-radius: 4px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 4px; transition: width 0.4s ease;
  width: 0%;
}

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.nav-phase { margin-bottom: 4px; }

.nav-phase-title {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 10px 14px 4px;
  color: var(--text-dim);
  white-space: nowrap;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 0;
  transition: background var(--transition);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: var(--surface); }
.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-icon { font-size: 16px; flex-shrink: 0; }
.nav-item-title { font-size: 13px; flex: 1; }
.nav-check { font-size: 12px; color: var(--green); flex-shrink: 0; }

/* =============================================
   MAIN
   ============================================= */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
  flex-shrink: 0;
  z-index: 10;
}

.menu-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: 18px; cursor: pointer; padding: 6px;
  border-radius: 6px;
  display: none;
}
.menu-btn:hover { background: var(--surface); color: var(--text); }

.topbar-title {
  flex: 1; font-weight: 600; font-size: 16px;
}

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

.btn-ghost {
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); padding: 5px 12px;
  border-radius: 6px; cursor: pointer; font-size: 12px;
  transition: all var(--transition);
}
.btn-ghost:hover {
  background: var(--surface); color: var(--text);
  border-color: var(--accent);
}

/* VIEWS */
.view { display: none; flex: 1; overflow-y: auto; padding: 24px; }
.view.active { display: block; }

/* =============================================
   DASHBOARD
   ============================================= */
.dash-hero {
  background: linear-gradient(135deg, var(--bg2) 0%, var(--bg3) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.dash-hero::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 200px; height: 200px;
  background: var(--accent-glow);
  border-radius: 50%;
  filter: blur(60px);
}
.dash-hero-sub {
  font-size: 13px; color: var(--text-muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.dash-hero-title {
  font-size: 28px; font-weight: 800; margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.dash-hero-desc { color: var(--text-muted); font-size: 14px; max-width: 600px; }

.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-value {
  font-size: 28px; font-weight: 800;
  color: var(--accent);
}
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

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

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

.phase-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.phase-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.phase-card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 14px;
}
.phase-color-dot {
  width: 10px; height: 10px;
  border-radius: 50%; flex-shrink: 0; margin-top: 5px;
}
.phase-card-info { flex: 1; }
.phase-card-title { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.phase-card-weeks { font-size: 11px; color: var(--text-muted); }
.phase-card-progress { text-align: right; }
.phase-card-pct { font-size: 20px; font-weight: 800; }
.phase-card-done { font-size: 11px; color: var(--text-muted); }

.phase-progress-bar {
  height: 3px; background: var(--surface);
}
.phase-progress-fill {
  height: 100%; transition: width 0.4s ease;
}

.phase-modules {
  padding: 12px 20px 16px;
}
.phase-module-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: color var(--transition);
}
.phase-module-item:last-child { border-bottom: none; }
.phase-module-item:hover { color: var(--accent); }
.phase-module-icon { font-size: 16px; }
.phase-module-title { flex: 1; font-size: 13px; }
.phase-module-week { font-size: 11px; color: var(--text-muted); }
.phase-module-done { font-size: 13px; color: var(--green); }

/* =============================================
   MODULE VIEW
   ============================================= */
.module-header {
  display: flex; align-items: flex-start; gap: 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.module-icon-big { font-size: 48px; }
.module-header-info { flex: 1; }
.module-phase-badge {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  color: white;
}
.module-title { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.module-meta {
  display: flex; gap: 16px;
  font-size: 12px; color: var(--text-muted); margin-bottom: 10px;
}
.module-desc { color: var(--text-muted); font-size: 14px; max-width: 700px; }

.module-actions {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.btn-complete {
  padding: 10px 20px;
  background: var(--accent); color: white;
  border: none; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-complete:hover { opacity: 0.85; }
.btn-complete.done {
  background: var(--green);
}
.btn-sd {
  padding: 8px 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 12px;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-sd:hover { border-color: var(--accent); color: var(--accent); }

/* TABS */
.tabs {
  display: flex; gap: 2px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
  flex-wrap: nowrap;
}
.tab {
  padding: 8px 18px;
  background: none; border: none;
  color: var(--text-muted); font-size: 13px; font-weight: 500;
  cursor: pointer; border-radius: 6px;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.active { background: var(--accent); color: white; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* TOPICS */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.topic-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.topic-item:hover { border-color: var(--accent); }
.topic-item.checked { border-color: var(--green); background: rgba(16,185,129,0.05); }
.topic-check { font-size: 14px; flex-shrink: 0; margin-top: 1px; color: var(--text-dim); }
.topic-item.checked .topic-check { color: var(--green); }

/* LABS */
.labs-grid {
  display: grid;
  gap: 16px;
}
.lab-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}
.lab-card:hover { border-color: var(--accent); }
.lab-card.done-lab {
  border-color: var(--green);
  background: rgba(16,185,129,0.04);
}
.lab-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.lab-difficulty {
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  text-transform: uppercase;
}
.lab-difficulty.beginner { background: rgba(16,185,129,0.15); color: var(--green); }
.lab-difficulty.intermediate { background: rgba(245,158,11,0.15); color: var(--amber); }
.lab-difficulty.advanced { background: rgba(239,68,68,0.15); color: var(--red); }
.lab-title { font-weight: 700; font-size: 15px; flex: 1; }
.lab-done-badge { font-size: 18px; }
.lab-desc { color: var(--text-muted); font-size: 13px; line-height: 1.7; }
.lab-btn {
  margin-top: 14px;
  padding: 7px 16px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; font-size: 12px;
  transition: all var(--transition);
  display: inline-block;
}
.lab-btn:hover { border-color: var(--green); color: var(--green); }
.lab-card.done-lab .lab-btn { border-color: var(--border); color: var(--text-muted); }

/* RESOURCES */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.resource-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition);
}
.resource-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  color: var(--accent);
}
.resource-icon { font-size: 20px; }
.resource-title { font-size: 13px; font-weight: 500; }
.resource-arrow { margin-left: auto; color: var(--text-dim); }

/* INTERVIEW */
.interview-list { display: grid; gap: 10px; }
.interview-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.interview-item:hover { border-color: var(--accent); }
.interview-item.revealed { }
.interview-q {
  display: flex; align-items: flex-start; gap: 10px;
}
.interview-num {
  font-size: 11px; font-weight: 700;
  color: var(--accent); flex-shrink: 0; margin-top: 2px;
  min-width: 24px;
}
.interview-text { flex: 1; font-weight: 500; }
.interview-hint {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px;
  display: none;
}
.interview-item.revealed .interview-hint { display: block; }
.interview-toggle {
  font-size: 11px; color: var(--text-dim);
  margin-top: 4px; display: block; text-align: right;
}

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(700px, 95vw);
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

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

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 18px; cursor: pointer; padding: 4px 8px;
  border-radius: 6px; transition: all var(--transition);
}
.modal-close:hover { background: var(--surface); color: var(--text); }

.modal-body { padding: 24px; }

.sd-prompt {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px; margin-bottom: 20px;
  font-size: 15px; line-height: 1.7;
  color: var(--text);
}

.sd-hints-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); margin-bottom: 10px;
}

.hints-list { list-style: none; display: grid; gap: 8px; }
.hints-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  filter: blur(4px);
  transition: filter var(--transition);
  user-select: none;
}
.hints-list li:hover { filter: blur(0); color: var(--accent); }
.hints-list li.revealed { filter: blur(0); }

.sd-timer { margin-top: 20px; display: flex; align-items: center; gap: 16px; }
.btn-primary {
  padding: 10px 20px;
  background: var(--accent); color: white;
  border: none; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all var(--transition);
}
.btn-primary:hover { opacity: 0.85; }
.timer-display {
  font-size: 28px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

/* =============================================
   LEARN TAB
   ============================================= */

/* Reuse code-layout / code-section-nav from code tab */
.learn-layout .code-section-nav { padding-top: 8px; }

.learn-progress-row {
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.learn-progress-label { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 6px; }
.learn-progress-mini {
  height: 3px; background: var(--surface); border-radius: 3px; overflow: hidden;
}
.learn-progress-mini-fill {
  height: 100%; background: var(--green); border-radius: 3px; transition: width 0.4s;
}

.lesson-read-time { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

/* Lesson section */
.lesson-section { display: none; }
.lesson-section.active { display: block; }

.lesson-content { overflow-y: auto; }

.lesson-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  padding: 24px 32px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg2); z-index: 5;
}
.lesson-title-row { flex: 1; }
.lesson-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; line-height: 1.3; }
.lesson-time-badge {
  font-size: 11px; color: var(--text-muted);
  background: var(--surface); padding: 2px 10px; border-radius: 20px;
  display: inline-block;
}
.lesson-mark-btn {
  padding: 8px 16px;
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; font-size: 12px; font-weight: 600;
  transition: all var(--transition); white-space: nowrap; flex-shrink: 0;
}
.lesson-mark-btn:hover { border-color: var(--green); color: var(--green); }
.lesson-mark-btn.done { background: rgba(16,185,129,0.1); border-color: var(--green); color: var(--green); }

/* Lesson body content */
.lesson-body {
  padding: 28px 32px;
  max-width: 820px;
}

.lesson-p {
  font-size: 14.5px; line-height: 1.85;
  color: var(--text); margin-bottom: 18px;
}
.lesson-p em { color: var(--accent); font-style: italic; }
.lesson-p strong { color: var(--text); font-weight: 700; }
.lesson-p code {
  font-family: monospace; font-size: 12.5px;
  background: var(--surface); color: var(--accent);
  padding: 1px 6px; border-radius: 4px;
  border: 1px solid var(--border);
}

.lesson-h2 {
  font-size: 18px; font-weight: 800;
  margin: 32px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  color: var(--text);
}
.lesson-h3 {
  font-size: 15px; font-weight: 700;
  margin: 24px 0 10px; color: var(--text);
}

/* Inline code blocks within lessons */
.lesson-code-block {
  margin: 16px 0 20px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.lesson-code-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--bg3); border-bottom: 1px solid var(--border);
}
.lesson-code-header .code-filename { flex: 1; }

/* Callout boxes */
.lesson-callout {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 18px 0;
  border-left: 4px solid;
}
.callout-info    { background: rgba(59,130,246,0.08);  border-color: var(--blue);   }
.callout-warning { background: rgba(245,158,11,0.08);  border-color: var(--amber);  }
.callout-tip     { background: rgba(16,185,129,0.08);  border-color: var(--green);  }
.callout-gotcha  { background: rgba(239,68,68,0.08);   border-color: var(--red);    }
.callout-header {
  font-size: 13px; font-weight: 700; margin-bottom: 6px;
}
.callout-info .callout-header    { color: var(--blue); }
.callout-warning .callout-header { color: var(--amber); }
.callout-tip .callout-header     { color: var(--green); }
.callout-gotcha .callout-header  { color: var(--red); }
.callout-body { font-size: 13.5px; line-height: 1.7; color: var(--text-muted); }
.callout-body code {
  font-family: monospace; font-size: 12px;
  background: rgba(255,255,255,0.08); padding: 1px 5px; border-radius: 3px;
}

/* ASCII diagrams */
.lesson-diagram {
  margin: 18px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.diagram-pre {
  font-family: 'Cascadia Code', 'Fira Mono', 'JetBrains Mono', monospace;
  font-size: 12px; line-height: 1.5;
  background: #0d0f1a;
  color: #a8b2d8;
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0;
  white-space: pre;
}
[data-theme="light"] .diagram-pre {
  background: #f0f2ff;
  color: #3a3f6b;
}

/* Lists in lessons */
.lesson-list {
  list-style: none;
  padding: 0; margin: 10px 0 18px;
  display: grid; gap: 8px;
}
.lesson-list li {
  font-size: 14px; line-height: 1.7;
  color: var(--text-muted);
  padding-left: 20px; position: relative;
}
.lesson-list li::before {
  content: "▸";
  position: absolute; left: 0;
  color: var(--accent); font-size: 12px; top: 3px;
}
.lesson-list li strong { color: var(--text); }
.lesson-list li code {
  font-family: monospace; font-size: 12px;
  background: var(--surface); color: var(--accent);
  padding: 1px 5px; border-radius: 3px;
}

/* Comparison tables */
.lesson-table-wrap {
  overflow-x: auto; margin: 16px 0 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.lesson-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.lesson-table th {
  background: var(--bg3);
  text-align: left; padding: 10px 14px;
  font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.lesson-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: top;
  line-height: 1.5;
}
.lesson-table td:first-child { font-weight: 600; color: var(--accent); white-space: nowrap; }
.lesson-table tr:last-child td { border-bottom: none; }
.lesson-table tr:hover td { background: var(--surface); }

/* Lesson footer */
.lesson-footer {
  padding: 24px 32px 32px;
  border-top: 1px solid var(--border);
}
.lesson-next-btn {
  padding: 12px 24px;
  background: var(--accent); color: white;
  border: none; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all var(--transition);
}
.lesson-next-btn:hover { opacity: 0.85; }
.lesson-done-msg {
  font-size: 16px; font-weight: 700;
  color: var(--green); text-align: center;
  padding: 12px;
}

/* Mobile tweaks for lessons */
@media (max-width: 768px) {
  .lesson-body { padding: 20px 16px; }
  .lesson-header { padding: 16px; flex-direction: column; }
  .lesson-title { font-size: 18px; }
  .lesson-footer { padding: 16px; }
}

/* =============================================
   CODE EXAMPLES TAB
   ============================================= */

/* Layout: sticky section nav on left, scrollable content on right */
.code-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  min-height: 600px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg2);
}

.code-section-nav {
  border-right: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  height: calc(100vh - var(--topbar-h) - 200px);
  overflow-y: auto;
  background: var(--bg2);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.code-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  transition: all var(--transition);
  border-left: 3px solid transparent;
  position: relative;
}
.code-nav-item:hover { background: var(--surface); color: var(--text); }
.code-nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-left-color: var(--accent);
}
.code-nav-icon { font-size: 16px; flex-shrink: 0; }
.code-nav-title { font-size: 12px; font-weight: 500; line-height: 1.4; }

/* Content pane */
.code-content { padding: 0; overflow: hidden; }

.code-section { display: none; }
.code-section.active { display: block; }

.code-section-header {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg2); z-index: 5;
}
.code-section-icon { font-size: 24px; }
.code-section-title { font-size: 18px; font-weight: 700; }

/* Individual code example card */
.code-example {
  border-bottom: 1px solid var(--border);
  padding: 20px 24px 24px;
}
.code-example:last-child { border-bottom: none; }

.code-example-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 8px;
}
.code-example-meta { flex: 1; min-width: 0; }
.code-example-title {
  font-size: 15px; font-weight: 700;
  display: block; margin-bottom: 4px;
}
.code-filename {
  font-size: 11px; font-family: monospace;
  color: var(--accent); background: var(--accent-glow);
  padding: 2px 8px; border-radius: 4px;
  display: inline-block;
}
.code-example-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.code-lang-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 4px;
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border);
}

.code-copy-btn {
  font-size: 11px; font-weight: 600;
  padding: 4px 12px;
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; transition: all var(--transition);
  white-space: nowrap;
}
.code-copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.code-copy-btn.copied { border-color: var(--green); color: var(--green); }

.code-example-desc {
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 12px; line-height: 1.6;
}

/* Code block */
.code-block-wrapper {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.code-pre {
  margin: 0 !important;
  border-radius: 0 !important;
  font-size: 12.5px !important;
  line-height: 1.6 !important;
  overflow-x: auto;
  max-height: 500px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Override Prism background to match our theme */
[data-theme=""] .code-pre,
:not([data-theme]) .code-pre { background: #1d1f2e !important; }
[data-theme="light"] .code-pre { background: #f5f7ff !important; }

/* Notes section */
.code-notes {
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.code-notes-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent); margin-bottom: 8px;
}
.code-notes-list {
  list-style: none; display: grid; gap: 6px;
}
.code-notes-list li {
  font-size: 12.5px; color: var(--text-muted); line-height: 1.6;
  padding-left: 16px; position: relative;
}
.code-notes-list li::before {
  content: "→";
  position: absolute; left: 0;
  color: var(--accent); font-size: 11px;
}

/* =============================================
   UTILITY
   ============================================= */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
  .sidebar {
    position: fixed; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform var(--transition);
    z-index: 200;
    width: var(--sidebar-w) !important;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar.mobile-open .logo-text,
  .sidebar.mobile-open .sidebar-progress,
  .sidebar.mobile-open .nav-label,
  .sidebar.mobile-open .nav-item-title,
  .sidebar.mobile-open .nav-phase-title { display: unset; }
  .sidebar.mobile-open .nav-item { padding: 8px 14px; justify-content: unset; }
  .sidebar.mobile-open .nav-icon { margin-right: 0; }

  .menu-btn { display: block; }
  .main { margin-left: 0; }
  .module-header { flex-direction: column; }
  .module-actions { align-items: flex-start; flex-direction: row; }
  .dash-hero-title { font-size: 22px; }
  .code-layout { grid-template-columns: 1fr; }
  .code-section-nav {
    position: static; height: auto;
    border-right: none; border-bottom: 1px solid var(--border);
    display: flex; flex-wrap: wrap; padding: 8px;
  }
  .code-nav-item { border-left: none; border-bottom: 3px solid transparent; }
  .code-nav-item.active { border-bottom-color: var(--accent); border-left: none; }
}
