/* =========================================================
   Material Design 3 — 文档页专用样式
   ========================================================= */

/* ---------- 布局 ---------- */
.docs-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0;
  max-width: var(--md-layout-max-width);
  margin: 0 auto;
  padding-top: var(--md-top-app-bar-height);
  align-items: start;
}

/* ---------- 侧边导航 ---------- */
.docs-sidenav {
  position: sticky;
  top: var(--md-top-app-bar-height);
  height: calc(100vh - var(--md-top-app-bar-height));
  width: 280px;
  padding: 16px 12px 24px;
  overflow-y: auto;
  border-right: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
  flex-shrink: 0;
}

.docs-sidenav__search {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--md-comp-textfield-height);
  padding: 0 12px;
  margin-bottom: 8px;
  background: var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-extra-small);
  transition: background var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}
.docs-sidenav__search:focus-within {
  background: var(--md-sys-color-surface-container-highest);
}
.docs-sidenav__search .material-icons-round {
  font-size: 20px;
  color: var(--md-sys-color-on-surface-variant);
}
.docs-sidenav__search input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font: inherit;
  font-size: 15px;
  color: var(--md-sys-color-on-surface);
}
.docs-sidenav__search input::placeholder {
  color: var(--md-sys-color-on-surface-variant);
}
.docs-sidenav__kbd {
  font-family: "Roboto Mono", monospace;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-extra-small);
  padding: 1px 6px;
}

.docs-sidenav__nav { margin-top: 8px; }

.docs-sidenav__group { margin-bottom: 16px; }

.docs-sidenav__group-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1px;
  color: var(--md-sys-color-on-surface-variant);
  text-transform: uppercase;
  padding: 12px 16px 8px;
}

.docs-sidenav__link {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 16px;
  margin: 2px 0;
  border-radius: var(--md-sys-shape-corner-small);
  font-size: 14px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  position: relative;
  transition: background var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard),
              color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}
.docs-sidenav__link .material-icons-round { font-size: 20px; }
.docs-sidenav__link::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--md-sys-color-on-surface);
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}
.docs-sidenav__link:hover::before { opacity: var(--md-state-hover-opacity); }
.docs-sidenav__link:hover { color: var(--md-sys-color-on-surface); }
.docs-sidenav__link.active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.docs-sidenav__link.active .material-icons-round { color: var(--md-sys-color-on-secondary-container); }

.docs-sidenav__footer {
  margin-top: 24px;
  padding: 16px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.docs-sidenav__version {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
}
.docs-sidenav__version-label { color: var(--md-sys-color-on-surface-variant); }
.docs-sidenav__version-value { font-weight: 500; color: var(--md-sys-color-on-surface); }

.docs-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--md-sys-color-scrim);
  opacity: 0;
  z-index: 40;
  transition: opacity var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard);
  pointer-events: none;
}
.docs-scrim.open { pointer-events: auto; }

/* ---------- 主内容 ---------- */
.docs-main {
  min-width: 0;
  padding: 0 0 96px;
}

.docs-mobile-bar {
  display: none;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  background: var(--md-sys-color-surface);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  position: sticky;
  top: var(--md-top-app-bar-height);
  z-index: 10;
}
.docs-mobile-bar__title {
  font-size: 16px;
  font-weight: 500;
  flex: 1;
}

.docs-article {
  max-width: 840px;
  margin: 0 auto;
  padding: 48px 64px;
}

/* ---------- 页头 ---------- */
.docs-hero { margin-bottom: 56px; }

.docs-hero__breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 16px;
}
.docs-hero__breadcrumb a { color: inherit; }
.docs-hero__breadcrumb a:hover { color: var(--md-sys-color-primary); }
.docs-hero__breadcrumb .material-icons-round { font-size: 16px; }

.docs-hero__title {
  font-size: var(--md-sys-typescale-display-small-font);
  font-weight: var(--md-sys-typescale-display-small-weight);
  line-height: var(--md-sys-typescale-display-small-line-height);
  letter-spacing: -0.25px;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 16px;
}

.docs-hero__lead {
  font-size: var(--md-sys-typescale-body-large-font);
  line-height: 1.8;
  color: var(--md-sys-color-on-surface-variant);
  max-width: 640px;
}

.docs-hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.md-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-size: 12px;
  font-weight: 500;
}
.md-chip .material-icons-round { font-size: 16px; }

/* ---------- 章节 ---------- */
.docs-section {
  padding: 32px 0;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  scroll-margin-top: calc(var(--md-top-app-bar-height) + 24px);
}
.docs-section:first-of-type { padding-top: 0; }

.docs-section__title {
  font-size: var(--md-sys-typescale-headline-medium-font);
  font-weight: var(--md-sys-typescale-headline-medium-weight);
  line-height: var(--md-sys-typescale-headline-medium-line-height);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 12px;
  letter-spacing: -0.25px;
}

.docs-section__lead {
  font-size: var(--md-sys-typescale-body-large-font);
  line-height: 1.8;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 24px;
}

.docs-h3 {
  font-size: var(--md-sys-typescale-title-large-font);
  font-weight: var(--md-sys-typescale-title-large-weight);
  line-height: var(--md-sys-typescale-title-large-line-height);
  color: var(--md-sys-color-on-surface);
  margin: 32px 0 12px;
}

.docs-section p {
  font-size: var(--md-sys-typescale-body-large-font);
  line-height: 1.8;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 16px;
}

/* ---------- 列表 ---------- */
.docs-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}
.docs-list li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 10px;
  font-size: var(--md-sys-typescale-body-large-font);
  line-height: 1.7;
  color: var(--md-sys-color-on-surface);
}
.docs-list li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
}
.docs-list strong { color: var(--md-sys-color-on-surface); font-weight: 500; }

/* ---------- 步骤列表 ---------- */
.docs-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}
.docs-step {
  position: relative;
  padding-left: 56px;
  padding-bottom: 28px;
  counter-increment: step;
}
.docs-step::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 40px;
  bottom: 0;
  width: 2px;
  background: var(--md-sys-color-outline-variant);
}
.docs-step:last-child { padding-bottom: 0; }
.docs-step:last-child::before { display: none; }

.docs-step__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.docs-step__index {
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.docs-step__title {
  font-size: var(--md-sys-typescale-title-medium-font);
  font-weight: var(--md-sys-typescale-title-medium-weight);
  color: var(--md-sys-color-on-surface);
}
.docs-step p {
  margin-bottom: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: var(--md-sys-typescale-body-medium-font);
  line-height: 1.7;
}

/* ---------- 提示框 ---------- */
.docs-callout {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container-low);
  margin: 24px 0;
}
.docs-callout .material-icons-round {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}
.docs-callout strong {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--md-sys-color-on-surface);
}
.docs-callout p {
  font-size: var(--md-sys-typescale-body-medium-font);
  line-height: 1.6;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
}
.docs-callout--info { background: var(--md-sys-color-secondary-container); }
.docs-callout--info .material-icons-round { color: var(--md-sys-color-on-secondary-container); }
.docs-callout--info strong { color: var(--md-sys-color-on-secondary-container); }
.docs-callout--info p { color: var(--md-sys-color-on-secondary-container); }

.docs-callout--warning { background: var(--md-sys-color-tertiary-container); }
.docs-callout--warning .material-icons-round { color: var(--md-sys-color-on-tertiary-container); }
.docs-callout--warning strong,
.docs-callout--warning p { color: var(--md-sys-color-on-tertiary-container); }

.docs-callout--success { background: var(--md-sys-color-primary-container); }
.docs-callout--success .material-icons-round { color: var(--md-sys-color-on-primary-container); }
.docs-callout--success strong,
.docs-callout--success p { color: var(--md-sys-color-on-primary-container); }

/* ---------- 代码块 ---------- */
.docs-code {
  margin: 24px 0;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container-high);
  overflow: hidden;
}
.docs-code__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--md-sys-color-surface-container-highest);
}
.docs-code__lang {
  font-family: "Roboto Mono", monospace;
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.docs-code__copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--md-sys-shape-corner-small);
  font-size: 12px;
  font-weight: 500;
  color: var(--md-sys-color-primary);
  position: relative;
  transition: background var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}
.docs-code__copy .material-icons-round { font-size: 16px; }
.docs-code__copy::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--md-sys-color-primary);
  opacity: 0;
}
.docs-code__copy:hover::before { opacity: var(--md-state-hover-opacity); }
.docs-code__copy.copied::before { opacity: 0; }
.docs-code__copy.copied {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.docs-code pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
}
.docs-code code {
  font-family: "Roboto Mono", monospace;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--md-sys-color-on-surface);
  white-space: pre;
}
.docs-code__comment { color: var(--md-sys-color-on-surface-variant); font-style: italic; }

/* ---------- 表格 ---------- */
.docs-table-wrap {
  margin: 24px 0;
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid var(--md-sys-color-outline-variant);
  overflow-x: auto;
}
.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.docs-table thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1px;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface-container-low);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  white-space: nowrap;
}
.docs-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface);
  line-height: 1.6;
}
.docs-table tbody tr:last-child td { border-bottom: none; }
.docs-table tbody tr:hover { background: var(--md-sys-color-surface-container-low); }

/* ---------- 卡片网格 ---------- */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.docs-card {
  position: relative;
  padding: 20px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container);
  border: 1px solid transparent;
  transition: background var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard),
              border-color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}
.docs-card h4 {
  font-size: var(--md-sys-typescale-title-medium-font);
  font-weight: var(--md-sys-typescale-title-medium-weight);
  color: var(--md-sys-color-on-surface);
  margin: 8px 0 4px;
}
.docs-card p {
  font-size: var(--md-sys-typescale-body-medium-font);
  line-height: 1.6;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
}
.docs-card__icon {
  font-size: 24px;
  color: var(--md-sys-color-primary);
}
.docs-card--link {
  cursor: pointer;
  text-decoration: none;
}
.docs-card--link::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--md-sys-color-on-surface);
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}
.docs-card--link:hover::before { opacity: var(--md-state-hover-opacity); }
.docs-card--link:hover { border-color: var(--md-sys-color-outline); }
.docs-card__arrow {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 18px;
  color: var(--md-sys-color-on-surface-variant);
}

/* ---------- 手风琴 ---------- */
.docs-accordion {
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.docs-accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 4px;
  font-size: var(--md-sys-typescale-body-large-font);
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  list-style: none;
  transition: color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}
.docs-accordion summary::-webkit-details-marker { display: none; }
.docs-accordion summary .material-icons-round {
  font-size: 20px;
  color: var(--md-sys-color-on-surface-variant);
  transition: transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
}
.docs-accordion[open] summary .material-icons-round { transform: rotate(180deg); }
.docs-accordion__body {
  padding: 0 4px 20px;
  animation: accordionIn var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized-decelerate);
}
.docs-accordion__body p {
  font-size: var(--md-sys-typescale-body-medium-font);
  line-height: 1.7;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
}
@keyframes accordionIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 分页导航 ---------- */
.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}
.docs-pager__btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  font-size: var(--md-sys-typescale-body-medium-font);
  position: relative;
  transition: background var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
  text-decoration: none;
  min-width: 180px;
}
.docs-pager__btn:last-child { text-align: right; }
.docs-pager__btn small {
  display: block;
  font-size: 11px;
  color: var(--md-sys-color-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.docs-pager__btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--md-sys-color-on-surface);
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}
.docs-pager__btn:hover::before { opacity: var(--md-state-hover-opacity); }
.docs-pager__btn .material-icons-round {
  font-size: 20px;
  color: var(--md-sys-color-primary);
}

/* ---------- FAB ---------- */
.md-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: var(--md-comp-fab-size);
  height: var(--md-comp-fab-size);
  border-radius: 50%;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 10px rgba(0,0,0,.16), 0 1px 18px rgba(0,0,0,.12), 0 3px 5px rgba(0,0,0,.20);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);
  transition: opacity var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard),
              transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized-decelerate),
              visibility var(--md-sys-motion-duration-medium2);
  z-index: 30;
}
.md-fab.visible { opacity: 1; visibility: visible; transform: scale(1); }
.md-fab .material-icons-round { font-size: 24px; }
.md-fab::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--md-sys-color-on-primary-container);
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}
.md-fab:hover::before { opacity: var(--md-state-hover-opacity); }

/* ---------- 响应式 ---------- */
@media (max-width: 1199px) {
  .docs-article { padding: 40px 40px; }
}

@media (max-width: 899px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidenav {
    position: fixed;
    top: calc(var(--md-top-app-bar-height) + 56px);
    left: 0;
    bottom: 0;
    height: auto;
    width: 288px;
    z-index: 41;
    transform: translateX(-100%);
    transition: transform var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-emphasized);
    box-shadow: 0 16px 24px rgba(0,0,0,.14);
    z-index: 45;
  }
  .docs-sidenav.open { transform: translateX(0); }
  .docs-scrim { display: block; }
  .docs-scrim.open { opacity: 0.4; }
  .docs-mobile-bar { display: flex; }
  .docs-article { padding: 24px 16px 80px; }
  .docs-hero__title { font-size: 32px; line-height: 40px; }
}

@media (max-width: 599px) {
  .docs-grid { grid-template-columns: 1fr; }
  .docs-pager { flex-direction: column; }
  .docs-pager__btn { min-width: 0; width: 100%; }
  .docs-table thead { display: none; }
  .docs-table, .docs-table tbody, .docs-table tr, .docs-table td {
    display: block;
    width: 100%;
  }
  .docs-table tbody td {
    border-bottom: none;
    padding: 8px 16px;
  }
  .docs-table tbody tr {
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    padding: 8px 0;
  }
}
