﻿/* ===================================================================
   BARRA DE ACCESIBILIDAD - DOCK VERTICAL COMPACTO
   Versión final: sin duplicados, con fix grayscale + modal ayuda
=================================================================== */

.accesibilidad-dock {
    position: fixed;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

    .accesibilidad-dock > * {
        pointer-events: auto;
    }

/* ===== BOTÓN PRINCIPAL ===== */

.acc-dock-toggle {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(145deg, #8B1D1D, #6d1717);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(139, 29, 29, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.25rem;
}

    .acc-dock-toggle:hover {
        transform: scale(1.08);
        box-shadow: 0 10px 24px rgba(139, 29, 29, 0.5), 0 0 0 4px rgba(255, 255, 255, 0.6);
    }

    .acc-dock-toggle:active {
        transform: scale(0.95);
    }

    .acc-dock-toggle:focus-visible {
        outline: 3px solid #fbbf24;
        outline-offset: 4px;
    }

/* Pulso animado */
.acc-dock-pulse {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid rgba(139, 29, 29, 0.5);
    animation: dockPulse 2.5s ease-out infinite;
    pointer-events: none;
}

@keyframes dockPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* Estado abierto del dock */
.accesibilidad-dock.open .acc-dock-toggle {
    background: linear-gradient(145deg, #0f172a, #1e293b);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.5), 0 0 0 3px rgba(251, 191, 36, 0.4);
}

.accesibilidad-dock.open .acc-dock-pulse {
    display: none;
}

/* ===== DOCK CON ICONOS ===== */

.acc-dock-items {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 30px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(15, 23, 42, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transform-origin: top center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    max-height: 0;
    overflow: hidden;
}

.accesibilidad-dock.open .acc-dock-items {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    max-height: 600px;
}

/* ===== BOTONES INDIVIDUALES DEL DOCK ===== */

.acc-dock-item {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    flex-shrink: 0;
}

    .acc-dock-item:hover {
        background: #f1f5f9;
        border-color: #cbd5e1;
        transform: scale(1.08);
        color: #8B1D1D;
    }

    .acc-dock-item:active {
        transform: scale(0.95);
    }

    .acc-dock-item:focus-visible {
        outline: 2px solid #8B1D1D;
        outline-offset: 2px;
    }

    /* Estado activo (función habilitada) */
    .acc-dock-item.active {
        background: linear-gradient(145deg, #8B1D1D, #6d1717);
        color: #fff;
        border-color: #8B1D1D;
        box-shadow: 0 4px 12px rgba(139, 29, 29, 0.3);
    }

        .acc-dock-item.active:hover {
            background: linear-gradient(145deg, #6d1717, #5d1414);
            color: #fff;
        }

        /* Indicador de "activo" (puntito amarillo) */
        .acc-dock-item.active::after {
            content: "";
            position: absolute;
            top: -2px;
            right: -2px;
            width: 10px;
            height: 10px;
            background: #fbbf24;
            border: 2px solid #fff;
            border-radius: 50%;
            box-shadow: 0 0 6px rgba(251, 191, 36, 0.6);
        }

    /* ✅ Botón deshabilitado (A+/A- llegó al límite) */
    .acc-dock-item.acc-disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

        .acc-dock-item.acc-disabled:hover {
            transform: none;
            background: #fff;
            color: #475569;
            border-color: #e2e8f0;
        }

/* Iconos de texto (A+ / A-) */
.acc-dock-text-icon {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 800;
    font-size: 0.85rem;
}

/* Divisor */
.acc-dock-divider {
    height: 1px;
    width: 70%;
    background: #e2e8f0;
    margin: 0.25rem auto;
}

/* Botón "?" del dock (azul) */
.acc-dock-help {
    color: #0369a1 !important;
    border-color: #bae6fd !important;
}

    .acc-dock-help:hover {
        background: #0369a1 !important;
        color: #fff !important;
        border-color: #0369a1 !important;
    }

/* Botón reset (rojo suave) */
.acc-dock-reset {
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
}

    .acc-dock-reset:hover {
        background: #dc2626 !important;
        color: #fff !important;
        border-color: #dc2626 !important;
    }

/* ===== TOOLTIP (al hover) ===== */

.acc-dock-item[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background: #0f172a;
    color: #fff;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
    z-index: 10;
}

.acc-dock-item[data-tooltip]::after {
    content: "";
    position: absolute;
    right: calc(100% + 6px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    border: 6px solid transparent;
    border-left-color: #0f172a;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 10;
}

.acc-dock-item:hover::before,
.acc-dock-item:hover::after,
.acc-dock-item:focus-visible::before,
.acc-dock-item:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

/* ===================================================================
   EFECTOS GLOBALES APLICADOS AL <body>
=================================================================== */

/* TAMAÑO DE TEXTO */
body.acc-text-large {
    font-size: 17px !important;
}

body.acc-text-xlarge {
    font-size: 19px !important;
}

    body.acc-text-large *,
    body.acc-text-xlarge * {
        line-height: 1.6 !important;
    }

/* ALTO CONTRASTE */
body.acc-high-contrast {
    background: #000 !important;
}

    body.acc-high-contrast *:not(.acc-dock-toggle):not(.acc-dock-items):not(.acc-dock-items *):not(.acc-dock-item):not(.acc-dock-item *):not(.accesibilidad-dock):not(.acc-help-modal):not(.acc-help-modal *) {
        background: #000 !important;
        color: #fff !important;
        border-color: #fff !important;
    }

    body.acc-high-contrast a:not(.acc-dock-toggle):not(.acc-dock-items *):not(.acc-help-modal *) {
        color: #fbbf24 !important;
        text-decoration: underline !important;
    }

    body.acc-high-contrast img,
    body.acc-high-contrast video {
        filter: grayscale(100%) contrast(1.2);
    }

/* ===================================================================
   ✅ ESCALA DE GRISES - FIX DEFINITIVO
   No usa filter en body porque eso afecta a TODO incluido fixed.
   Aplica grayscale solo a los hijos directos del body,
   excluyendo la barra y el modal de ayuda.
=================================================================== */

body.acc-grayscale:not(.acc-high-contrast) > *:not(.accesibilidad-dock):not(.acc-help-modal):not(.reading-guide-line):not(script):not(style):not(noscript):not(#barra-busqueda-sticky):not(#tickerWrapper):not(#atractivoViewportContainer):not(.dlr-chatbot):not(.dlr-chatbot-overlay) {
    filter: grayscale(100%);
}

/* Aplicar gris directamente a estos elementos fixed/importantes */
body.acc-grayscale #barra-busqueda-sticky,
body.acc-grayscale #tickerWrapper,
body.acc-grayscale #atractivoViewportContainer {
    filter: grayscale(100%);
}

/* SUBRAYAR ENLACES */
body.acc-links a:not(.acc-dock-toggle):not(.acc-dock-items *):not(.acc-help-modal *) {
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    text-underline-offset: 3px !important;
    font-weight: 600 !important;
}

/* REDUCIR MOVIMIENTO */
body.acc-no-motion *,
body.acc-no-motion *::before,
body.acc-no-motion *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
}

/* CURSOR GRANDE */
body.acc-big-cursor,
body.acc-big-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M8 4 L40 24 L24 28 L20 44 Z" fill="black" stroke="white" stroke-width="2"/></svg>') 4 4, auto !important;
}

    body.acc-big-cursor a,
    body.acc-big-cursor button,
    body.acc-big-cursor [role="button"] {
        cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M14 4 L14 32 L22 28 L26 38 L30 36 L26 26 L36 26 Z" fill="black" stroke="white" stroke-width="2"/></svg>') 14 4, pointer !important;
    }

/* FUENTE LEGIBLE */
body.acc-readable,
body.acc-readable *:not(.fas):not(.far):not(.fab):not(i) {
    font-family: 'Verdana', 'Arial', sans-serif !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
    line-height: 1.7 !important;
}

/* LÍNEA DE GUÍA DE LECTURA */
.reading-guide-line {
    position: fixed;
    left: 0;
    width: 100%;
    height: 38px;
    background: rgba(251, 191, 36, 0.25);
    border-top: 2px solid rgba(251, 191, 36, 0.6);
    border-bottom: 2px solid rgba(251, 191, 36, 0.6);
    pointer-events: none;
    z-index: 9997;
    display: none;
    transition: top 0.05s linear;
}

body.acc-reading-guide .reading-guide-line {
    display: block;
}

/* ===================================================================
   MODAL DE AYUDA DE ACCESIBILIDAD
=================================================================== */

.acc-help-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.25s ease;
}

    .acc-help-modal.open {
        display: flex;
        opacity: 1;
    }

.acc-help-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
}

.acc-help-content {
    position: relative;
    z-index: 2;
    background: #fff;
    border-radius: 20px;
    width: min(480px, 100%);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.3);
    animation: acc-help-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes acc-help-in {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.acc-help-close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    z-index: 3;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

    .acc-help-close:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: scale(1.1) rotate(90deg);
    }

/* HEADER del modal */
.acc-help-header {
    background: linear-gradient(145deg, #8B1D1D, #6d1717);
    color: #fff;
    padding: 1.5rem 1.5rem 1.25rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

    .acc-help-header::before {
        content: "";
        position: absolute;
        top: -50%;
        right: -20%;
        width: 250px;
        height: 250px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(212, 175, 55, 0.25), transparent 60%);
        pointer-events: none;
    }

.acc-help-icon-wrapper {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fbbf24;
    position: relative;
    z-index: 2;
}

.acc-help-header h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 900;
    margin: 0 0 0.3rem 0;
    color: #fff;
    position: relative;
    z-index: 2;
}

.acc-help-header p {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    position: relative;
    z-index: 2;
}

/* LISTA de items explicativos */
.acc-help-list {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

    .acc-help-list::-webkit-scrollbar {
        width: 6px;
    }

    .acc-help-list::-webkit-scrollbar-track {
        background: #f1f5f9;
        border-radius: 3px;
    }

    .acc-help-list::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 3px;
    }

.acc-help-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    transition: background 0.2s ease;
}

    .acc-help-item:hover {
        background: #f8fafc;
    }

.acc-help-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(139, 29, 29, 0.08);
    color: #8B1D1D;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 800;
}

.acc-help-icon-reset {
    background: rgba(220, 38, 38, 0.08);
    color: #dc2626;
}

.acc-help-item > div {
    flex: 1;
}

    .acc-help-item > div strong {
        display: block;
        font-size: 0.88rem;
        font-weight: 700;
        color: #1e293b;
        margin-bottom: 0.15rem;
    }

    .acc-help-item > div p {
        font-size: 0.78rem;
        line-height: 1.45;
        color: #64748b;
        margin: 0;
    }

/* FOOTER del modal */
.acc-help-footer {
    background: #f8fafc;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-align: center;
}

    .acc-help-footer small {
        font-size: 0.72rem;
        color: #64748b;
        line-height: 1.4;
    }

    .acc-help-footer i {
        color: #8B1D1D;
        margin-right: 0.25rem;
    }

.acc-help-shortcut kbd {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-bottom-width: 2px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.7rem;
    color: #1e293b;
    margin: 0 0.1rem;
}

/* ===================================================================
   RESPONSIVE - Mobile
=================================================================== */

@media (max-width: 768px) {
    .accesibilidad-dock {
        right: 0.6rem;
    }

    .acc-dock-toggle {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }

    .acc-dock-item {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .acc-dock-text-icon {
        font-size: 0.78rem;
    }

    .acc-dock-items {
        padding: 0.4rem;
        gap: 0.35rem;
    }

    /* En mobile: tooltip arriba del botón (no a la izquierda) */
    .acc-dock-item[data-tooltip]::before {
        right: auto;
        left: 50%;
        top: auto;
        bottom: calc(100% + 8px);
        transform: translateX(-50%) translateY(8px);
        font-size: 0.7rem;
        padding: 0.35rem 0.65rem;
    }

    .acc-dock-item[data-tooltip]::after {
        right: auto;
        left: 50%;
        top: auto;
        bottom: calc(100% + 2px);
        transform: translateX(-50%) translateY(8px);
        border-color: transparent;
        border-top-color: #0f172a;
    }

    .acc-dock-item:hover::before,
    .acc-dock-item:hover::after,
    .acc-dock-item:focus-visible::before,
    .acc-dock-item:focus-visible::after {
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 600px) {
    .acc-help-modal {
        padding: 0.85rem;
    }

    .acc-help-content {
        max-height: 90vh;
    }

    .acc-help-header {
        padding: 1.25rem 1rem 1rem;
    }

    .acc-help-icon-wrapper {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

    .acc-help-header h3 {
        font-size: 1.15rem;
    }

    .acc-help-list {
        padding: 0.85rem 1rem;
    }

    .acc-help-item {
        padding: 0.6rem 0.65rem;
    }
}

@media (max-width: 400px) {
    .acc-dock-toggle {
        width: 40px;
        height: 40px;
    }

    .acc-dock-item {
        width: 34px;
        height: 34px;
    }
}
/* El chatbot no debe quedar filtrado dentro del contenido */
body.acc-grayscale .dlr-chatbot,
body.acc-grayscale .dlr-chatbot * {
    filter: none !important;
}