/*
 * ==========================================
 * 1. FILTROS VISUALES (CONTRASTE / GRISES)
 * ==========================================
 */

/* Alto Contraste: Invierte colores del contenedor principal */
.site-content.high-contrast {
    filter: invert(100%);
    background-color: black; /* Fondo de respaldo al invertir */
}

/* Escala de Grises: Elimina saturación */
.site-content.grayscale {
    filter: grayscale(100%);
}

/*
 * Corrección para imágenes y videos dentro del filtro:
 * Si invertimos el sitio, las fotos se ven como "negativos".
 * Aquí las volvemos a invertir para que se vean normales dentro del modo oscuro.
 */
.site-content.high-contrast img,
.site-content.high-contrast video,
.site-content.high-contrast .carousel-control-prev-icon,
.site-content.high-contrast .carousel-control-next-icon,
.site-content.high-contrast .card-img-top {
    filter: invert(100%);
}

.site-content.grayscale img {
    filter: grayscale(100%);
}


/*
 * ==========================================
 * 2. ELEMENTOS EXCLUIDOS DE LOS FILTROS
 * ==========================================
 * Estos elementos (botón flotante, chat, menú lateral) 
 * NO deben verse afectados por los filtros de la página.
 */

/* Botón flotante de accesibilidad */
.accessibility-button-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #1A5986;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 1050; /* Por encima de todo */
    transition: background-color 0.3s ease;
    filter: none !important; /* Asegura que no se invierta */
}

.accessibility-button-trigger:hover {
    background-color: #144264;
}

.accessibility-button-trigger i {
    font-size: 28px;
}

/* Chat (Burbuja y Caja) */
.chat-bubble, .chat-box {
    filter: none !important;
}

/* Menú Sidebar (Offcanvas) */
.accessibility-offcanvas {
    background-color: #fff;
    color: #000;
    filter: none !important; /* Vital para que el menú se vea bien siempre */
}

.accessibility-offcanvas .offcanvas-header {
    background-color: #144264;
    color: white;
}

/* El botón de cerrar (X) necesita invertirse solo si el fondo es oscuro, 
   pero aquí forzamos estilos para asegurar visibilidad */
.accessibility-offcanvas .offcanvas-header .btn-close {
    filter: invert(1);
    opacity: 1;
}

.accessibility-offcanvas .offcanvas-body h6, 
.accessibility-offcanvas .offcanvas-body .btn {
    font-family: 'font-bold', sans-serif;
}


/*
 * ==========================================
 * 3. FUNCIONALIDADES ESPECÍFICAS
 * ==========================================
 */

/* Resaltar Enlaces */
.highlight-links a {
    border: 2px solid #FFD200 !important;
    background-color: rgba(255, 210, 0, 0.3) !important;
    color: #000 !important; /* Asegura contraste de texto */
    padding: 2px 5px !important;
    text-decoration: underline !important;
}

/* Guía de Lectura - CORREGIDO (debe ser kebab-case para coincidir con JS) */
.reading-guide-line {
    position: fixed;
    top: -100px; /* Fuera de pantalla por defecto */
    left: 0;
    width: 100%;
    height: 5px;
    background-color: #FFD200;
    z-index: 2000; /* Muy alto */
    pointer-events: none; /* Permite hacer clic a través de la línea */
    display: none; /* Oculto inicialmente */
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.reading-guide-line.active {
    display: block !important;
}

/* Cursor Grande (SVG incrustado) */
.large-cursor, .large-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewport="0 0 48 48" style="fill:black;stroke:white;stroke-width:2px;"><path d="M10 10l15 35l5-13l13-5z"/></svg>') 0 0, auto !important;
}

/* Ocultar Imágenes */
.hide-images img, 
.hide-images video, 
.hide-images .hero-section {
    opacity: 0 !important;
    visibility: hidden !important;
    height: 0 !important; /* Colapsar espacio para lectura fluida */
    min-height: 0 !important;
    overflow: hidden !important;
}

/* Fuente Legible (Forzar Arial/Sans-Serif) */
.legible-font, .legible-font * {
    font-family: Arial, Helvetica, sans-serif !important;
    font-weight: normal !important;
    letter-spacing: 0.5px !important;
    line-height: 1.6 !important;
}

/*
 * ==========================================
 * 4. ESTADOS DE BOTONES (UI)
 * ==========================================
 */

/* Botón Activo (Amarillo Institucional) */
.btn-accessibility-active {
    background-color: #FFD200 !important;
    color: #144264 !important;
    font-weight: bold;
    border: 2px solid #144264 !important;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

/* Ajuste para iconos dentro del botón activo */
.btn-accessibility-active i {
    color: #144264 !important;
}


/*
 * ==========================================
 * 5. RESPONSIVIDAD (Móviles)
 * ==========================================
 */

@media (max-width: 768px) {
    /* Ajusta la posición del botón de accesibilidad para evitar superposición */
    .accessibility-button-trigger {
        width: 50px;
        height: 50px;
        bottom: 90px; /* Más alto para dejar sitio al chat */
        right: 15px;
        font-size: 24px;
    }

    /* Chat bubble */
    .chat-bubble {
        width: 50px;
        height: 50px;
        bottom: 20px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .accessibility-button-trigger {
        width: 45px;
        height: 45px;
        bottom: 80px;
        right: 10px;
        font-size: 22px;
    }
    
    .chat-bubble {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 10px;
    }
}