/* 
   Radio Popup
*/

        /* ── Variables de tema (espejo del portal) ───────────── */
        :root {
            --accent:      #ff2a5f;
            --bg:          #ffffff;
            --bg-card:     #ffffff;
            --bg-sec:      #f8fafc;
            --border:      #e2e8f0;
            --text:        #0f172a;
            --text-muted:  #475569;
            --shadow:      0 10px 30px rgba(0,0,0,0.1);
            --btn-bg:      #0f172a;
            --btn-icon:    #ffffff;
            --blur-op:     0.45;
            --bass-scale:  1;
        }

        [data-theme="dark"] {
            --bg:          #0f172a;
            --bg-card:     #1e293b;
            --bg-sec:      #334155;
            --border:      #334155;
            --text:        #f1f5f9;
            --text-muted:  #cbd5e1;
            --shadow:      0 10px 30px rgba(0,0,0,0.5);
            --btn-bg:      #f1f5f9;
            --btn-icon:    #0f172a;
            --blur-op:     0.2;
        }

        /* ── Reset & Base ───────────────────────────────────── */
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

        html, body {
            width: 360px;
            height: 540px; /* Reducido para eliminar el espacio blanco sobrante en la base */
            overflow: hidden;
            font-family: 'Inter', sans-serif;
            background: var(--bg);
            color: var(--text);
            transition: background 0.3s, color 0.3s;
        }

        /* ── Scrollbar Personalizado (igual que el sitio original) ── */
        .pso-list::-webkit-scrollbar {
            width: 6px;
        }
        .pso-list::-webkit-scrollbar-track {
            background: transparent;
        }
        .pso-list::-webkit-scrollbar-thumb {
            background-color: var(--border);
            border-radius: 10px;
        }
        .pso-list::-webkit-scrollbar-thumb:hover {
            background-color: var(--text-muted);
        }

        /* ── Layout root ────────────────────────────────────── */
        #popup-root {
            display: flex;
            flex-direction: column;
            width: 100%;      /* ocupa el 100% sin excederse */
            height: 100%;
            position: relative;
            overflow: hidden;
            background: var(--bg-card);
        }

        /* ══════════════════════════════════════════════════════
           TOP BAR
        ══════════════════════════════════════════════════════ */
        .popup-topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 9px 14px;
            background: var(--bg-card);
            border-bottom: 1px solid var(--border);
            gap: 8px;
            flex-shrink: 0;
            transition: background 0.3s, border-color 0.3s;
            z-index: 20;
        }

        .popup-brand {
            display: flex;
            align-items: center;
            gap: 7px;
            font-size: 0.78rem;
            font-weight: 700;
            color: var(--text-muted);
            text-decoration: none;
        }

        .popup-brand i { color: var(--accent); }

        .popup-topbar-actions {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        /* Botón emisoras */
        .popup-list-btn {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 5px 10px;
            border-radius: 6px;
            border: 1px solid var(--border);
            background: transparent;
            color: var(--text-muted);
            font-size: 0.72rem;
            font-weight: 600;
            cursor: pointer;
            font-family: inherit;
            transition: background 0.2s, color 0.2s;
        }

        .popup-list-btn:hover {
            background: var(--bg-sec);
            color: var(--text);
        }

        /* ══════════════════════════════════════════════════════
           CARD DEL REPRODUCTOR  (copia fiel del player-v5-card)
        ══════════════════════════════════════════════════════ */
        .popup-player-card {
            position: relative;
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            background: var(--bg-card);
            transition: background 0.3s;
        }

        /* Fondo desenfocado — igual que player-bg-blur */
        .popup-bg-blur {
            position: absolute;
            top: 0; left: 0;
            width: 100%; height: 60%;
            z-index: 0;
            overflow: hidden;
        }

        .popup-bg-blur img {
            width: 100%; height: 100%;
            object-fit: cover;
            filter: blur(25px);
            opacity: var(--blur-op);
            transform: scale(1.2);
            transition: all 0.5s ease;
        }

        /* El fade VIVE DENTRO de .popup-bg-blur (igual que el original):
           así el gradiente opera sobre el 60% superior, no el 100% de la tarjeta */
        .popup-bg-fade {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(180deg, transparent 0%, transparent 30%, var(--bg-card) 100%);
            transition: background 0.3s;
        }

        [data-theme="dark"] .popup-bg-blur img { opacity: 0.2; }

        /* Contenido sobre el blur */
        .popup-content {
            position: relative;
            z-index: 1;
            display: flex;
            flex-direction: column;
            height: 100%;
            padding: 20px 20px 14px;
        }

        /* ── Círculo de carátula (igual que art-circle-wrap) ── */
        .popup-art-section {
            display: flex;
            justify-content: center;
            margin-top: 15px;
        }

        .popup-art-circle {
            width: 180px;
            height: 180px;
            border-radius: 50%;
            border: 6px solid var(--bg-card);
            box-shadow: var(--shadow);
            background: var(--bg-card);
            position: relative;
            transition: border-color 0.3s;
        }

        /* Anillo de pulso de bajo */
        .popup-art-circle::before {
            content: '';
            position: absolute;
            inset: 0;
            border-radius: 50%;
            border: 2px solid rgb(var(--dynamic-accent, 255, 42, 95));
            transform: scale(calc(1.11 + ((var(--bass-scale, 1) - 1) * 1.2)));
            opacity: calc((var(--bass-scale, 1) - 1) * 3.5);
            pointer-events: none;
            z-index: -1;
            transition: transform 0.05s linear, opacity 0.05s linear;
        }

        .popup-art-circle img {
            width: 100%; height: 100%;
            border-radius: 50%;
            object-fit: cover;
            position: relative;
            z-index: 2;
            transition: transform 0.3s ease;
        }

        .popup-art-circle img.pulse {
            transform: scale(calc(1 + ((var(--bass-scale, 1) - 1) * 0.4)));
            box-shadow: 0 0 calc(160px * (var(--bass-scale, 1) - 1)) rgba(var(--dynamic-accent, 255, 42, 95), calc(2.6 * (var(--bass-scale, 1) - 1)));
            transition: transform 0.05s linear, box-shadow 0.05s linear;
        }

        /* ── Nombre emisora ──────────────────────────────────── */
        .popup-station-name {
            text-align: center;
            font-size: 1.2rem;
            font-weight: 500;
            color: var(--text);
            margin-top: 32px;
            margin-bottom: 4px;
            transition: color 0.3s;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* ── Marquee de pista (igual que .player-track-info) ── */
        .popup-track-info {
            text-align: center;
            margin-bottom: 18px;
            min-width: 0;
            width: 100%;
        }

        .popup-marquee-outer {
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            white-space: nowrap;
            position: relative;
            width: 100%;
        }

        .popup-marquee-inner {
            display: inline-flex;
            font-size: 1.35rem;
            font-weight: 300;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--text);
            transition: color 0.3s;
            width: max-content;
            position: relative;
            padding-left: 20px;
        }

        .popup-marquee-inner span { padding-right: 50px; }

        .popup-marquee-inner.marquee-anim {
            animation: pmq linear infinite;
        }

        @keyframes pmq {
            0%   { transform: translateX(0); }
            100% { transform: translateX(-50%); }
        }

        /* ── Volumen (igual que player-volume-section) ────────── */
        .popup-vol-section {
            margin-top: 12px; /* Fijo — antes era auto (causaba el gap gigante) */
            margin-bottom: 14px;
        }

        .popup-vol-row {
            display: flex;
            align-items: center;
            gap: 12px;
            color: var(--text);
        }

        .popup-vol-row > i { font-size: 1rem; cursor: pointer; color: var(--text); transition: color 0.3s; }

        .popup-vol-right {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.82rem;
            color: var(--text);
            font-weight: 500;
        }

        .popup-vol-right i { font-size: 1.1rem; }

        /* Slider */
        .popup-range-wrap {
            position: relative;
            flex-grow: 1;
            height: 4px;
            background: var(--border);
            border-radius: 2px;
        }

        .popup-range-wrap input[type="range"] {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            opacity: 0;
            cursor: pointer;
            z-index: 2;
        }

        .popup-range-fill {
            position: absolute;
            top: 0; left: 0;
            height: 100%;
            background: var(--accent);
            border-radius: 2px;
            pointer-events: none;
            z-index: 1;
            width: 100%;
        }

        .popup-range-fill::after {
            content: '';
            position: absolute;
            right: -6px; top: 50%;
            transform: translateY(-50%);
            width: 14px; height: 14px;
            background: var(--text-muted);
            border-radius: 50%;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }

        /* ── Controles inferiores (igual que player-bottom-controls) */
        .popup-bottom {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding-bottom: 10px;
        }

        /* Mini visualizador */
        .popup-viz {
            display: flex;
            align-items: flex-end;
            gap: 4px;
            height: 26px;
            width: 45px;
        }

        .popup-viz .bar {
            width: 5px;
            background: var(--text);
            border-radius: 2px;
            height: 10%;
            transition: height 0.05s ease, background 0.3s;
        }

        /* Botón Play (igual que btn-play-solid) */
        .popup-play-btn {
            width: 68px; height: 68px;
            border-radius: 50%;
            background: var(--btn-bg);
            color: var(--btn-icon);
            border: none;
            font-size: 1.7rem;
            display: flex;
            justify-content: center;
            align-items: center;
            box-shadow: var(--shadow);
            cursor: pointer;
            transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s, color 0.3s;
        }

        .popup-play-btn:hover { transform: scale(1.08); }

        /* ── Nuevos controles de navegación ─────────────────── */
        .popup-controls-group {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .popup-nav-btn {
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 1.2rem;
            cursor: pointer;
            transition: color 0.2s, transform 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .popup-nav-btn:hover {
            color: var(--accent);
            transform: scale(1.1);
        }
        
        .popup-nav-btn:active {
            transform: scale(0.9);
        }

        .popup-play-btn .fa-play { padding-left: 4px; }

        /* LIVE badge */
        .popup-live {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-muted);
            font-size: 0.62rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 1px;
            width: 45px;
        }

        .popup-live i { font-size: 1.2rem; margin-bottom: 2px; }
        .popup-live.on { color: var(--accent); }
        .popup-live.on i { animation: flash 2s infinite; }

        @keyframes flash {
            0%, 100% { opacity: 1; }
            50%       { opacity: 0.3; }
        }

        /* ══════════════════════════════════════════════════════
           OVERLAY: LISTA DE EMISORAS
        ══════════════════════════════════════════════════════ */
        .popup-stations-overlay {
            display: none;
            flex-direction: column;
            position: absolute;
            inset: 0;
            background: var(--bg-card);
            z-index: 50;
            transition: background 0.3s;
        }

        .popup-stations-overlay.open { display: flex; }

        .pso-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 16px;
            border-bottom: 1px solid var(--border);
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-muted);
            flex-shrink: 0;
        }

        .pso-header button {
            background: none; border: none;
            color: var(--text-muted); font-size: 1.1rem;
            cursor: pointer; transition: color 0.2s;
        }

        .pso-header button:hover { color: var(--text); }

        .pso-list {
            overflow-y: auto;
            flex: 1;
            padding: 6px 0;
        }

        .pso-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 16px;
            cursor: pointer;
            transition: background 0.2s;
        }

        .pso-item:hover { background: var(--bg-sec); }

        .pso-item.active { background: rgba(255, 42, 95, 0.1); }
        .pso-item.active .pso-name { color: var(--accent); }

        .pso-logo {
            width: 44px; height: 44px;
            border-radius: 50%; overflow: hidden;
            flex-shrink: 0;
            background: var(--bg-sec);
        }

        .pso-logo img { width: 100%; height: 100%; object-fit: cover; }

        .pso-info { flex: 1; overflow: hidden; }

        .pso-name {
            font-size: 0.88rem; font-weight: 600;
            color: var(--text);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }

        .pso-freq {
            font-size: 0.72rem;
            color: var(--text-muted);
        }
