/* Custom TOC Sidebar Styles */
.toc-sidebar {
  position: fixed;
  right: 0;
  top: 50px;
  width: 280px;
  height: calc(100vh - 50px);
  background: #f8f9fa;
  border-left: 1px solid #e9ecef;
  padding: 20px 0;
  overflow-y: auto;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.toc-sidebar-content {
  padding: 0 20px;
}

.toc-sidebar-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 15px;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toc-sidebar-nav #TableOfContents {
  font-size: 14px;
}

.toc-sidebar-nav #TableOfContents ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-sidebar-nav #TableOfContents li {
  margin-bottom: 8px;
}

.toc-sidebar-nav #TableOfContents a {
  color: #666;
  text-decoration: none;
  display: block;
  padding: 5px 0;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.toc-sidebar-nav #TableOfContents a:hover {
  color: #007bff;
  background-color: rgba(0, 123, 255, 0.1);
  padding-left: 8px;
}

.toc-sidebar-nav #TableOfContents ul ul {
  margin-left: 15px;
  margin-top: 5px;
}

.toc-sidebar-nav #TableOfContents ul ul li {
  margin-bottom: 4px;
  font-size: 13px;
}

/* Hide the default TOC button */
body .progress {
  display: none !important;
}

/* Main content adjustment when TOC sidebar is present */
body:has(.toc-sidebar) .main-content {
  margin-right: 300px;
  transition: margin-right 0.3s ease;
}

/* Responsive design for smaller screens */
@media (max-width: 1200px) {
  .toc-sidebar {
    width: 250px;
  }

  body:has(.toc-sidebar) .main-content {
    margin-right: 270px;
  }
}

@media (max-width: 992px) {
  .toc-sidebar {
    transform: translateX(100%);
  }

  body:has(.toc-sidebar) .main-content {
    margin-right: 0;
  }

  /* Show TOC button on mobile */
  body .progress {
    display: block !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .toc-sidebar {
    background: #1a1a1a;
    border-left-color: #333;
  }

  .toc-sidebar-title {
    color: #e9ecef;
  }

  .toc-sidebar-nav #TableOfContents a {
    color: #adb5bd;
  }

  .toc-sidebar-nav #TableOfContents a:hover {
    color: #66b2ff;
    background-color: rgba(102, 178, 255, 0.1);
  }
}