/**
 * CINIA - Accessibility Toolbar
 * Herramientas de accesibilidad para mejorar la experiencia de todos los usuarios
 */

/* ========================================
   TOOLBAR CONTAINER
   ======================================== */

.a11y-toolbar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Toggle Button (Icono flotante) */
.a11y-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #ad060e;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(173, 6, 14, 0.4),
                0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.a11y-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(173, 6, 14, 0.5),
                0 3px 8px rgba(0, 0, 0, 0.3);
}

.a11y-toggle:focus {
    outline: 3px solid #ffeb3b;
    outline-offset: 3px;
}

.a11y-toggle[aria-expanded="true"] {
    background: #8a0508;
}

/* Badge de notificación */
.a11y-toggle::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    background: #ffeb3b;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.a11y-toolbar.has-settings .a11y-toggle::after {
    opacity: 1;
}

/* ========================================
   PANEL DE HERRAMIENTAS
   ======================================== */

.a11y-panel {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 320px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.a11y-panel:not([hidden]) {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

.a11y-panel h3 {
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #ad060e 0%, #8a0508 100%);
    color: white;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 3px solid #6d0406;
}

.a11y-panel-content {
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    padding: 16px;
}

/* Scrollbar personalizado */
.a11y-panel-content::-webkit-scrollbar {
    width: 8px;
}

.a11y-panel-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.a11y-panel-content::-webkit-scrollbar-thumb {
    background: #ad060e;
    border-radius: 4px;
}

.a11y-panel-content::-webkit-scrollbar-thumb:hover {
    background: #8a0508;
}

/* ========================================
   SECCIONES DEL PANEL
   ======================================== */

.a11y-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.a11y-section:last-of-type {
    border-bottom: none;
}

.a11y-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   BOTONES DEL TOOLBAR
   ======================================== */

.a11y-section button,
.a11y-reset {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.a11y-section button:hover,
.a11y-reset:hover {
    background: #e8e8e8;
    transform: translateX(4px);
}

.a11y-section button:focus,
.a11y-reset:focus {
    outline: 3px solid #ad060e;
    outline-offset: 2px;
}

.a11y-section button.active {
    background: #ad060e;
    color: white;
    border-color: #ad060e;
}

.a11y-section button.active::after {
    content: '✓';
    font-weight: bold;
}

/* Botones en grid para contraste */
.a11y-section.contrast-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.a11y-section.contrast-section button {
    margin-bottom: 0;
}

/* ========================================
   SELECT Y CONTROLES
   ======================================== */

.a11y-section select {
    width: 100%;
    padding: 10px 12px;
    background: #f5f5f5;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.a11y-section select:focus {
    outline: 3px solid #ad060e;
    outline-offset: 2px;
    background: white;
}

/* Control de rango para velocidad de lectura */
.a11y-range {
    width: 100%;
    margin-top: 8px;
}

.a11y-range input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.a11y-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #ad060e;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.a11y-range input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.a11y-range input[type="range"]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(173, 6, 14, 0.3);
}

/* ========================================
   BOTÓN DE RESET
   ======================================== */

.a11y-reset {
    background: linear-gradient(135deg, #ff6b6b 0%, #c92a2a 100%);
    color: white;
    font-weight: 600;
    justify-content: center;
    margin-top: 16px;
    border: none;
}

.a11y-reset:hover {
    background: linear-gradient(135deg, #ff5252 0%, #b71c1c 100%);
    transform: translateX(0) scale(1.02);
}

/* ========================================
   CLASES DE ESTADO (aplicadas al body)
   ======================================== */

/* Alto contraste */
body.high-contrast {
    background: #000 !important;
    color: #fff !important;
}

body.high-contrast *:not(.a11y-toolbar):not(.a11y-toolbar *) {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}

body.high-contrast a:not(.a11y-toolbar a) {
    color: #ffeb3b !important;
    text-decoration: underline !important;
}

body.high-contrast img:not(.a11y-toolbar img) {
    filter: contrast(1.2) brightness(0.9);
}

/* Contraste invertido */
body.contrast-invert {
    filter: invert(1) hue-rotate(180deg);
}

body.contrast-invert .a11y-toolbar {
    filter: invert(1) hue-rotate(180deg);
}

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

body.text-xlarge {
    font-size: 150% !important;
}

body.text-xxlarge {
    font-size: 175% !important;
}

/* Espaciado de líneas */
body.spacing-line *:not(.a11y-toolbar *) {
    line-height: 2 !important;
}

/* Espaciado de letras */
body.spacing-letter *:not(.a11y-toolbar *) {
    letter-spacing: 0.12em !important;
}

/* Links resaltados */
body.highlight-links a:not(.a11y-toolbar a) {
    background: #ffeb3b !important;
    color: #000 !important;
    text-decoration: underline !important;
    font-weight: bold !important;
    padding: 2px 4px !important;
    border-radius: 2px !important;
}

/* Cursor grande */
body.cursor-large,
body.cursor-large * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><circle cx="24" cy="24" r="20" fill="rgba(173,6,14,0.7)" stroke="white" stroke-width="2"/></svg>') 24 24, auto !important;
}

/* Guía de lectura */
.reading-guide {
    position: fixed;
    width: 100%;
    height: 3px;
    background: #ad060e;
    pointer-events: none;
    z-index: 99998;
    box-shadow: 0 0 0 100vh rgba(0,0,0,0.4);
    transition: top 0.1s ease;
}

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

body.animations-paused .wow {
    visibility: visible !important;
    animation-name: none !important;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 480px) {
    .a11y-toolbar {
        bottom: 10px;
        right: 10px;
    }
    
    .a11y-panel {
        width: calc(100vw - 40px);
        right: 10px;
    }
    
    .a11y-toggle {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
}

/* ========================================
   MODO IMPRESIÓN
   ======================================== */

@media print {
    .a11y-toolbar {
        display: none !important;
    }
    
    body.high-contrast,
    body.contrast-invert,
    body.highlight-links {
        filter: none !important;
        background: white !important;
        color: black !important;
    }
}




