/* ═══════════ 全局重置 ═══════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 15px; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif;
  color: #2c3e50;
  line-height: 1.85;
  background: #f5f7fa;
}

/* ═══════════ 内容容器 ═══════════ */
.content {
  padding: 28px 40px 56px;
  max-width: 960px;
  margin: 0 auto;
}

/* ═══════════ 章节页导航 ═══════════ */
.page-nav {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 10px 24px;
  background: #1a2639; color: #c8d6e5; font-size: 13px;
}
.page-nav a { color: #74b9ff; text-decoration: none; }
.page-nav a:hover { text-decoration: underline; }
.nav-cur { color: #8395a7; margin: 0 auto; text-align: center; }
.page-nav.bottom { justify-content: center; border-top: 1px solid #e8ecf1; }
.chap-label {
  display: inline-block; margin: 18px 0 2px; padding: 3px 12px;
  background: #eaf2f8; color: #2B579A; border-radius: 4px; font-size: 13px;
}

/* ═══════════ 目录页 ═══════════ */
.toc { max-width: 900px; margin: 0 auto; padding: 36px 24px 60px; }
.toc-head { border-bottom: 2px solid #d4e6f1; padding-bottom: 10px; margin-bottom: 6px; }
.toc-head h1 { font-size: 26px; color: #1a5276; margin-bottom: 4px; }
.toc-head p { font-size: 13px; color: #7f8c8d; }
.toc-chapter {
  margin: 30px 0 8px; padding: 8px 14px;
  font-size: 19px; color: #fff; background: #1a5276; border-radius: 4px;
  font-weight: 600;
}
.toc-section {
  display: flex; align-items: baseline; gap: 12px;
  padding: 8px 14px; font-size: 14.5px; color: #2c3e50;
  text-decoration: none; border-left: 3px solid transparent;
}
.toc-section:hover { background: #eaf2f8; border-left-color: #3498db; color: #1a5276; }
.toc-section .n {
  flex-shrink: 0; width: 56px; color: #8395a7; font-size: 12.5px; text-align: right;
}
.toc-note { margin: 22px 0 0; padding: 12px 16px; font-size: 12.5px; color: #7f8c8d; border-top: 1px solid #e0e4e8; }

/* ═══════════ 排版 ═══════════ */
h1 { font-size: 28px; color: #1a5276; margin-bottom: 6px; }
h1 + p { font-size: 13px; color: #7f8c8d; margin-bottom: 28px; }

h2 {
  font-size: 21px; color: #1a5276;
  border-bottom: 2px solid #d4e6f1; padding-bottom: 8px;
  margin: 44px 0 16px;
  scroll-margin-top: 70px;
}

h3 {
  font-size: 17px; color: #2B579A;
  margin: 24px 0 10px;
  scroll-margin-top: 70px;
}

p { margin: 8px 0 12px; }

ul, ol { margin: 8px 0 12px 24px; }
li { margin: 4px 0; }

/* ═══════════ 表格 ═══════════ */
table {
  border-collapse: collapse; width: 100%; margin: 14px 0;
  font-size: 14px;
}
th {
  background: #1a5276; color: #fff;
  padding: 10px 14px; text-align: left; font-weight: 600;
}
td {
  padding: 9px 14px; border-bottom: 1px solid #e0e4e8;
}
tr:nth-child(even) td { background: #f8f9fb; }

/* ═══════════ 提示框 ═══════════ */
.tip, .warn, .info, .danger {
  padding: 14px 18px; margin: 14px 0; border-radius: 6px;
  font-size: 14px; line-height: 1.75;
}
.tip  { background: #eafaf1; border-left: 4px solid #27ae60; }
.warn { background: #fef9e7; border-left: 4px solid #e67e22; }
.info { background: #eaf2f8; border-left: 4px solid #2B579A; }
.danger{ background: #fdedec; border-left: 4px solid #c0392b; }

/* ═══════════ 操作步骤 ═══════════ */
.step {
  display: flex; align-items: flex-start;
  padding: 10px 0; margin: 2px 0;
}
.step-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  background: #2B579A; color: #fff;
  text-align: center; border-radius: 50%;
  font-size: 13px; font-weight: 700; line-height: 26px;
  margin-right: 12px; margin-top: 1px;
}
.step-body { flex: 1; }

/* ═══════════ 代码 ═══════════ */
code {
  background: #eef1f5; padding: 2px 7px; border-radius: 3px;
  font-size: 13px; font-family: "Consolas", "Courier New", monospace;
  color: #2c3e50;
}
pre {
  background: #2d3436; color: #dfe6e9; padding: 16px 20px;
  border-radius: 6px; overflow-x: auto; font-size: 13px; line-height: 1.6;
  margin: 12px 0;
}

/* ═══════════ 图片 ═══════════ */
img {
  max-width: 100%; height: auto;
  border: 1px solid #dce3ea; border-radius: 6px;
  margin: 12px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.img-caption { font-size: 12px; color: #95a5a6; text-align: center; margin-top: -8px; margin-bottom: 12px; }

/* ═══════════ 快捷键标记 ═══════════ */
kbd {
  background: #f0f0f0; border: 1px solid #ccc; border-radius: 3px;
  padding: 1px 6px; font-size: 12px; box-shadow: 0 1px 0 #bbb;
}

/* ═══════════ 打印 ═══════════ */
@media print {
  .page-nav { display: none; }
  .content { padding: 0; max-width: none; }
}

/* ════════════════════════════════════════════════════════════════════
   左侧目录 sidebar（2026-09-13 新增：每页带目录，与上下节翻页共存；
   生成器=docs/手册/add_sidebar.py，改样式后重跑脚本即可全册刷新）
   ════════════════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 280px;
  background: #1a2639;
  color: #c8d6e5;
  overflow-y: auto; overflow-x: hidden;
  z-index: 100;
  display: flex; flex-direction: column;
}
.sidebar-header {
  padding: 20px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.sidebar-header h2 { font-size: 16px; color: #fff; font-weight: 600; line-height: 1.4; }
.sidebar-header .sub { font-size: 12px; color: #636e7b; margin-top: 3px; }
.sidebar-nav { flex: 1; padding: 10px 0 24px; }
.sidebar-nav a {
  display: block;
  padding: 8px 20px 8px 26px;
  color: #a4b0be; text-decoration: none;
  font-size: 13.5px; line-height: 1.5;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.04); color: #dfe6e9; }
.sidebar-nav a.active {
  background: rgba(41,128,185,0.18);
  color: #ffffff;
  border-left-color: #4aa3df;
}
.sidebar-group {
  padding: 16px 20px 4px;
  font-size: 12px; color: #636e7b;
  letter-spacing: 1px;
}
/* 图片占位框（待切图章节：写出文件名，图放 images/ 后把占位 div 换 <img> 即显示） */
.img-placeholder {
  display: flex; align-items: center; justify-content: center;
  min-height: 160px; margin: 12px 0 0;
  background: #fafbfc; border: 2px dashed #cbd5e0; border-radius: 6px;
  color: #7f8c8d; font-size: 13px; text-align: center; padding: 16px;
}

/* 内容区整体右移，翻页导航保留在原位（主区域内） */
.layout-main { margin-left: 280px; min-height: 100vh; }
/* 窄屏：隐藏 sidebar，回归纯翻页模式 */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .layout-main { margin-left: 0; }
}
