/**
 * TextToolz TOC Pro - Styling (Matches Main Site)
 */

/* Table of Contents Container */
.table-of-contents {
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.dark-mode .table-of-contents {
  background: #1e2124;
  border-color: #2a2e32;
}

/* TOC Header */
.toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  margin-bottom: 1rem;
}

.table-of-contents h3 {
  color: #2563eb;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

body.dark-mode .table-of-contents h3 {
  color: #60a5fa;
}

/* Toggle Button */
.toc-toggle {
  background: transparent;
  border: none;
  color: #2563eb;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border-radius: 6px;
}

body.dark-mode .toc-toggle {
  color: #60a5fa;
}

.toc-toggle:hover {
  background: rgba(37, 99, 235, 0.1);
}

body.dark-mode .toc-toggle:hover {
  background: rgba(96, 165, 250, 0.1);
}

.toc-toggle i {
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.toc-toggle.collapsed i {
  transform: rotate(180deg);
}

/* TOC List */
.toc-list {
  margin: 0;
  padding-left: 1.5rem;
  list-style: decimal;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.35rem;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

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

.toc-list li {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.toc-list a {
  color: #374151;
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
}

body.dark-mode .toc-list a {
  color: #b0b3b8;
}

.toc-list a:hover {
  color: #2563eb;
  text-decoration: underline;
}

body.dark-mode .toc-list a:hover {
  color: #60a5fa;
}

/* Active link highlighting */
.toc-list a.active {
  color: #2563eb;
  font-weight: 600;
}

body.dark-mode .toc-list a.active {
  color: #60a5fa;
}

/* Nested lists */
.toc-list ol {
  list-style-type: lower-alpha;
  padding-left: 1.5rem;
  margin-top: 0.25rem;
}

.toc-list ol ol {
  list-style-type: lower-roman;
}

.toc-list ol ol ol {
  list-style-type: decimal;
  font-size: 0.9em;
}

.toc-list ol ol ol ol {
  list-style-type: lower-alpha;
  font-size: 0.85em;
}

/* Semantic Section Styling */
.info-section {
  margin: 0.9rem 0;
  padding: 0.65rem 0;
  border-bottom: 1px solid #e5e7eb;
}

body.dark-mode .info-section {
  border-color: #2a2e32;
}

.info-section:last-of-type {
  border-bottom: none;
}

.info-section h2,
.info-section h3,
.info-section h4,
.info-section h5,
.info-section h6 {
  color: #111827;
  font-weight: 700;
  margin: 0 0 1rem 0;
  scroll-margin-top: 100px; /* Offset for sticky header */
}

body.dark-mode .info-section h2,
body.dark-mode .info-section h3,
body.dark-mode .info-section h4,
body.dark-mode .info-section h5,
body.dark-mode .info-section h6 {
  color: #e5e7eb;
}

.info-section h2 {
  font-size: 1.75rem;
}

.info-section h3 {
  font-size: 1.5rem;
}

.info-section h4 {
  font-size: 1.3rem;
}

.info-section h5 {
  font-size: 1.15rem;
}

.info-section h6 {
  font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .table-of-contents {
    padding: 1rem;
  }
  
  .toc-list {
    padding-left: 1rem;
    font-size: 0.9rem;
  }
  
  .table-of-contents h3 {
    font-size: 1.1rem;
  }
}

/* Print styles */
@media print {
  .table-of-contents {
    border: 1px solid #000;
    background: #fff;
  }
  
  .toc-toggle {
    display: none;
  }
  
  .toc-list {
    max-height: none !important;
    opacity: 1 !important;
  }
}

