/* === 文档展示页样式 === */
:root {
  --sidebar-width: 280px;
  --header-height: 56px;
  --primary: #1a73e8;
  --primary-light: #e8f0fe;
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --border: #e8eaed;
  --text: #202124;
  --text-secondary: #5f6368;
  --text-muted: #9aa0a6;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* === 侧边栏 === */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  border-right: 1px solid rgba(255,255,255,0.15);
  background: #E1595D;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-header .logo {
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* 目录树 */
.toc-tree { list-style: none; }

.toc-item {
  user-select: none;
}

.toc-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 20px;
  cursor: pointer;
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  position: relative;
}

.toc-link:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.toc-link.active {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-left-color: #fff;
  font-weight: 500;
}

.toc-folder > .toc-link {
  font-weight: 600;
  color: #fff;
  font-size: 14px;
}

.toc-icon {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

.toc-folder > .toc-link .toc-icon {
  transition: transform 0.2s;
}

.toc-folder.open > .toc-link .toc-icon {
  transform: rotate(90deg);
}

.toc-children {
  list-style: none;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.toc-folder.open > .toc-children {
  max-height: 2000px;
}

.toc-children .toc-link {
  padding-left: 44px;
}

.toc-children .toc-children .toc-link {
  padding-left: 68px;
}

/* 侧边栏底部 */
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.sidebar-footer a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}

.sidebar-footer a:hover { color: #fff; }

/* === 右侧内容区 === */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 联系方式栏 */
.contact-bar {
  padding: 14px 60px;
  font-size: 15px;
  font-weight: 600;
  color: #555;
  background: #FDF6F5;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.contact-item svg {
  flex-shrink: 0;
  opacity: 0.55;
}

/* === 主内容区 === */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 40px 60px;
  max-width: 900px;
}

.main-content h1 { font-size: 2em; margin: 0 0 16px; font-weight: 700; }
.main-content h2 { font-size: 1.5em; margin: 32px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-weight: 600; }
.main-content h3 { font-size: 1.2em; margin: 24px 0 8px; font-weight: 600; }
.main-content p { margin: 0 0 12px; color: #3c4043; }
.main-content ul, .main-content ol { margin: 0 0 16px; padding-left: 24px; }
.main-content li { margin-bottom: 4px; }
.main-content a { color: var(--primary); text-decoration: none; }
.main-content a:hover { text-decoration: underline; }
.main-content img { max-width: 100%; border-radius: var(--radius); margin: 12px 0; }
.main-content pre { background: #1e1e1e; color: #d4d4d4; padding: 16px 20px; border-radius: var(--radius); overflow-x: auto; font-size: 14px; margin: 12px 0; line-height: 1.5; }
.main-content code { font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace; font-size: 0.9em; }
.main-content :not(pre) > code { background: #f1f3f4; padding: 2px 6px; border-radius: 4px; color: #d93025; }
.main-content table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.main-content th, .main-content td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; font-size: 14px; }
.main-content th { background: var(--bg-secondary); font-weight: 600; }
.main-content blockquote { border-left: 4px solid var(--primary); padding: 8px 16px; margin: 12px 0; background: var(--primary-light); border-radius: 0 var(--radius) var(--radius) 0; color: #3c4043; }
.main-content hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* 空状态 */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state p { font-size: 16px; }

/* Loading */
.loading { color: var(--text-muted); padding: 40px; text-align: center; }

/* 移动端菜单按钮 */
.menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  width: 36px; height: 36px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  box-shadow: var(--shadow);
}

/* 侧边栏遮罩 */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 50;
}

/* === 响应式 === */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    z-index: 60;
    height: 100vh;
    transition: left 0.3s;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay.show { display: block; }
  .menu-toggle { display: flex; align-items: center; justify-content: center; }
  .contact-bar { padding: 8px 16px; font-size: 12px; }
  .main-content { padding: 20px 16px; }
}
