/* Advanced Table of Contents Widget Styles */

.advanced-toc-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: none;
    position: relative;
    transition: all 0.3s ease;
}

.advanced-toc-container:hover {
    box-shadow: none;
}

/* Title Styles */
.advanced-toc-title {
    font-size: 18px;
    font-weight: 600;
    color: #333333;
    margin: 0 0 15px 0;
    padding: 0 0 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.advanced-toc-title.has-border {
    border-bottom: 2px solid #e0e0e0;
}

/* Toggle Button */
.toc-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toc-toggle:hover {
    background-color: #f5f5f5;
}

.toggle-icon {
    width: 16px;
    height: 16px;
    position: relative;
    transition: transform 0.3s ease;
}

.toggle-icon::before,
.toggle-icon::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 2px;
    background: #666;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.toggle-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.advanced-toc-container.collapsed .toggle-icon::after {
    transform: translate(-50%, -50%) rotate(0deg);
}

/* Progress Bar */
.toc-progress-bar {
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    margin-bottom: 15px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007cba, #ff6b35);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* List Styles */
.advanced-toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    transition: all 0.3s ease;
}

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

.advanced-toc-list li {
    margin-bottom: 8px;
    position: relative;
}

.advanced-toc-list li:last-child {
    margin-bottom: 0;
}

/* Nested Lists */
.advanced-toc-list ul {
    list-style: none;
    margin: 5px 0 0 0;
    padding-left: 20px;
    position: relative;
}

.advanced-toc-container.has-connector-lines .advanced-toc-list ul::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #e0e0e0;
}

/* Link Styles */
.advanced-toc-list a {
    display: block;
    color: #007cba;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.3s ease;
    position: relative;
    font-size: 14px;
    line-height: 1.4;
}

.advanced-toc-list a:hover {
    color: #005a87;
    background-color: #f8f9fa;
    transform: translateX(2px);
}

.advanced-toc-list a.active {
    color: #ff6b35;
    background-color: #fff3f0;
    font-weight: 500;
    border-left: 3px solid #ff6b35;
}

.advanced-toc-list a.active::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #ff6b35;
    border-radius: 0 2px 2px 0;
}

/* Number Styles */
.toc-number {
    color: #666;
    font-weight: 500;
    margin-right: 8px;
    font-size: 13px;
}

.advanced-toc-list a.active .toc-number {
    color: #ff6b35;
}

/* Hierarchical Styles */
.advanced-toc-container.hierarchical .advanced-toc-list a {
    position: relative;
}

/* H2 Level */
.advanced-toc-container.hierarchical .advanced-toc-list > li > a {
    font-weight: 500;
    font-size: 15px;
    color: #333;
}

/* H3 Level */
.advanced-toc-container.hierarchical .advanced-toc-list ul li a {
    font-size: 14px;
    color: #666;
    padding-left: 16px;
}

/* H4 Level */
.advanced-toc-container.hierarchical .advanced-toc-list ul ul li a {
    font-size: 13px;
    color: #888;
    padding-left: 20px;
}

/* H5 Level */
.advanced-toc-container.hierarchical .advanced-toc-list ul ul ul li a {
    font-size: 12px;
    color: #999;
    padding-left: 24px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .advanced-toc-container {
        padding: 15px;
        margin: 15px 0;
    }
    
    .advanced-toc-title {
        font-size: 16px;
    }
    
    .advanced-toc-list a {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .advanced-toc-list ul {
        padding-left: 15px;
    }
}

@media (max-width: 480px) {
    .advanced-toc-container {
        padding: 12px;
        margin: 10px 0;
    }
    
    .advanced-toc-title {
        font-size: 15px;
    }
    
    .advanced-toc-list a {
        padding: 5px 8px;
        font-size: 12px;
    }
    
    .advanced-toc-list ul {
        padding-left: 12px;
    }
}

/* Animation Effects */
.advanced-toc-container.has-entrance-animation .advanced-toc-list li {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.3s ease forwards;
}

.advanced-toc-container.has-entrance-animation .advanced-toc-list li:nth-child(1) { animation-delay: 0.1s; }
.advanced-toc-container.has-entrance-animation .advanced-toc-list li:nth-child(2) { animation-delay: 0.2s; }
.advanced-toc-container.has-entrance-animation .advanced-toc-list li:nth-child(3) { animation-delay: 0.3s; }
.advanced-toc-container.has-entrance-animation .advanced-toc-list li:nth-child(4) { animation-delay: 0.4s; }
.advanced-toc-container.has-entrance-animation .advanced-toc-list li:nth-child(5) { animation-delay: 0.5s; }
.advanced-toc-container.has-entrance-animation .advanced-toc-list li:nth-child(6) { animation-delay: 0.6s; }
.advanced-toc-container.has-entrance-animation .advanced-toc-list li:nth-child(7) { animation-delay: 0.7s; }
.advanced-toc-container.has-entrance-animation .advanced-toc-list li:nth-child(8) { animation-delay: 0.8s; }
.advanced-toc-container.has-entrance-animation .advanced-toc-list li:nth-child(9) { animation-delay: 0.9s; }
.advanced-toc-container.has-entrance-animation .advanced-toc-list li:nth-child(10) { animation-delay: 1.0s; }

/* Animation Keyframes */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Active Indicator */
.advanced-toc-container.has-active-indicator .advanced-toc-list a::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.3s ease;
}

.advanced-toc-container.has-active-indicator .advanced-toc-list a.active::after {
    background: #ff6b35;
    box-shadow: 0 0 8px rgba(255, 107, 53, 0.3);
}

/* No Headings State */
.advanced-toc-no-headings {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.advanced-toc-no-headings p {
    margin: 0;
    font-size: 14px;
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .advanced-toc-container {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .advanced-toc-title {
        color: #e0e0e0;
    }
    
    .advanced-toc-title.has-border {
        border-bottom-color: #444;
    }
    
    .advanced-toc-list a {
        color: #4a9eff;
    }
    
    .advanced-toc-list a:hover {
        background-color: #333;
        color: #6bb6ff;
    }
    
    .advanced-toc-list a.active {
        background-color: #2d1810;
        color: #ff8c5a;
    }
    
    .toc-progress-bar {
        background: #444;
    }
    
    .advanced-toc-container.has-connector-lines .advanced-toc-list ul::before {
        background: #444;
    }
}

/* Enhanced Styling Features */

/* Custom Border Styles */
.advanced-toc-list a {
    border: none;
    box-shadow: none;
}

/* Enhanced Hover Effects */
.advanced-toc-list a:hover {
    text-decoration: none;
}

/* Enhanced Active State */
.advanced-toc-list a.active {
    text-decoration: none;
}

/* Custom Animation Classes */
.advanced-toc-container[data-animation-type="fadeInDown"] .advanced-toc-list li {
    animation-name: fadeInDown;
}

.advanced-toc-container[data-animation-type="fadeInLeft"] .advanced-toc-list li {
    animation-name: fadeInLeft;
}

.advanced-toc-container[data-animation-type="fadeInRight"] .advanced-toc-list li {
    animation-name: fadeInRight;
}

.advanced-toc-container[data-animation-type="slideInUp"] .advanced-toc-list li {
    animation-name: slideInUp;
}

.advanced-toc-container[data-animation-type="slideInDown"] .advanced-toc-list li {
    animation-name: slideInDown;
}

.advanced-toc-container[data-animation-type="slideInLeft"] .advanced-toc-list li {
    animation-name: slideInLeft;
}

.advanced-toc-container[data-animation-type="slideInRight"] .advanced-toc-list li {
    animation-name: slideInRight;
}

.advanced-toc-container[data-animation-type="zoomIn"] .advanced-toc-list li {
    animation-name: zoomIn;
}

.advanced-toc-container[data-animation-type="bounceIn"] .advanced-toc-list li {
    animation-name: bounceIn;
}

/* Disable animations when reduced motion is preferred */
@media (prefers-reduced-motion: reduce) {
    .advanced-toc-container.has-entrance-animation .advanced-toc-list li {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .advanced-toc-list a {
        transition: none;
    }
}

/* Print Styles */
@media print {
    .advanced-toc-container {
        background: white !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .advanced-toc-list a {
        color: #000 !important;
        text-decoration: none !important;
    }

    .advanced-toc-list a.active {
        font-weight: bold !important;
        background: none !important;
    }

    .toc-toggle,
    .toc-progress-bar {
        display: none !important;
    }
}
