.toc-nav {
  padding: 0;
}

/* Styles pour la table des matières améliorée */
.toc-sidebar {
  position: sticky;
  top: 2rem;
  height: fit-content;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  padding: 1.5rem;
  background: #f8f9fa;
  border-radius: 0.5rem;
  border: 1px solid #e9ecef;
  z-index: 10;
}

.toc-title {
  font-size: 0.875rem;
  font-weight: 400;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  border-bottom: 2px solid #dee2e6;
  padding-bottom: 0.5rem;
}

.toc-nav .nav-link {
  display: block;
  padding: 0.2rem 0.75rem;
  color: #6c757d;
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: 0.375rem;
  transition: all 0.15s ease-in-out;
  border-left: 3px solid transparent;
  margin-bottom: 0rem;
}

.toc-nav .nav-link:hover {
  color: #0d6efd;
  background-color: rgba(13, 110, 253, 0.1);
  border-left-color: #0d6efd;
}

.toc-nav .nav-link.active {
  color: #0d6efd;
  background-color: rgba(13, 110, 253, 0.1);
  border-left-color: #0d6efd;
  font-weight: 600;
}

/* Indentation pour les sous-sections */
.toc-nav .nav-link.h3 {
  padding-left: 1.5rem;
  font-size: 0.8rem;
  border-left-width: 2px;
}

.toc-nav .nav-link.h3.active {
  border-left-width: 3px;
}

/* Bouton mobile */
.toc-mobile-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1050;
  background: #0d6efd;
  color: white;
  border: none;
  border-radius: 50%;
  width: 3.5rem;
  height: 3.5rem;
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.toc-mobile-toggle:hover {
  background: #0b5ed7;
  transform: scale(1.05);
}

/* Menu mobile overlay */
.toc-mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.toc-mobile-overlay.show {
  display: block;
  opacity: 1;
}

.toc-mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 320px;
  height: 100%;
  background: white;
  z-index: 1050;
  padding: 2rem;
  overflow-y: auto;
  transition: right 0.3s ease-in-out;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
}

.toc-mobile-menu.show {
  right: 0;
}

.toc-mobile-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6c757d;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toc-mobile-close:hover {
  color: #495057;
}

/* Animation d'apparition */
.toc-sidebar {
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive - Masquer la TOC desktop sur mobile */
@media (max-width: 991.98px) {
  .toc-sidebar {
    display: none;
  }
}

/* Amélioration de l'indicateur actif */
.toc-nav .nav-link.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: #0d6efd;
  border-radius: 0 2px 2px 0;
}

.toc-nav .nav-link {
  position: relative;
}

@media (max-width: 568px) {
  .toc-nav .nav-link {
    padding: 0.6rem 0.75rem;
  }
}
