/* ============================================
   PANEL DE ACCESIBILIDAD - UCL
   Opciones de acceso para personas con discapacidad
   ============================================ */

/* Variables de accesibilidad */
:root {
    --a11y-panel-bg: #1a1a2e;
    --a11y-panel-text: #ffffff;
    --a11y-accent: #00a8e8;
    --a11y-accent-hover: #0090c5;
    --a11y-toggle-bg: #16213e;
    --a11y-switch-on: #4ade80;
    --a11y-switch-off: #64748b;
}

/* ============================================
   BOTÓN FLOTANTE DE ACCESIBILIDAD
   ============================================ */
.accessibility-panel {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.accessibility-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--a11y-accent), #0066cc);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 168, 232, 0.4);
    transition: all 0.3s ease;
    color: white;
    font-size: 1.8rem;
}

.accessibility-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 168, 232, 0.6);
}

.accessibility-toggle:focus {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.accessibility-toggle[aria-expanded="true"] {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

/* ============================================
   PANEL DE OPCIONES
   ============================================ */
.accessibility-options {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 340px;
    max-height: 80vh;
    background: var(--a11y-panel-bg);
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accessibility-options.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.accessibility-options[aria-hidden="false"] {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Header del panel */
.accessibility-header {
    background: linear-gradient(135deg, var(--a11y-accent), #0066cc);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accessibility-header h2 {
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.accessibility-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.accessibility-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.accessibility-close:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Contenido del panel */
.accessibility-content {
    padding: 15px 20px 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.accessibility-content::-webkit-scrollbar {
    width: 6px;
}

.accessibility-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.accessibility-content::-webkit-scrollbar-thumb {
    background: var(--a11y-accent);
    border-radius: 3px;
}

/* Grupos de opciones */
.accessibility-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.accessibility-group:last-of-type {
    border-bottom: none;
    margin-bottom: 15px;
}

.accessibility-group h3 {
    color: var(--a11y-accent);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.accessibility-group h3 i {
    font-size: 0.85rem;
}

/* Botones de tamaño de texto */
.accessibility-buttons {
    display: flex;
    gap: 10px;
}

.accessibility-buttons button {
    flex: 1;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: var(--a11y-toggle-bg);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.accessibility-buttons button:hover {
    background: var(--a11y-accent);
    border-color: var(--a11y-accent);
    transform: translateY(-2px);
}

.accessibility-buttons button:focus {
    outline: 2px solid var(--a11y-accent);
    outline-offset: 2px;
}

.accessibility-buttons button:active {
    transform: translateY(0);
}

/* Switches de opciones */
.accessibility-toggles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.accessibility-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 10px;
    transition: background 0.3s ease;
}

.accessibility-switch:hover {
    background: rgba(255, 255, 255, 0.05);
}

.accessibility-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    width: 46px;
    height: 26px;
    background: var(--a11y-switch-off);
    border-radius: 13px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.switch-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.accessibility-switch input:checked + .switch-slider {
    background: var(--a11y-switch-on);
}

.accessibility-switch input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.accessibility-switch input:focus + .switch-slider {
    box-shadow: 0 0 0 3px rgba(0, 168, 232, 0.4);
}

.switch-label {
    color: var(--a11y-panel-text);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Botón de reset */
.accessibility-reset {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    margin-top: 5px;
}

.accessibility-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.4);
}

.accessibility-reset:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ============================================
   GUÍA DE LECTURA
   ============================================ */
.reading-guide {
    display: none;
    position: fixed;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(255, 255, 0, 0.15) 20%,
        rgba(255, 255, 0, 0.3) 50%,
        rgba(255, 255, 0, 0.15) 80%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 9998;
    transition: top 0.05s linear;
}

.reading-guide.active {
    display: block;
}

/* ============================================
   ESTILOS DE ACCESIBILIDAD APLICADOS
   ============================================ */

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

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

body.high-contrast a {
    color: #ffff00 !important;
    text-decoration: underline !important;
}

body.high-contrast a:hover,
body.high-contrast a:focus {
    color: #00ffff !important;
}

body.high-contrast button,
body.high-contrast .hero-button,
body.high-contrast .nav-button,
body.high-contrast .program-button {
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #fff !important;
}

body.high-contrast button:hover,
body.high-contrast .hero-button:hover,
body.high-contrast .nav-button:hover,
body.high-contrast .program-button:hover {
    background: #ffff00 !important;
    color: #000 !important;
}

body.high-contrast img {
    filter: grayscale(100%) contrast(1.2);
}

body.high-contrast .accessibility-panel,
body.high-contrast .accessibility-options,
body.high-contrast .accessibility-toggle {
    filter: none;
}

body.high-contrast .accessibility-options * {
    background-color: var(--a11y-panel-bg) !important;
    color: #fff !important;
}

body.high-contrast .accessibility-header {
    background: linear-gradient(135deg, var(--a11y-accent), #0066cc) !important;
}

/* Escala de Grises */
body.grayscale {
    filter: grayscale(100%);
}

body.grayscale .accessibility-panel {
    filter: none;
}

/* Invertir Colores */
body.invert-colors {
    filter: invert(100%) hue-rotate(180deg);
}

body.invert-colors img,
body.invert-colors video,
body.invert-colors .accessibility-panel {
    filter: invert(100%) hue-rotate(180deg);
}

/* Subrayar Enlaces */
body.underline-links a {
    text-decoration: underline !important;
    text-underline-offset: 3px;
}

body.underline-links a:hover {
    text-decoration-thickness: 3px !important;
}

/* Fuente Legible (para dislexia) */
body.readable-font,
body.readable-font * {
    font-family: 'OpenDyslexic', 'Comic Sans MS', 'Arial', sans-serif !important;
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
}

/* Mayor Espaciado */
body.line-spacing {
    line-height: 2 !important;
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
}

body.line-spacing p,
body.line-spacing li,
body.line-spacing span,
body.line-spacing div {
    line-height: 2 !important;
}

/* Cursor Grande */
body.big-cursor,
body.big-cursor * {
    cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path fill="%23000" stroke="%23fff" stroke-width="1" d="M5.5 3.21V20.8l4.79-4.79h7.32L5.5 3.21z"/></svg>') 0 0, auto !important;
}

body.big-cursor a,
body.big-cursor button,
body.big-cursor [role="button"],
body.big-cursor input[type="submit"],
body.big-cursor input[type="button"],
body.big-cursor .hero-button,
body.big-cursor .nav-button,
body.big-cursor .program-button,
body.big-cursor .service-link {
    cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path fill="%23000" stroke="%23fff" stroke-width="1" d="M10.5 6l6 6-6 6V6z M6 4v16h2V4H6z"/></svg>') 0 0, pointer !important;
}

/* Detener Animaciones */
body.stop-animations,
body.stop-animations *,
body.stop-animations *::before,
body.stop-animations *::after {
    animation: none !important;
    transition: none !important;
}

body.stop-animations .particle,
body.stop-animations .loader-wrapper {
    display: none !important;
}

/* Resaltar Foco */
body.highlight-focus *:focus {
    outline: 4px solid #ff6b00 !important;
    outline-offset: 4px !important;
    box-shadow: 0 0 0 8px rgba(255, 107, 0, 0.3) !important;
}

body.highlight-focus a:focus,
body.highlight-focus button:focus,
body.highlight-focus input:focus,
body.highlight-focus select:focus,
body.highlight-focus textarea:focus {
    outline: 4px solid #ff6b00 !important;
    outline-offset: 4px !important;
}

/* ============================================
   AJUSTES DE TAMAÑO DE TEXTO
   ============================================ */
body.font-size-1 { font-size: 90% !important; }
body.font-size-2 { font-size: 100% !important; }
body.font-size-3 { font-size: 110% !important; }
body.font-size-4 { font-size: 120% !important; }
body.font-size-5 { font-size: 130% !important; }
body.font-size-6 { font-size: 140% !important; }
body.font-size-7 { font-size: 150% !important; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .accessibility-panel {
        right: 15px;
        bottom: 15px;
    }
    
    .accessibility-toggle {
        width: 55px;
        height: 55px;
        font-size: 1.6rem;
    }
    
    .accessibility-options {
        width: calc(100vw - 30px);
        max-width: 340px;
        right: 0;
        bottom: 65px;
    }
    
    .accessibility-header {
        padding: 15px;
    }
    
    .accessibility-header h2 {
        font-size: 1.1rem;
    }
    
    .accessibility-content {
        padding: 12px 15px 15px;
        max-height: 55vh;
    }
    
    .accessibility-group {
        margin-bottom: 15px;
        padding-bottom: 12px;
    }
    
    .switch-label {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .accessibility-options {
        width: calc(100vw - 20px);
        right: -5px;
    }
    
    .accessibility-buttons button {
        padding: 10px 8px;
        font-size: 0.95rem;
    }
}

/* ============================================
   PREFERENCIAS DE MOVIMIENTO REDUCIDO
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .accessibility-toggle,
    .accessibility-options,
    .switch-slider,
    .switch-slider::before {
        transition: none;
    }
}

/* ============================================
   MODO OSCURO DEL SISTEMA
   ============================================ */
@media (prefers-color-scheme: dark) {
    .accessibility-panel {
        --a11y-panel-bg: #0f0f23;
        --a11y-toggle-bg: #1a1a3e;
    }
}
