/* ==========================================================================
   CSS DE ACCESIBILIDAD - WCAG AAA - TUSITIOYA
   ========================================================================== */

/* --- 1. CONFIGURACIÓN DE TAMAÑOS DE TEXTO --- */
html.accessibility-text-125 { font-size: 125% !important; }
html.accessibility-text-150 { font-size: 150% !important; }
html.accessibility-text-200 { font-size: 200% !important; }

/* --- 2. FUENTE LEGIBLE --- */
body.accessibility-readable-font,
body.accessibility-readable-font * {
    font-family: Arial, Verdana, sans-serif !important;
    line-height: 1.7 !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
}

/* --- 3. MONOCROMO (BLANCO Y NEGRO) --- */
html.accessibility-monochrome {
    filter: grayscale(100%) !important;
}

/* --- 4. SIN ANIMACIONES (REDUCIR MOVIMIENTO) --- */
html.accessibility-no-motion *,
html.accessibility-no-motion *:before,
html.accessibility-no-motion *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

/* --- 5. RESALTAR ENLACES --- */
body.accessibility-highlight-links a:not(.acc-widget-btn, .acc-panel *) {
    text-decoration: underline !important;
    font-weight: 800 !important;
    outline: 2px solid currentColor !important;
    outline-offset: 2px !important;
}

/* --- 6. INDICADORES DE FOCO ULTRA-VISIBLES --- */
body.accessibility-highlight-focus *:focus-visible,
body.accessibility-highlight-focus *:focus {
    outline: 4px solid #ffff00 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px #000000, 0 0 0 10px #ffffff !important;
    position: relative;
    z-index: 99999 !important;
}

/* --- 7. CURSOR GRANDE --- */
body.accessibility-big-cursor,
body.accessibility-big-cursor * {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 32 32'><path d='M0,0 L0,24 L8,18 L14,30 L18,28 L12,16 L20,16 Z' fill='white' stroke='black' stroke-width='2'/></svg>"), auto !important;
}

/* --- 8. GUÍA DE LECTURA --- */
#accessibility-reading-guide {
    position: fixed;
    left: 0;
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 0, 0.7);
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.9);
    pointer-events: none;
    z-index: 999999;
    display: none;
}

/* --- 9. MODO ALTO CONTRASTE (WCAG AAA) --- */
html.accessibility-high-contrast {
    background-color: #000000 !important;
    background-image: none !important;
    color: #ffffff !important;
}

html.accessibility-high-contrast body {
    background-color: #000000 !important;
    background-image: none !important;
    color: #ffffff !important;
}

/* Anulamos colores y sombras excepto para el panel de accesibilidad */
html.accessibility-high-contrast *:not(.acc-widget-btn, .acc-panel, .acc-panel *) {
    background-color: #000000 !important;
    background-image: none !important;
    color: #ffff00 !important; /* Texto amarillo */
    border-color: #ffffff !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

html.accessibility-high-contrast a:not(.acc-widget-btn, .acc-panel *) {
    color: #00ffff !important; /* Enlaces cian sobre negro */
    text-decoration: underline !important;
}

html.accessibility-high-contrast button:not(.acc-widget-btn, .acc-panel *) {
    border: 2px solid #ffffff !important;
    border-radius: 4px !important;
    background-color: #000000 !important;
    color: #ffff00 !important;
}

html.accessibility-high-contrast input:not(.acc-panel *),
html.accessibility-high-contrast select:not(.acc-panel *),
html.accessibility-high-contrast textarea:not(.acc-panel *) {
    border: 2px solid #ffffff !important;
    background-color: #000000 !important;
    color: #ffff00 !important;
}

/* --- 10. ESTILOS DEL PANEL DE ACCESIBILIDAD --- */
.acc-widget-btn {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    left: auto !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #00d1ff 0%, #0077ff 100%) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 4px 20px rgba(0, 209, 255, 0.4) !important;
    cursor: pointer !important;
    z-index: 999990 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 24px !important;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s !important;
}

.acc-widget-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 24px rgba(0, 209, 255, 0.6) !important;
}

.acc-widget-btn:focus-visible {
    outline: 4px solid #ffffff !important;
    outline-offset: 2px !important;
}

.acc-panel {
    position: fixed !important;
    bottom: 90px !important;
    right: 20px !important;
    left: auto !important;
    width: 350px !important;
    max-width: calc(100vw - 40px) !important;
    max-height: calc(100vh - 120px) !important;
    background-color: #1e293b !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    z-index: 999991 !important;
    overflow-y: auto !important;
    display: none;
    flex-direction: column;
    animation: accSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    color: #ffffff !important;
    font-family: system-ui, -apple-system, sans-serif !important;
}

@keyframes accSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.acc-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background-color: #0f172a;
    border-top-left-radius: 19px;
    border-top-right-radius: 19px;
}

.acc-panel-title {
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #00d1ff;
}

.acc-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background-color 0.2s;
}

.acc-close-btn:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.acc-panel-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.acc-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.acc-control-group {
    background-color: #0f172a;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.acc-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.acc-toggle-row:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 8px;
    padding-bottom: 12px;
}

.acc-label-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 12px;
}

.acc-label-text {
    font-size: 14px;
    font-weight: 600;
}

.acc-desc-text {
    font-size: 11px;
    color: #94a3b8;
}

/* Toggle Switch */
.acc-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.acc-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.acc-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #475569;
    transition: .3s;
    border-radius: 24px;
}

.acc-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.acc-switch input:checked + .acc-slider {
    background-color: #00d1ff;
}

.acc-switch input:focus-visible + .acc-slider {
    box-shadow: 0 0 0 3px #ffffff;
}

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

/* Button Group for Text Scaling */
.acc-btn-group {
    display: flex;
    gap: 4px;
    width: 100%;
}

.acc-btn-opt {
    flex: 1;
    background-color: #1e293b;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 4px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.acc-btn-opt:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.acc-btn-opt.active {
    background-color: #00d1ff;
    color: #0f172a;
    border-color: #00d1ff;
}

.acc-btn-opt:focus-visible {
    outline: 2px solid #ffffff;
}

.acc-reset-btn {
    background: none;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    color: #94a3b8;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: color 0.2s, border-color 0.2s, background-color 0.2s;
    width: 100%;
    margin-top: 8px;
}

.acc-reset-btn:hover {
    color: #ffffff;
    border-color: #ffffff;
    background-color: rgba(255, 255, 255, 0.02);
}
