/* ===== 在线课程知识库排版系统 ===== */

.course-main {
  padding-top: 110px;
  min-height: 60vh;
}

.course-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 80px;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* ---------- 侧边目录 ---------- */
.course-side {
  position: sticky;
  top: 94px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  padding: 18px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.course-side::-webkit-scrollbar { width: 4px; }
.course-side::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.course-side-home {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 14px;
}
.course-side-home:hover { text-decoration: underline; }

.course-side-module {
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.course-side-module .csm-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 50px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.course-side-module h4 {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
}

.course-side-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.course-side-list a {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 7px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
  transition: background 0.2s, color 0.2s;
}

.course-side-list a:hover {
  background: var(--bg-alt);
  color: var(--text-primary);
}

.course-side-list li.current a {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.course-side-list .cs-no {
  flex-shrink: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 700;
}

.course-side-list li.current .cs-no { color: var(--primary); }

.course-side-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.course-side-nav a {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-decoration: none;
}
.course-side-nav a:hover { color: var(--primary); }

/* ---------- 正文 ---------- */
.lesson {
  max-width: 800px;
}

.lesson-crumb {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.lesson-crumb a { color: var(--text-secondary); text-decoration: none; }
.lesson-crumb a:hover { color: var(--primary); }
.lesson-crumb .sep { margin: 0 6px; }

.lesson-hero {
  padding-bottom: 24px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.lesson-stage {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 50px;
  background: var(--secondary-light);
  color: var(--secondary);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.lesson-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 6px;
}

.lesson-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
  margin-top: 10px;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.lesson-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 50px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ---------- 正文排版 ---------- */
.lesson-body h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 48px 0 18px;
  padding-left: 14px;
  border-left: 4px solid var(--primary);
  line-height: 1.4;
}

.lesson-body h3 {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 32px 0 12px;
}

.lesson-body h4 {
  font-size: 0.98rem;
  font-weight: 700;
  margin: 24px 0 10px;
  color: var(--text-primary);
}

.lesson-body p {
  font-size: 0.98rem;
  line-height: 1.9;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.lesson-body strong { font-weight: 700; }

.lesson-body ul, .lesson-body ol {
  margin: 0 0 18px 4px;
  padding-left: 22px;
}

.lesson-body li {
  font-size: 0.96rem;
  line-height: 1.85;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.lesson-body a {
  color: var(--primary);
  text-decoration: none;
}
.lesson-body a:hover { text-decoration: underline; }

.lesson-body blockquote {
  margin: 20px 0;
  padding: 14px 20px;
  border-left: 4px solid var(--secondary);
  background: var(--secondary-light);
  border-radius: 0 12px 12px 0;
  font-size: 0.95rem;
  line-height: 1.8;
  color: #115e59;
}

/* ---------- 提示框 ---------- */
.callout {
  margin: 24px 0;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid;
  font-size: 0.92rem;
  line-height: 1.8;
}

.callout .co-title {
  display: block;
  font-weight: 800;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.callout p { margin-bottom: 8px; font-size: 0.92rem; }
.callout p:last-child { margin-bottom: 0; }
.callout ul, .callout ol { margin-bottom: 0; }
.callout li { font-size: 0.9rem; }

.callout.tip {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.callout.tip .co-title { color: #15803d; }

.callout.warn {
  background: #fffbeb;
  border-color: #fde68a;
}
.callout.warn .co-title { color: #b45309; }

.callout.key {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.callout.key .co-title { color: var(--primary-dark); }

.callout.advanced {
  background: #faf5ff;
  border-color: #e9d5ff;
}
.callout.advanced .co-title { color: #7e22ce; }

/* ---------- 术语卡片 ---------- */
.concept {
  margin: 24px 0;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.concept .concept-term {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.concept p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 0;
}

/* ---------- 代码块 ---------- */
.codeblock {
  margin: 22px 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #1e293b;
  background: #0f172a;
}

.codeblock-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 16px;
  background: #1e293b;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.codeblock-head .copy-btn {
  all: unset;
  cursor: pointer;
  color: #94a3b8;
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 6px;
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  transition: color 0.2s, background 0.2s;
}

.codeblock-head .copy-btn:hover {
  color: #e2e8f0;
  background: rgba(255,255,255,0.08);
}

.codeblock pre {
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0;
}

.codeblock code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.75;
  color: #e2e8f0;
  white-space: pre;
}

.codeblock .cm { color: #64748b; }
.codeblock .kw { color: #93c5fd; }
.codeblock .str { color: #86efac; }
.codeblock .num { color: #fdba74; }

/* 行内代码 */
.lesson-body code:not(.codeblock code) {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary-dark);
  white-space: nowrap;
}

/* ---------- 表格 ---------- */
.lesson-table-wrap {
  overflow-x: auto;
  margin: 22px 0;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.lesson-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: var(--bg-card);
}

.lesson-body th {
  background: var(--bg-alt);
  text-align: left;
  padding: 11px 14px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.lesson-body td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  line-height: 1.7;
  vertical-align: top;
}

.lesson-body tr:last-child td { border-bottom: none; }
.lesson-body tr:hover td { background: var(--bg-alt); }

/* ---------- 流程图（纯文本） ---------- */
.flowbox {
  margin: 24px 0;
  padding: 20px 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6ff, #f0fdfa);
  border: 1px solid #bfdbfe;
  overflow-x: auto;
}

.flowbox pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.9;
  color: var(--text-primary);
  margin: 0;
  white-space: pre;
}

/* ---------- 目标 / 小结 / 练习 ---------- */
.objectives, .takeaways, .practice {
  margin: 0 0 28px;
  padding: 22px 24px;
  border-radius: 14px;
}

.objectives {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.objectives h2, .takeaways h2, .practice h2 {
  font-size: 1.02rem;
  font-weight: 800;
  margin: 0 0 12px;
  padding: 0;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.objectives h2 { color: var(--primary-dark); }

.objectives ul { margin-bottom: 0; }
.objectives li { color: #1e40af; font-size: 0.93rem; }

.takeaways {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.takeaways h2 { color: #15803d; }
.takeaways ul { margin-bottom: 0; }
.takeaways li { color: #166534; font-size: 0.93rem; }

.practice {
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.practice h2 { color: #b45309; }
.practice li { color: #92400e; font-size: 0.93rem; }
.practice ol, .practice ul { margin-bottom: 0; }

/* ---------- 上下节导航 ---------- */
.lesson-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 52px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.lesson-pager a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.lesson-pager a:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-hover);
}

.lesson-pager .lp-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.lesson-pager .lp-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.5;
}

.lesson-pager a.next { text-align: right; }

/* ---------- 模块概览页 ---------- */
.module-hero {
  max-width: 800px;
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.module-lessons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 800px;
}

.module-lesson-card {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 22px 24px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.module-lesson-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.mlc-no {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.mlc-body { flex: 1; min-width: 0; }

.mlc-body h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text-primary);
}

.module-lesson-card:hover .mlc-body h3 { color: var(--primary); }

.mlc-body p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
}

.mlc-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.mlc-meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- 移动端 ---------- */
.side-toggle {
  display: none;
  width: 100%;
  margin-bottom: 18px;
  padding: 13px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
}

@media (max-width: 968px) {
  .course-wrap {
    grid-template-columns: 1fr;
    gap: 0;
    padding-bottom: 60px;
  }
  .side-toggle { display: block; }
  .course-side {
    display: none;
    position: static;
    max-height: none;
    margin-bottom: 28px;
  }
  .course-side.side-open { display: block; }
  .lesson-hero h1 { font-size: 1.55rem; }
  .lesson-body h2 { font-size: 1.2rem; margin-top: 40px; }
  .lesson-pager { grid-template-columns: 1fr; }
  .lesson-pager a.next { text-align: left; }
  .catalog-module-head { flex-wrap: wrap; }
  .cm-meta { flex-direction: row; gap: 12px; }
}

/* ---------- 目录页目录列表 ---------- */
.catalog-stage {
  margin: 44px 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.catalog-stage .stage-tag {
  flex-shrink: 0;
  padding: 4px 14px;
  border-radius: 50px;
  background: var(--secondary-light);
  color: var(--secondary);
  font-size: 0.8rem;
  font-weight: 700;
}

.catalog-stage h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
}

.catalog-stage .stage-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.catalog-module {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.catalog-module-head {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.cm-no {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.cm-info { flex: 1; min-width: 0; }

.cm-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 3px;
}

.cm-info h3 a { color: var(--text-primary); text-decoration: none; }
.cm-info h3 a:hover { color: var(--primary); }

.cm-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

.cm-meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.cm-meta span {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.catalog-lessons {
  list-style: none;
  padding: 8px 0;
}

.catalog-lessons li { border-bottom: 1px solid var(--bg-alt); }
.catalog-lessons li:last-child { border-bottom: none; }

.catalog-lessons a {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 24px;
  text-decoration: none;
  transition: background 0.15s;
}

.catalog-lessons a:hover { background: var(--bg-alt); }

.cl-no {
  flex-shrink: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  width: 38px;
}

.cl-title {
  flex: 1;
  font-size: 0.92rem;
  color: var(--text-primary);
  line-height: 1.6;
}

.catalog-lessons a:hover .cl-title { color: var(--primary); }

.cl-dur {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}
