.global-toc {
  position: fixed;
  top: 80px;
  left: 20px;
  width: 250px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 9999;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.global-toc.collapsed {
  width: 250px;
}

.global-toc.collapsed .global-toc-list {
  max-height: 0;
  opacity: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.global-toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #f3f4f6;
}

.global-toc.collapsed .global-toc-header {
  border-bottom: none;
}

.global-toc-title {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.01em;
}

.global-toc-toggle {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  color: #6b7280;
  font-size: 18px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  line-height: 1;
}

.global-toc-toggle:hover {
  background: #f3f4f6;
  color: #111827;
  border-color: #d1d5db;
}

.global-toc-toggle:active {
  transform: scale(0.95);
}

.global-toc-list {
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  padding: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
}

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

.global-toc li {
  margin-bottom: 2px;
}

.global-toc a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: #4b5563;
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: all 0.15s ease;
  line-height: 1.4;
}

.global-toc a:hover {
  background: #f9fafb;
  color: #111827;
  transform: translateX(2px);
}

.global-toc a.active {
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
  color: #ffffff;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.global-toc a.active:hover {
  transform: none;
  background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
}

@media (max-width: 768px) {
  .global-toc {
    display: none;
  }
}

/* Custom scrollbar */
.global-toc-list::-webkit-scrollbar {
  width: 6px;
}

.global-toc-list::-webkit-scrollbar-track {
  background: transparent;
}

.global-toc-list::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 3px;
}

.global-toc-list::-webkit-scrollbar-thumb:hover {
  background: #d1d5db;
}

/* Smooth animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.global-toc {
  animation: slideIn 0.3s ease-out;
}