/* Table of Contents Widget */
.wl-toc__wrapper {
    --wl-box-background-color: #f8f9fa;
    --wl-box-border-color: #e9ecef;
    --wl-box-border-width: 1px;
    --wl-box-border-radius: 8px;
    --wl-box-padding: 20px;
    /* --wl-box-min-height: 200px; */
    --wl-header-background-color: transparent;
    --wl-header-color: #333;
    --wl-toggle-button-color: #666;
    --wl-separator-width: 1px;
    --wl-toc-body-max-height: 400px;
    --wl-item-text-color: #555;
    --wl-item-text-hover-color: #0073aa;
    --wl-item-text-active-color: #005177;
    --wl-item-text-decoration: none;
    --wl-item-text-hover-decoration: none;
    --wl-item-text-active-decoration: none;
    --wl-item-text-transition-duration: 300ms;
    --wl-marker-color: #666;
    --wl-marker-size: 20px;
    --wl-nested-list-indent: 1.5em;
    
    background-color: var(--wl-box-background-color);
    border: var(--wl-box-border-width) solid var(--wl-box-border-color);
    border-radius: var(--wl-box-border-radius);
    padding: var(--wl-box-padding);
    min-height: var(--wl-box-min-height);
    margin-bottom: 20px;
    position: relative;
}

/* Box Shadow */
.wl-toc__wrapper {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Header */
.wl-toc__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: var(--wl-separator-width) solid var(--wl-box-border-color);
    background-color: var(--wl-header-background-color);
    cursor: pointer;
    user-select: none;
}

.wl-toc__header-title {
    margin: 0;
    color: var(--wl-header-color);
    font-size: 1.2em;
    font-weight: 600;
    flex-grow: 1;
    line-height: 1.4;
}

/* Toggle Buttons */
.wl-toc__toggle-button {
    cursor: pointer;
    color: var(--wl-toggle-button-color);
    font-size: 16px;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.wl-toc__toggle-button:hover {
    color: var(--wl-item-text-hover-color);
}

.wl-toc__toggle-button--collapse {
    display: block;
}

 .wl-toc__toggle-button--expand {
    display: none;
}

.wl-toc--collapsed .wl-toc__toggle-button--collapse {
    display: flex;
}

/* Body */
.wl-toc__body {
    max-height: var(--wl-toc-body-max-height);
    overflow-y: auto;
    transition: max-height 0.3s ease;
    overflow-x: hidden;
    padding-right: 12px;
}

.wl-toc--collapsed .wl-toc__body {
    max-height: 0;
    overflow: hidden;
}

.wl-toc__no-headings-message {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* List */
.wl-toc__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wl-toc__list-item {
    margin-bottom: 8px;
    position: relative;
    display: flex;
    align-items: flex-start;
    padding-left: 0;
    transition: padding-left 0.3s ease;
    line-height: 1.4;
}

/* Hierarchical View */
.wl-toc__list--hierarchical .wl-toc__list-item--level-3 {
    padding-left: var(--wl-nested-list-indent);
}

.wl-toc__list--hierarchical .wl-toc__list-item--level-4 {
    padding-left: calc(var(--wl-nested-list-indent) * 2);
}

.wl-toc__list--hierarchical .wl-toc__list-item--level-5 {
    padding-left: calc(var(--wl-nested-list-indent) * 3);
}

.wl-toc__list--hierarchical .wl-toc__list-item--level-6 {
    padding-left: calc(var(--wl-nested-list-indent) * 4);
}

/* Markers */
.wl-toc__list-item-marker {
    width: var(--wl-marker-size);
    height: var(--wl-marker-size);
    color: var(--wl-item-text-color);
    font-size: calc(var(--wl-marker-size) * 0.6);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 5px;
    flex-shrink: 0;
    margin-top: 2px;
}

.wl-toc__list-item:has(> .wl-toc__list-item-text.active) .wl-toc__list-item-marker{
    color: var(--wl-item-text-active-color);
}

.wl-toc__list-item:has(> .wl-toc__list-item-text:hover) .wl-toc__list-item-marker{
      color: var(--wl-item-text-hover-color);
}

.wl-toc__list--bullets .wl-toc__list-item-marker i,
.wl-toc__list--bullets .wl-toc__list-item-marker svg {
    width: calc(var(--wl-marker-size) * 0.6);
    height: calc(var(--wl-marker-size) * 0.6);
    color: var(--wl-marker-color);
}

/* Links */
.wl-toc__list-item-text {
    color: var(--wl-item-text-color);
    text-decoration: var(--wl-item-text-decoration);
    transition: all var(--wl-item-text-transition-duration) ease;
    flex-grow: 1;
    word-wrap: break-word;
    display: block;
    padding: 2px 0;
}

.wl-toc__list-item-text:hover {
    color: var(--wl-item-text-hover-color);
    text-decoration: var(--wl-item-text-hover-decoration);
}

.wl-toc__list-item-text.active {
    color: var(--wl-item-text-active-color);
    text-decoration: var(--wl-item-text-active-decoration);
    /* font-weight: 600; */
    /* background-color: rgba(0, 115, 170, 0.05);
    border-radius: 3px;
    padding: 2px 8px;
    margin: -2px -8px; */
}

/* Word Wrap */
.wl-toc--content-ellipsis .wl-toc__list-item-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive Minimize */
@media (max-width: 1024px) {
    .wl-toc--minimized-on-desktop.wl-toc--collapsed .wl-toc__body {
        display: none;
    }
}

@media (max-width: 768px) {
    .wl-toc--minimized-on-tablet.wl-toc--collapsed .wl-toc__body {
        display: none;
    }
}

@media (max-width: 480px) {
    .wl-toc--minimized-on-mobile.wl-toc--collapsed .wl-toc__body {
        display: none;
    }
    
    .wl-toc__wrapper {
        --wl-box-padding: 15px;
    }
}

/* Scrollbar Styling */
.wl-toc__body::-webkit-scrollbar {
    width: 6px;
}

.wl-toc__body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.wl-toc__body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.wl-toc__body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Collapse Subitems */
.wl-toc__list-item-toggle {
    cursor: pointer;
    color: var(--wl-marker-color);
    margin-left: 10px;
    font-size: 12px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-top: 4px;
}

.wl-toc__list-item--collapsed .wl-toc__list-item-toggle {
    transform: rotate(-90deg);
}

.wl-toc__list-item--collapsed .wl-toc__list-item-children {
    display: none;
}

/* Loading State */
.wl-toc__spinner {
    display: none;
    text-align: center;
    padding: 20px;
}

.wl-toc__wrapper.loading .wl-toc__spinner {
    display: block;
}

.wl-toc__wrapper.loading .wl-toc__body {
    display: none;
}