/* ============================================================
   KJA ACCESIBILITY & PREMIUM WIDGETS SYSTEM
   ============================================================ */

/* ============================================================
   1. PUNTERO GLOW SPOTLIGHT
   ============================================================ */
#cursor-dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary-pink, #f10075);
    border-radius: 50%;
    position: fixed;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease, width 0.2s ease, height 0.2s ease;
}

#cursor-glow {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(241, 0, 117, 0.08) 0%, rgba(241, 0, 117, 0.03) 40%, transparent 70%);
    border-radius: 50%;
    position: fixed;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 999998;
    opacity: 0;
    transition: opacity 0.3s ease, background 0.3s ease;
}

#cursor-glow.active {
    opacity: 1;
}

/* Glow al pasar por tarjetas */
#cursor-glow.on-card {
    background: radial-gradient(circle, rgba(0, 79, 176, 0.12) 0%, rgba(0, 79, 176, 0.04) 40%, transparent 70%);
}

#cursor-dot.hovering {
    width: 20px;
    height: 20px;
    background-color: var(--primary-pink, #f10075) !important;
    mix-blend-mode: difference;
}

/* Ocultar en dispositivos móviles */
@media (max-width: 968px) {
    #cursor-dot, #cursor-glow {
        display: none !important;
    }
}

/* ============================================================
   2. WIDGET DE ACCESIBILIDAD UNIVERSAL (DRAWER)
   ============================================================ */

/* Botón flotante (FAB) */
.accessibility-fab {
    position: fixed;
    left: 28px;
    bottom: 28px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue, #004fb0), #0066ff);
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 24px rgba(0, 79, 176, 0.3);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1550;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.accessibility-fab:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 12px 32px rgba(0, 79, 176, 0.5);
    background: linear-gradient(135deg, #0066ff, var(--primary-pink, #f10075));
}

.accessibility-fab svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

/* Backdrop Overlay */
.accessibility-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 15, 45, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1700;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.accessibility-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Drawer */
.accessibility-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 380px;
    height: 100vh;
    background: rgba(18, 22, 33, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 25px 0 50px rgba(0, 0, 0, 0.4);
    z-index: 1750;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    color: #f3f4f6;
}

.accessibility-drawer.open {
    transform: translateX(0);
}

/* Header */
.accessibility-header {
    background: var(--primary-blue, #004fb0);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.accessibility-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
}

.accessibility-header-title svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.accessibility-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* Body Content */
.accessibility-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Selector Group */
.accessibility-select-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.accessibility-select-label {
    font-size: 13px;
    font-weight: 600;
    color: #9ca3af;
}

.accessibility-select-wrapper {
    position: relative;
    width: 100%;
}

.accessibility-select {
    width: 100%;
    background: #191e2b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 12px 16px;
    color: #ffffff;
    font-size: 14px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.accessibility-select:focus {
    outline: none;
    border-color: var(--primary-pink, #f10075);
    box-shadow: 0 0 10px rgba(241, 0, 117, 0.3);
}

.accessibility-select-wrapper::after {
    content: '▼';
    font-size: 10px;
    color: #9ca3af;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Grid of Cards */
.accessibility-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.accessibility-card {
    background: #191e2b;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

.accessibility-card:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(241, 0, 117, 0.3);
    transform: translateY(-2px);
}

.accessibility-card.active {
    background: rgba(241, 0, 117, 0.05);
    border-color: rgba(241, 0, 117, 0.6);
    box-shadow: 0 4px 15px rgba(241, 0, 117, 0.15);
}

.accessibility-card-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: all 0.3s ease;
}

.accessibility-card.active .accessibility-card-icon {
    background: var(--primary-pink, #f10075);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(241, 0, 117, 0.5);
}

.accessibility-card-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.accessibility-card-label {
    font-size: 13px;
    font-weight: 600;
    color: #e5e7eb;
}

/* Multi-segment Indicator Bar */
.accessibility-bar {
    width: 80%;
    display: flex;
    gap: 3px;
    margin-top: 4px;
}

.accessibility-segment {
    height: 4px;
    flex: 1;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    transition: background-color 0.3s ease;
}

.accessibility-card .accessibility-segment.active {
    background: var(--primary-pink, #f10075);
}

/* Footer Section */
.accessibility-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: center;
}

.accessibility-reset {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.accessibility-reset:hover {
    color: var(--primary-pink, #f10075);
}

.accessibility-reset svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    transition: transform 0.5s ease;
}

.accessibility-reset:hover svg {
    transform: rotate(-360deg);
}

/* ============================================================
   3. CLASES DE MODIFICACIÓN DE ACCESIBILIDAD
   ============================================================ */

/* Contrastes */
html.acc-contrast-high {
    filter: contrast(1.4) saturate(1.1) brightness(1.0) !important;
}

html.acc-monochrome {
    filter: grayscale(1) !important;
}

html.acc-inverted {
    filter: invert(1) hue-rotate(180deg) !important;
}

html.acc-inverted img,
html.acc-inverted video,
html.acc-inverted iframe,
html.acc-inverted svg,
html.acc-inverted .carousel-bg {
    filter: invert(1) hue-rotate(180deg) !important;
}

/* Cursores Gigantes */
html.acc-cursor-1,
html.acc-cursor-1 * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M0,0 L0,20 L5,15 L11,27 L15,25 L9,13 L16,13 Z' fill='white' stroke='black' stroke-width='2'/%3E%3C/svg%3E"), auto !important;
}

html.acc-cursor-2,
html.acc-cursor-2 * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 32 32'%3E%3Cpath d='M0,0 L0,20 L5,15 L11,27 L15,25 L9,13 L16,13 Z' fill='white' stroke='black' stroke-width='2'/%3E%3C/svg%3E"), auto !important;
}

/* Dislexia amigable (OpenDyslexic se carga de forma diferida vía JS solo al activarse) */
html.acc-dyslexia,
html.acc-dyslexia * {
    font-family: 'OpenDyslexic', 'Comic Neue', 'Comic Sans MS', sans-serif !important;
}

/* Interlineados */
html.acc-line-height-1 p,
html.acc-line-height-1 li,
html.acc-line-height-1 span,
html.acc-line-height-1 a,
html.acc-line-height-1 h1,
html.acc-line-height-1 h2,
html.acc-line-height-1 h3,
html.acc-line-height-1 h4,
html.acc-line-height-1 h5,
html.acc-line-height-1 h6 {
    line-height: 1.95 !important;
}

html.acc-line-height-2 p,
html.acc-line-height-2 li,
html.acc-line-height-2 span,
html.acc-line-height-2 a,
html.acc-line-height-2 h1,
html.acc-line-height-2 h2,
html.acc-line-height-2 h3,
html.acc-line-height-2 h4,
html.acc-line-height-2 h5,
html.acc-line-height-2 h6 {
    line-height: 2.3 !important;
}

/* Enfoque de alta visibilidad (Navegación Teclado) */
html.acc-focus-highlight *:focus {
    outline: 4px solid var(--primary-pink, #f10075) !important;
    outline-offset: 4px !important;
    box-shadow: 0 0 15px rgba(241, 0, 117, 0.8) !important;
}

/* Máscara de lectura (ADHD Focus Line) */
.accessibility-reading-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99999;
    display: none;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(0, 0, 0, 0.5) calc(var(--mask-y, 50%) - 45px),
        transparent calc(var(--mask-y, 50%) - 45px),
        transparent calc(var(--mask-y, 50%) + 45px),
        rgba(0, 0, 0, 0.5) calc(var(--mask-y, 50%) + 45px),
        rgba(0, 0, 0, 0.5) 100%
    );
}

/* Adaptación responsive en Mobile */
@media (max-width: 480px) {
    .accessibility-fab {
        left: 12px;
        bottom: 12px;
        width: 52px;
        height: 52px;
    }
    .accessibility-drawer {
        width: 100%;
    }
}

/* ============================================================
   4. WIDGET DE WHATSAPP AVANZADO CON TOAST Y BADGE
   ============================================================ */

/* Contenedor flotante */
.whatsapp-widget {
    position: fixed;
    right: 28px;
    bottom: 28px;
    z-index: 1600;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}

/* Toast flotante */
.whatsapp-toast {
    position: relative;
    max-width: 280px;
    background: rgba(255, 255, 255, 0.98);
    color: var(--text-dark, #333333);
    border-radius: 20px;
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 79, 176, 0.08);
}

.whatsapp-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.whatsapp-toast::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 22px;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid rgba(0, 79, 176, 0.08);
    border-right: 1px solid rgba(0, 79, 176, 0.08);
    transform: rotate(45deg);
}

/* Botón flotante */
.whatsapp-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #25D366;
    box-shadow: 0 8px 32px rgba(37, 211, 102, 0.45), 0 2px 8px rgba(0, 0, 0, 0.18);
    text-decoration: none;
    color: #fff;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease;
    pointer-events: auto;
    overflow: visible;
}

/* Anillo de pulso */
.whatsapp-button::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.35);
    animation: wa-pulse-ring 2.8s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    z-index: -1;
}

@keyframes wa-pulse-ring {
    0%   { transform: scale(1);    opacity: 0.75; }
    60%  { transform: scale(1.5);  opacity: 0; }
    100% { transform: scale(1.5);  opacity: 0; }
}

.whatsapp-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(37, 211, 102, 0.55), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.whatsapp-button:hover::before {
    animation-play-state: paused;
}

.whatsapp-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.whatsapp-icon svg {
    width: 32px;
    height: 32px;
    display: block;
    fill: #ffffff;
}

/* Tooltip lateral en hover */
.whatsapp-label {
    position: absolute;
    right: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background: #121621;
    color: #ffffff;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.whatsapp-label::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 7px;
    border-color: transparent transparent transparent #121621;
}

.whatsapp-button:hover .whatsapp-label {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Badge tipo iOS */
.whatsapp-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 11px;
    background: var(--primary-pink, #f10075);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2.5px solid #fff;
    box-shadow: 0 2px 8px rgba(241, 0, 117, 0.45);
    animation: badge-pop 0.4s 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes badge-pop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

@media (max-width: 968px) {
    .whatsapp-widget {
        right: 18px;
        bottom: 18px;
        gap: 8px;
    }
    .whatsapp-button {
        width: 54px;
        height: 54px;
    }
    .whatsapp-icon svg {
        width: 28px;
        height: 28px;
    }
    .whatsapp-label {
        display: none !important;
    }
}
