/* ==========================================================================
   文档与协议专版样式表 (docs.css)
   专用于 /pages/ 目录下的 12 个二级页面，提供优雅的双栏阅读与移动端导航
   ========================================================================== */

.docs-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height) - 100px);
  max-width: var(--max-content-width);
  margin: 0 auto;
  width: 100%;
  padding: 24px 20px 60px;
  gap: 36px;
}

/* ==========================================================================
   左侧侧边栏导航 (Sidebar)
   ========================================================================== */
.docs-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--header-height) + 24px);
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
  padding-right: 12px;
  scrollbar-width: thin;
}

.sidebar-group {
  margin-bottom: 24px;
}

.sidebar-group-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-left: 12px;
}

.sidebar-nav-list {
  list-style: none;
}

.sidebar-nav-item {
  margin-bottom: 2px;
}

.sidebar-nav-link {
  display: block;
  padding: 8px 12px;
  font-size: 0.92rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: all var(--transition-fast);
}

.sidebar-nav-link:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

.sidebar-nav-link.active {
  color: var(--primary);
  font-weight: 600;
  background-color: var(--primary-light);
  border-left-color: var(--primary);
}

/* 移动端展开侧边栏悬浮按钮 */
.mobile-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 90;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   正文阅读区 (Content Area)
   ========================================================================== */
.docs-content {
  flex: 1;
  min-width: 0; /* 防止子元素溢出 Flex 容器 */
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px 48px;
  box-shadow: var(--shadow-sm);
}

.article-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 24px;
  margin-bottom: 32px;
}

.article-category {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
}

.article-title {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
}

/* 文章正文 Typography 排版规范 */
.article-body {
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.article-body p {
  margin-bottom: 18px;
}

.article-body h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 36px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.article-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 28px;
  margin-bottom: 12px;
}

.article-body ul, 
.article-body ol {
  margin-bottom: 20px;
  padding-left: 24px;
}

.article-body li {
  margin-bottom: 8px;
}

.article-body strong {
  color: var(--text-primary);
}

/* 提示卡片 (Callout Boxes) */
.callout {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin: 20px 0;
  border-left: 4px solid var(--primary);
  background-color: var(--primary-light);
  font-size: 0.95rem;
}

.callout-title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

/* 表格样式 */
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.95rem;
}

.article-body th,
.article-body td {
  padding: 12px 16px;
  border: 1px solid var(--border-subtle);
  text-align: left;
}

.article-body th {
  background-color: var(--bg-subtle);
  font-weight: 600;
  color: var(--text-primary);
}

.article-body tr:nth-child(even) td {
  background-color: var(--bg-page);
}

/* 图片样式 */
.article-body img {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  margin: 20px auto;
  border: 1px solid var(--border-subtle);
}

.center-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 24px 0;
}

.center-container img {
  margin: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   文章底部：上一篇 / 下一篇 翻页器
   ========================================================================== */
.docs-pagination {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.pagination-btn {
  display: inline-flex;
  flex-direction: column;
  padding: 12px 20px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  max-width: 48%;
}

.pagination-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: var(--primary-light);
  transform: translateY(-2px);
}

.pagination-btn .label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.pagination-btn .title {
  font-size: 0.95rem;
  font-weight: 600;
}

.pagination-btn.next {
  margin-left: auto;
  text-align: right;
}

/* ==========================================================================
   移动端响应式 (Docs Responsive)
   ========================================================================== */
@media (max-width: 860px) {
  .docs-layout {
    flex-direction: column;
    padding: 16px 12px 60px;
  }

  .docs-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 280px;
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    background: var(--bg-surface);
    z-index: 1005;
    padding: 20px;
    box-shadow: var(--shadow-xl);
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
  }

  .docs-sidebar.open {
    transform: translateX(0);
  }

  .docs-sidebar-backdrop {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1004;
  }

  .docs-sidebar-backdrop.show {
    display: block;
  }

  .mobile-sidebar-toggle {
    display: flex;
  }

  .docs-content {
    padding: 24px 20px;
  }

  .article-title {
    font-size: 1.6rem;
  }
}
