/* ══ Radio 21 Sticky Player v1.3.0 ══ */
:root {
    --r21-color-tema: #cc0000;
}

#r21-reproductor {
    position: fixed;
    bottom: 20px;
    right: 20px;
    left: auto;
    z-index: 99999;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 72px;
    background: #131F49;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    border-radius: 12px;
    transition: transform .35s cubic-bezier(.4,0,.2,1), opacity .35s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    padding: 0 16px;
    border: 1px solid rgba(255,255,255,.08);
}
#r21-reproductor.r21-oculto  { transform: translateX(calc(100% + 40px)); opacity: 0; pointer-events: none; }
#r21-reproductor.r21-visible { transform: translateX(0); opacity: 1; }

/* — contenedor — */
.r21-contenedor {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* — utilidad — */
.r21-no-mostrar { display: none !important; }

/* — botón reproducir — */
.r21-boton {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--r21-color-tema);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: filter .15s, transform .15s;
    outline: none;
}
.r21-boton:hover  { filter: brightness(1.18); transform: scale(1.06); }
.r21-boton:active { transform: scale(.95); }
.r21-boton:focus-visible { box-shadow: 0 0 0 3px rgba(255,255,255,.4); }

.r21-pulso {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--r21-color-tema);
    opacity: 0.35;
    animation: r21pulso 1.8s ease-out infinite;
    pointer-events: none;
}
@keyframes r21pulso {
    0%   { transform: scale(1); opacity: .9; }
    100% { transform: scale(1.9); opacity: 0; }
}

.r21-icono { width: 22px; height: 22px; display: block; }

@keyframes r21girar { to { transform: rotate(360deg); } }
.r21-girar { animation: r21girar .85s linear infinite; }

/* — identidad — */
.r21-identidad {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.r21-nombre-emisora {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .03em;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.r21-datos {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.r21-frecuencia {
    font-size: 11px;
    color: rgba(255,255,255,.5);
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

#r21-estado {
    font-size: 11px;
    color: var(--r21-color-tema);
    font-weight: 700;
    letter-spacing: .05em;
}

/* — ondas — */
.r21-ondas {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 32px;
    flex: 1;
    justify-content: center;
}
.r21-barra {
    display: block;
    width: 3px;
    height: 6px;
    border-radius: 2px;
    background: rgba(255,255,255,.15);
    transition: background .3s;
}
.r21-barra.r21-activa {
    background: var(--r21-color-tema);
    animation: r21onda var(--d, .8s) ease-in-out infinite alternate;
}
.r21-barra:nth-child(1) { --d: .60s }
.r21-barra:nth-child(2) { --d: .90s }
.r21-barra:nth-child(3) { --d: .52s }
.r21-barra:nth-child(4) { --d: 1.10s }
.r21-barra:nth-child(5) { --d: .72s }
.r21-barra:nth-child(6) { --d: .85s }
.r21-barra:nth-child(7) { --d: .65s }
.r21-barra:nth-child(8) { --d: 1.00s }
@keyframes r21onda {
    0%   { height: 5px }
    40%  { height: 22px }
    70%  { height: 14px }
    100% { height: 26px }
}

/* — volumen — */
.r21-volumen-grupo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 44px;
    width: 32px;
}

.r21-volumen-boton {
    background: none;
    border: none;
    color: rgba(255,255,255,.55);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s;
    border-radius: 50%;
}
.r21-volumen-boton:hover { color: #fff; background: rgba(255,255,255,.08); }
.r21-volumen-boton:focus-visible { box-shadow: 0 0 0 2px rgba(255,255,255,.35); outline: none; }

.r21-volumen-control {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    bottom: 46px; /* Flota sobre el reproductor */
    left: 50%;
    z-index: 100000;
    width: 80px; /* Largo del slider vertical */
    height: 24px; /* Alto de la cajita protectora */
    border-radius: 12px;
    background: #131F49; /* Fondo oscuro idéntico a la barra */
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 16px rgba(0,0,0,.5);
    outline: none;
    cursor: pointer;
    padding: 0 8px;
    
    /* Transformación para centrar y rotar a vertical */
    transform: translateX(-50%) scale(0.95) rotate(-90deg);
    transform-origin: center;
    
    /* Ocultar por defecto */
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}

/* Mostrar volumen slider al hacer hover sobre el grupo */
.r21-volumen-grupo:hover .r21-volumen-control,
.r21-volumen-grupo:focus-within .r21-volumen-control {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) scale(1) rotate(-90deg);
}

.r21-volumen-control::-webkit-slider-runnable-track {
    height: 3px;
    background: rgba(255,255,255,.2);
    border-radius: 1.5px;
}
.r21-volumen-control::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    margin-top: -4.5px; /* Centrar el thumb en el track */
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.r21-volumen-control::-moz-range-track {
    height: 3px;
    background: rgba(255,255,255,.2);
    border-radius: 1.5px;
}
.r21-volumen-control::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* — cerrar — */
.r21-cerrar {
    background: none;
    border: none;
    color: rgba(255,255,255,.35);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: color .15s, background .15s;
    flex-shrink: 0;
    margin-left: auto;
}
.r21-cerrar:hover { color: #fff; background: rgba(255,255,255,.1); }
.r21-cerrar:focus-visible { box-shadow: 0 0 0 2px rgba(255,255,255,.35); outline: none; }

/* — botón flotante — */
.r21-boton-flotante {
    position: fixed;
    bottom: 20px;
    right: 20px;
    left: auto;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--r21-color-tema);
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
    transition: filter .15s, transform .15s, opacity .35s, visibility .35s;
}
.r21-boton-flotante:hover { filter: brightness(1.15); transform: scale(1.04); }
.r21-boton-flotante:active { transform: scale(.97); }
.r21-boton-flotante:focus-visible { box-shadow: 0 0 0 3px rgba(204,0,0,.4); outline: none; }
.r21-boton-flotante.r21-oculto { opacity: 0; pointer-events: none; visibility: hidden; }

/* — responsive — */
@media (max-width: 768px) {
    #r21-reproductor {
        bottom: 12px;
        right: 12px;
        width: calc(100% - 24px);
        max-width: none;
        border-radius: 8px;
        padding: 0 12px;
    }
    .r21-ondas { display: none; }
    .r21-nombre-emisora { max-width: 140px; font-size: 13px; }

    /* Volumen: en touch no hay :hover, así que el slider queda visible e inline en vez de flotar oculto */
    .r21-volumen-grupo { width: auto; }
    .r21-volumen-control {
        position: static;
        transform: none;
        opacity: 1;
        pointer-events: auto;
        width: 56px;
        height: 20px;
        padding: 0 6px;
    }
    .r21-volumen-grupo:hover .r21-volumen-control,
    .r21-volumen-grupo:focus-within .r21-volumen-control {
        transform: none;
    }
    .r21-boton-flotante {
        bottom: 12px;
        right: 12px;
    }
}
@media (max-width: 480px) {
    .r21-frecuencia { display: none; }
    .r21-nombre-emisora { max-width: 120px; }
    #r21-flotante-texto { display: none; }
    .r21-boton-flotante {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
        gap: 0;
    }
}
