/* 目录样式 */
.toc-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 250px;
  height: 100%;
  background-color: #2d2d2d;
  overflow-y: auto;
  padding: 20px 0;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  box-sizing: border-box;
}

/* 自定义滚动条样式 */
.toc-container::-webkit-scrollbar {
  width: 8px;
}

.toc-container::-webkit-scrollbar-track {
  background: #2d2d2d;
}

.toc-container::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

.toc-container::-webkit-scrollbar-thumb:hover {
  background: #777;
}

.toc-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  background-color: #333;
  color: #f06292;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  z-index: 1001;
  border-radius: 4px;
  font-size: 14px;
}

.toc-title {
  color: #f06292;
  text-align: center;
  margin-bottom: 15px;
  font-size: 16px;
  font-weight: bold;
  padding: 0 15px;
}

.toc-list {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.toc-item {
  padding: 6px 15px;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
  cursor: pointer;
  font-size: 13px;
}

.toc-item:hover {
  background-color: #3a3a3a;
  border-left: 3px solid #03dac6;
}

.toc-item.active {
  background-color: #3a3a3a;
  border-left: 3px solid #f06292;
}

.toc-link {
  text-decoration: none;
  color: #e0e0e0;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* h2 样式 - 无缩进 */
.toc-h2 {
  font-weight: bold;
}

/* h3 样式 - 缩进 15px */
.toc-h3 {
  padding-left: 15px;
  font-weight: normal;
}

/* h4 样式 - 缩进 30px */
.toc-h4 {
  padding-left: 30px;
  font-weight: normal;
  font-size: 12px;
}

/* 表格样式 */
table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background-color: #2d2d2d;
  color: #e0e0e0;
  font-size: 14px;
  table-layout: auto;
  word-wrap: break-word;
}

th, td {
  border: 1px solid #444444;
  padding: 12px 15px;
  text-align: left;
}

th {
  background-color: #333333;
  color: #f06292;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:nth-child(even) {
  background-color: #3a3a3a;
}

tr:hover {
  background-color: #444444;
}

/* 响应式表格 */
@media screen and (max-width: 768px) {
  table {
    display: table;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: -ms-autohiding-scrollbar;
    max-width: 100%;
    margin: 1rem 0;
  }
  
  th, td {
    padding: 8px 10px;
    font-size: 13px;
  }
  
  /* 当表格很宽时，允许水平滚动 */
  .markdown-section {
    overflow-x: hidden;
  }
}

/* 移动端样式 */
@media (max-width: 768px) {
  .toc-container {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 250px;
    height: 100vh;
  }
  
  .toc-container.open {
    transform: translateX(0);
  }
  
  .toc-toggle {
    display: block;
  }
  
  .main-content {
    margin-left: 0;
    overflow-x: hidden;
  }
}

/* 桌面端样式 */
@media (min-width: 769px) {
  .main-content {
    margin-left: 250px;
    overflow-x: hidden;
  }
  
  .toc-toggle {
    display: none;
  }
  
  /* 确保目录容器在桌面端正确显示 */
  .toc-container {
    height: 100vh;
  }
}