/* ============================================
   Table of Contents Sidebar (Floating)
   ============================================ */

/* TOC Sidebar - floating on left side */
.toc-sidebar {
  position: fixed;
  top: 5rem;
  left: 1rem;
  width: 16rem;
  max-height: calc(100vh - 6rem);
  z-index: 100;
}

/* TOC Navigation */
.toc-nav {
  background-color: rgba(0, 0, 0, 0.02);
  border-left: 2px solid #e0e0e0;
  padding: 1rem;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  transition: all 0.3s ease;
}

[data-theme="dark"] .toc-nav {
  background-color: rgba(255, 255, 255, 0.02);
  border-left-color: #3a3a3a;
}

/* TOC Title */
.toc-title {
  font-family: 'Open Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  margin: 0 0 0.75rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e0e0e0;
}

[data-theme="dark"] .toc-title {
  color: #999;
  border-bottom-color: #3a3a3a;
}

/* TOC Content list */
#toc-content {
  font-family: 'Open Sans', sans-serif;
}

#toc-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#toc-content li {
  margin: 0.25rem 0;
}

#toc-content > ul > li > a {
  display: block;
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: #555;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
}

#toc-content a:hover {
  color: #008AFF;
  border-left-color: #008AFF;
  background-color: rgba(0, 138, 255, 0.05);
}

#toc-content a.active {
  color: #008AFF;
  border-left-color: #008AFF;
  font-weight: 600;
  background-color: rgba(0, 138, 255, 0.08);
}

/* H3 items (nested) */
#toc-content ul ul a {
  padding-left: 1.25rem;
  font-size: 0.75rem;
  color: #666;
}

/* H4 items */
#toc-content ul ul ul a {
  padding-left: 1.75rem;
  font-size: 0.7rem;
}

/* Smooth scroll offset for fixed header */
#toc-content a {
  scroll-margin-top: 4.5rem;
}

/* Hide TOC if empty */
#toc:empty,
#toc-content:empty {
  display: none;
}

#toc-content li:empty {
  display: none;
}

/* Hide TOC on smaller screens - only show on large screens */
@media (max-width: 1199px) {
  .toc-sidebar {
    display: none !important;
  }
}
