@import url('./right-toc.css');
@import url('./doc-header.css');
@import url('./doc-footer.css');
@import url('./mode-switcher.css');
nav {
  margin: 0 !important;
  padding: 0;
}
.page-layout {
  margin-top: -20px !important;
  margin-bottom: -63px !important;
}
  /* 重置默认边距 */
  body {
    margin: 0;
    padding: 0;
    background: #f5f5f5;
  }

  /* 整体布局：左侧固定，右侧全白 */
  .page-layout {
    min-height: 100vh;
  }

  /* 左侧目录：固定位置，紧贴左边 */
  .sidebar-fixed {
    width: 320px;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    position: fixed;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    
    transform: translateX(0);
    transition: transform 0.3s ease;   /* ✅ 平滑动画关键 */
  }

  .sidebar-fixed.collapsed {
    transform: translateX(calc(-100% + 20px));
}

/* 小把手在右边缘 */
.sidebar-toggle {
  position:absolute;
  left:303px;
  top:50%;
  font-size:24px;
  color:#7d7878;
  z-index:9999;
  cursor: pointer;
  transform: translateY(-50%);

}

  /* 目录内部内容 */
  .sidebar-content {
    padding: 20px 20px;
  }

  /* 目录标题 */
  .toc-header {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    padding: 0 10px;
    text-align: center;
  }

.toc-header-line1 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  color: #9ca3af;
}
.toc-header-line2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #ffa116;
}

  /* 目录列表 */
  .toc-nav {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .toc-nav li {
    margin-bottom: 2px;
  }

  /* 目录链接 */
  
  /* ✅ 文本容器：占据剩余空间并显示省略号 */
.toc-text {
  flex: 1;
  min-width: 0;  /* 👈 关键：允许 flex 子项缩小到内容宽度以下 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

  .toc-item {
    display: flex;
    align-items: center;
    padding: 10px 5px;
    color: #6b7280;
    text-decoration: none;
    font-size: 16px;
    border-radius: 6px;
    transition: all 0.2s;
    position: relative;
  }

  .toc-item:hover {
    background: #f9fafb;
    color: #374151;
    text-decoration: none; 
  }

  /* 激活状态 */
  .toc-item.active {
    background: #f3f4f6;
    color: #1f2937;
    font-weight: 600;
  }

  .toc-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 28px;
    background: #2563eb;
    border-radius: 0 2px 2px 0;
  }

  /* 图标 */
  .toc-item i {
    margin-right: 10px;
    font-size: 16px;
    width: 16px;
  }

  /* 二级目录 */
  .toc-nav .toc-nav {
    padding-left: 28px;
    margin-top: 4px;
  }

  .toc-nav .toc-nav .toc-item {
    font-size: 14px;
    padding: 8px 8px;
  }

  /* 三级目录 */
  .toc-nav .toc-nav .toc-nav {
    padding-left: 20px;
  }

  .toc-nav .toc-nav .toc-nav .toc-item {
    font-size: 16px;
    color: #9ca3af;
  }

/* 一级标题（分类）：添加箭头和可点击样式 */
.toc-nav > li > .toc-item {
  cursor: pointer;
  position: relative;
}

/* 箭头图标：紧跟在文字右边 */
.toc-item .fa-chevron-right,
.toc-item .fa-chevron-down {
  transition: none;
  font-size: 12px;
  margin-left: 8px;  /* 👈 改：在文字右边留一点间距 */
  margin-right: 0;   /* 👈 移除右边距 */
}

/* 二级目录：默认隐藏 */
.toc-nav > li > .toc-nav {
  /*display: none;*/
  padding-left: 24px;
  margin-top: 4px;
  overflow: hidden;  
  max-height: 0; 
  opacity: 0;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.4s ease, 
              margin-top 0.4s ease; /* ✅ 改：使用贝塞尔曲线 */
}

/* 展开状态：显示子菜单 */
.toc-nav > li.expanded > .toc-nav {
  /*display: block;*/
  max-height: 2000px;  /* 👈 添加：足够大的值 */
  opacity: 1;  /* 👈 添加 */
  margin-top: 4px; /* ✅ 改：展开时恢复 margin */
  transition: max-height 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.4s ease, 
              margin-top 0.4s ease; /* ✅ 改：使用贝塞尔曲线 */
}


/* 二级目录项：添加延迟动画 */
.toc-nav > li > .toc-nav > li {
  opacity: 0;
  transform: translateY(-10px);  /* 👈 添加：从上方滑入 */
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* 展开状态下的子项动画 */
.toc-nav > li.expanded > .toc-nav > li {
  opacity: 1;
  transform: translateY(0);
}

/* 为每个子项添加递增延迟 */
.toc-nav > li.expanded > .toc-nav > li:nth-child(1) {
  transition-delay: 0.05s;
}

.toc-nav > li.expanded > .toc-nav > li:nth-child(2) {
  transition-delay: 0.1s;
}

.toc-nav > li.expanded > .toc-nav > li:nth-child(3) {
  transition-delay: 0.15s;
}

.toc-nav > li.expanded > .toc-nav > li:nth-child(4) {
  transition-delay: 0.2s;
}

.toc-nav > li.expanded > .toc-nav > li:nth-child(5) {
  transition-delay: 0.25s;
}
/* 如果有更多项，可以继续添加，或者用这个通用方案 */
.toc-nav > li.expanded > .toc-nav > li:nth-child(n+6) {
  transition-delay: 0.3s;
}
/* ===============右侧主内容区域============================== */
.main-area {
  margin-left: 0;
  background: #ffffff;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  position: relative;
  width: 100%;  /* 👈 添加 */
}

/* 内容容器：居中显示 */
.content-container {
  width: 100%;                /* 👈 改：使用 width */
  max-width: 980px;
  margin: 0 auto;
  padding: 15px 40px 0px 40px;
  flex-shrink: 0;             /* 👈 改：禁止收缩 */
  box-sizing: border-box;     /* 👈 添加 */
}
  /* 滚动条美化 */
  .sidebar-fixed::-webkit-scrollbar {
    width: 6px;
  }

  .sidebar-fixed::-webkit-scrollbar-track {
    background: #f9fafb;
  }

  .sidebar-fixed::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
  }

  .sidebar-fixed::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
  }
/* 默认：桌面端隐藏移动端按钮 */
.mobile-menu-btn {
  display: none;
}

/* 当视口小于 1500px 时，侧边栏会隐藏，显示按钮 */
@media (max-width: 1500px) {
  .mobile-menu-btn {
    display: block;
    position: fixed;
    top: 60px;
    left: 20px;
    z-index: 1000; 
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .sidebar-fixed {
    position: fixed;      /* 确保是定位元素 */
    z-index: 1001;        /* 👉 比按钮高，这样就会盖住按钮 */
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

  .sidebar-fixed.open {
    transform: translateX(0);
  }

  .main-area {
    margin-left: 0;
  }

  .content-container {
    padding: 15px 20px;
  }
}
/* 阅读限制遮罩 - 添加到 markdown-body 底部 */
.markdown-body {
  position: relative; /* 确保遮罩相对于 markdown-body 定位 */
}

.read-limit-mask {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  pointer-events: none;
}

/* 遮罩层 - 纯白色，无渐变 */
.read-limit-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 10%,
    rgba(255, 255, 255, 0.5) 40%,
    rgba(255, 255, 255, 0.8) 60%,
    rgba(255, 255, 255, 1) 100%
  );
  pointer-events: none;
}

/* 内容区域 */
.read-limit-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end; /* ✅ 改为 flex-end，内容靠底部 */
  height: 200px; /* ✅ 必须设置高度，justify-content 才有效 */
  padding: 40px 20px 0px;
  background: transparent;
  pointer-events: auto;
}

/* 描述文字 */
.read-limit-text {
  font-size: 15px;
  font-weight: 500;
  color: #6b7280;
  margin: 0 0 20px 0;
}

/* 登录按钮 - 橙色系 */
.read-limit-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 500;
  color: white;
  background: #ffa116;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(255, 161, 22, 0.3);
}

.read-limit-btn:hover {
  background: #ff8800;
  box-shadow: 0 4px 12px rgba(255, 161, 22, 0.4);
}

.read-limit-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(255, 161, 22, 0.3);
}

.read-limit-btn i {
  font-size: 16px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .read-limit-overlay {
    height: 150px;
  }

  .read-limit-content {
    padding: 30px 20px 40px;
  }

  .read-limit-text {
    font-size: 14px;
    margin: 0 0 16px 0;
  }

  .read-limit-btn {
    padding: 10px 28px;
    font-size: 14px;
  }
}