/* ============================================================
   Data Analyst Interview Prep — chapter & component styles
   ============================================================ */

/* ---- Chapter layout ---- */
.chapter-container {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 20px 72px;
}

/* ---- Chapter navigation (top & bottom) ---- */
.chapter-nav-top,
.chapter-nav-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

.chapter-nav-bottom {
  margin-top: 44px;
  margin-bottom: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.nav-link.disabled { opacity: 0.45; pointer-events: none; }
.nav-link .nav-dir { color: var(--text-muted); font-size: 0.8rem; }

/* ---- Chapter header ---- */
.chapter-header {
  background: var(--grad-hero);
  color: #fff;
  border-radius: var(--radius);
  padding: 36px 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}

.chapter-header .chapter-kicker {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.chapter-header h1 {
  color: #fff;
  margin-bottom: 12px;
}

.chapter-header .chapter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chapter-header .meta-chip {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

/* ---- Learning objectives ---- */
.learning-objectives {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-bottom: 32px;
}

.learning-objectives h2 {
  font-size: 1.05rem;
  margin-bottom: 12px;
  color: var(--text);
}

.learning-objectives ul { margin-bottom: 0; }
.learning-objectives li { color: var(--text-light); }

/* ---- Content sections ---- */
.content-section {
  margin-bottom: 40px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.content-section:last-of-type { border-bottom: none; }

.content-section h2 {
  font-size: 1.45rem;
  margin-bottom: 14px;
}

.content-section h3 {
  font-size: 1.15rem;
  margin: 24px 0 10px;
}

.content-section p,
.content-section li {
  color: var(--text-light);
}

.content-section strong { color: var(--text); }

/* ---- Stability badges ---- */
.stability-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.stable-badge {
  background: color-mix(in srgb, var(--info) 15%, transparent);
  color: var(--info);
  border: 1px solid color-mix(in srgb, var(--info) 40%, transparent);
}

.volatile-badge {
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 42%, transparent);
}

/* ---- Callouts ---- */
.callout {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 20px 0;
  background: var(--surface);
}

.callout-icon { font-size: 1.2rem; line-height: 1.4; flex-shrink: 0; }

.callout-content { color: var(--text-light); }
.callout-content strong { color: var(--text); }
.callout-content p { margin-bottom: 0; }

.callout-warning { border-left: 4px solid var(--warning); background: color-mix(in srgb, var(--warning) 8%, var(--surface)); }
.callout-tip { border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.callout-note { border-left: 4px solid var(--info); background: color-mix(in srgb, var(--info) 8%, var(--surface)); }
.callout-realworld { border-left: 4px solid var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }

/* ---- Code blocks ---- */
pre {
  background: var(--code-bg);
  color: #e6e6e6;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0 0 1.5em;
  font-size: 0.9rem;
  line-height: 1.6;
}

pre code { background: none; padding: 0; font-size: inherit; }

code {
  background: var(--surface-2);
  color: var(--accent-light);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.88em;
}

/* ---- Data tables (JSON-driven) ---- */
.data-table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin: 20px 0;
}

.data-table-container .table-loading { color: var(--text-muted); font-style: italic; }

/* ---- Hands-on project ---- */
.hands-on-project {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin: 40px 0;
}

.hands-on-project h2 { font-size: 1.35rem; }

.project-brief { color: var(--text-light); margin-bottom: 18px; }

.project-steps h3 { font-size: 1rem; margin-bottom: 8px; }
.project-steps ol { color: var(--text-light); }

.solution-toggle {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.solution-toggle summary {
  cursor: pointer;
  padding: 14px 18px;
  background: var(--surface-2);
  font-weight: 700;
  color: var(--text);
  list-style-position: inside;
}

.solution-toggle summary:hover { background: var(--bg-elevated); }

.solution-content {
  padding: 20px 18px;
  border-top: 1px solid var(--border);
  color: var(--text-light);
}

/* ---- Key takeaways ---- */
.key-takeaways { margin: 40px 0; }

.takeaways-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.takeaway-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
}

.takeaway-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.takeaway-card p { color: var(--text-light); font-size: 0.93rem; margin-bottom: 0; }

/* ---- Quiz ---- */
.chapter-quiz {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin: 40px 0;
}

.quiz-question {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.quiz-question:last-of-type { border-bottom: none; }

.question-text {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

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

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-light);
  transition: background 0.12s ease, border-color 0.12s ease;
}

.quiz-option:hover { background: var(--surface-2); border-color: var(--border-strong); }

.quiz-option input { margin-top: 4px; accent-color: var(--primary); }

.quiz-feedback {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
}

.quiz-feedback.correct {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent-light);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

.quiz-feedback.incorrect {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: #ff8a87;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
}

.quiz-submit-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.quiz-submit-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }

.quiz-score {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  text-align: center;
  font-size: 1.05rem;
  color: var(--text);
  border: 1px solid var(--border);
}

.quiz-score strong { color: var(--accent-light); font-size: 1.2rem; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .chapter-nav-top, .chapter-nav-bottom { flex-direction: column; align-items: stretch; }
  .chapter-header { padding: 26px 20px; }
  .chapter-header h1 { font-size: 1.5rem; }
  .hands-on-project, .chapter-quiz { padding: 20px; }
}
