/**
 * CSS für das Advanced Table of Contents Plugin - Verbesserte Version
 */

/* Hauptcontainer für das Inhaltsverzeichnis */
.advanced-toc {
    margin: 30px 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    font-family: inherit;
}

/* Header-Bereich mit Titel und Toggle-Button */
.advanced-toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #1a4594;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Titel des Inhaltsverzeichnisses */
.advanced-toc-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.advanced-toc-title::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='21' y1='10' x2='7' y2='10'%3E%3C/line%3E%3Cline x1='21' y1='6' x2='3' y2='6'%3E%3C/line%3E%3Cline x1='21' y1='14' x2='3' y2='14'%3E%3C/line%3E%3Cline x1='21' y1='18' x2='7' y2='18'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

/* Toggle-Button */
.advanced-toc-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    margin-left: 15px;
}

.advanced-toc-toggle svg {
    width: 16px;
    height: 16px;
}

.advanced-toc-toggle[aria-expanded="false"] {
    transform: rotate(-180deg);
}

/* Container für die Liste */
#advanced-toc-container,
#advanced-toc-modal-container {
    max-height: 500px;
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

#advanced-toc-container.collapsed,
#advanced-toc-modal-container.collapsed {
    max-height: 0;
    overflow: hidden;
}

/* Die eigentliche Liste */
#advanced-toc-list,
#advanced-toc-modal-list {
    list-style: none;
    padding: 5px 0;
    margin: 0;
    background-color: white;
}

#advanced-toc-list li,
#advanced-toc-modal-list li {
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

#advanced-toc-list li:last-child,
#advanced-toc-modal-list li:last-child {
    border-bottom: none;
}

/* Unterschiedliche Einrückung für h2 und h3 */
#advanced-toc-list li.advanced-toc-h2,
#advanced-toc-modal-list li.advanced-toc-h2 {
    padding-left: 0;
}

#advanced-toc-list li.advanced-toc-h3,
#advanced-toc-modal-list li.advanced-toc-h3 {
    padding-left: 15px;
    background-color: rgba(0, 0, 0, 0.01);
}

/* Links im Inhaltsverzeichnis */
#advanced-toc-list a,
#advanced-toc-modal-list a {
    color: #1a4594;
    text-decoration: none !important;
    display: block;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: normal;
    transition: all 0.2s;
    position: relative;
}

#advanced-toc-list li.advanced-toc-h3 a,
#advanced-toc-modal-list li.advanced-toc-h3 a {
    color: #444;
    font-size: 14px;
}

#advanced-toc-list a:hover,
#advanced-toc-modal-list a:hover {
    background-color: rgba(26, 69, 148, 0.05);
    color: #1a4594;
    text-decoration: none !important;
    padding-left: 25px;
}

/* Icons vor den Links */
.advanced-toc-icon {
    margin-right: 8px;
    opacity: 0.6;
    font-size: 12px;
}

/* Styles für Screenreader */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* Fixen Button für mobile Ansicht */
.advanced-toc-floating-btn {
    position: fixed;
    top: 100px;
    right: 20px;
    background-color: #1a4594;
    color: white;
    padding: 12px 16px;
    border-radius: 50px;
    border: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    z-index: 99999;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.advanced-toc-floating-btn:hover {
    background-color: #15356f;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
}

.advanced-toc-floating-btn svg {
    width: 16px;
    height: 16px;
}

/* Modal für die mobile Ansicht */
.advanced-toc-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 380px;
    max-height: 85vh;
    background-color: white;
    color: #333;
    z-index: 100000;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Overlay für den Modal-Hintergrund */
.advanced-toc-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    z-index: 99999;
}

/* Responsive Styles */
@media screen and (max-width: 767px) {
    .advanced-toc-floating-btn {
        top: 20px;
        right: 20px;  /* Wieder rechts statt links */
        padding: 10px 15px;  /* Mehr Platz für Text */
        border-radius: 50px;  /* Zurück zu abgerundeter Form für Text */
        width: auto;  /* Kein festes Quadrat mehr */
        height: auto;
        justify-content: center;
    }
    
    /* Entfernen der Text-Ausblendung */
    .advanced-toc-floating-btn span {
        display: inline;  /* Text anzeigen */
        margin-left: 5px;
    }
    
    .advanced-toc {
        margin: 20px 0;
    }
    
    .advanced-toc-header {
        padding: 12px 15px;
    }
    
    #advanced-toc-list a,
    #advanced-toc-modal-list a {
        padding: 10px 15px;
    }
}