/* ==========================================================================
   Widget Flotante de Accesibilidad SbN ECP
   ========================================================================== */

/* --- Contenedor principal (fixed, costado derecho) --- */
#sbn-a11y-widget {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    font-family: Roboto, sans-serif;
}

/* --- Pestaña de toggle --- */
#sbn-a11y-toggle {
    position: relative;
    background-color: #0a3f0a;
    color: #ffffff;
    border: none;
    border-radius: 6px 0 0 6px;
    padding: 12px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.25);
    transition: background-color 0.2s ease, padding-right 0.2s ease;
    flex-shrink: 0;
    order: 2;
}

#sbn-a11y-toggle:hover {
    background-color: #145214;
}

#sbn-a11y-toggle:focus {
    outline: 2px solid #BAD405;
    outline-offset: 2px;
}

#sbn-a11y-toggle[aria-expanded="true"] {
    background-color: #145214;
    border-radius: 0 0 0 6px;
}

.sbn-a11y-toggle__label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    white-space: nowrap;
    line-height: 1;
}

/* --- Panel de controles --- */
#sbn-a11y-panel {
    background-color: #ffffff;
    border: 1px solid #c8d8c8;
    border-right: none;
    border-radius: 8px 0 0 8px;
    box-shadow: -4px 4px 16px rgba(0, 0, 0, 0.18);
    padding: 0;
    width: 200px;
    order: 1;

    /* Estado cerrado */
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-width 0.3s ease, opacity 0.25s ease;
}

#sbn-a11y-panel.open {
    max-width: 50px;
    opacity: 1;
}

/* --- Cabecera del panel --- */
.sbn-a11y-panel__header {
    background-color: #0a3f0a;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 7px;
    border-radius: 8px 0 0 0;
    white-space: nowrap;
}

/* --- Separador --- */
.sbn-a11y-panel__separator {
    height: 1px;
    background-color: #e0eae0;
    margin: 0 12px;
}

/* --- Grupos de controles --- */
.sbn-a11y-group {
    padding: 5px 5px 5px;
}

.sbn-a11y-group__title {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: #4a6a4a;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 7px;
    white-space: nowrap;
}

.sbn-a11y-group__buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* --- Botones --- */
.sbn-a11y-btn {
    background: transparent;
    border: 1px solid #c8d8c8;
    border-radius: 4px;
    color: #0a3f0a;
    cursor: pointer;
    padding: 4px 9px;
    font-family: Roboto, sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.sbn-a11y-btn:hover {
    background-color: #d4e8d4;
    border-color: #008E65;
}

.sbn-a11y-btn:focus {
    outline: 2px solid #BAD405;
    outline-offset: 2px;
}

.sbn-a11y-btn.active {
    background-color: #0a3f0a;
    border-color: #0a3f0a;
    color: #ffffff;
}

.sbn-a11y-btn.active:hover {
    background-color: #145214;
    border-color: #145214;
}

/* Tamaños de fuente en los botones */
.sbn-a11y-btn--font-small  { font-size: 11px; }
.sbn-a11y-btn--font-normal { font-size: 13px; }
.sbn-a11y-btn--font-large  { font-size: 15px; font-weight: 700; }

/* ==========================================================================
   MODO ALTO CONTRASTE
   ========================================================================== */

body.sbn-high-contrast {
    background-color: #000000 !important;
    color: #ffffff !important;
}

body.sbn-high-contrast .frontpage {
    background-color: #000000 !important;
}

body.sbn-high-contrast p,
body.sbn-high-contrast span,
body.sbn-high-contrast li,
body.sbn-high-contrast td,
body.sbn-high-contrast th,
body.sbn-high-contrast label,
body.sbn-high-contrast div {
    color: #ffffff !important;
}

body.sbn-high-contrast .h1,
body.sbn-high-contrast .h2,
body.sbn-high-contrast .h3,
body.sbn-high-contrast .h4,
body.sbn-high-contrast .h5,
body.sbn-high-contrast .h6,
body.sbn-high-contrast h1,
body.sbn-high-contrast h2,
body.sbn-high-contrast h3,
body.sbn-high-contrast h4,
body.sbn-high-contrast h5,
body.sbn-high-contrast h6 {
    color: #ffff00 !important;
}

body.sbn-high-contrast a,
body.sbn-high-contrast a:visited {
    color: #ffff00 !important;
    text-decoration: underline !important;
}

body.sbn-high-contrast a:hover,
body.sbn-high-contrast a:focus {
    color: #000000 !important;
    background-color: #ffff00 !important;
}

body.sbn-high-contrast .sbn-navbar {
    background-color: #000000 !important;
    border-top-color: #ffff00 !important;
}

body.sbn-high-contrast .sbn-navbar a {
    color: #ffffff !important;
}

body.sbn-high-contrast .sbn-navbar .nav-item:hover {
    background-color: #ffff00 !important;
}

body.sbn-high-contrast .sbn-navbar .nav-item:hover a {
    color: #000000 !important;
}

/* Widget en modo contraste */
body.sbn-high-contrast #sbn-a11y-panel {
    background-color: #1a1a1a !important;
    border-color: #555555 !important;
}

body.sbn-high-contrast .sbn-a11y-group__title {
    color: #aaaaaa !important;
}

body.sbn-high-contrast .sbn-a11y-btn {
    color: #ffffff !important;
    border-color: #555555 !important;
}

body.sbn-high-contrast .sbn-a11y-btn:hover {
    background-color: #ffff00 !important;
    color: #000000 !important;
    border-color: #ffff00 !important;
}

body.sbn-high-contrast .sbn-a11y-btn.active {
    background-color: #ffff00 !important;
    border-color: #ffff00 !important;
    color: #000000 !important;
}

body.sbn-high-contrast .sbn-a11y-panel__separator {
    background-color: #333333 !important;
}

body.sbn-high-contrast .card,
body.sbn-high-contrast .card-body,
body.sbn-high-contrast section,
body.sbn-high-contrast article {
    background-color: #111111 !important;
    border-color: #555555 !important;
}

body.sbn-high-contrast .btn-primary,
body.sbn-high-contrast .btn-success {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}

body.sbn-high-contrast img {
    filter: brightness(0.85) contrast(1.1);
}

body.sbn-high-contrast input,
body.sbn-high-contrast textarea,
body.sbn-high-contrast select {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

body.sbn-high-contrast input::placeholder,
body.sbn-high-contrast textarea::placeholder {
    color: #aaaaaa !important;
}

/* ==========================================================================
   INTERLINEADO AUMENTADO
   ========================================================================== */

body.sbn-line-height-large p,
body.sbn-line-height-large li,
body.sbn-line-height-large td,
body.sbn-line-height-large th,
body.sbn-line-height-large span,
body.sbn-line-height-large label,
body.sbn-line-height-large a {
    line-height: 2.2 !important;
}

body.sbn-line-height-large h1,
body.sbn-line-height-large h2,
body.sbn-line-height-large h3,
body.sbn-line-height-large h4,
body.sbn-line-height-large h5,
body.sbn-line-height-large h6 {
    line-height: 1.8 !important;
}

/* ==========================================================================
   RESPONSIVO — móvil
   ========================================================================== */

@media (max-width: 576px) {
    #sbn-a11y-widget {
        top: auto;
        bottom: 80px;
        transform: none;
    }

    #sbn-a11y-panel {
        max-width: 180px;
    }

    #sbn-a11y-panel.open {
        max-width: 180px;
    }
}
