/**
 * Table of Contents Styling
 * 
 * Styles for a summary/table of contents that appears at the top of post content
 */

/* Wrapper for content and TOC */
.post-content-with-toc {
  position: relative;
  display: block;
  width: 100%;
}

/* Post content without custom margin */
.single-post .box-wrapper .main-wrapper .main-container .page-wrapper article .post-content-with-toc .post-content {
  width: 100%;
  margin: 0 auto !important; /* Reset margin */
}

/* Table of Contents Container */
.post-table-of-contents {
  position: relative;
  width: 100%;
  margin: 4em auto 0 auto;
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 1.5em 2em;
  box-shadow: 0px 2px 8px 4px rgba(0, 0, 0, 0.05);
  border-left: 4px solid var(--color-green, #52924e);
  border-right: 4px solid var(--color-green, #52924e);
  font-size: 0.95em;
  line-height: 1.5;
  max-width: 1056px;
}

/* Title for TOC */
.post-table-of-contents h4 {
  margin: 0 0 1em 0 !important;
  color: var(--color-text, #101213) !important;
  font-size: 1.5em !important;
  font-weight: 600 !important;
}

/* TOC List Styling */
.post-table-of-contents ul {
  padding-left: 0 !important;
  margin-bottom: 0 !important;
  list-style-type: none !important;
}

/* TOC List Items */
.post-table-of-contents li {
  margin-bottom: 0.5em !important;
  line-height: 1.4 !important;
  transition: all 0.2s ease;
  position: relative;
}

/* Hierarchical lines to show structure */
.post-table-of-contents li {
  padding-left: 20px;
  position: relative;
}

/* Vertical line */
.post-table-of-contents li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e5e7eb;
}

/* Level indicators - these will be added by JavaScript */
.post-table-of-contents li .level-line {
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 18px;
  height: 2px;
  background: #e5e7eb;
}

/* Each successive level gets padding */
.post-table-of-contents li.level-1 {
  padding-left: 20px;
}

.post-table-of-contents li.level-2 {
  padding-left: 40px;
}

.post-table-of-contents li.level-3 {
  padding-left: 60px;
}

.post-table-of-contents li.level-4 {
  padding-left: 80px;
}

.post-table-of-contents li.level-5 {
  padding-left: 100px;
}

.post-table-of-contents li.level-6 {
  padding-left: 120px;
}

/* Each level's line is positioned appropriately */
.post-table-of-contents li.level-1::before {
  left: 0;
}

.post-table-of-contents li.level-2::before {
  left: 20px;
}

.post-table-of-contents li.level-3::before {
  left: 40px;
}

.post-table-of-contents li.level-4::before {
  left: 60px;
}

.post-table-of-contents li.level-5::before {
  left: 80px;
}

.post-table-of-contents li.level-6::before {
  left: 100px;
}

/* Horizontal connecting line to each item */
.post-table-of-contents li.level-1 .level-line {
  width: 18px;
  left: 0;
}

.post-table-of-contents li.level-2 .level-line {
  width: 18px;
  left: 20px;
}

.post-table-of-contents li.level-3 .level-line {
  width: 18px;
  left: 40px;
}

.post-table-of-contents li.level-4 .level-line {
  width: 18px;
  left: 60px;
}

.post-table-of-contents li.level-5 .level-line {
  width: 18px;
  left: 80px;
}

.post-table-of-contents li.level-6 .level-line {
  width: 18px;
  left: 100px;
}

/* Last items in each level need special treatment */
.post-table-of-contents li:last-of-type::before {
  height: 0.7em;
}

/* TOC Links */
.post-table-of-contents a {
  text-decoration: none !important;
  color: var(--color-text, #101213) !important;
  display: inline-block;
  transition: color 0.2s ease;
  padding: 2px 0;
}

.post-table-of-contents a:hover {
  color: var(--color-green, #52924e) !important;
  padding-left: 2px;
}

/* Accordion Styles */
.toc-toggle {
  cursor: pointer;
  margin-right: 8px;
  transition: transform 0.2s ease;
  display: inline-block;
  color: #52924e;
  font-size: 1.5em;
  width: 29.4px;
  text-align: center;
  user-select: none;
}

.toc-toggle.expanded {
  transform: rotate(90deg);
}

.toc-collapsible {
  display: none;
  transition: all 0.3s ease;
}

.toc-collapsible.expanded {
  display: block;
}

.toc-item-wrapper {
  display: flex;
  align-items: baseline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .post-table-of-contents {
    padding: 1.2em 1.5em;
    margin-bottom: 2em;
    margin-left: 1em;
    margin-right: 1em;
    width: unset;
  }
}

/* Print styles */
@media print {
  .post-table-of-contents {
    display: none !important;
  }
} 