/* 课程大纲预览页：沿用站点 theme.css 的变量与品牌样式 */
@import url("./theme.css");

body {
  font-size: 16px;
}

/* 顶部滚动进度 */
.doc-progress {
  position: fixed;
  top: var(--topbar);
  left: 0;
  height: 3px;
  width: 0;
  z-index: 300;
  background: linear-gradient(90deg, #2f6fed, #0ea5a4 55%, #7c3aed);
  box-shadow: 0 0 12px rgba(47, 111, 237, 0.45);
  transition: width 0.08s linear;
}

.doc-layout {
  display: grid;
  grid-template-columns: 316px minmax(0, 1fr);
  gap: clamp(20px, 2.4vw, 36px);
  align-items: start;
}

/* 左侧目录 */
.doc-side {
  position: sticky;
  top: calc(var(--topbar) + 18px);
  max-height: calc(100vh - var(--topbar) - 36px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px) saturate(150%);
}

.doc-side__title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 4px 6px;
}

.doc-side__title strong {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.doc-side__title span {
  font-size: 13px;
  color: var(--muted);
}

.doc-search input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.92);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.doc-search input:focus {
  border-color: rgba(47, 111, 237, 0.45);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.1);
}

.doc-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.doc-filter {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  transition: all 0.18s ease;
}

.doc-filter:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.doc-filter[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(135deg, #17324d, #2f6fed);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(47, 111, 237, 0.24);
}

.doc-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
  scrollbar-width: thin;
}

.doc-list::-webkit-scrollbar {
  width: 6px;
}

.doc-list::-webkit-scrollbar-thumb {
  background: rgba(20, 33, 61, 0.16);
  border-radius: 99px;
}

.doc-item {
  display: grid;
  gap: 3px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.doc-item:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--line);
  transform: translateX(2px);
}

.doc-item[aria-current="true"] {
  background: linear-gradient(135deg, rgba(47, 111, 237, 0.1), rgba(14, 165, 164, 0.08));
  border-color: rgba(47, 111, 237, 0.22);
}

.doc-item__name {
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.45;
}

.doc-item__meta {
  font-size: 13.5px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 右侧正文 */
.doc-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 60px;
}

.doc-hero {
  padding: clamp(22px, 2.6vw, 34px);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(47, 111, 237, 0.1), transparent 55%),
    var(--card-solid);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
}

.doc-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  color: var(--a);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.doc-hero__eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: linear-gradient(90deg, var(--a), var(--b));
}

.doc-hero h1 {
  font-size: clamp(26px, 2.6vw, 38px);
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 800;
  margin-bottom: 8px;
}

.doc-hero__sub {
  font-size: 15px;
  color: var(--ink-3);
  margin-bottom: 18px;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.doc-meta__item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-2);
}

.doc-meta__item b {
  font-weight: 750;
  color: var(--ink);
}

.doc-meta__item i {
  font-style: normal;
  color: var(--muted);
  font-size: 13px;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.doc-source {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  word-break: break-all;
}

/* 章节 */
.doc-section {
  padding: clamp(20px, 2.2vw, 30px);
  border-radius: var(--radius);
  background: var(--card-solid);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
}

.doc-section + .doc-section {
  margin-top: 0;
}

.doc-section__head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.doc-num {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 45%),
    linear-gradient(135deg, #1b3a5c, #2f6fed);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 8px 18px rgba(47, 111, 237, 0.22);
  position: relative;
  overflow: hidden;
}

.doc-num::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.45) 48%, transparent 62%);
  transform: translateX(-120%);
  transition: transform 0.6s ease;
}

.doc-section:hover .doc-num::after {
  transform: translateX(120%);
}

.doc-section__title {
  font-size: clamp(19px, 1.6vw, 23px);
  font-weight: 750;
  line-height: 1.45;
  letter-spacing: -0.005em;
  padding-top: 6px;
}

.doc-section__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.doc-p {
  font-size: 16px;
  line-height: 1.95;
  color: var(--ink-2);
  max-width: 82ch;
  white-space: pre-wrap;
}

.doc-sub {
  margin-left: 54px;
  padding: 18px 20px;
  border-left: 2px solid rgba(47, 111, 237, 0.18);
  border-radius: 0 14px 14px 0;
  background: rgba(247, 250, 255, 0.7);
}

.doc-sub .doc-section__title {
  font-size: 17.5px;
  padding-top: 0;
}

.doc-sub .doc-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 11.5px;
  background: linear-gradient(135deg, rgba(47, 111, 237, 0.85), rgba(14, 165, 164, 0.85));
  box-shadow: none;
}

/* 表格 */
.doc-table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #fff;
  scrollbar-width: thin;
}

.doc-table-wrap::-webkit-scrollbar {
  height: 8px;
}

.doc-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(20, 33, 61, 0.18);
  border-radius: 99px;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.7;
  min-width: 100%;
}

.doc-table th,
.doc-table td {
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
  min-width: 84px;
}

.doc-table th:last-child,
.doc-table td:last-child {
  border-right: 0;
}

.doc-table tr:last-child td {
  border-bottom: 0;
}

.doc-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef3fb;
  color: var(--ink);
  font-weight: 750;
}

.doc-table tbody tr:nth-child(even) td {
  background: rgba(247, 250, 255, 0.6);
}

.doc-table tbody tr:hover td {
  background: rgba(47, 111, 237, 0.05);
}

.doc-table td.is-empty {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(20, 33, 61, 0.035),
    rgba(20, 33, 61, 0.035) 1px,
    transparent 1px,
    transparent 8px
  );
}

.doc-table td.is-mark {
  text-align: center;
  color: var(--a);
  font-weight: 800;
  font-size: 16px;
}

.doc-table td.is-num {
  font-family: var(--mono);
  font-size: 13.5px;
  white-space: nowrap;
}

/* 空状态 / 加载 */
.doc-empty {
  padding: 60px 30px;
  text-align: center;
  border-radius: var(--radius);
  background: var(--card-solid);
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 16px;
}

.doc-loading {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

@media (max-width: 1080px) {
  .doc-layout {
    grid-template-columns: 1fr;
  }
  .doc-side {
    position: relative;
    top: 0;
    max-height: 420px;
  }
  .doc-sub {
    margin-left: 0;
  }
}

@media print {
  .app-topbar,
  .app-footer,
  .doc-side,
  .doc-progress,
  .doc-actions {
    display: none !important;
  }
  .doc-layout {
    grid-template-columns: 1fr;
  }
  .doc-section,
  .doc-hero {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }
  body {
    background: #fff;
  }
}

/* 首页模块卡片 */
.doc-modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.doc-module {
  display: grid;
  gap: 6px;
  text-align: left;
  padding: 22px 22px 20px;
  border-radius: 16px;
  background: var(--card-solid);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.doc-module:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(47, 111, 237, 0.22);
}

.doc-module__name {
  font-size: 17px;
  font-weight: 750;
  color: var(--ink);
}

.doc-module__count {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--a);
}

.doc-module__sample {
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
}
