/* Python B02 Course - Shared Stylesheet */
:root {
  --bg: #fafaf8;
  --text: #1a1a1a;
  --muted: #666;
  --accent: #2563eb;
  --accent-light: #dbeafe;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --error: #dc2626;
  --error-bg: #fee2e2;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --code-bg: #1e1e2e;
  --code-text: #cdd6f4;
  --border: #e5e7eb;
  --card: #ffffff;
  --serif: Georgia, 'Times New Roman', serif;
  --mono: 'Fira Code', 'Cascadia Code', Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Typography */
h1 { font-size: 2rem; line-height: 1.2; margin-bottom: 0.5rem; color: var(--text); }
h2 { font-size: 1.4rem; margin-top: 2.5rem; margin-bottom: 0.75rem; color: var(--text); border-bottom: 2px solid var(--border); padding-bottom: 0.3rem; }
h3 { font-size: 1.1rem; margin-top: 1.5rem; margin-bottom: 0.5rem; color: var(--accent); font-family: var(--sans); }
p { margin-bottom: 1rem; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: 0.3rem; }
strong { color: var(--text); }
a { color: var(--accent); text-decoration: underline; }

/* Lesson header */
.lesson-header {
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  background: var(--accent-light);
  border-radius: 0 8px 8px 0;
}
.lesson-header .lesson-num {
  font-family: var(--sans);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
}
.lesson-header h1 { font-size: 1.7rem; margin-top: 0.25rem; }
.lesson-header .subtitle { color: var(--muted); font-size: 0.95rem; font-family: var(--sans); margin-top: 0.25rem; }

/* Code blocks */
pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 1rem 0 1.25rem;
}
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: #f0f0f0;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  color: #c0392b;
}
pre code { background: none; color: inherit; padding: 0; font-size: inherit; }

/* Syntax highlighting colors */
.kw  { color: #cba6f7; } /* keywords: def, if, for, etc */
.fn  { color: #89b4fa; } /* function names */
.str { color: #a6e3a1; } /* strings */
.num { color: #fab387; } /* numbers */
.cm  { color: #6c7086; } /* comments */
.var { color: #cdd6f4; } /* variables */
.op  { color: #89dceb; } /* operators */

/* Callout boxes */
.callout {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin: 1.25rem 0;
  font-family: var(--sans);
  font-size: 0.95rem;
}
.callout.info { background: var(--accent-light); border-left: 4px solid var(--accent); }
.callout.tip  { background: var(--success-bg); border-left: 4px solid var(--success); }
.callout.warn { background: var(--warning-bg); border-left: 4px solid var(--warning); }
.callout-title { font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem; }
.callout.info .callout-title { color: var(--accent); }
.callout.tip  .callout-title { color: var(--success); }
.callout.warn .callout-title { color: var(--warning); }

/* Table */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-family: var(--sans); font-size: 0.9rem; }
th { background: var(--accent); color: white; padding: 0.6rem 0.8rem; text-align: left; }
td { padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--border); }
tr:nth-child(even) td { background: #f8f8f8; }

/* Quiz section */
.quiz-section {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0;
}
.quiz-section h2 { border: none; margin-top: 0; }
.quiz-score {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.question-block { margin-bottom: 1.75rem; }
.question-text {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.97rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}
.question-text .q-num {
  display: inline-block;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  width: 1.5rem;
  height: 1.5rem;
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.5rem;
  margin-right: 0.5rem;
}

.options { display: flex; flex-direction: column; gap: 0.5rem; }
.option-btn {
  font-family: var(--sans);
  font-size: 0.9rem;
  text-align: left;
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}
.option-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-light); }
.option-btn.correct { border-color: var(--success); background: var(--success-bg); color: var(--success); font-weight: 600; }
.option-btn.wrong   { border-color: var(--error); background: var(--error-bg); color: var(--error); }
.option-btn.reveal  { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.option-btn:disabled { cursor: default; }
.feedback {
  font-family: var(--sans);
  font-size: 0.88rem;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 5px;
  display: none;
}
.feedback.show { display: block; }
.feedback.correct { background: var(--success-bg); color: var(--success); }
.feedback.wrong   { background: var(--error-bg); color: var(--error); }

/* Drills section */
.drills-section {
  background: #fffbeb;
  border: 2px solid #fcd34d;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0;
}
.drills-section h2 { border: none; margin-top: 0; color: #92400e; }

.drill-block {
  background: white;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.drill-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.drill-badge {
  background: #d97706;
  color: white;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}
.drill-title { font-family: var(--sans); font-weight: 600; font-size: 0.95rem; }
.drill-task { font-family: var(--sans); font-size: 0.9rem; margin-bottom: 0.75rem; color: #374151; }
.drill-task code { font-size: 0.85em; }

.reveal-btn {
  font-family: var(--sans);
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  background: #d97706;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background 0.15s;
}
.reveal-btn:hover { background: #b45309; }
.drill-answer {
  margin-top: 0.75rem;
  display: none;
}
.drill-answer.show { display: block; }
.drill-answer pre { margin: 0; }
.drill-hint {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
  font-style: italic;
}

/* Nav footer */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 0.9rem;
}
.nav-link { color: var(--accent); text-decoration: none; }
.nav-link:hover { text-decoration: underline; }

/* Ask teacher callout */
.ask-teacher {
  background: #f0fdf4;
  border: 1.5px dashed var(--success);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-top: 2.5rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: #166534;
}
.ask-teacher strong { display: block; margin-bottom: 0.25rem; }

/* Progress bar */
.progress-bar {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}
.progress-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border);
}
.progress-dot.done { background: var(--success); }
.progress-dot.current { background: var(--accent); }

@media print {
  .quiz-section, .drills-section { break-inside: avoid; }
  .reveal-btn, .option-btn { print-color-adjust: exact; }
}

@media (max-width: 600px) {
  body { font-size: 16px; padding: 1rem; }
  h1 { font-size: 1.5rem; }
}
