/* ========== pages 页面导航样式（nav-chapter结构） ========== */
.sn {
  padding: 12px 0;
}

/* 大章节 */
.nav-chapter {
  margin-bottom: 2px;
}

.nav-chapter-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 6px;
  margin: 0 4px;
}

.nav-chapter-title:hover {
  background: #f1f5f9;
}

.nav-chapter.open > .nav-chapter-title {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
}

.ch-arrow {
  font-size: 10px;
  transition: transform 0.2s;
  opacity: 0.6;
}

.nav-chapter.open > .nav-chapter-title .ch-arrow {
  transform: rotate(90deg);
  opacity: 0.9;
}

/* 子分组 */
.nav-group {
  margin-bottom: 1px;
}

.nav-group-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px 8px 24px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 6px;
  margin: 0 4px;
}

.nav-group-title:hover {
  background: #f1f5f9;
  color: var(--text);
}

.nav-chapter.open > .nav-group > .nav-group-title {
  color: var(--accent);
}

.nav-group.open > .nav-group-title {
  color: var(--accent);
  font-weight: 600;
}

.g-arrow {
  font-size: 9px;
  transition: transform 0.2s;
  opacity: 0.5;
}

.nav-group.open > .nav-group-title .g-arrow {
  transform: rotate(90deg);
  opacity: 0.8;
}

/* 导航项目容器 - 默认隐藏 */
.nav-group-items {
  display: none;
  padding: 4px 8px;
}

.nav-group.open > .nav-group-items {
  display: block;
}

/* 单个导航项 */
.nav-item {
  display: block;
  padding: 6px 16px 6px 28px;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  transition: all 0.1s;
  border-radius: 4px;
  margin: 2px 0;
}

.nav-item:hover {
  background: #f1f5f9;
  color: var(--text);
  text-decoration: none;
}

.nav-item.active {
  background: #fef2f2;
  color: var(--accent);
  font-weight: 600;
  border-left: 3px solid var(--accent);
  margin-left: -3px;
}

/* ===================================================
   v3-page.css - 详情页补充样式
   （v3.css 已有的不再重复，只补充缺失部分）
   =================================================== */

/* ========== content 页面主内容区 ========== */
.main, .main-content {
  flex: 1;
  padding: 0;
  max-width: none;
}

/* ========== content 页面导航样式 ========== */

/* Level 1: 大分类 */
.nav-section {
  margin-bottom: 4px;
}

.nav-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  background: #f8fafc;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-section-title:hover {
  background: #e2e8f0;
  color: var(--text);
}

.nav-section-title .arrow {
  font-size: 10px;
  transition: transform 0.2s;
}

/* 展开时箭头旋转 */
.nav-section.open > .nav-section-title .arrow {
  transform: rotate(180deg);
}

.nav-section-items {
  padding: 4px 8px;
  display: none;  /* 默认隐藏，点击展开 */
}

.nav-section.open > .nav-section-items {
  display: block;
}

/* Level 2: 子分类 */
.nav-sub {
  margin: 2px 0;
}

.nav-sub-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 6px;
}

.nav-sub-title:hover {
  background: #f1f5f9;
  color: var(--text);
}

.nav-sub-title .arrow {
  font-size: 8px;
  transition: transform 0.2s;
}

.nav-sub.open > .nav-sub-title .arrow {
  transform: rotate(90deg);
}

/* 当前文件所在的子分类 - 默认展开 + 高亮 */
.nav-sub.active > .nav-sub-title {
  color: var(--accent);
  font-weight: 600;
  background: rgba(220, 38, 38, 0.06);
}

.nav-sub.active > .nav-sub-title .arrow {
  transform: rotate(90deg);
}

/* Level 3: 具体文件 */
.nav-sub-items {
  padding: 2px 0 2px 8px;
  display: none;
}

.nav-sub.open > .nav-sub-items,
.nav-sub.active > .nav-sub-items {
  display: block;
}

.nav-link {
  display: block;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text2);
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-link:hover {
  background: #f1f5f9;
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  background: rgba(220, 38, 38, 0.1);
  color: var(--accent);
  font-weight: 600;
}

.nav-home-link {
  display: block;
  text-align: center;
  padding: 10px 16px;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--accent), #ef4444);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
}

.nav-home-link:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* 补充 .main 的左侧留白，防止被 sticky sidebar 遮挡 */
@media (min-width: 901px) {
  .main {
    padding-left: calc(var(--side-w) + 32px) !important;
    padding-right: 32px !important;
    max-width: calc(100% - var(--side-w) - 64px) !important;
  }
}

/* 移动端适配 */
@media (max-width: 900px) {
  .mobile-menu-btn { display: block !important; }
  
  /* 重要：覆盖 v3.css 的 .sidebar { display: none } */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: -280px !important;
    width: 280px !important;
    height: 100vh !important;
    z-index: 200 !important;
    background: var(--card) !important;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1) !important;
    transition: left 0.3s ease !important;
    overflow-y: auto !important;
    padding-top: 60px !important;
    display: block !important;
  }
  
  .sidebar.mobile-open {
    left: 0 !important;
  }
  
  .sidebar-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0,0,0,0.5) !important;
    z-index: 199 !important;
    display: none !important;
  }
  
  .sidebar-overlay.show {
    display: block !important;
  }
  
  /* 移动端主内容区 */
  .main-content {
    padding: 20px 16px 60px !important;
    max-width: 100% !important;
  }
  
  /* 移动端导航项 */
  .nav-section-items {
    flex-direction: column !important;
  }
  .nav-link {
    display: block !important;
    padding: 8px 12px !important;
  }
  
  /* 其他移动端样式 */
  .content-wrapper { padding: 16px 0 60px !important; }
  .page-title { font-size: 22px !important; }
  .article-body h2 { font-size: 18px !important; }
  .article-body h3 { font-size: 16px !important; }
  .article-body p, .article-body li { font-size: 14px !important; }
  .page-nav { flex-direction: column !important; gap: 8px !important; }
  .pn { text-align: center !important; }
}

/* 详情页正文样式 */
.main-content {
  padding: 0;
}
.content-wrapper {
  padding: 32px 40px 80px;
  margin-top: var(--hd-h);
}
.breadcrumb {
  font-size: 13px; color: var(--text3); margin-bottom: 16px;
}
.breadcrumb a { color: var(--text2); }
.breadcrumb a:hover { color: var(--accent); }
.page-title {
  font-size: 26px; font-weight: 700; margin-bottom: 8px;
}
.page-meta { margin-bottom: 24px; }
.meta-tag {
  display: inline-block; padding: 2px 10px; border-radius: 4px;
  background: #f1f5f9; color: var(--text2); font-size: 12px; margin-right: 8px;
}
.article-body { line-height: 1.8; }
.article-body h2 {
  font-size: 20px; margin: 32px 0 14px; font-weight: 700;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.article-body h3 { font-size: 17px; margin: 24px 0 10px; font-weight: 600; }
.article-body p { margin-bottom: 14px; }
.article-body ul, .article-body ol { padding-left: 24px; margin-bottom: 14px; }
.article-body li { margin-bottom: 6px; }
.article-body strong { font-weight: 600; }
.article-body table { width: 100%; border-collapse: collapse; margin: 20px 0; }
.article-body th {
  background: var(--text); color: #fff; padding: 10px 14px; text-align: left;
}
.article-body td { padding: 8px 14px; border-bottom: 1px solid var(--border); }
.article-body tr:nth-child(even) td { background: #f8fafc; }
.article-body img { max-width: 100%; border-radius: 8px; }

/* 翻页导航 */
.page-nav {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border);
}
.nav-prev, .nav-next {
  flex: 1; padding: 12px 20px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; color: var(--text2);
  transition: all .15s; display: flex; align-items: center; gap: 8px;
}
.nav-next { justify-content: flex-end; }
.nav-prev:hover, .nav-next:hover {
  border-color: var(--accent); color: var(--accent);
  background: #fff5f5; text-decoration: none;
}
.nav-disabled { opacity: 0.4; pointer-events: none; }
.nav-home {
  padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; color: var(--text2); white-space: nowrap;
  display: flex; align-items: center;
}
.nav-home:hover { border-color: var(--blue); color: var(--blue); }

/* 搜索结果 */
.search-results {
  position: fixed; top: var(--hd-h); right: 24px; z-index: 200;
  width: 420px; max-height: 60vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.12); display: none;
}
.search-results.show { display: block; }
.sr-item {
  display: block; padding: 10px 16px; border-bottom: 1px solid var(--border);
  color: var(--text);
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: #f1f5f9; text-decoration: none; }
.sr-title { font-size: 14px; font-weight: 500; }
.sr-desc { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* 占位符样式（内容即将上线） */
.placeholder {
  margin: 32px 0; padding: 40px 24px; text-align: center;
  background: #fffbeb; border: 1px dashed #fde68a; border-radius: 10px;
}
.placeholder-icon { font-size: 48px; margin-bottom: 16px; }
.placeholder h3 { font-size: 16px; color: #92400e; margin-bottom: 8px; }
.placeholder p { font-size: 13px; color: #b45309; }

/* 内联推广 */
.qihuo-inline {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, #fff7f7, #fff0f0);
  border: 1px solid rgba(220,38,38,0.25); border-radius: 10px;
  padding: 16px 20px; margin: 32px 0; font-size: 13px; color: #7f1d1d;
}
.qihuo-tag { background: rgba(220,38,38,0.12); padding: 3px 10px; border-radius: 6px; font-weight: 700; font-size: 12px; color: #dc2626; }
.qihuo-inline a { color: #dc2626; font-weight: 600; text-decoration: none; border-bottom: 1px dashed #dc2626; }
.qihuo-inline a:hover { color: #b91c1c; border-bottom-color: #b91c1c; }

/* 详情页底部CTA广告 */
.page-cta-ad {
  margin: 40px 0 0;
  background: linear-gradient(135deg, #1a0505, #2d0a0a);
  border: 1px solid rgba(220,38,38,0.4);
  border-radius: 12px;
  padding: 24px 28px;
}
.page-cta-ad-title {
  font-size: 17px; font-weight: 700; color: #fff; margin-bottom: 8px;
}
.page-cta-ad-desc {
  font-size: 13px; color: #94a3b8; line-height: 1.7; margin-bottom: 16px;
}
.page-cta-ad-btn {
  display: inline-block; padding: 10px 24px;
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff; text-decoration: none; border-radius: 8px;
  font-size: 14px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(220,38,38,0.4);
  transition: all 0.2s;
}
.page-cta-ad-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(220,38,38,0.5);
}

/* 侧边悬浮广告卡片 - 已禁用，用户要求只保留底部广告 */
/*
.floating-ad {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 260px;
  background: linear-gradient(135deg, #1a0505, #2d0a0a);
  border: 1px solid rgba(220,38,38,0.5);
  border-radius: 12px;
  padding: 16px;
  z-index: 150;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  animation: fadeInUp 0.5s ease-out;
}
*/
/* 悬浮广告动画和关闭按钮 - 已禁用
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.floating-ad-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; color: #666; font-size: 18px; cursor: pointer;
  line-height: 1;
}
.floating-ad-close:hover { color: #e53e3e; }
.floating-ad-title {
  font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 6px;
}
.floating-ad-desc {
  font-size: 12px; color: #94a3b8; line-height: 1.6; margin-bottom: 12px;
}
.floating-ad-btn {
  display: block; width: 100%; padding: 10px;
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff; text-decoration: none; border-radius: 8px;
  font-size: 14px; font-weight: 700; text-align: center;
  transition: all 0.2s;
}
.floating-ad-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 14px rgba(220,38,38,0.4);
}
.floating-ad-sub {
  display: block; width: 100%; margin-top: 8px; padding: 8px;
  background: transparent; color: #f56565; text-decoration: none; border-radius: 8px;
  font-size: 13px; font-weight: 600; text-align: center;
  border: 1px solid rgba(220,38,38,0.3);
  transition: all 0.2s;
}
.floating-ad-sub:hover { background: rgba(220,38,38,0.08); }
@media (max-width: 768px) { .floating-ad { display: none; } }
*/
