/* 题解目录导航栏容器 */
.solution-toc-container {
  position: fixed;
  width: 200px;
  max-height: 350px;
  overflow: hidden; /* 防止容器本身溢出 */
  background: #ffffff;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  z-index: 100;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
}

/* 隐藏状态：淡出动画 */
.solution-toc-container.hide {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.15s ease-in, transform 0.15s ease-in;
}

/* 显示状态：淡入动画 */
.solution-toc-container:not(.hide) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

/* 目录头部 */
.solution-toc-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e1e4e8;
  background: #f6f8fa;
}

.solution-toc-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #24292e;
}

/* 目录导航 */
.solution-toc-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0; /* 确保 flex 子元素可以收缩 */
  max-height: calc(350px - 49px); /* 减去 header 的高度（约49px：12px padding + 14px font + border等） */
}

.solution-toc-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

/* 目录项 */
.solution-toc-item {
  margin: 0;
  padding: 0;
}

.solution-toc-link {
  display: block;
  padding: 6px 16px;
  color: #586069;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.5;
  transition: color 0.2s ease, background-color 0.2s ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.solution-toc-link:hover {
  color: #0366d6;
  background-color: #f6f8fa;
  text-decoration: none;
}

/* 活动项 */
.solution-toc-item.active .solution-toc-link {
  color: #0366d6;
  font-weight: 600;
  background-color: #f6f8fa;
  border-left: 3px solid #0366d6;
  padding-left: 13px; /* 16px - 3px border */
}

/* 不同层级的缩进 */
.solution-toc-item-level-1 .solution-toc-link {
  padding-left: 16px;
  font-weight: 600;
}

.solution-toc-item-level-2 .solution-toc-link {
  padding-left: 24px;
}

.solution-toc-item-level-3 .solution-toc-link {
  padding-left: 32px;
}

.solution-toc-item-level-4 .solution-toc-link {
  padding-left: 40px;
}

.solution-toc-item-level-5 .solution-toc-link {
  padding-left: 48px;
}

.solution-toc-item-level-6 .solution-toc-link {
  padding-left: 56px;
}

/* 活动项的缩进调整 */
.solution-toc-item-level-1.active .solution-toc-link {
  padding-left: 13px;
}

.solution-toc-item-level-2.active .solution-toc-link {
  padding-left: 21px;
}

.solution-toc-item-level-3.active .solution-toc-link {
  padding-left: 29px;
}

.solution-toc-item-level-4.active .solution-toc-link {
  padding-left: 37px;
}

.solution-toc-item-level-5.active .solution-toc-link {
  padding-left: 45px;
}

.solution-toc-item-level-6.active .solution-toc-link {
  padding-left: 53px;
}

/* 滚动条样式 */
.solution-toc-nav::-webkit-scrollbar {
  width: 6px;
}

.solution-toc-nav::-webkit-scrollbar-track {
  background: #f6f8fa;
  border-radius: 3px;
}

.solution-toc-nav::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.solution-toc-nav::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* 深色主题支持 */
.theme--dark .solution-toc-container {
  background: #21262d;
  border-color: #30363d;
}

.theme--dark .solution-toc-header {
  background: #161b22;
  border-bottom-color: #30363d;
}

.theme--dark .solution-toc-title {
  color: #c9d1d9;
}

.theme--dark .solution-toc-link {
  color: #8b949e;
}

.theme--dark .solution-toc-link:hover {
  color: #58a6ff;
  background-color: #161b22;
}

.theme--dark .solution-toc-item.active .solution-toc-link {
  color: #58a6ff;
  background-color: #161b22;
  border-left-color: #58a6ff;
}

.theme--dark .solution-toc-nav::-webkit-scrollbar-track {
  background: #161b22;
}

.theme--dark .solution-toc-nav::-webkit-scrollbar-thumb {
  background: #484f58;
}

.theme--dark .solution-toc-nav::-webkit-scrollbar-thumb:hover {
  background: #6e7681;
}
