/* 目录标题 */
.toc-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 12px;
  padding: 6px 12px;
  padding-top: 0;
  border-left: 2px solid #e5e7eb; /* 与 item 保持一致的侧边线 */
}

/* 目录列表容器 */
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 70vh;
  overflow-y: auto;
  max-width: 180px; 
}

/* Webkit 滚动条（Chrome、Safari、Edge）- 优先使用，支持更细的宽度 */
@supports selector(::-webkit-scrollbar) {
  .toc-list {
    &::-webkit-scrollbar {
      width: 2px;
    }

    &::-webkit-scrollbar-track {
      background: transparent;
    }

    &::-webkit-scrollbar-thumb {
      background: rgba(156, 163, 175, 0.2);
      border-radius: 2px;
    }

    &::-webkit-scrollbar-thumb:hover {
      background: rgba(156, 163, 175, 0.35);
    }
  }
}

/* Firefox 回退方案 */
@supports not selector(::-webkit-scrollbar) {
  .toc-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.25) transparent;
  }
}

/* 目录项 */
.toc-item {
  font-size: 14px;
  transition: all 0.2s ease;
  border-left: 2px solid #e5e7eb; /* 每个 item 自带侧边线 */
  cursor: pointer;
  margin: 0;
}


/* 根据层级缩进 */
.level-2 { padding-left: 10px; }
.level-3 { padding-left: 20px; }
.level-4 { padding-left: 30px; }

/* 悬停效果 */
.toc-item:hover {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.03);
}

/* 激活状态 */
.toc-item.active {
  color: #3b82f6;
  font-weight: 500;
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
}

/* 链接样式 */
.toc-item a {
  text-decoration: none;
  color: inherit;
  display: block;
  width: 100%;
  padding: 4px 0;
  padding-right: 4px;
}

/* 文字溢出处理 */
.toc-item a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 非激活状态的文字颜色 */
.toc-item:not(.active) {
  color: #6b7280;
}

/* 激活项的悬停效果 */
.toc-item.active:hover {
  background: rgba(59, 130, 246, 0.12);
}