/* ==================== TABLE OF CONTENTS / PAGE NAVIGATOR ==================== */
.toc-container {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 900;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    max-width: 280px;
    max-height: 70vh;
    overflow-y: auto;
    transition: all 0.3s ease;
    border: 2px solid rgba(11, 145, 208, 0.2);
}

.toc-toggle {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 901;
    background: linear-gradient(135deg, #0b91d0, #0876b0);
    color: white;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(11, 145, 208, 0.4);
    transition: all 0.3s ease;
    border: none;
}

.toc-toggle:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 8px 30px rgba(11, 145, 208, 0.6);
}

.toc-toggle i {
    font-size: 1.5rem;
}

.toc-container.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) translateX(20px);
}

.toc-title {
    font-family: 'Noto Serif', serif;
    font-size: 1.15rem;
    color: #0b91d0;
    margin-bottom: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid rgba(11, 145, 208, 0.2);
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-list a {
    text-decoration: none;
    color: #6c757d;
    font-size: 0.9rem;
    display: block;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    padding-left: 1.2rem;
}

.toc-list a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: #0b91d0;
    border-radius: 2px;
    transition: height 0.3s ease;
}

.toc-list a:hover,
.toc-list a.active {
    color: #0b91d0;
    background: rgba(11, 145, 208, 0.1);
    font-weight: 500;
}

.toc-list a:hover::before,
.toc-list a.active::before {
    height: 70%;
}

/* Scrollbar personalizado para TOC */
.toc-container::-webkit-scrollbar {
    width: 6px;
}

.toc-container::-webkit-scrollbar-track {
    background: rgba(11, 145, 208, 0.05);
    border-radius: 10px;
}

.toc-container::-webkit-scrollbar-thumb {
    background: rgba(11, 145, 208, 0.3);
    border-radius: 10px;
}

.toc-container::-webkit-scrollbar-thumb:hover {
    background: rgba(11, 145, 208, 0.5);
}

@media (max-width: 1400px) {
    .toc-container {
        display: none;
    }

    .toc-toggle {
        bottom: 2rem;
        top: auto;
        right: 2rem;
        transform: none;
    }

    .toc-toggle:hover {
        transform: scale(1.1);
    }

    .toc-container.mobile-active {
        display: block;
        position: fixed;
        right: 1rem;
        bottom: 5.5rem;
        top: auto;
        transform: none;
        max-height: 60vh;
        overflow-y: auto;
    }

    .toc-container.hidden {
        display: none;
    }
}

/* ==================== IMAGE MODAL ==================== */
.image-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
    cursor: zoom-out;
}

.image-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-content {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    animation: zoomIn 0.3s ease;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.image-modal-close {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 3rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    z-index: 10001;
}

.image-modal-close:hover {
    background: rgba(196, 30, 58, 0.9);
    transform: rotate(90deg);
}

/* Hacer imágenes clicables */
img[data-zoomable] {
    cursor: zoom-in;
    transition: all 0.3s ease;
}

img[data-zoomable]:hover {
    opacity: 0.9;
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .image-modal-close {
        top: 20px;
        right: 20px;
        font-size: 2.5rem;
        width: 50px;
        height: 50px;
    }

    .image-modal-content {
        max-width: 95%;
        max-height: 85vh;
    }

    .toc-toggle {
        width: 50px;
        height: 50px;
        bottom: 1.5rem;
        right: 1.5rem;
    }

    .toc-container.mobile-active {
        right: 0.5rem;
        left: 0.5rem;
        max-width: calc(100% - 1rem);
    }
}
