/* =============================================
   文档中心 - 左侧边栏 + 右侧内容 布局
   ============================================= */

/* 整体布局：导航栏高度72px，下方左右分栏 */
#document-page {
  background: #f5f6f8;
}

.doc-layout {
  display: flex;
  min-height: calc(100vh - 72px);
  margin-top: 72px; /* 导航栏高度 */
}

/* ===== 左侧侧边栏 ===== */
.doc-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #eaecef;
  position: fixed;
  top: 72px;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

/* 搜索框 */
.doc-sidebar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid #eaecef;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.doc-sidebar-search svg {
  flex-shrink: 0;
  color: #aaa;
}

.doc-sidebar-search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  color: #333;
  background: transparent;
}

.doc-sidebar-search input::placeholder {
  color: #bbb;
}

/* 导航加载状态 */
.doc-nav-loading {
  padding: 20px 16px;
  font-size: 13px;
  color: #aaa;
}

/* 导航容器 */
.doc-nav {
  flex: 1;
  padding: 8px 0 24px;
}

/* 一级分类标题 */
.doc-nav-category {
  margin-top: 4px;
}

.doc-nav-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 10px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a2e;
  border-radius: 0;
  transition: background 0.15s;
  user-select: none;
}

.doc-nav-category-header:hover {
  background: #f5f6f8;
}

.doc-nav-category-header.active {
  color: #1677FF;
}

.doc-nav-category-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  flex-shrink: 0;
}

.doc-nav-category-icon img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.doc-nav-category-name {
  flex: 1;
}

.doc-nav-chevron {
  width: 14px;
  height: 14px;
  color: #aaa;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.doc-nav-category.open .doc-nav-chevron {
  transform: rotate(90deg);
}

/* 二级文章列表 */
.doc-nav-articles {
  display: none;
  padding: 2px 0 6px 0;
}

.doc-nav-category.open .doc-nav-articles {
  display: block;
}

.doc-nav-article-link {
  display: block;
  padding: 7px 16px 7px 44px;
  font-size: 13px;
  color: #555;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border-left: 2px solid transparent;
  margin-left: 18px;
  border-radius: 0 4px 4px 0;
  line-height: 1.5;
}

.doc-nav-article-link:hover {
  background: #f0f7ff;
  color: #1677FF;
}

.doc-nav-article-link.active {
  background: #e8f3ff;
  color: #1677FF;
  border-left-color: #1677FF;
  font-weight: 500;
}

/* ===== 右侧内容区 ===== */
.doc-main {
  flex: 1;
  margin-left: 260px;
  min-height: calc(100vh - 72px);
  background: #f5f6f8;
}

/* ===== 文档首页卡片 ===== */
.doc-home {
  padding: 40px 48px;
  max-width: 1100px;
}

.doc-home-header {
  margin-bottom: 36px;
}

.doc-home-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 8px;
}

.doc-home-header p {
  font-size: 14px;
  color: #888;
}

.doc-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.doc-card {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  border: 1px solid #eaecef;
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
}

.doc-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.doc-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f0f0f0;
}

.doc-card-header img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.doc-card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a2e;
}

.doc-card-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.doc-card-links a {
  font-size: 13px;
  color: #555;
  text-decoration: none;
  padding: 3px 0;
  transition: color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-card-links a:hover {
  color: #1677FF;
}

.doc-card-more {
  display: inline-block;
  margin-top: 10px;
  font-size: 12px;
  color: #1677FF;
  text-decoration: none;
}

/* ===== 文章详情页 ===== */
.doc-article {
  padding: 40px 60px;
  max-width: 900px;
  background: #fff;
  min-height: calc(100vh - 72px);
}

.doc-article-breadcrumb {
  font-size: 13px;
  color: #aaa;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.doc-article-breadcrumb a {
  color: #888;
  text-decoration: none;
}

.doc-article-breadcrumb a:hover {
  color: #1677FF;
}

.doc-article-breadcrumb .sep {
  color: #ccc;
}

.doc-article-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1.4;
  margin-bottom: 12px;
}

.doc-article-meta {
  font-size: 12px;
  color: #bbb;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eaecef;
}

.doc-article-body {
  font-size: 15px;
  color: #333;
  line-height: 1.9;
}

.doc-article-body h2, .doc-article-body h3 {
  margin: 24px 0 12px;
  color: #1a1a2e;
}

.doc-article-body p {
  margin-bottom: 14px;
}

.doc-article-body img {
  max-width: 100%;
  border-radius: 4px;
}

.doc-article-body a {
  color: #1677FF;
}

/* ===== 移动端菜单按钮 ===== */
.doc-mobile-menu-btn {
  display: none;
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 200;
  background: #1677FF;
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(22,119,255,0.35);
}

.doc-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

/* ===== 响应式 ===== */
@media (max-width: 1200px) {
  .doc-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 992px) {
  /* 移动端侧边栏从顶部0开始，覆盖整个视口高度 */
  .doc-sidebar {
    top: 0 !important;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 10002; /* 高于导航栏的9999 */
  }
  .doc-sidebar.open {
    transform: translateX(0);
  }
  .doc-sidebar-overlay.open {
    display: block;
    z-index: 10001;
  }
  .doc-main {
    margin-left: 0;
  }
  .doc-mobile-menu-btn {
    display: flex;
  }
  .doc-home {
    padding: 24px 16px;
  }
  .doc-article {
    padding: 24px 16px;
  }
  .doc-cards {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .doc-cards {
    grid-template-columns: 1fr;
  }
}
