/* ── reset & base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary:    #1a73e8;
  --primary-dk: #1558b0;
  --accent:     #f4511e;
  --success:    #34a853;
  --bg:         #f1f3f6;
  --card-bg:    #ffffff;
  --text:       #202124;
  --muted:      #5f6368;
  --border:     #dadce0;
  --radius:     10px;
  --shadow:     0 1px 6px rgba(0,0,0,.10);
  --shadow-md:  0 3px 14px rgba(0,0,0,.13);
  --navbar-h:   52px;
  --sidebar-w:  220px;
}
body { font-family: "PingFang SC","Noto Sans SC",sans-serif; background: var(--bg); color: var(--text); }
a    { color: inherit; text-decoration: none; }

/* ── navbar ────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; gap: 16px;
  height: var(--navbar-h); padding: 0 20px;
  background: #fff; border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.nav-brand { font-size: 1.05rem; font-weight: 700; color: var(--primary); margin-right: 8px; flex-shrink: 0; }
.nav-series { display: flex; gap: 6px; }
.nav-tab {
  padding: 5px 12px; border-radius: 18px;
  font-size: .82rem; color: var(--muted);
  transition: background .15s, color .15s;
}
.nav-tab:hover { background: var(--bg); color: var(--text); }
.nav-spacer { flex: 1; }
.nav-reload {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 18px; font-size: .82rem;
  background: #e8f0fe; color: var(--primary); cursor: pointer;
  border: 1px solid #c5d8ff; transition: all .15s; flex-shrink: 0;
}
.nav-reload:hover { background: var(--primary); color: #fff; }

/* ── index page ────────────────────────────────────────────────────────── */
.page-index { max-width: 1400px; margin: 0 auto; padding: 24px 20px; }

.series-tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.tab-btn {
  padding: 8px 20px; border: 2px solid var(--border); border-radius: 24px;
  background: #fff; cursor: pointer; font-size: .92rem; font-weight: 500;
  color: var(--muted); transition: all .15s;
}
.tab-btn:hover { border-color: var(--primary); color: var(--primary); }
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab-btn .count {
  display: inline-block; margin-left: 6px;
  background: rgba(0,0,0,.12); border-radius: 10px;
  padding: 0 7px; font-size: .72rem;
}
.tab-btn.active .count { background: rgba(255,255,255,.3); }

.series-panel { display: none; }
.series-panel.active { display: block; }

.course-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
}
.course-card {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  transition: transform .15s, box-shadow .15s;
  display: flex; flex-direction: column;
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.card-thumb {
  width: 100%;
  min-height: 200px;
  overflow: hidden;
  background: #fff;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-placeholder {
  width: 100%; min-height: 200px;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; font-weight: 800; color: #d1d5db;
  background: #f9fafb;
}

/* key concepts — white card, clean typography, blue accent bar on top */
.card-concepts {
  width: 100%;
  min-height: 200px;
  padding: 0;
  display: flex; flex-direction: column;
  background: #fff;
  overflow: hidden;
  color: var(--text);
  border-top: 4px solid var(--primary);  /* thin accent bar only */
}
.card-concepts-inner {
  padding: 14px 16px 12px;
  display: flex; flex-direction: column; gap: 8px; flex: 1;
}
.card-concepts-title {
  font-size: 1rem; font-weight: 800; color: var(--primary);
  letter-spacing: .01em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.card-concept-tag {
  font-size: .88rem; color: #374151; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-concept-keywords {
  display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 6px;
}
.card-kw {
  font-size: .72rem; padding: 3px 9px; border-radius: 10px;
  background: #eff6ff; color: var(--primary);
  border: 1px solid #bfdbfe;
  font-weight: 600; white-space: nowrap;
}

/* card lower body — always white background, always dark text */
.card-body {
  padding: 12px 14px;
  flex: 1; display: flex; flex-direction: column; gap: 5px;
  background: #ffffff;                 /* explicit white */
}
.card-num  { font-size: .78rem; color: var(--muted); }
.card-title {
  font-size: 1rem; font-weight: 700; line-height: 1.45; flex: 1;
  color: var(--text);
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.card-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.badge { font-size: .68rem; padding: 2px 7px; border-radius: 10px; }
.badge-video { background: #e8f5e9; color: #2e7d32; }
.badge-txt   { background: #e3f2fd; color: #1565c0; }
.badge-img   { background: #fff3e0; color: #e65100; }
.badge-pdf   { background: #fce4ec; color: #880e4f; }

/* ── course page layout ─────────────────────────────────────────────────── */
.page-course {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--navbar-h));
}

/* sidebar */
.sidebar {
  border-right: 1px solid var(--border);
  background: #fff;
  overflow-y: auto;
  position: sticky; top: var(--navbar-h);
  height: calc(100vh - var(--navbar-h));
}
.sidebar-series-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 10;
}
.stab {
  flex: 1; padding: 9px 4px; border: none; background: none;
  font-size: .75rem; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; transition: all .15s;
}
.stab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.sidebar-list { padding: 4px 0; }
.sidebar-item {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 14px; font-size: .82rem; color: var(--text);
  border-left: 3px solid transparent; transition: background .1s;
}
.sidebar-item:hover   { background: var(--bg); }
.sidebar-item.current { border-left-color: var(--primary); background: #e8f0fe; color: var(--primary); font-weight: 600; }
.snum  { color: var(--muted); font-size: .72rem; min-width: 22px; }
.stitle { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* course main — FULL WIDTH, no max-width cap */
.course-main {
  padding: 28px 32px 48px;
  width: 100%;
  min-width: 0;
}

/* course header */
.course-header { margin-bottom: 22px; }
.course-series-tag {
  display: inline-block; background: var(--primary); color: #fff;
  font-size: .72rem; padding: 3px 10px; border-radius: 12px; margin-bottom: 8px;
}
.course-main h1 { font-size: 1.5rem; line-height: 1.4; }

/* ── TOP PANEL: video (left) + summary (right) ───────────────────────── */
.course-top {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
  margin-bottom: 32px;
  align-items: start;
}
.top-video-col video,
.top-video-col audio {
  width: 100%; border-radius: var(--radius);
  background: #000; box-shadow: var(--shadow-md);
  display: block;
}
.audio-fallback { margin-top: 8px; font-size: .82rem; }
.audio-fallback summary { cursor: pointer; color: var(--muted); }
.audio-fallback audio { width: 100%; margin-top: 6px; }

.top-summary-col {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  height: fit-content;
}
.top-summary-col h2 {
  font-size: .9rem; font-weight: 700; color: var(--primary);
  margin-bottom: 14px; letter-spacing: .02em;
  display: flex; align-items: center; gap: 6px;
}
.summary-list {
  list-style: none; display: flex; flex-direction: column; gap: 10px;
}
.summary-list li {
  font-size: .88rem; line-height: 1.65; padding-left: 18px; position: relative;
  color: var(--text);
}
.summary-list li::before {
  content: "▶"; position: absolute; left: 0;
  color: var(--primary); font-size: .65rem; top: 4px;
}

/* PDF bar */
.pdf-bar {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px;
  padding: 12px 16px; background: #fff8e1;
  border-radius: var(--radius); border-left: 4px solid #f9a825;
}
.pdf-bar-label { font-size: .78rem; color: var(--muted); align-self: center; margin-right: 4px; }
.pdf-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; background: #fff; border: 1px solid var(--border);
  border-radius: 6px; font-size: .82rem;
  transition: background .1s, border-color .1s;
}
.pdf-link:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

/* ── SECTION ROWS ────────────────────────────────────────────────────── */
.sections-label {
  font-size: .78rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 16px; margin-top: 4px;
}

.section-content-row {
  display: grid;
  grid-template-columns: minmax(320px, 44%) 1fr;
  gap: 0;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
/* image always on LEFT — no alternating */
.row-even { grid-template-columns: minmax(320px, 44%) 1fr; }

/* image column */
.section-image-col {
  position: relative;
  background: #0d1117;
  display: flex; flex-direction: column;
  min-height: 200px;
}
.section-image-col .img-viewport {
  flex: 1;
}

/* image placeholder */
.img-placeholder {
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px;
  background: #f8f9fa; border-right: 1px dashed var(--border);
  min-height: 220px;
}
/* placeholder always same style — image left */
.placeholder-icon { font-size: 2.2rem; opacity: .35; }
.placeholder-text { font-size: .82rem; color: var(--muted); text-align: center; line-height: 1.5; padding: 0 16px; }
.placeholder-text strong { display: block; font-size: .78rem; color: #94a3b8; margin-top: 4px; }

.img-viewport-label {
  font-size: .68rem; color: rgba(255,255,255,.55); padding: 4px 10px;
  background: rgba(0,0,0,.5); display: flex; align-items: center; gap: 4px;
  cursor: pointer;
}
.img-viewport-label:hover { color: #fff; background: rgba(0,0,0,.7); }

/* text column */
.section-text-col {
  padding: 24px 28px;
  display: flex; flex-direction: column; gap: 0;
  min-width: 0;
  border-left: 1px solid var(--border);
}
/* text col always has left border (image is always to its left) */

.section-heading {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 1.05rem; font-weight: 700; margin-bottom: 14px;
  color: var(--text); line-height: 1.4; padding-bottom: 12px;
  border-bottom: 2px solid var(--bg);
}
.section-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: .8rem; font-weight: 700;
  flex-shrink: 0; margin-top: 2px;
}

/* highlights */
.highlights-box {
  background: linear-gradient(135deg, #fffbeb, #fef9c3);
  border-left: 3px solid #f59e0b;
  border-radius: 0 6px 6px 0;
  padding: 10px 14px; margin-bottom: 14px;
}
.highlight-item {
  font-size: .88rem; line-height: 1.65; color: #78350f; margin-bottom: 8px;
  display: flex; gap: 6px;
}
.highlight-item::before { content: "💡"; flex-shrink: 0; }
.highlight-item:last-child { margin-bottom: 0; }

/* key points */
.key-points {
  list-style: none; display: flex; flex-direction: column; gap: 7px;
  margin-bottom: 14px;
}
.key-points li {
  font-size: .88rem; line-height: 1.6; padding-left: 16px; position: relative;
}
.key-points li::before {
  content: "·"; position: absolute; left: 3px; color: var(--primary);
  font-size: 1.3rem; line-height: 1;
}

/* case cards */
.cases-area { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.case-card {
  background: #f9fafb; border: 1px solid #e5e7eb;
  border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0;
  padding: 10px 14px;
}
.case-label {
  font-size: .72rem; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
}
.case-content { font-size: .86rem; line-height: 1.7; color: var(--text); }

/* full text */
.full-text-details { margin-top: 12px; }
.full-text-details summary {
  font-size: .8rem; color: var(--muted); cursor: pointer;
  padding: 6px 0; border-bottom: 1px dashed var(--border);
  display: flex; align-items: center; gap: 6px;
}
.full-text-details summary:hover { color: var(--primary); }
.full-text-body {
  margin-top: 10px; max-height: 500px; overflow-y: auto;
  font-size: .86rem; line-height: 1.85; color: var(--muted);
  padding: 14px 16px; background: #f8f9fa; border-radius: 6px;
}
.full-text-body p { margin-bottom: 10px; }

/* ── multi-part courses ─────────────────────────────────────────────── */
.part-block {
  margin-bottom: 40px;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.part-header {
  display: flex; align-items: center; gap: 12px;
  background: var(--primary); color: #fff; padding: 10px 20px;
}
.part-badge {
  font-size: .78rem; font-weight: 700;
  background: rgba(255,255,255,.25); padding: 3px 10px; border-radius: 12px;
}
.part-title { font-size: .95rem; font-weight: 600; }
.part-video-wrap { background: #000; }
.part-video-wrap video { width: 100%; display: block; }
.part-video-wrap audio { width: 100%; display: block; padding: 8px; }
.part-audio-fallback { padding: 8px 16px; background: #1a1a2e; }
.part-audio-fallback details summary { color: rgba(255,255,255,.6); font-size: .8rem; cursor: pointer; }
.part-audio-fallback audio { width: 100%; margin-top: 6px; }
.part-image-overview {
  padding: 12px 16px 4px; background: #0d1117;
}

/* raw fallback (no notes yet) */
.section-block { margin-bottom: 32px; }
.course-main h2 {
  font-size: 1rem; font-weight: 600; margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 2px solid var(--border);
}
.image-strip { display: flex; flex-direction: column; gap: 12px; }
.mindmap-img { max-width: 100%; border-radius: 8px; cursor: zoom-in; }
.case-block {
  border-left: 4px solid var(--accent); padding: 12px 16px;
  background: #fff; border-radius: 0 8px 8px 0;
  font-size: .88rem; line-height: 1.7;
}
.transcript-toggle { cursor: pointer; user-select: none; }
.transcript-body {
  max-height: 400px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 18px;
  font-size: .88rem; line-height: 1.8; color: var(--muted);
}
.transcript-body p { margin-bottom: 10px; }

/* ── lightbox ───────────────────────────────────────────────────────── */
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.92);
  align-items: center; justify-content: center;
  cursor: zoom-out; padding: 20px;
}
.lightbox-inner {
  position: relative; overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 16px 64px rgba(0,0,0,.7);
  cursor: default;
}
.lightbox-inner img {
  position: absolute; top: 0; left: 0; width: 100%;
}
.lightbox-close {
  position: fixed; top: 16px; right: 20px;
  color: rgba(255,255,255,.8); font-size: 1.5rem;
  cursor: pointer; z-index: 1001;
  background: rgba(0,0,0,.5); border-radius: 50%;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ── series page ────────────────────────────────────────────────────── */
.page-series { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: calc(100vh - var(--navbar-h)); }
.series-main { padding: 28px 32px; }
.series-header { margin-bottom: 24px; }
.series-tag { display: inline-block; background: var(--primary); color: #fff; font-size: .72rem; padding: 3px 10px; border-radius: 12px; margin-bottom: 8px; }
.series-header h1 { font-size: 1.5rem; }
.series-meta { margin-top: 8px; font-size: .88rem; color: var(--muted); display: flex; align-items: center; gap: 16px; }
.btn-knowledge { background: var(--accent); color: #fff; padding: 4px 14px; border-radius: 16px; font-size: .8rem; }
.series-knowledge-block { margin-bottom: 28px; background: var(--card-bg); padding: 18px 22px; border-radius: var(--radius); box-shadow: var(--shadow); }
.series-grid-section h2 { font-size: 1rem; margin-bottom: 14px; }
.done-dot { color: var(--success); font-size: .7rem; margin-left: 4px; }
.processed-badge { background: var(--success); color: #fff; font-size: .65rem; padding: 1px 5px; border-radius: 8px; margin-left: 4px; }

/* ── responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .course-top { grid-template-columns: 1fr; }
  .section-content-row,
  .row-even { grid-template-columns: 1fr; }
  .section-image-col { min-height: 280px; }
  .img-placeholder { min-height: 160px; }
}
@media (max-width: 768px) {
  .page-course { grid-template-columns: 1fr; }
  .course-main { padding: 16px; }
  .sidebar { position: relative; height: auto; max-height: 180px; }
  .course-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
}
