/**
 * TOC Plugin Styles
 * Table of Contents Sidebar
 */

/* ============================================
   WRAPPER - Grid Layout
   ============================================ */

.toc-wrapper {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 1.5rem;
    max-width: 100%;
    position: relative;
    align-items: start;
}

/* ============================================
   SIDEBAR
   ============================================ */

.toc-sidebar {
    position: relative;
    height: fit-content;
}

.toc-nav {
    position: sticky;
    top: 100px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}


/* ============================================
   TOC LIST
   ============================================ */

.toc-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.toc-list.collapsed {
    display: none;
}

.toc-item {
    margin: 0;
    padding: 0;
}

.toc-item a {
    display: block;
    padding: 8px 16px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.toc-item a:hover {
    background: #f5f5f5;
    color: #3D6680;
}

/* H3 Einrückung */
.toc-item-h3 a {
    padding-left: 28px;
    font-size: 13px;
    color: #777;
}

/* Aktiver Link */
.toc-item.active a {
    background: #f0f7ff;
    color: #3D6680;
    border-left-color: #3D6680;
    font-weight: 500;
}

/* ============================================
   CONTENT AREA
   ============================================ */

.toc-content {
    min-width: 0;
}

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */

.toc-back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: #3D6680;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 999;
}

.toc-back-to-top:hover {
    background: #2a4a5c;
    transform: translateY(-2px);
}

.toc-back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   RESPONSIVE - TABLET
   ============================================ */

@media (max-width: 1024px) {
    .toc-wrapper {
        grid-template-columns: 1fr 180px;
        gap: 1rem;
    }
    
    .toc-nav {
        top: 80px;
    }
    
    .toc-item a {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .toc-item-h3 a {
        padding-left: 22px;
        font-size: 12px;
    }
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 768px) {
    .toc-wrapper {
        display: block;
    }
    
    .toc-sidebar {
        margin-bottom: 1.5rem;
    }
    
    .toc-nav {
        position: relative;
        top: 0;
        max-height: none;
    }
    
    .toc-list {
        max-height: 300px;
        overflow-y: auto;
    }
    
    .toc-list.collapsed {
        display: none;
    }
    
    .toc-back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* ============================================
   SCROLL PROGRESS (Optional)
   ============================================ */

.toc-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: #3D6680;
    z-index: 9999;
    transition: width 0.1s linear;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .toc-sidebar,
    .toc-back-to-top {
        display: none !important;
    }
    
    .toc-wrapper {
        display: block;
    }
}
