/* ==================================================
   GD ACCESSIBILITY - FRONTEND STYLES
   ================================================== */

/* ----- BOTÓN FLOTANTE ----- */
#gd-a11y-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: #0057ff;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    z-index: 999999;
    transition: transform 0.2s, background 0.2s;
}

#gd-a11y-button:hover {
    transform: scale(1.05);
}

/* Posición izquierda */
.gd-btn-position-left #gd-a11y-button {
    right: auto;
    left: 20px;
}

/* ----- PANEL ----- */
#gd-a11y-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: #1a1a2e;
    color: #eee;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 999998;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.gd-btn-position-left #gd-a11y-panel {
    right: auto;
    left: 20px;
    transform: translateX(-400px);
}

#gd-a11y-panel.active {
    transform: translateX(0);
}

/* HEADER PANEL */
.gd-a11y-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
}

.gd-a11y-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #fff;
}

#gd-a11y-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

#gd-a11y-close:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* ITEMS DEL PANEL */
.gd-a11y-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.gd-a11y-info {
    flex: 1;
}

.gd-a11y-info strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.gd-a11y-info span {
    font-size: 0.75rem;
    color: #aaa;
}

/* SWITCH TOGGLE */
.gd-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.gd-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.gd-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3a3a4a;
    transition: 0.2s;
    border-radius: 24px;
}

.gd-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.2s;
    border-radius: 50%;
}

input:checked + .gd-slider {
    background-color: #0057ff;
}

input:checked + .gd-slider:before {
    transform: translateX(26px);
}

/* BOTÓN LECTOR */
#gd-read-selection {
    background: #0057ff;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

#gd-read-selection:hover {
    background: #0040cc;
}

/* RESET BUTTON */
.gd-a11y-reset-wrap {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

#gd-a11y-reset {
    width: 100%;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #ff6b6b;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

#gd-a11y-reset:hover {
    background: rgba(255,107,107,0.2);
}

/* ----- GUÍA DE LECTURA ----- */
#gd-reading-guide {
    position: fixed;
    left: 0;
    width: 100%;
    height: 32px;
    background: rgba(0,87,255,0.15);
    border-top: 2px solid #0057ff;
    border-bottom: 2px solid #0057ff;
    pointer-events: none;
    z-index: 999997;
    display: none;
}

/* ==================================================
   MODOS DE ACCESIBILIDAD
   ================================================== */

/* ALTO CONTRASTE */
.gd-contrast,
.gd-contrast *:not(.gd-switch *) {
    background-color: #000 !important;
    color: #ff0 !important;
    border-color: #ff0 !important;
}

.gd-contrast a,
.gd-contrast button {
    color: #0ff !important;
}

/* TEXTO GRANDE */
.gd-bigtext,
.gd-bigtext p,
.gd-bigtext li,
.gd-bigtext span:not(.gd-slider) {
    font-size: 1.25rem !important;
    line-height: 1.5 !important;
}

/* ESCALA DE GRISES */
.gd-grayscale {
    filter: grayscale(100%);
}

/* ESPACIADO LECTURA */
.gd-spacing p,
.gd-spacing li,
.gd-spacing div:not(#gd-a11y-panel *) {
    line-height: 2 !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
}

/* PAUSAR ANIMACIONES */
.gd-pauseanim *,
.gd-pauseanim *:before,
.gd-pauseanim *:after {
    animation-play-state: paused !important;
    transition: none !important;
}

/* OCULTAR IMÁGENES */
.gd-hideimages img:not(#gd-a11y-panel img) {
    visibility: hidden !important;
    height: auto !important;
}

/* RESPONSIVE */
@media (max-width: 480px) {
    #gd-a11y-panel {
        width: calc(100vw - 40px);
        right: 20px;
        bottom: 80px;
    }
    
    .gd-btn-position-left #gd-a11y-panel {
        left: 20px;
    }
}