/* Documentation content styles */
#documentation-content img {
    max-width: 100%;
    height: auto;
    margin-top: 20px;
    margin-bottom: 40px;
}

#documentation-content h1,
#documentation-content h2,
#documentation-content h3,
#documentation-content h4,
#documentation-content h5,
#documentation-content h6 {
    margin-top: 30px;
    margin-bottom: 15px;
}

#documentation-content pre {
    background-color: #f5f5f5;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
}

#documentation-content code {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
}

#documentation-content pre code {
    background-color: transparent;
    padding: 0;
}

/* Heading anchor link styles */
#documentation-content h1,
#documentation-content h2,
#documentation-content h3,
#documentation-content h4,
#documentation-content h5,
#documentation-content h6 {
    position: relative;
}

#documentation-content .heading-anchor-link {
    opacity: 0;
    position: absolute;
    left: -1.5em;
    padding-top: 8px;
    font-size: 0.8em;
    color: #6c757d;
    text-decoration: none;
    transition: opacity 0.2s ease-in-out;
}

#documentation-content h1:hover .heading-anchor-link,
#documentation-content h2:hover .heading-anchor-link,
#documentation-content h3:hover .heading-anchor-link,
#documentation-content h4:hover .heading-anchor-link,
#documentation-content h5:hover .heading-anchor-link,
#documentation-content h6:hover .heading-anchor-link {
    opacity: 1;
}

#documentation-content .heading-anchor-link:hover {
    color: #007bff;
}

/* Floating Table of Contents Styles */
#floating-toc {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1040;
}

#toc-toggle {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#toc-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#toc-toggle.active {
    display: none;
}

.toc-panel {
    display: none;
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 300px;
    max-height: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

.toc-panel.active {
    display: flex;
    flex-direction: column;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

.toc-header h5 {
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
}

.close-toc {
    color: #6c757d;
    font-size: 1.2rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-toc:hover {
    color: #dc3545;
    text-decoration: none;
}

.toc-nav {
    overflow-y: auto;
    padding: 15px 0;
    flex: 1;
}

.toc-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-nav li {
    margin: 0;
}

.toc-nav a {
    display: block;
    padding: 6px 20px;
    color: #495057;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-left: 3px solid transparent;
}

.toc-nav a:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

.toc-nav a.active {
    color: #007bff;
    border-left-color: #007bff;
    background-color: #e7f3ff;
    font-weight: 500;
}

/* h2 headings - top level */
.toc-nav .toc-h2 > a {
    font-weight: 600;
    padding-left: 20px;
}

/* h3 headings - nested */
.toc-nav .toc-h3 > a {
    padding-left: 40px;
    font-size: 0.85rem;
}

/* Hide on mobile */
@media (max-width: 991px) {
    #floating-toc {
        display: none !important;
    }
}

/* Scrollbar styling for TOC nav */
.toc-nav::-webkit-scrollbar {
    width: 6px;
}

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

.toc-nav::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.toc-nav::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
