/* Botón Flotante */
#accessibility-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1074;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #3298ad;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    transition: transform 0.3s ease;
}

#accessibility-btn:hover {
    transform: scale(1.1);
}

#accessibility-btn:focus {
    outline: 3px solid #ffbf00;
}

/* Panel Modal */
#accessibility-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    max-width: 90vw;
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 1074;
    padding: 20px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #3298ad #f0f0f0;
}

#accessibility-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.acc-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.acc-panel-header h2 {
    font-size: 1.25rem;
    margin: 0;
    color: #333;
    font-family: inherit;
}

.acc-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.acc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.acc-option-btn {
    background: white;
    border: 2px solid #eee;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #444;
    text-align: center;
    min-height: 110px;
}

.acc-option-btn:hover {
    background-color: #f8f9fa;
    border-color: #3298ad;
}

.acc-option-btn.active {
    background-color: #e6f3ff;
    border-color: #3298ad;
    color: #3298ad;
    font-weight: bold;
}

.acc-option-btn i {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.acc-option-btn span {
    font-size: 0.9rem;
    line-height: 1.2;
}

.acc-reset-btn {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    background-color: #3298ad;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.acc-reset-btn:hover {
    background-color: #267a8c;
}

/* --- CLASES DE ACCESIBILIDAD APLICADAS AL BODY --- */

/* 1. Alto Contraste */
body.acc-contrast {
    filter: contrast(1.5);
    background-color: black !important;
    color: yellow !important;
}

body.acc-contrast * {
    background-color: black !important;
    color: yellow !important;
    border-color: yellow !important;
}

body.acc-contrast img,
body.acc-contrast video,
body.acc-contrast iframe {
    filter: invert(0);
    /* Evitar invertir imágenes si usamos invert, pero aquí usamos replace de colores */
}

/* Método alternativo de contraste mejorado (Invertir) */
body.acc-contrast-invert {
    filter: invert(1) hue-rotate(180deg);
}

body.acc-contrast-invert img,
body.acc-contrast-invert video {
    filter: invert(1) hue-rotate(-180deg);
}

/* 2. Resaltar Enlaces */
body.acc-links a {
    text-decoration: underline !important;
    background-color: #ffeb3b !important;
    color: #000 !important;
    font-weight: bold !important;
    border: 2px solid #000 !important;
    display: inline-block;
}

/* 3. Agrandar Texto */
body.acc-text-large {
    font-size: 125% !important;
}

body.acc-text-extra-large {
    font-size: 150% !important;
}

/* 4. Fuente Dislexia */
@font-face {
    font-family: 'OpenDyslexic';
    src: url('https://cdnjs.cloudflare.com/ajax/libs/oppia/0.0.3/third_party/static/OpenDyslexic-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

body.acc-dyslexia * {
    font-family: 'OpenDyslexic', 'Comic Sans MS', sans-serif !important;
}

/* 5. Cursor Grande */
body.acc-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;"><polygon points="0,0 0,40 12,28 24,48 32,44 18,24 36,24"/></svg>'), auto !important;
}

/* 6. Espaciado de Texto */
body.acc-spacing * {
    letter-spacing: 0.1em !important;
    line-height: 1.8 !important;
    word-spacing: 0.2em !important;
}

/* 7. Ocultar Imágenes */
body.acc-hide-images img,
body.acc-hide-images svg,
body.acc-hide-images video {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* 8. Pausar Animaciones */
body.acc-stop-animations *,
body.acc-stop-animations *:before,
body.acc-stop-animations *:after {
    animation-play-state: paused !important;
    transition: none !important;
}