/* Sidebar Table of Contents */
.widget-toc {
    margin-bottom: 25px;
}

.widget-toc nav {
    max-height: none; /* Let JavaScript control this */
    scrollbar-width: thin;
}

.widget-toc nav::-webkit-scrollbar {
    width: 5px;
}

.widget-toc nav::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.widget-toc nav::-webkit-scrollbar-thumb {
    background: #98253a; /*TODO: use $highlightColor variable*/
}

/* Style the TOC list */
.widget-toc ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.widget-toc li {
    margin: 0;
    padding: 0;
}

.widget-toc ul ul {
    padding-left: 15px;
}

.widget-toc a {
    display: block;
    padding: 6px 0;
    font-size: 14px;
    line-height: 1.3;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f2f2f2;
    background-color: transparent !important; /* Prevent background color change */
}

.widget-toc a:hover {
    color: #98253a;
    background-color: transparent !important;
}

.widget-toc a:active,
.widget-toc a:focus {
    background-color: transparent !important;
    outline: none; /* Remove focus outline */
}

/* Active TOC item */
.widget-toc .active > a {
    color: #98253a;
    font-weight: bold;
    background-color: transparent !important;
}

/* Hide the original TOC if it still appears in the content */
.post__toc.toc {
    display: none;
}

/* Override any theme default for TOC links to prevent background change */
.widget-toc nav li a,
.widget-toc nav li a:hover,
.widget-toc nav li a:active,
.widget-toc nav li a:focus,
.toc__menu a,
.toc__menu a:hover,
.toc__menu a:active,
.toc__menu a:focus {
    background-color: transparent !important;
}

/* When sidebar is on the right side, constant from mainroad's style.css */
@media screen and (min-width: 768px) {
    .sidebar--sticky {
        position: sticky;
        top: 10px;
        max-height: 100vh;
        overflow-y: auto;
        scrollbar-width: thin;
    }

    .sidebar--sticky::-webkit-scrollbar {
        width: 5px;
    }

    .sidebar--sticky::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .sidebar--sticky::-webkit-scrollbar-thumb {
        background: #98253a;
    }
}
