/* ============================================================
   pages/course-detail.html 样式（P0-4-T17 自动外联）
   ============================================================ */
  :root {
    --bg-page:    #fafbfc;
    --bg-card:    #ffffff;
    --bg-soft:    #eff6ff;
    --text-primary:   #1f2937;
    --text-secondary: #475569;
    --text-muted:     #6b7280;
    --text-hint:      #cbd5e1;
    --border:      #e5e7eb;
    --border-soft: #f1f5f9;
    --accent:        #3b82f6;
    --accent-hover:  #2563eb;
    --accent-soft:   #60a5fa;
    --accent-fade:   rgba(59,130,246,0.10);
    --success:     #16a34a;
    --warning:     #f59e0b;
  }
  body { background: var(--bg-page); }
  /* 顶栏（.topbar/.wordmark/.nav-item/.login-btn/.user-menu 等）统一由
     topbar.9a2859cf.css + topbar.js 注入提供，本页不再保留私有副本，避免漂移 */
  .footer {
    max-width: 1240px; margin: 0 auto;
    padding: 24px 32px 40px;
    display: flex; justify-content: space-between; align-items: center;
    color: var(--text-muted); font-size: 12px;
    border-top: 1px solid var(--border-soft);
  }
  .footer .build { letter-spacing: 0.16em; }

  @media (max-width: 720px) {
    .footer { padding: 20px 24px; }
    .course-detail { padding: 0 20px 40px; }
  }

  /* ============================================================
     课程详情正文（v3 课程列表页重构时曾从共享 course.css 丢失，
     此处按旧版浅色设计恢复，token 与本文件 :root 对齐）
     ============================================================ */

  /* 加载 / 错误 / 空状态 */
  .course-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-muted);
    text-align: center;
  }
  .course-empty .icon { font-size: 64px; opacity: 0.4; margin-bottom: 16px; }
  .course-empty .msg { font-size: 15px; color: var(--text-secondary); margin: 0 0 6px; }
  .course-empty .hint { font-size: 13px; }

  /* 列表异步加载占位（资料 / 评论） */
  .al-loading { text-align: center; color: var(--text-muted); padding: 24px 0; font-size: 13px; }

  .course-detail {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 32px 60px;
  }
  .course-detail .crumb {
    padding: 24px 0 8px;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.04em;
  }
  .course-detail .crumb a { color: var(--text-secondary); text-decoration: none; }
  .course-detail .crumb a:hover { color: var(--accent); }
  .course-detail .head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px 0 24px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 24px;
  }
  .course-detail .head .type-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-self: start;
    align-self: flex-start;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--accent);
    background: var(--accent-fade);
    border-radius: 999px;
  }
  /* 防止 course 列表页轮播的裸 .dot 样式泄漏到 meta 分隔符 */
  .course-detail .head .meta .dot {
    width: auto; height: auto;
    border-radius: 0;
    background: none;
    cursor: default;
    padding: 0;
    color: var(--text-hint);
  }
  /* type-pill 内的价格小徽章（JS 内联了 position:static） */
  .course-detail .head .price-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    line-height: 1.6;
  }
  .course-detail .head .price-tag.free { background: rgba(34,197,94,0.95); color: #fff; }
  .course-detail .head .price-tag.unlocked { background: rgba(99,102,241,0.95); color: #fff; }
  .course-detail .head .price-tag.paid {
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: #fff;
  }
  .course-detail .head h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
  }
  .course-detail .head .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
  }
  .course-detail .head .summary {
    margin: 12px 0 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 780px;
  }
  .course-detail .head .summary + .summary { margin-top: 10px; }
  .course-detail .head .summary strong {
    color: var(--text-primary);
    font-weight: 600;
    margin-right: 4px;
  }

  /* 视频课程布局 */
  .video-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 28px;
    align-items: start;
  }
  .video-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(15,23,42,0.18);
  }
  .video-player video { width: 100%; height: 100%; display: block; }
  .video-empty {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #94a3b8; font-size: 14px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    flex-direction: column;
  }
  .video-empty .ic { font-size: 64px; margin-bottom: 12px; display: block; }

  .lesson-title { margin: 18px 0 4px; font-size: 18px; font-weight: 600; color: var(--text-primary); }
  .lesson-sub { font-size: 13px; color: var(--text-muted); }

  /* 章节目录 */
  .chapters-panel {
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
  }
  .chapters-panel .ph {
    padding: 12px 14px 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-soft);
    display: flex; justify-content: space-between; align-items: center;
  }
  .chapters-panel .ph .badge {
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--text-hint);
    font-weight: 400;
    text-transform: none;
  }
  .chapter { border-bottom: 1px solid var(--border-soft); }
  .chapter:last-child { border-bottom: 0; }
  .chapter-head {
    padding: 12px 14px 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex; justify-content: space-between; align-items: baseline;
  }
  .chapter-head .num { font-size: 11px; font-weight: 500; color: var(--text-muted); }
  .lessons { padding: 4px 6px 10px; list-style: none; margin: 0; }
  .lesson {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    user-select: none;
  }
  .lesson:hover { background: var(--bg-soft); color: var(--text-primary); }
  .lesson.active {
    background: var(--accent-fade);
    color: var(--accent);
    font-weight: 500;
  }
  .lesson.disabled { cursor: not-allowed; color: var(--text-hint); }
  .lesson .idx {
    flex-shrink: 0;
    width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px;
    background: var(--bg-soft);
    color: var(--text-muted);
    border-radius: 50%;
  }
  .lesson.active .idx { background: var(--accent); color: #fff; }
  .lesson .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lesson .lock { font-size: 11px; color: var(--text-hint); }
  .chapters-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
  }

  /* 图文正文 */
  .article-body {
    max-width: 780px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 40px 56px;
    /* 显式基础文字色：否则 li 等未单独设色的元素会继承 main.css 的深色主题近白色 */
    color: var(--text-primary);
  }
  .article-body p { margin: 0 0 14px; font-size: 15px; line-height: 1.85; color: var(--text-primary); }
  .article-body h1, .article-body h2, .article-body h3 {
    margin: 28px 0 12px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
  }
  .article-body h1 { font-size: 24px; padding-bottom: 8px; border-bottom: 1px solid var(--border-soft); }
  .article-body h2 { font-size: 20px; }
  .article-body h3 { font-size: 17px; }
  .article-body strong { font-weight: 600; color: var(--text-primary); }
  .article-body em { color: var(--text-secondary); }
  .article-body code {
    font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
    font-size: 0.88em;
    padding: 2px 6px;
    background: var(--bg-soft);
    border-radius: 4px;
    color: #be185d;
  }
  .article-body pre {
    margin: 16px 0;
    padding: 14px 18px;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.7;
  }
  .article-body pre code { background: transparent; color: inherit; padding: 0; font-size: inherit; }
  .article-body ul, .article-body ol { margin: 0 0 14px; padding-left: 24px; }
  .article-body li { margin-bottom: 6px; line-height: 1.75; }
  .article-body blockquote {
    margin: 16px 0;
    padding: 10px 18px;
    border-left: 3px solid var(--accent);
    background: var(--bg-soft);
    color: var(--text-secondary);
    border-radius: 0 8px 8px 0;
  }
  .article-body hr { border: 0; border-top: 1px dashed var(--border); margin: 24px 0; }
  .article-body a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-fade);
  }
  .article-body a:hover { border-bottom-color: var(--accent); }

  /* 详情页内的解锁提示卡 */
  .unlock-cta {
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 32px;
    background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(249,115,22,0.08));
    border: 1px solid rgba(245,158,11,0.22);
    border-radius: 14px;
    text-align: center;
  }
  .unlock-cta .ic { font-size: 36px; }
  .unlock-cta h3 { margin: 8px 0 6px; font-size: 18px; color: var(--text-primary); }
  .unlock-cta p { margin: 0 0 16px; font-size: 14px; color: var(--text-secondary); }
  .unlock-cta .actions { display: inline-flex; gap: 12px; }
  .unlock-cta .btn {
    padding: 10px 24px; font-size: 14px; font-family: inherit; font-weight: 500;
    border-radius: 8px; cursor: pointer; transition: all 0.15s ease; border: 1px solid transparent;
  }
  .unlock-cta .btn-primary { color: #fff; background: linear-gradient(135deg, #f59e0b, #f97316); }
  .unlock-cta .btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
  .unlock-cta .btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
  .unlock-cta .btn-ghost { color: var(--text-secondary); background: #fff; border-color: var(--border); }
  .unlock-cta .btn-ghost:hover { background: var(--bg-soft); }

  /* 右侧二级 Tab */
  .right-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
  }
  .right-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-soft);
    background: var(--bg-soft);
  }
  .right-tabs .rt {
    flex: 1;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  }
  .right-tabs .rt:hover { color: var(--text-primary); background: rgba(59,130,246,0.04); }
  .right-tabs .rt.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: #fff;
  }
  .rt-pane { padding: 8px 0; overflow-y: auto; flex: 1; }
  .rt-pane[hidden] { display: none; }
  .rt-pane > .chapters-panel { background: transparent; }

  /* 评论模块 */
  .comments-section { padding: 14px 16px 18px; }
  .comment-form {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-soft);
    margin-bottom: 16px;
    overflow: hidden;
  }
  .comment-form textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.6;
    color: var(--text-primary);
    background: transparent;
    border: 0;
    outline: none;
    resize: vertical;
    min-height: 60px;
    box-sizing: border-box;
  }
  .comment-form textarea:focus { background: #fff; }
  .comment-form-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-top: 1px solid var(--border-soft);
    background: #fff;
  }
  .comment-form-foot .hint { font-size: 12px; color: var(--text-muted); }
  .comment-form-foot .hint a { color: var(--accent); text-decoration: none; }
  .btn-submit {
    padding: 6px 16px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
  }
  .btn-submit:hover:not(:disabled) { background: var(--accent-hover); }
  .btn-submit:disabled { opacity: 0.45; cursor: not-allowed; }

  .comment-list { display: flex; flex-direction: column; gap: 12px; }
  .comment-item {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    transition: border-color 0.15s ease;
  }
  .comment-item:hover { border-color: var(--border); }
  .c-avatar {
    flex-shrink: 0;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-fade);
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    border-radius: 50%;
    overflow: hidden;
  }
  .c-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .c-body { flex: 1; min-width: 0; }
  .c-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
  .c-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
  .c-time { font-size: 11px; color: var(--text-muted); }
  .c-content {
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-secondary);
    word-break: break-word;
    white-space: pre-wrap;
  }
  .comment-empty {
    padding: 36px 12px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-soft);
    border: 1px dashed var(--border);
    border-radius: 10px;
  }

  /* 课程资料（附件） */
  .materials-section { padding: 14px 16px 18px; }
  .materials-list { display: flex; flex-direction: column; gap: 10px; }
  .material-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  }
  .material-item:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(59,130,246,0.10);
    transform: translateY(-1px);
  }
  .m-icon {
    flex-shrink: 0;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    background: var(--accent);
    border-radius: 8px;
    text-align: center;
    line-height: 1;
  }
  .m-icon[data-ext="doc"], .m-icon[data-ext="docx"]  { background: #2563eb; }
  .m-icon[data-ext="xls"], .m-icon[data-ext="xlsx"]  { background: #16a34a; }
  .m-icon[data-ext="ppt"], .m-icon[data-ext="pptx"]  { background: #ea580c; }
  .m-icon[data-ext="pdf"]                             { background: #dc2626; }
  .m-icon[data-ext="txt"]                             { background: #64748b; }
  .m-icon[data-ext="md"]                              { background: #475569; }
  .m-icon[data-ext="zip"], .m-icon[data-ext="rar"],
  .m-icon[data-ext="7z"], .m-icon[data-ext="tar"],
  .m-icon[data-ext="gz"]                              { background: #b45309; }
  .m-icon[data-ext="png"], .m-icon[data-ext="jpg"],
  .m-icon[data-ext="jpeg"], .m-icon[data-ext="gif"],
  .m-icon[data-ext="webp"], .m-icon[data-ext="svg"],
  .m-icon[data-ext="bmp"]                             { background: #0ea5e9; }
  .m-icon[data-ext="csv"], .m-icon[data-ext="json"],
  .m-icon[data-ext="xml"]                             { background: #7c3aed; }
  .m-body { flex: 1; min-width: 0; }
  .m-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
  }
  .m-meta { font-size: 11px; color: var(--text-muted); letter-spacing: 0.04em; }
  .m-download {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--accent);
    background: var(--accent-fade);
    border: 1px solid transparent;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.15s ease;
  }
  .m-download:hover { color: #fff; background: var(--accent); border-color: var(--accent); }
  .m-download .dl-icon { font-size: 11px; }
  .materials-empty {
    padding: 40px 16px;
    text-align: center;
    background: var(--bg-soft);
    border: 1px dashed var(--border);
    border-radius: 10px;
  }
  .materials-empty .ic { font-size: 40px; opacity: 0.4; margin-bottom: 8px; }
  .materials-empty .msg { font-size: 14px; color: var(--text-primary); font-weight: 500; margin-bottom: 4px; }
  .materials-empty .hint { font-size: 12px; color: var(--text-muted); }

  @media (max-width: 960px) {
    .video-layout { grid-template-columns: 1fr; }
    .chapters-panel { position: static; max-height: none; }
    .article-body { padding: 24px 20px; }
    .right-panel { position: static; max-height: none; }
    .rt-pane { max-height: 480px; }
  }
