/* Table of Contents Sidebar - LEFT SIDE */
.toc-sidebar {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1), 0 8px 25px rgba(125, 211, 192, 0.15);
    height: fit-content;
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    width: 280px;
    border: 2px solid rgba(125, 211, 192, 0.3);
    backdrop-filter: blur(15px);
    z-index: 999;
    max-height: 80vh;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.toc-sidebar:hover {
    transform: translateY(-50%) translateX(5px);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.15), 0 12px 35px rgba(125, 211, 192, 0.25);
    border-color: rgba(125, 211, 192, 0.5);
}

.toc-title {
    color: #4a9b8e;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: none; /* Ocultar título duplicado */
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #e8f5f3 0%, #f0f9f7 100%);
    padding: 15px 20px;
    border-radius: 12px;
    border-left: 4px solid #7dd3c0;
    box-shadow: 0 4px 15px rgba(125, 211, 192, 0.1);
    transition: all 0.3s ease;
}

.toc-title:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(125, 211, 192, 0.2);
    background: linear-gradient(135deg, #d4f1ed 0%, #e8f5f3 100%);
}

.toc-title i {
    color: #7dd3c0;
}

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

.toc-item {
    margin-bottom: 8px;
}

.toc-link {
    display: block;
    padding: 10px 15px;
    color: #666;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.toc-link:hover {
    background: rgba(125, 211, 192, 0.1);
    color: #4a9b8e;
    border-left-color: #7dd3c0;
    transform: translateX(5px);
}

.toc-link.active {
    background: linear-gradient(135deg, rgba(125, 211, 192, 0.2) 0%, rgba(125, 211, 192, 0.1) 100%);
    color: #4a9b8e;
    border-left-color: #7dd3c0;
    font-weight: 600;
}

/* OCULTAR LA BARRITA DE SELECCIÓN - NO QUEREMOS QUE SE MUESTRE */
.toc-link.active::before {
    display: none !important;
}

/* OCULTAR LA BARRITA CUANDO EL MODAL ESTÁ ABIERTO */
.toc-sidebar.show .toc-link.active {
    background: transparent !important;
    border-left-color: transparent !important;
}

.toc-sidebar.show .toc-link.active::before {
    display: none !important;
}

.toc-subitem {
    margin-left: 20px;
    margin-top: 5px;
}

.toc-subitem .toc-link {
    font-size: 0.85rem;
    padding: 8px 12px;
}

.toc-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(125, 211, 192, 0.2);
    z-index: 1000;
}

.toc-progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #7dd3c0 0%, #4a9b8e 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.reading-time {
    background: rgba(125, 211, 192, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.reading-time h4 {
    color: #4a9b8e;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.reading-time p {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

.toc-toggle {
    display: none; /* OCULTAR EN DESKTOP - Solo se usa en móvil */
    background: linear-gradient(135deg, #7dd3c0 0%, #4a9b8e 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 30px;
    cursor: pointer;
    margin-bottom: 20px;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(74, 155, 142, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    font-weight: 600;
}

.toc-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.toc-toggle:hover::before {
    left: 100%;
}

.toc-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 155, 142, 0.4), 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Mobile TOC Button */
.mobile-toc-button {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 60px;
    right: 20px;
    background: linear-gradient(135deg, #7dd3c0 0%, #4a9b8e 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(74, 155, 142, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    z-index: 1001;
    min-width: 120px;
    width: 120px;
    height: 48px;
    overflow: hidden;
    text-decoration: none;
    gap: 8px;
    box-sizing: border-box;
}

.mobile-toc-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.mobile-toc-button:hover::before {
    left: 100%;
}

.mobile-toc-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(74, 155, 142, 0.4), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mobile-toc-button i {
    font-size: 0.9rem;
}

/* Mobile Back Button */
.mobile-back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 60px;
    left: 20px;
    background: linear-gradient(135deg, #7dd3c0 0%, #4a9b8e 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(74, 155, 142, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    z-index: 1001;
    min-width: 120px;
    width: 120px;
    height: 48px;
    text-decoration: none;
    overflow: hidden;
    gap: 8px;
    box-sizing: border-box;
}

.mobile-back-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.mobile-back-button:hover::before {
    left: 100%;
}

.mobile-back-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(74, 155, 142, 0.4), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mobile-back-button i {
    font-size: 0.9rem;
}


/* Container adjustments for left sidebar */
.article-container {
    margin-left: 320px; /* Space for left sidebar */
    margin-top: 60px; /* Reduced space for fixed header */
}

/* Footer styles for articles - Force green background */
.footer {
    background: linear-gradient(135deg, #2c3e50 0%, #4a9b8e 100%) !important;
    color: white !important;
    padding: 80px 0 20px !important;
    position: relative !important;
    margin-top: 40px !important;
    display: block !important;
    visibility: visible !important;
    min-height: 400px !important;
}

/* Override container styles for footer */
.footer .container {
    background: transparent !important;
    box-shadow: none !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 60px !important;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-column h3 {
    color: white !important;
    font-size: 1.5rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.footer-column p {
    color: rgba(255,255,255,0.9) !important;
    line-height: 1.6;
    margin-bottom: 15px;
}

.footer-column i {
    color: #7dd3c0 !important;
    margin-right: 10px;
    width: 20px;
}

.online-features {
    margin-top: 20px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    color: rgba(255,255,255,0.9) !important;
}

.feature-item i {
    color: #7dd3c0 !important;
    font-size: 1.1rem;
}

.social-links p {
    color: rgba(255,255,255,0.9) !important;
    margin-bottom: 10px;
    font-weight: 500;
}

.social-links a {
    color: #7dd3c0 !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: white !important;
}

.footer-cta {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.footer-cta p {
    color: white !important;
    font-weight: 500;
    margin-bottom: 15px;
}

.footer-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #25D366 !important;
    color: white !important;
    padding: 12px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.footer-whatsapp-btn:hover {
    background: #128C7E !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.2);
    padding: 20px 0 !important;
    padding-top: 20px;
    text-align: center;
}

.footer-links {
    margin-bottom: 15px;
}

.footer-links a {
    color: rgba(255,255,255,0.8) !important;
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white !important;
}

.footer-links span {
    color: rgba(255,255,255,0.5) !important;
}

.footer-bottom p {
    color: rgba(255,255,255,0.7) !important;
    font-size: 0.9rem;
}


@media (max-width: 768px) {
    .article-container {
        margin-left: 0;
        margin-top: 75px !important; /* Even more space for mobile */
    }
    
    .toc-sidebar {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        right: auto !important;
        bottom: auto !important;
        width: 90% !important;
        max-width: 400px !important;
        max-height: 70vh !important;
        border-radius: 20px;
        display: none !important; /* Hidden by default on mobile */
        z-index: 10000 !important;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
        overflow-y: auto;
        /* FORZAR QUE NO SE MUEVA CON EL SCROLL - ABSOLUTAMENTE FIJO */
        will-change: transform !important;
        backface-visibility: hidden !important;
        /* Prevenir cualquier movimiento */
        margin: 0 !important;
        padding: 25px !important;
    }

    .toc-sidebar.show {
        display: block !important; /* Show when toggled */
    }
    
    /* FORZAR CIERRE DEL MODAL AL HACER CLIC EN ENLACE */
    .toc-sidebar:not(.show) {
        display: none !important;
    }

    .mobile-toc-button {
        display: block !important; /* Show mobile button */
    }
    
    .mobile-back-button {
        display: block !important; /* Show mobile back button */
    }

    .toc-toggle {
        display: block !important; /* MOSTRAR EN MÓVIL */
    }
    
    /* OCULTAR EL BOTÓN TOC-TOGGLE DENTRO DEL MODAL - SOLO QUEREMOS EL TÍTULO UNA VEZ */
    .toc-sidebar.show .toc-toggle {
        display: none !important; /* Cuando el modal está abierto, ocultar el botón */
    }

    .toc-list {
        display: none;
    }

    .toc-list.active {
        display: block;
    }

    .reading-time {
        display: none; /* Hide reading time on mobile to save space */
    }
}

@media (max-width: 480px) {
    .mobile-toc-button {
        top: 55px;
        right: 15px;
        font-size: 0.9rem;
        padding: 10px 15px;
        min-width: 100px;
    }
    
    .mobile-back-button {
        top: 55px;
        left: 15px;
        font-size: 0.9rem;
        padding: 10px 15px;
        min-width: 100px;
    }
    
    .toc-sidebar {
        width: 95% !important;
        max-width: 350px !important;
        max-height: 75vh !important;
    }
}
