/* 文档页面样式 */
:root {
  --color-primary: var(--color-text-active, #f28a00);
  --color-secondary: #2c3e50;
  --color-border: var(--color-border, #e8e8e8);
  --color-bg-light: var(--color-panel, #f5f7fa);
  --color-text: var(--color-text, #333);
  --color-text-light: var(--color-text-light, #666);
  --color-text-muted: var(--color-text-muted, #999);
  --border-radius: 8px;
  --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s ease;
}
/* 整体容器 */
.doc-container {
  display: flex;
  max-width: 1600px;
  margin: 0 auto;
  position: relative;
  min-height: calc(100vh - 60px);
}
/* 移动端菜单开关 */
.mobile-menu-toggle {
  display: none;
  position: sticky;
  top: 0;
  padding: 0.8em 1em;
  background: var(--color-bg-light);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  z-index: 20;
  margin-bottom: 1em;
  border-radius: var(--border-radius);
}
.mobile-menu-toggle .toggle-button {
  display: flex;
  align-items: center;
  gap: 0.5em;
  background: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.5em 1em;
  color: var(--color-text);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.mobile-menu-toggle .toggle-button i {
  font-size: 1.2em;
  transform: rotate(0deg);
  transition: transform 0.3s ease;
}
.mobile-menu-toggle .toggle-button:hover {
  background: rgba(0, 0, 0, 0.02);
}
.mobile-menu-toggle .toggle-button.active {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.mobile-menu-toggle .toggle-button.active i {
  transform: rotate(180deg);
}
/* 侧边栏样式 */
.sidebar-menu {
  width: 250px;
  flex-shrink: 0;
  background: var(--color-bg-light);
  border-right: 1px solid var(--color-border);
  z-index: 10;
  transition: var(--transition);
  position: sticky;
  align-self: flex-start;
  top: 0;
  height: calc(100vh - 60px);
  overflow-y: auto;
}
.sidebar-menu .toc-wrapper {
  padding: 1em;
}
.sidebar-menu .toc-wrapper .toc-header {
  padding: 0.8em 1em;
  margin-bottom: 1em;
}
.sidebar-menu .toc-wrapper .toc-header h3 {
  margin: 0;
  font-size: 1.1em;
  font-weight: 600;
  color: var(--color-text);
  position: relative;
  padding-left: 1em;
}
.sidebar-menu .toc-wrapper .toc-header h3::before {
  content: '';
  display: block;
  width: 4px;
  height: 100%;
  background: var(--color-primary);
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 2px;
}
.sidebar-menu .toc-wrapper .toc-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-menu .toc-wrapper .toc-content ul li {
  margin-bottom: 0.5em;
  padding-left: 1em;
  position: relative;
}
.sidebar-menu .toc-wrapper .toc-content ul li:before {
  content: "";
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-text-muted);
  position: absolute;
  left: 0;
  top: 0.7em;
}
.sidebar-menu .toc-wrapper .toc-content ul li li {
  font-size: 0.9em;
  margin-top: 0.4em;
  margin-bottom: 0.4em;
}
.sidebar-menu .toc-wrapper .toc-content ul li li:before {
  width: 3px;
  height: 3px;
}
.sidebar-menu .toc-wrapper .toc-content ul li a {
  color: var(--color-text-light);
  text-decoration: none;
  display: block;
  padding: 0.3em 0;
  transition: var(--transition);
  border-radius: 4px;
}
.sidebar-menu .toc-wrapper .toc-content ul li a:hover {
  color: var(--color-primary);
  background-color: rgba(242, 138, 0, 0.05);
  padding-left: 0.5em;
}
.sidebar-menu .toc-wrapper .toc-content ul li a.active {
  color: var(--color-primary);
  font-weight: 500;
  background-color: rgba(242, 138, 0, 0.08);
  padding-left: 0.5em;
}
.sidebar-menu::-webkit-scrollbar {
  width: 4px;
}
.sidebar-menu::-webkit-scrollbar-track {
  background: #f5f5f5;
}
.sidebar-menu::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 2px;
}
.sidebar-menu::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}
/* 主内容区 */
.main-content {
  flex: 1;
  padding: 2em;
  line-height: 1.8;
  overflow: hidden;
}
.main-content .content-wrapper {
  background: var(--color-bg-light);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 2em;
}
.main-content .content-wrapper p {
  line-height: 1.8;
  margin-bottom: 1.2em;
}
.main-content .content-wrapper h1,
.main-content .content-wrapper h2,
.main-content .content-wrapper h3,
.main-content .content-wrapper h4,
.main-content .content-wrapper h5,
.main-content .content-wrapper h6 {
  color: var(--color-secondary);
  margin-top: 1.5em;
  margin-bottom: 0.8em;
  font-weight: 600;
  position: relative;
}
.main-content .content-wrapper h1::after,
.main-content .content-wrapper h2::after,
.main-content .content-wrapper h3::after,
.main-content .content-wrapper h4::after,
.main-content .content-wrapper h5::after,
.main-content .content-wrapper h6::after {
  content: '';
  display: block;
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, var(--color-border), transparent);
  margin-top: 0.5em;
}
.main-content .content-wrapper h1 {
  font-size: 2em;
  color: var(--color-primary);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.5em;
}
.main-content .content-wrapper h1::after {
  display: none;
}
.main-content .content-wrapper h2 {
  font-size: 1.6em;
}
.main-content .content-wrapper h3 {
  font-size: 1.3em;
}
.main-content .content-wrapper h4 {
  font-size: 1.1em;
}
.main-content .content-wrapper ul,
.main-content .content-wrapper ol {
  padding-left: 1.5em;
  margin-bottom: 1.2em;
}
.main-content .content-wrapper ul li,
.main-content .content-wrapper ol li {
  margin-bottom: 0.5em;
}
.main-content .content-wrapper ul li ul,
.main-content .content-wrapper ol li ul,
.main-content .content-wrapper ul li ol,
.main-content .content-wrapper ol li ol {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}
.main-content .content-wrapper img {
  max-width: 100%;
  height: auto;
  margin: 1em 0;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.main-content .content-wrapper code {
  font-family: 'Courier New', Courier, monospace;
  background: var(--color-bg-light);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  color: #e67e22;
}
.main-content .content-wrapper pre {
  background: var(--color-bg-light);
  padding: 1em;
  border-radius: var(--border-radius);
  overflow-x: auto;
  margin: 1.5em 0;
  border: 1px solid var(--color-border);
}
.main-content .content-wrapper pre code {
  background: none;
  padding: 0;
  color: #16a085;
  font-size: 0.9em;
  display: block;
  line-height: 1.6;
}
.main-content .content-wrapper blockquote {
  border-left: 4px solid var(--color-primary);
  padding: 0.8em 1em;
  background: rgba(242, 138, 0, 0.05);
  color: var(--color-text-light);
  margin: 1.5em 0;
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
}
.main-content .content-wrapper blockquote p {
  margin: 0;
}
.main-content .content-wrapper table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}
.main-content .content-wrapper table th,
.main-content .content-wrapper table td {
  border: 1px solid #eee;
  padding: 0.8em;
  text-align: left;
}
.main-content .content-wrapper table th {
  background: #f9f9f9;
  font-weight: 600;
}
.main-content .content-wrapper table tr:nth-child(even) {
  background: #f9f9f9;
}
.main-content .content-wrapper table tr:hover {
  background: #f3f3f3;
}
/* 右侧页内导航 */
.page-toc {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  align-self: flex-start;
  top: 0;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 1em;
}
.page-toc .toc-wrapper {
  background: var(--color-bg-light);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  padding: 1em;
}
.page-toc .toc-wrapper .toc-header {
  padding: 0.5em 0;
  margin-bottom: 1em;
  border-bottom: 1px solid var(--color-border);
}
.page-toc .toc-wrapper .toc-header h3 {
  margin: 0;
  font-size: 1em;
  font-weight: 600;
  color: var(--color-text);
}
.page-toc .toc-wrapper .toc-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.page-toc .toc-wrapper .toc-content ul li {
  margin-bottom: 0.3em;
  font-size: 0.9em;
}
.page-toc .toc-wrapper .toc-content ul li a {
  color: var(--color-text-light);
  text-decoration: none;
  display: block;
  padding: 0.3em 0.5em;
  border-radius: 4px;
  transition: var(--transition);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page-toc .toc-wrapper .toc-content ul li a:hover {
  color: var(--color-primary);
  background-color: rgba(242, 138, 0, 0.05);
}
.page-toc .toc-wrapper .toc-content ul li a.active {
  color: var(--color-primary);
  font-weight: 500;
  background-color: rgba(242, 138, 0, 0.08);
}
.page-toc .toc-wrapper .toc-content ul li ul {
  padding-left: 1em;
  margin-top: 0.3em;
}
.page-toc .toc-wrapper .toc-content ul li ul li {
  font-size: 0.9em;
}
.page-toc::-webkit-scrollbar {
  width: 4px;
}
.page-toc::-webkit-scrollbar-track {
  background: #f5f5f5;
}
.page-toc::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 2px;
}
.page-toc::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}
/* 响应式调整 */
@media (max-width: 1200px) {
  .page-toc {
    display: none;
  }
}
@media (max-width: 768px) {
  .doc-container {
    flex-direction: column;
  }
  .mobile-menu-toggle {
    display: block;
  }
  .sidebar-menu {
    width: 100%;
    display: block;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    position: relative;
    height: auto;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  .sidebar-menu.mobile-expanded {
    max-height: 70vh;
    overflow-y: auto;
    border-bottom: 1px solid var(--color-border);
  }
  .main-content {
    padding: 1em;
  }
  .main-content .content-wrapper {
    padding: 1.5em;
  }
}
