/* 
   Radio
*/

	:focus {
    	outline: none;    	
        -webkit-tap-highlight-color: transparent; /* Quita el resaltado de tap en Android/iOS */
	}

    /* Ocultar inicialmente para evitar FOUC */
    .player-v5-card,
    .stations-list-wrap,
    .popup-launch-banner {
        visibility: hidden;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .player-v5-card.loaded,
    .stations-list-wrap.loaded,
    .popup-launch-banner.loaded {
        visibility: visible;
        opacity: 1;
    }

    :root {
        --player-accent: #ff2a5f;
        --player-text-base: var(--text-primary);
        --player-text-muted: var(--text-secondary);
        --player-bg-card: var(--bg-card);
        --player-bg-main: var(--bg-primary);
        --player-item-hover: var(--bg-tertiary);
        --player-border: var(--border-color);
        --player-btn-bg: var(--text-primary);
        --player-btn-icon: var(--bg-primary);
        --bass-scale: 1;
    }

    /* =========================================
       BASE WRAPPER — sin overflow oculto en X
    ========================================= */
    .radio-page-wrapper {
        position: relative;
        background: var(--player-bg-main);
        /* FIX: overflow-x hidden aquí provoca que elementos internos
           con position:absolute salgan del stacking context y el
           navegador móvil igual calcule un ancho mayor. Se controla
           desde la raíz del body/html en lugar de aquí. */
        color: var(--player-text-base);
        padding-bottom: 0;
        transition: background 0.3s, color 0.3s;
        /* FIX: usar width:100% en lugar de max-width:100% para evitar
           que el cálculo de ancho tome referencias incorrectas en móvil */
        width: 100%;
        box-sizing: border-box;
    }

    /* Background Animations */
    .mesh-background {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 0;
        overflow: hidden;
        /* El overflow:hidden va aquí, en el contenedor del fondo,
           no en el wrapper principal — así no afecta el layout */
    }

    .mesh-ball {
        position: absolute;
        filter: blur(120px);
        border-radius: 50%;
        opacity: 0.15;
    }

    .ball-1 {
        width: 500px;
        height: 500px;
        background: var(--primary);
        top: -100px;
        right: -50px;
        animation: float 15s infinite alternate;
    }

    .ball-2 {
        width: 400px;
        height: 400px;
        background: var(--info);
        bottom: -50px;
        left: -50px;
        animation: float 12s infinite alternate-reverse;
    }

    @keyframes float {
        from { transform: translate(0, 0); }
        to   { transform: translate(60px, 40px); }
    }

    .radio-hero {
        position: relative;
        z-index: 10;
        padding: 2rem 0;
    }

    /* FIX: el container de Bootstrap o tu layout base ya tiene
       padding lateral; el radio-layout NO debe agregar su propio
       padding/margin horizontal que compita con él */
    .radio-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
        align-items: stretch;
        max-width: 1050px;
        margin: 0 auto;
        min-height: 600px;
        /* FIX: box-sizing garantiza que max-width incluya padding */
        box-sizing: border-box;
    }

    /* =========================================
       V5.1 THEMED CARD CSS
    ========================================= */
    .player-container-main {
        display: flex;
        justify-content: center;
        width: 100%;
        /* FIX: min-width:0 evita que el item de grid se expanda
           más allá de su columna asignada */
        min-width: 0;
        height: 100%;
        box-sizing: border-box;
    }

    .player-v5-card {
        position: relative;
        width: 100%;
        max-width: 500px;
        height: 100%;
        min-height: 650px;
        border-radius: 20px;
        overflow: hidden;
        background-color: var(--player-bg-card);
        box-shadow: var(--shadow-lg);
        display: flex;
        flex-direction: column;
        transition: background 0.3s, box-shadow 0.3s;
        margin: 0 auto;
        box-sizing: border-box;
    }

    /* Background Blur Layer */
    .player-bg-blur {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 60%;
        z-index: 0;
        overflow: hidden;
    }

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

    .bg-fade-to-white {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: linear-gradient(180deg, transparent 0%, transparent 30%, var(--player-bg-card) 100%);
    }

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

    .player-content-zindex {
        position: relative;
        z-index: 1;
        display: flex;
        flex-direction: column;
        height: 100%;
        padding: 30px;
        box-sizing: border-box;
    }

    /* Top Art Section */
    .player-top-art {
        display: flex;
        justify-content: center;
        margin-top: 30px;
    }
    /* Ajuste tamaño para PC */
    .art-circle-wrap {
        width: 260px;
        height: 260px;
        border-radius: 50%;
        border: 6px solid var(--player-bg-card);
        box-shadow: 0 10px 30px var(--shadow-sm);
        background: var(--player-bg-card);
        position: relative;
        flex-shrink: 0;
    }

    .art-circle-wrap::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 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;
    }

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

    .art-circle-wrap 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;
    }

    /* Station Name */
    /* FIX: margen reducido; el valor original de 70px en pantallas
       medianas causaba que el card creciera más allá del viewport */
    .station-name-fixed {
        text-align: center;
        font-size: 1.4rem;
        font-weight: 500;
        color: var(--player-text-base);
        margin-top: 60px;
        margin-bottom: 5px;
        transition: color 0.3s;
    }

    /* Track Info Section with Marquee */
    .player-track-info {
        text-align: center;
        margin-bottom: 25px;
        min-width: 0;
        width: 100%;
    }

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

    .marquee-content {
        display: inline-flex;
        font-size: 1.6rem;
        font-weight: 300;
        font-family: inherit;
        text-transform: uppercase;
        letter-spacing: 1px;
        color: var(--player-text-base);
        transition: color 0.3s;
        width: max-content;
        position: relative;
        /* padding-left: 20px; */
    }

    .marquee-content span {
        padding-right: 10px;
    }

    .marquee-anim {
        animation: marquee 10s linear infinite;
    }

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

    /* Volume Bar */
    .player-volume-section {
        margin-top: auto;
        margin-bottom: 25px;
    }

    .volume-controls {
        display: flex;
        align-items: center;
        gap: 15px;
    }

    .volume-controls > i {
        color: var(--player-text-base);
        font-size: 1.1rem;
        cursor: pointer;
        transition: color 0.3s;
    }

    .volume-right-wrap {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 0.85rem;
        color: var(--player-text-base);
        font-weight: 500;
    }

    .volume-right-wrap i {
        font-size: 1.2rem;
    }

    .custom-range-slider {
        position: relative;
        flex-grow: 1;
        height: 4px;
        background: var(--player-border);
        border-radius: 2px;
    }

    .custom-range-slider input[type="range"] {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        cursor: pointer;
        z-index: 2;
    }

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

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

    /* Bottom Controls */
    .player-bottom-controls {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 15px;
    }

    /* Synced Mini visualizer */
    .mini-visualizer {
        display: flex;
        align-items: flex-end;
        gap: 4px;
        height: 26px;
        width: 45px;
    }

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

    /* Center Play Button */
    .play-btn-circle {
        display: flex;
        justify-content: center;
    }

    .btn-play-solid {
        width: 80px;
        height: 80px;
        border-radius: 50%;
        background: var(--player-btn-bg);
        color: var(--player-btn-icon);
        border: none;
        font-size: 1.8rem;
        display: flex;
        justify-content: center;
        align-items: center;
        box-shadow: var(--shadow-md);
        transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s, color 0.3s;
        cursor: pointer;
    }

    .btn-play-solid:hover {
        transform: scale(1.1);
    }

    /* ── Nuevos controles de navegación ─────────────────── */
    .play-btn-circle-group {
        display: flex;
        align-items: center;
        gap: 25px;
    }

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

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

    @media (max-width: 480px) {
        .play-btn-circle-group { gap: 15px; }
        .nav-btn { font-size: 1.2rem; }
    }

    .btn-play-solid .fa-play {
        padding-left: 5px;
    }

    /* Live Badge */
    .live-badge-wrap {
        width: 45px;
        display: flex;
        justify-content: flex-end;
    }

    .live-icon {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: var(--player-text-muted);
        font-size: 0.65rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .live-icon i {
        font-size: 1.3rem;
        margin-bottom: 2px;
    }

    .live-icon.live-active {
        color: var(--player-accent);
    }

    .live-icon.live-active i {
        animation: flash 2s infinite;
    }

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

    /* =========================================
       List Section
    ========================================= */
    .stations-list-wrap {
        background: var(--player-bg-card);
        padding: 2.5rem;
        border-radius: 20px;
        border: 1px solid var(--player-border);
        box-shadow: var(--shadow-sm);
        height: 100%;
        max-height: 600px;
        max-width: 500px;
        margin: 0 auto;
        min-height: 680px;
        width: 100%;
        /* FIX: min-width:0 evita que el item de grid se expanda
           más allá de su columna asignada */
        min-width: 0;
        display: flex;
        flex-direction: column;
        transition: background 0.3s, border-color 0.3s;
        box-sizing: border-box;
    }

    .stations-list-wrap .section-title {
        margin-bottom: 1.5rem;
        font-size: 1.3rem;
        display: flex;
        align-items: center;
        gap: 12px;
        color: var(--player-text-base);
        font-weight: 700;
        flex-shrink: 0;
    }

    .stations-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
        flex-grow: 1;
        overflow-y: auto;
        padding-right: 15px;
        margin-right: -15px;
    }

    .stations-grid::-webkit-scrollbar       { width: 6px; }
    .stations-grid::-webkit-scrollbar-track { background: transparent; }
    .stations-grid::-webkit-scrollbar-thumb { background-color: var(--player-border); border-radius: 10px; }
    .stations-grid::-webkit-scrollbar-thumb:hover { background-color: var(--player-text-muted); }

    .station-item {
        background: transparent;
        border-radius: 12px;
        padding: 12px;
        display: flex;
        align-items: center;
        gap: 15px;
        cursor: pointer;
        transition: 0.2s;
        border: 1px solid var(--player-border);
    }

    .station-item:hover {
        background: var(--player-item-hover);
        transform: translateX(5px);
    }

    .station-item.active {
        border-color: rgba(255, 42, 95, 0.4);
        background: rgba(255, 42, 95, 0.05);
    }

    .station-item.active .st-indicator {
        color: var(--player-accent);
        opacity: 1;
        transform: scale(1);
    }

    .st-logo {
        width: 60px;
        height: 60px;
        border-radius: 10px;
        background: white;
        overflow: hidden;
        flex-shrink: 0;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

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

    .st-info {
        flex: 1;
        /* FIX: min-width:0 evita que el texto largo desborde el flex container */
        min-width: 0;
        color: var(--player-text-base);
    }

    .st-info h4 {
        font-size: 1rem;
        margin-bottom: 2px;
        font-weight: 600;
        /* FIX: truncar nombres largos de emisoras */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .st-info span {
        font-size: 0.8rem;
        color: var(--player-text-muted);
    }

    .st-indicator {
        opacity: 0;
        transform: scale(0.5);
        transition: 0.3s;
        font-size: 1.8rem;
        flex-shrink: 0;
    }

    /* =============================================
       BANNER: Abrir en ventana popup
    ============================================= */
    .popup-launch-banner {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 1.5rem;
        background: var(--bg-card);
        padding: 1.5rem 2.5rem;
        border-radius: 20px;
        border: 1px solid var(--player-border);
        box-shadow: var(--shadow-sm);
        margin: 0 auto 2rem;
        max-width: 900px;
        width: 100%;
        box-sizing: border-box;
        transition: transform 0.3s ease, background 0.3s;
    }

    .popup-launch-banner:hover {
        background: var(--bg-secondary);
    }

    .plb-info {
        display: flex;
        align-items: center;
        gap: 12px;
        color: var(--text-primary);
        font-size: 1rem;
        font-weight: 500;
        flex: 1;
        min-width: 0;
    }

    .plb-info i {
        color: var(--player-accent);
        font-size: 1.35rem;
        flex-shrink: 0;
    }

    .plb-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px 24px;
        border-radius: 12px;
        background: var(--primary);
        color: white !important;
        border: none;
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        font-family: inherit;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .plb-btn:hover {
        background: var(--primary-dark);
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    }

    .plb-btn:active {
        transform: translateY(0);
    }

    /* =============================================
       RESPONSIVE — FIX PRINCIPAL
       IMPORTANTE: todos los breakpoints van al mismo
       nivel, SIN anidar. Los media queries anidados
       dentro de otros media queries son ignorados
       por la mayoría de navegadores móviles.
    ============================================= */

    /* Tablet / móvil grande */
    @media (max-width: 992px) {
        .radio-layout {
            grid-template-columns: 1fr;
            margin-top: 1rem;
            margin-bottom: 0;
            height: auto;
            gap: 1.5rem;
            /* FIX: sin padding horizontal aquí; el container padre
               ya tiene el padding lateral correcto */
            padding: 0;
        }

        .player-container-main {
            width: 100%;
        }

        .player-v5-card {
            margin: 0 auto;
            min-height: 650px;
            height: auto;
            /* FIX: max-width controlado para no salir del viewport */
            width: 100%;
            max-width: 100%;
        }

        .player-content-zindex {
            padding: 20px;
        }
        /* Ajuste tamaño Móvil */
        .art-circle-wrap {
            width: 260px;
            height: 260px;
        }

        .station-name-fixed {
            margin-top: 60px;
        }

        .stations-list-wrap {
            min-height: 350px;
            max-height: 450px;
            width: 100%;
            max-width: 100%;
            margin: 0 auto;
            padding: 1.25rem;
        }

        .popup-launch-banner {
            flex-direction: column;
            text-align: center;
            padding: 1.25rem;
            max-width: 100%;
        }

        .plb-info {
            flex-direction: column;
            gap: 8px;
        }

        .plb-btn {
            width: 100%;
        }
    }

    /* Móvil pequeño — FIX: media query al nivel raíz, NO anidado */
    @media (max-width: 480px) {
        .player-v5-card {
            min-height: 400px;
            border-radius: 16px;
        }

        .player-content-zindex {
            padding: 15px;
        }
        /* Ajuste tamaño movil */
        .art-circle-wrap {
            width: 200px;
            height: 200px;
        }

        .station-name-fixed {
            font-size: 1rem;
            margin-top: 40px;
        }

        .marquee-content {
            font-size: 1.2rem;
        }

        .btn-play-solid {
            width: 54px;
            height: 54px;
            font-size: 1.3rem;
        }

        .player-bottom-controls {
            padding-bottom: 8px;
        }

        .player-track-info {
            margin-bottom: 15px;
        }

        .volume-controls {
            gap: 8px;
        }

        .volume-right-wrap {
            font-size: 0.75rem;
            gap: 6px;
        }

        .st-logo {
            width: 38px;
            height: 38px;
        }

        .st-info h4 {
            font-size: 0.875rem;
        }

        .st-info span {
            font-size: 0.7rem;
        }

        .stations-list-wrap {
            padding: 1rem;
            border-radius: 16px;
        }
    }

    /* Móvil muy pequeño */
    @media (max-width: 360px) {
        .player-content-zindex {
            padding: 12px;
        }

        .art-circle-wrap {
            width: 100px;
            height: 100px;
        }

        .btn-play-solid {
            width: 46px;
            height: 46px;
            font-size: 1.1rem;
        }

        .volume-right-wrap .vol-percentage,
        .volume-right-wrap #volumeIconMax {
            display: none;
        }
    }