/* DDKK 文章目录样式 - 基于 Ant Design 5.x 设计规范 */
/* 所有选择器均使用完整前缀，避免样式冲突 */


.ddkk-toc {
  position: relative;
  width: 100%;
  height: 100%;
  /* 使用 flex 布局，使内部元素充满容器高度 */
  display: flex;
  flex-direction: column;
  min-height: 0; /* 允许缩小 */
}

#tocml {
  position: relative;
  width: 100%;
  display: block;
}

.ddkk-toc-aside {
  /* 使用透明背景，继承父容器背景 */
  background: transparent;
  padding: 0;
  /* 目录列表填充剩余高度，支持滚动 */
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0; /* 允许 flex 子元素缩小 */
  display: flex;
  flex-direction: column;
}

.ddkk-toc-title {
  font-size: 14px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.88);
  margin: 0;
  padding: 0 0 8px 0;
  padding-left: 0; /* 与容器内边距对齐 */
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0; /* 标题不收缩 */
}

.ddkk-toc-content {
  margin: 0;
  padding-left: 0; /* 与容器内边距对齐 */
  flex: 1;
  min-height: 0;
}

.ddkk-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ddkk-toc-item {
  padding: 4px 0;
  font-size: 14px;
  line-height: 1.8;
  position: relative;
  /* 允许伪元素超出边界显示 */
  overflow: visible;
}

.ddkk-toc-item-level-1 {
  padding-left: 10px;
}

.ddkk-toc-item-level-2 {
  padding-left: 16px;
  font-size: 12px;
}

.ddkk-toc-item-level-3 {
  padding-left: 32px;
  font-size: 12px;
}

.ddkk-toc-item-level-4 {
  padding-left: 48px;
  font-size: 12px;
}

.ddkk-toc-item-level-5 {
  padding-left: 64px;
  font-size: 12px;
}

.ddkk-toc-link {
  display: block;
  color: rgba(0, 0, 0, 0.88);
  text-decoration: none;
  transition: color 0.2s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 0;
  position: relative;
}

.ddkk-toc-link:hover {
  color: #1677ff;
}

.ddkk-toc-link-active {
  color: rgba(0, 0, 0, 0.88);
  font-weight: 600;
}

/* 激活项样式：整行背景 + 左侧蓝色竖条（所有层级通用） */
.ddkk-toc-item-active > .ddkk-toc-link {
  background: rgba(22, 119, 255, 0.06);
  padding: 2px 8px;
  margin: 0 -8px;
  color: #1677ff;
  border-left: 2px solid #1677ff;
}

/* 自定义滚动条样式 */
.ddkk-toc-aside::-webkit-scrollbar {
  width: 4px;
}

.ddkk-toc-aside::-webkit-scrollbar-track {
  background: transparent;
}

.ddkk-toc-aside::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

.ddkk-toc-aside::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* 目录内容为空时，隐藏整个目录容器 */
/* 使用 :has() 选择器，当目录为空时自动隐藏 */
.ddkk-article-toc:has(#article-catalog:empty) {
  display: none !important;
}

/* 目录内容为空时，隐藏目录 aside（备用方案） */
.ddkk-toc-aside:has(#article-catalog:empty) {
  display: none;
}

/* 响应式设计 - 小屏幕隐藏目录 */
/* 窗口宽度小于 1366px 时，隐藏右侧目录内容（与布局保持一致） */
@media (max-width: 1365.98px) {
  #tocml {
    display: none;
  }
}

