/* =============================================
 *  JamboRadio — YouTube Live Pop-up Player
 *  Launcher pill → modal → docked mini-player
 * ============================================= */

.jr-lv {
    --jr-lv-red: #FF2D2D;
    --jr-lv-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --jr-lv-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
    --jr-lv-side: 24px;
    /* Clears the floating radio bar (16px offset + ~72px bar) */
    --jr-lv-bottom: 104px;
    font-family: var(--jr-font) !important;
}

.jr-lv [hidden] { display: none !important; }

/* ── Pulsing live dot (shared) ── */
.jr-lv-dot {
    position: relative;
    display: inline-block;
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: var(--jr-lv-red);
}
.jr-lv-dot::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--jr-lv-red);
    animation: jr-lv-ping 1.6s var(--jr-lv-ease, ease-out) infinite;
}

@keyframes jr-lv-ping {
    0%   { transform: scale(1);   opacity: 0.75; }
    100% { transform: scale(3.2); opacity: 0; }
}

/* ══════════════════════════════════════
 *  Launcher pill
 * ══════════════════════════════════════ */
.jr-lv-launcher {
    position: fixed !important;
    bottom: var(--jr-lv-bottom) !important;
    z-index: 99991 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px 20px 12px 16px !important;
    margin: 0 !important;
    border: 2px solid var(--jr-yellow) !important;
    border-radius: var(--jr-radius-full) !important;
    background: var(--jr-primary) !important;
    color: #fff !important;
    font: 700 13px/1 var(--jr-font) !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
    cursor: pointer !important;
    overflow: hidden !important;
    box-shadow: 0 8px 28px rgba(26, 26, 46, 0.35), 0 0 0 0 rgba(255, 215, 0, 0.5) !important;
    animation: jr-lv-enter 0.7s var(--jr-lv-spring) 0.8s both, jr-lv-glow 2.8s ease-in-out 1.6s infinite;
    transition: transform 0.25s var(--jr-lv-ease), bottom 0.4s var(--jr-lv-ease), opacity 0.3s ease, visibility 0.3s;
}
.jr-lv--right .jr-lv-launcher { right: var(--jr-lv-side) !important; }
.jr-lv--left  .jr-lv-launcher { left:  var(--jr-lv-side) !important; }

/* Gold shimmer sweep */
.jr-lv-launcher::before {
    content: '';
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 215, 0, 0.35), transparent);
    transform: skewX(-20deg);
    animation: jr-lv-shimmer 4s ease-in-out 2s infinite;
    pointer-events: none;
}

.jr-lv-launcher:hover,
.jr-lv-launcher:focus-visible {
    transform: translateY(-3px) scale(1.03) !important;
    background: var(--jr-primary) !important;
    color: var(--jr-yellow) !important;
    outline: none !important;
}
.jr-lv-launcher:focus-visible { box-shadow: 0 0 0 4px rgba(255, 215, 0, 0.45) !important; }
.jr-lv-launcher:active { transform: translateY(0) scale(0.97) !important; }

.jr-lv-launcher-icon { color: var(--jr-lv-red); flex: 0 0 auto; }

/* Hide launcher while the player is open */
.jr-lv.is-open .jr-lv-launcher {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(16px) scale(0.9) !important;
    animation: none;
}

/* Drop to the corner when the radio bar is closed */
body:has(.jr-floating-player.is-hidden) .jr-lv { --jr-lv-bottom: 24px; }

@keyframes jr-lv-enter {
    from { opacity: 0; transform: translateY(30px) scale(0.8); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes jr-lv-glow {
    0%, 100% { box-shadow: 0 8px 28px rgba(26, 26, 46, 0.35), 0 0 0 0 rgba(255, 215, 0, 0.45); }
    50%      { box-shadow: 0 8px 28px rgba(26, 26, 46, 0.35), 0 0 0 10px rgba(255, 215, 0, 0); }
}
@keyframes jr-lv-shimmer {
    0%, 60% { left: -60%; }
    100%    { left: 130%; }
}

/* ══════════════════════════════════════
 *  Backdrop
 * ══════════════════════════════════════ */
.jr-lv-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 100000 !important;
    background: rgba(15, 15, 30, 0.72) !important;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    animation: jr-lv-fade-in 0.35s ease both;
}
.jr-lv.is-leaving .jr-lv-backdrop { animation: jr-lv-fade-out 0.3s ease both; }

@keyframes jr-lv-fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes jr-lv-fade-out { from { opacity: 1; } to { opacity: 0; } }

/* ══════════════════════════════════════
 *  Player window — shared
 * ══════════════════════════════════════ */
.jr-lv-window {
    position: fixed !important;
    z-index: 100001 !important;
    display: flex !important;
    flex-direction: column !important;
    border-radius: 18px !important;
    background: var(--jr-primary) !important;
    color: #fff !important;
    overflow: hidden !important;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5) !important;
    /* Animated gold gradient frame */
    border: 2px solid transparent !important;
    background-image:
        linear-gradient(var(--jr-primary), var(--jr-primary)),
        linear-gradient(120deg, var(--jr-yellow), #B8963E, var(--jr-accent), var(--jr-yellow)) !important;
    background-origin: border-box !important;
    background-clip: padding-box, border-box !important;
    background-size: 100% 100%, 300% 300% !important;
    animation: jr-lv-frame 6s linear infinite;
}

@keyframes jr-lv-frame {
    0%   { background-position: 0 0, 0% 50%; }
    100% { background-position: 0 0, 300% 50%; }
}

/* ── Modal state (centred) ── */
.jr-lv-window.is-modal {
    top: 50% !important;
    left: 50% !important;
    width: min(960px, calc(100vw - 48px)) !important;
    transform: translate(-50%, -50%);
    animation: jr-lv-frame 6s linear infinite, jr-lv-pop-in 0.55s var(--jr-lv-spring) both;
}
.jr-lv.is-leaving .jr-lv-window.is-modal {
    animation: jr-lv-pop-out 0.3s var(--jr-lv-ease) both;
}

@keyframes jr-lv-pop-in {
    from { opacity: 0; transform: translate(-50%, -46%) scale(0.88); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes jr-lv-pop-out {
    from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    to   { opacity: 0; transform: translate(-50%, -46%) scale(0.92); }
}

/* ── Docked state (mini-player) ── */
.jr-lv-window.is-docked {
    bottom: var(--jr-lv-bottom) !important;
    width: min(380px, calc(100vw - 32px)) !important;
    border-radius: 14px !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45) !important;
    animation: jr-lv-frame 6s linear infinite, jr-lv-dock-in 0.5s var(--jr-lv-spring) both;
    transition: bottom 0.4s var(--jr-lv-ease);
}
.jr-lv--right .jr-lv-window.is-docked { right: var(--jr-lv-side) !important; }
.jr-lv--left  .jr-lv-window.is-docked { left:  var(--jr-lv-side) !important; }
.jr-lv.is-leaving .jr-lv-window.is-docked {
    animation: jr-lv-dock-out 0.3s var(--jr-lv-ease) both;
}

@keyframes jr-lv-dock-in {
    from { opacity: 0; transform: translateY(40px) scale(0.85); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes jr-lv-dock-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(40px) scale(0.9); }
}

/* ── Header ── */
.jr-lv-head {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px 12px 12px 18px !important;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.08), transparent 60%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.is-docked .jr-lv-head { padding: 8px 8px 8px 12px !important; gap: 8px !important; }

.jr-lv-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 7px !important;
    flex: 0 0 auto !important;
    padding: 5px 10px !important;
    border-radius: var(--jr-radius-full) !important;
    background: rgba(255, 45, 45, 0.15) !important;
    color: #FF6B6B !important;
    font: 800 11px/1 var(--jr-font) !important;
    letter-spacing: 0.12em !important;
}

.jr-lv-title {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    color: #fff !important;
    font: 700 16px/1.2 var(--jr-font) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}
.is-docked .jr-lv-title { font-size: 13px !important; }

.jr-lv-actions { display: flex !important; gap: 6px !important; flex: 0 0 auto !important; }

.jr-lv-btn,
.jr-lv-btn:visited {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
    cursor: pointer !important;
    text-decoration: none !important;
    box-shadow: none !important;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s var(--jr-lv-spring) !important;
}
.is-docked .jr-lv-btn { width: 30px !important; height: 30px !important; }
.jr-lv-btn:hover,
.jr-lv-btn:focus-visible {
    background: var(--jr-yellow) !important;
    color: var(--jr-primary) !important;
    transform: scale(1.1) !important;
    outline: none !important;
}
.jr-lv-btn--close:hover,
.jr-lv-btn--close:focus-visible {
    background: var(--jr-accent) !important;
    color: #fff !important;
    transform: scale(1.1) rotate(90deg) !important;
}

/* Minimise ↔ expand icon swap */
.jr-lv-ic-max { display: none; }
.is-docked .jr-lv-ic-min { display: none; }
.is-docked .jr-lv-ic-max { display: block; }

/* ── Video stage ── */
.jr-lv-stage {
    position: relative !important;
    width: 100% !important;
    aspect-ratio: 16 / 9;
    background: #0d0d1a !important;
}
.jr-lv-stage iframe {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: 0 !important;
    opacity: 0;
    transition: opacity 0.6s ease;
}
.jr-lv-stage.is-loaded iframe { opacity: 1; }

/* Gold equaliser loader — echoes the station logo */
.jr-lv-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 48px;
    transform: translate(-50%, -50%);
    transition: opacity 0.4s ease;
}
.jr-lv-loader span {
    width: 7px;
    height: 100%;
    border-radius: 4px;
    background: var(--jr-yellow);
    transform-origin: bottom;
    animation: jr-lv-eq 1s ease-in-out infinite;
}
.jr-lv-loader span:nth-child(2) { animation-delay: -0.25s; }
.jr-lv-loader span:nth-child(3) { animation-delay: -0.5s; }
.jr-lv-loader span:nth-child(4) { animation-delay: -0.75s; }
.jr-lv-stage.is-loaded .jr-lv-loader { opacity: 0; }

@keyframes jr-lv-eq {
    0%, 100% { transform: scaleY(0.3); }
    50%      { transform: scaleY(1); }
}

/* ══════════════════════════════════════
 *  Inline trigger — [jr_live_button]
 * ══════════════════════════════════════ */
.jr-lv-inline-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px 22px !important;
    border: 2px solid var(--jr-primary) !important;
    border-radius: var(--jr-radius-full) !important;
    background: var(--jr-yellow) !important;
    color: var(--jr-primary) !important;
    font: 700 14px/1 var(--jr-font) !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    cursor: pointer !important;
    transition: transform 0.25s var(--jr-lv-spring, ease), box-shadow 0.25s ease, background 0.2s ease !important;
}
.jr-lv-inline-btn:hover,
.jr-lv-inline-btn:focus-visible {
    background: var(--jr-primary) !important;
    color: var(--jr-yellow) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(26, 26, 46, 0.25) !important;
    outline: none !important;
}
.jr-lv-inline-btn .jr-lv-dot { --jr-lv-red: #FF2D2D; }

/* ══════════════════════════════════════
 *  Responsive
 * ══════════════════════════════════════ */
@media (max-width: 767px) {
    .jr-lv {
        --jr-lv-side: 12px;
        /* Mobile radio bar: 8px offset + ~64px */
        --jr-lv-bottom: 80px;
    }
    body:has(.jr-floating-player.is-hidden) .jr-lv { --jr-lv-bottom: 12px; }

    .jr-lv-launcher { padding: 10px 16px 10px 12px !important; font-size: 12px !important; }

    .jr-lv-window.is-modal {
        width: calc(100vw - 24px) !important;
        border-radius: 14px !important;
    }
    .jr-lv-head { padding: 10px 10px 10px 14px !important; }
    .jr-lv-title { font-size: 14px !important; }
}

@media (max-width: 480px) {
    /* Icon + dot only on small phones */
    .jr-lv-launcher-text { display: none !important; }
    .jr-lv-launcher { padding: 12px !important; gap: 8px !important; }
    .jr-lv-window.is-docked { width: min(260px, calc(100vw - 24px)) !important; }
    .is-docked .jr-lv-badge { display: none !important; }
}

/* ── Respect reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .jr-lv *,
    .jr-lv *::before,
    .jr-lv *::after,
    .jr-lv-window,
    .jr-lv-launcher {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
