/* Quant Academy — Shared Stylesheet */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --green: #3fb950;
  --blue: #58a6ff;
  --yellow: #d29922;
  --red: #f85149;
  --purple: #bc8cff;
  --phase1: #3fb950;
  --phase2: #58a6ff;
  --phase3: #bc8cff;
  --radius: 8px;
  --font-mono: 'Courier New', Courier, monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ─────────────────────────────────────────── */
.container { max-width: 860px; margin: 0 auto; padding: 32px 20px; }
.header { border-bottom: 1px solid var(--border); padding-bottom: 24px; margin-bottom: 32px; }
.header h1 { font-size: 1.6rem; font-weight: 700; }
.header .subtitle { color: var(--text-muted); margin-top: 4px; font-size: 0.95rem; }

/* ── Phase badges ────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-phase1 { background: rgba(63,185,80,0.15); color: var(--phase1); border: 1px solid rgba(63,185,80,0.3); }
.badge-phase2 { background: rgba(88,166,255,0.15); color: var(--phase2); border: 1px solid rgba(88,166,255,0.3); }
.badge-phase3 { background: rgba(188,140,255,0.15); color: var(--phase3); border: 1px solid rgba(188,140,255,0.3); }

/* ── Progress bar ────────────────────────────────────── */
.progress-section { margin-bottom: 32px; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.88rem; color: var(--text-muted); }
.progress-bar { height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.progress-fill.phase1 { background: var(--phase1); }
.progress-fill.phase2 { background: var(--phase2); }
.progress-fill.phase3 { background: var(--phase3); }
.progress-fill.overall { background: linear-gradient(90deg, var(--phase1), var(--phase2), var(--phase3)); }

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.card h2 { font-size: 1.15rem; margin-bottom: 12px; }
.card h3 { font-size: 1rem; margin-bottom: 8px; color: var(--blue); }

/* ── Lesson content ──────────────────────────────────── */
.lesson-body p { margin-bottom: 14px; }
.lesson-body ul, .lesson-body ol { padding-left: 22px; margin-bottom: 14px; }
.lesson-body li { margin-bottom: 6px; }
.lesson-body strong { color: #fff; }
.lesson-body em { color: var(--text-muted); font-style: normal; }
.callout {
  background: rgba(88,166,255,0.07);
  border-left: 3px solid var(--blue);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 16px 0;
  font-size: 0.95rem;
}
.callout.warning { background: rgba(210,153,34,0.07); border-color: var(--yellow); }
.callout.success { background: rgba(63,185,80,0.07); border-color: var(--green); }
.callout.danger  { background: rgba(248,81,73,0.07);  border-color: var(--red); }

/* ── Code blocks ─────────────────────────────────────── */
.code-block {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  white-space: pre;
}
.code-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom: none;
  padding: 4px 12px;
  border-radius: var(--radius) var(--radius) 0 0;
  display: inline-block;
  margin-bottom: -1px;
}
/* Simple syntax-like coloring */
.kw  { color: #ff7b72; }   /* keywords */
.fn  { color: #d2a8ff; }   /* functions */
.str { color: #a5d6ff; }   /* strings */
.cm  { color: #8b949e; }   /* comments */
.nm  { color: #79c0ff; }   /* numbers/names */
.op  { color: #ff7b72; }   /* operators */

/* ── Try it box ──────────────────────────────────────── */
.try-it {
  background: rgba(63,185,80,0.05);
  border: 1px solid rgba(63,185,80,0.25);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
}
.try-it h4 { color: var(--green); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.try-it p { font-size: 0.95rem; margin: 0; }

/* ── Quiz ────────────────────────────────────────────── */
.quiz { margin: 24px 0; }
.quiz h4 { font-size: 1rem; font-weight: 600; margin-bottom: 16px; color: var(--text); }
.quiz-q { margin-bottom: 20px; }
.quiz-q p { margin-bottom: 10px; font-size: 0.95rem; }
.quiz-option {
  display: block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.quiz-option:hover { border-color: var(--blue); background: rgba(88,166,255,0.07); }
.quiz-option.correct { border-color: var(--green); background: rgba(63,185,80,0.12); color: var(--green); }
.quiz-option.wrong   { border-color: var(--red);   background: rgba(248,81,73,0.10); color: var(--red); opacity: 0.7; }
.quiz-explanation { font-size: 0.85rem; color: var(--text-muted); margin-top: 8px; display: none; padding: 8px 12px; background: var(--surface); border-radius: 6px; }
.quiz-explanation.show { display: block; }

/* ── Stuck form ──────────────────────────────────────── */
.stuck-section { margin: 24px 0; }
.stuck-section h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--yellow); margin-bottom: 10px; }
.stuck-section textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.15s;
}
.stuck-section textarea:focus { outline: none; border-color: var(--yellow); }
.stuck-section textarea::placeholder { color: var(--text-muted); }
.stuck-btn {
  margin-top: 8px;
  background: transparent;
  border: 1px solid var(--yellow);
  color: var(--yellow);
  padding: 7px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}
.stuck-btn:hover { background: rgba(210,153,34,0.12); }
.stuck-saved { display: none; font-size: 0.82rem; color: var(--text-muted); margin-top: 6px; }
.stuck-saved.show { display: block; }

/* ── Complete button ─────────────────────────────────── */
.complete-section { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 16px; }
.complete-btn {
  background: var(--green);
  color: #000;
  border: none;
  padding: 11px 28px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.complete-btn:hover { opacity: 0.85; }
.complete-btn.done { background: var(--surface2); color: var(--green); border: 1px solid var(--green); cursor: default; }
.complete-status { font-size: 0.88rem; color: var(--text-muted); }

/* ── Nav links ───────────────────────────────────────── */
.lesson-nav { display: flex; justify-content: space-between; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }
.nav-btn {
  color: var(--blue);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 0;
  border: none;
  background: none;
  cursor: pointer;
  transition: color 0.15s;
}
.nav-btn:hover { color: #fff; }
.nav-btn.disabled { color: var(--text-muted); cursor: default; pointer-events: none; }

/* ── Index dashboard ─────────────────────────────────── */
.phase-section { margin-bottom: 36px; }
.phase-section h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.phase-section .phase-desc { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 16px; }

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}
.lesson-tile {
  aspect-ratio: 1;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  cursor: pointer;
}
.lesson-tile:hover { border-color: var(--blue); color: var(--text); }
.lesson-tile.complete  { background: rgba(63,185,80,0.12);  border-color: rgba(63,185,80,0.4);  color: var(--green);  }
.lesson-tile.has-notes { background: rgba(210,153,34,0.08); border-color: rgba(210,153,34,0.3); }
.lesson-tile .day-num  { font-size: 1.1rem; line-height: 1; margin-bottom: 2px; }
.lesson-tile .day-dot  { width: 6px; height: 6px; border-radius: 50%; margin-top: 4px; background: transparent; }
.lesson-tile.complete  .day-dot { background: var(--green); }
.lesson-tile.has-notes .day-dot { background: var(--yellow); }

/* ── Stuck notes panel (index) ───────────────────────── */
.notes-panel { margin-top: 32px; }
.notes-panel h3 { font-size: 1rem; margin-bottom: 12px; color: var(--yellow); }
.note-item { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px; margin-bottom: 8px; font-size: 0.88rem; }
.note-item .note-day { color: var(--yellow); font-weight: 600; margin-bottom: 4px; font-size: 0.82rem; }
.note-item .note-text { color: var(--text-muted); }
.no-notes { color: var(--text-muted); font-size: 0.88rem; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 600px) {
  .container { padding: 20px 14px; }
  .lesson-grid { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
}
