/* Blog Table of Contents Styles */

/* Container and Layout */
.bd-table-of-contents {
    width: 50%;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 40px;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

/* Header */
.bd-toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: #f1f3f4;
    border-bottom: 1px solid #e9ecef;
}

.bd-toc-header p {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.bd-toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.bd-toc-toggle:hover {
    background-color: #e9ecef;
}

.bd-toggle-icon {
    display: block;
    width: 16px;
    height: 16px;
    position: relative;
    transition: transform 0.3s ease;
}

.bd-toggle-icon::before,
.bd-toggle-icon::after {
    content: '';
    position: absolute;
    background-color: #666;
    transition: all 0.3s ease;
}

.bd-toggle-icon::before {
    width: 16px;
    height: 2px;
    top: 7px;
    left: 0;
}

.bd-toggle-icon::after {
    width: 2px;
    height: 16px;
    top: 0;
    left: 7px;
}

.bd-table-of-contents.collapsed .bd-toggle-icon::after {
    transform: rotate(90deg);
}

/* Content */
.bd-toc-content {
    padding: 20px 25px;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 500px;
    opacity: 1;
    overflow-y: auto;
}

.bd-table-of-contents.collapsed .bd-toc-content {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
}

/* List */
.bd-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bd-toc-list li {
    margin-bottom: 12px;
}

.bd-toc-list li:last-child {
    margin-bottom: 0;
}

.bd-toc-list a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #555;
    font-size: 14px;
    line-height: 1.4;
    padding: 0px 0;
    transition: color 0.3s ease;
    position: relative;
}

.bd-toc-list a::before {
    content: '';
    width: 6px;
    height: 6px;
    background-color: #ec1f28;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
}

.bd-toc-list a:hover {
    color: #ec1f28;
}

.bd-toc-list a.active {
    color: #ec1f28;
    font-weight: 600;
}

.bd-toc-list a.active::before {
    background-color: #ec1f28;
    width: 8px;
    height: 8px;
}

.bd-toc-list .h3-item {
    margin-left: 20px;
}

.bd-toc-list .h3-item a::before {
    width: 4px;
    height: 4px;
    background-color: #6c757d;
}

.bd-toc-list .h4-item {
    margin-left: 40px;
}

.bd-toc-list .h4-item a::before {
    width: 4px;
    height: 4px;
    background-color: #9ca3af;
}

/* Blog body headings with IDs for anchor links */
.bd-blog-body h2[id],
.postbox-details-text h2[id] {
    scroll-margin-top: 100px;
}

.bd-blog-body h3[id],
.postbox-details-text h3[id] {
    scroll-margin-top: 100px;
}

.bd-blog-body h4[id],
.postbox-details-text h4[id] {
    scroll-margin-top: 100px;
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Responsive Design */
@media (max-width: 992px) {
    .bd-table-of-contents {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .bd-table-of-contents {
        width: 100%;
        background: #f8f9fa;
        border-radius: 12px;
        margin-bottom: 40px;
        overflow: hidden;
        border: 1px solid #e9ecef;
    }

    .bd-toc-header {
        padding: 15px 20px;
    }

    .bd-toc-content {
        padding: 15px 20px;
    }

    .bd-toc-header h3 {
        font-size: 16px;
    }

    /* Mobile-specific table of contents behavior */
    .bd-table-of-contents:not(.mobile-expanded) .bd-toc-content {
        max-height: 0;
        opacity: 0;
        padding-top: 0;
        padding-bottom: 0;
        overflow: hidden;
    }

    .bd-table-of-contents.mobile-expanded .bd-toc-content {
        max-height: 500px;
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .bd-toc-header {
        padding: 12px 15px;
    }

    .bd-toc-content {
        padding: 12px 15px;
    }
}

