@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

:root {
    --bg-black: #000000;
    --bg-dark: #121212;
    --bg-card: #181818;
    --primary: #ff0055; /* Neon Pink */
    --text-white: #ffffff;
    --text-gray: #b3b3b3;
    --nav-width: 240px;
    --player-height: 85px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0; background: var(--bg-black); color: var(--text-white);
    font-family: 'Inter', sans-serif; height: 100vh; overflow: hidden;
}

/* --- SCROLLBAR NEON --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { 
    background: var(--primary); 
    border-radius: 4px; 
}
::-webkit-scrollbar-thumb:hover { background: #ff3377; }

/* LAYOUT GENERAL */
.app-container {
    display: grid;
    grid-template-areas: "sidebar main" "player player";
    grid-template-columns: var(--nav-width) 1fr;
    grid-template-rows: 1fr var(--player-height);
    height: 100vh;
}

/* SIDEBAR */
.sidebar {
    grid-area: sidebar; background: #050505;
    display: flex; flex-direction: column; padding: 20px;
    border-right: 1px solid #222;
}
.logo-area {
    display: flex; align-items: center; gap: 10px; margin-bottom: 30px;
    font-size: 1.3rem; font-weight: 800; color: white; cursor: pointer;
}
.logo-area img { width: 32px; height: 32px; }

.desktop-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-btn {
    background: none; border: none; color: var(--text-gray);
    display: flex; align-items: center; gap: 15px; padding: 12px;
    font-size: 0.95rem; font-weight: 600; cursor: pointer; border-radius: 6px; transition: 0.2s;
}
.nav-btn:hover, .nav-btn.active { color: white; background: #222; }
.nav-btn i { font-size: 1.3rem; }
.sidebar-footer { margin-top: auto; color: #444; font-size: 0.7rem; }

/* MAIN CONTENT */
.main-content {
    grid-area: main; 
    background: linear-gradient(180deg, #18050a 0%, #000000 40%);
    overflow-y: auto; padding: 0 30px 30px 30px; position: relative;
}

/* HEADER */
.top-header {
    position: sticky; top: 0; z-index: 50;
    padding: 20px 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(15px);
    display: flex; align-items: center; gap: 20px;
}
.mobile-logo-area { display: none; } 

.search-container { position: relative; flex: 1; max-width: 400px; }
.search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #777; font-size: 1.1rem; }
#integrated-search {
    width: 100%; background: #1f1f1f; border: 1px solid transparent; border-radius: 50px;
    padding: 12px 12px 12px 45px; color: white; outline: none; font-family: inherit;
    transition: 0.3s;
}
#integrated-search:focus { background: #333; border-color: var(--primary); }

/* CHIPS */
.filters-row {
    display: flex; gap: 10px; overflow-x: auto; padding-bottom: 5px; margin-bottom: 20px;
    scrollbar-width: none;
}
.filters-row::-webkit-scrollbar { display: none; }

.chip {
    flex: 0 0 auto; background: #1f1f1f; border: 1px solid transparent;
    color: white; padding: 8px 18px; border-radius: 20px;
    font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: 0.2s;
    display: flex; align-items: center; gap: 8px;
}
.chip:hover { background: #333; }
.chip.active { background: white; color: black; transform: scale(1.05); font-weight: 800; }
.flag-icon { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; }

/* GRID DE RADIOS */
.stations-grid {
    display: grid; 
    /* Desktop: columnas automáticas */
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 20px; padding-bottom: 20px;
}
.station-card {
    background: #121212; padding: 15px; border-radius: 8px;
    cursor: pointer; transition: 0.3s;
    position: relative; /* Necesario para efectos */
}
.station-card:hover { background: #222; }
.station-card.active { border: 1px solid var(--primary); background: #1a050a; }

.card-img-container {
    width: 100%; 
    aspect-ratio: 1/1; /* Mantiene la imagen cuadrada siempre */
    border-radius: 6px; overflow: hidden;
    margin-bottom: 12px; position: relative; background: #000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
.card-img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; }
.station-card:hover .card-img { transform: scale(1.05); }

/* ANIMACIÓN ECUALIZADOR (ARREGLADA) */
.playing-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center; gap: 4px; /* Gap ajustado */
    opacity: 0; transition: 0.2s;
}
.station-card.active .playing-overlay { opacity: 1; }

.equalizer-bar { 
    width: 5px; /* Barras más visibles */
    background: var(--primary); 
    border-radius: 2px;
    animation: bounce 1s infinite ease-in-out; 
}
/* Retardos para efecto de ola */
.equalizer-bar:nth-child(1) { animation-delay: 0.0s; height: 30%; }
.equalizer-bar:nth-child(2) { animation-delay: 0.2s; height: 50%; }
.equalizer-bar:nth-child(3) { animation-delay: 0.4s; height: 30%; }

@keyframes bounce { 
    0%, 100% { height: 30%; transform: scaleY(1); } 
    50% { height: 70%; transform: scaleY(1.2); } 
}

.card-title { font-weight: 700; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.95rem; }
.card-sub { font-size: 0.8rem; color: var(--text-gray); }

/* --- PLAYER BAR --- */
.player-bar {
    grid-area: player; background: black; border-top: 1px solid #222;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; z-index: 500; position: relative;
}
.mp-progress-bar { position: absolute; top: 0; left: 0; right: 0; height: 2px; background: #222; }
.mp-progress-fill { height: 100%; width: 0%; background: var(--primary); box-shadow: 0 0 10px var(--primary); transition: width 0.1s linear; }

.pb-left { display: flex; align-items: center; gap: 15px; width: 30%; height: 100%; cursor: pointer; }
.pb-thumb { width: 56px; height: 56px; border-radius: 4px; object-fit: cover; }
.pb-info { display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.pb-title { font-size: 0.95rem; font-weight: 700; color: white; margin-bottom: 2px; }
.pb-artist { font-size: 0.75rem; color: var(--text-gray); }

/* Controles Centrales */
.pb-center { display: flex; align-items: center; gap: 20px; width: 40%; justify-content: center; }

/* Botones Barra Desktop */
.ctrl-btn-md, .ctrl-btn-lg, .mobile-play-btn {
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer; transition: 0.2s;
    padding: 0; margin: 0;
}
.ctrl-btn-md { color: #ccc; font-size: 2rem; }
.ctrl-btn-md:hover { color: white; transform: scale(1.1); }

/* Botón Play Grande Desktop */
.ctrl-btn-lg {
    width: 42px; height: 42px; border-radius: 50%; 
    background: white; color: black; font-size: 1.4rem;
    box-shadow: 0 0 10px rgba(255,255,255,0.2);
}
.ctrl-btn-lg:hover { transform: scale(1.05); background: var(--primary); color: white; }

.pb-right { width: 30%; display: flex; justify-content: flex-end; align-items: center; }
.volume-control-pc { display: flex; align-items: center; gap: 10px; color: #888; }
.volume-control-pc i { font-size: 1.2rem; }
#volume-slider { width: 100px; accent-color: var(--primary); height: 4px; cursor: pointer; }
.mobile-play-btn { display: none; }

/* --- FULL PLAYER OVERLAY --- */
.full-player-overlay {
    position: fixed; inset: 0; background: #000; z-index: 10000;
    display: none; flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.2, 0, 0, 1);
}
.full-player-overlay.open { display: flex; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.fp-background { position: absolute; inset: 0; opacity: 0.4; filter: blur(60px); background-size: cover; background-position: center; }
.fp-content { position: relative; padding: 30px; height: 100%; display: flex; flex-direction: column; justify-content: space-between; }
.fp-header { display: flex; justify-content: space-between; align-items: center; color: white; }
.fp-header span { font-size: 0.8rem; letter-spacing: 2px; font-weight: 700; color: #aaa; }

.fp-art-area { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px; }
.fp-art-area img { 
    width: 100%; max-width: 350px; aspect-ratio: 1/1; 
    border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.6); 
    object-fit: cover;
}

.fp-info-area { text-align: left; margin-bottom: 20px; }
.fp-info-area h2 { font-size: 1.8rem; margin: 0 0 5px 0; font-weight: 800; }
.fp-info-area p { color: #ccc; margin: 0; font-size: 1.1rem; }

.icon-btn { background: none; border: none; color: white; font-size: 1.8rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* CONTROLES FULL PLAYER (CON !IMPORTANT PARA ASEGURAR VISIBILIDAD) */
.fp-controls {
    display: flex; justify-content: space-evenly; align-items: center; margin-bottom: 40px; width: 100%; padding: 0 10px;
}
.fp-btn-sm { 
    color: #888 !important; font-size: 1.5rem; background: none; border: none; cursor: pointer; 
}
.fp-btn-md { 
    color: white !important; font-size: 3rem; background: none; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.fp-btn-md:active { transform: scale(0.9); }

.fp-btn-lg {
    width: 75px; height: 75px; background: white !important; color: black !important; border-radius: 50%;
    font-size: 2.5rem; display: flex; align-items: center; justify-content: center; border: none; cursor: pointer;
    box-shadow: 0 0 20px rgba(255,255,255,0.2);
}
.fp-btn-lg:active { transform: scale(0.95); background: #eee !important; }

/* MOBILE NAV & RESPONSIVE */
.mobile-nav { display: none; }
.sub-heading { color: white; margin-top: 20px; font-size: 1.1rem; font-weight: 700; }

.horizontal-scroll-container {
    display: flex; gap: 15px; overflow-x: auto; padding-bottom: 15px; scrollbar-width: none;
}
.horizontal-scroll-container .station-card { min-width: 140px; width: 140px; }

/* --- VERSIÓN MÓVIL OPTIMIZADA --- */
@media (max-width: 900px) {
    .app-container { display: block; height: 100%; }
    .sidebar, .pb-center, .volume-control-pc { display: none !important; }

    .main-content {
        height: 100vh; padding: 0 15px 160px 15px; background: #000; border-radius: 0;
    }

    .top-header { padding: 15px 0; gap: 15px; background: rgba(0,0,0,0.9); }
    .mobile-logo-area { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.2rem; }
    .mobile-logo-area img { width: 28px; height: 28px; }
    
    /* REJILLA MÓVIL CORREGIDA */
    .stations-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 Columnas Estrictas */
        gap: 12px; /* Espacio limpio */
    }
    .station-card { 
        padding: 0; background: transparent; 
        min-width: 0; /* Evita desbordamientos */
    }
    
    /* PLAYER FLOTANTE MÓVIL */
    .player-bar {
        position: fixed !important;
        bottom: calc(65px + 15px + env(safe-area-inset-bottom)) !important;
        left: 10px !important; right: 10px !important;
        height: 60px !important; width: auto !important;
        background: #181818 !important; border-radius: 8px;
        border: none; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
        z-index: 9999; padding: 0 10px;
    }
    .pb-left { width: 100%; gap: 10px; }
    .pb-thumb { width: 42px; height: 42px; }
    .pb-title { font-size: 0.9rem; margin-bottom: 0; }
    .pb-right { width: auto; }
    .mobile-play-btn { display: flex !important; font-size: 2rem; color: white !important; padding: 0; margin-right: 5px; }
    
    .mobile-nav {
        display: flex; position: fixed; bottom: 0; left: 0; right: 0;
        height: calc(65px + env(safe-area-inset-bottom));
        background: rgba(0,0,0,0.95); backdrop-filter: blur(20px);
        justify-content: space-around; align-items: flex-start;
        padding-top: 10px; z-index: 9000; border-top: 1px solid #222;
    }
    .mn-item {
        background: none; border: none; color: #777;
        display: flex; flex-direction: column; align-items: center; gap: 4px;
        font-size: 0.7rem; width: 100%; cursor: pointer;
    }
    .mn-item.active { color: white; }
    .mn-item i { font-size: 1.5rem; }
    
    button i, button svg { pointer-events: none; }
}

/* --- ESTILOS DEL FULL PLAYER (OVERLAY) --- */

/* Estructura Principal */
.fp-content {
    display: flex; flex-direction: column; height: 100%;
    padding: 20px 20px 40px 20px;
    justify-content: space-between; /* Distribuye espacio verticalmente */
}

/* Imagen y Textos */
.fp-art-area { flex: 1; display: flex; align-items: center; justify-content: center; margin: 20px 0; }
.fp-art-area img { 
    width: 100%; max-width: 320px; aspect-ratio: 1/1; 
    border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); object-fit: cover;
}
.fp-info-area { text-align: left; margin-bottom: 20px; }
.fp-info-area h2 { font-size: 1.6rem; color: white; margin: 0; }
.fp-info-area p { font-size: 1rem; color: #bbb; margin: 5px 0 0 0; }

/* Barra de Progreso */
.fp-progress-container {
    display: flex; align-items: center; gap: 10px; margin-bottom: 20px;
}
.time-current, .time-total { font-size: 0.75rem; color: #ddd; width: 40px; }
.progress-bar-bg {
    flex: 1; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden;
}
.progress-bar-fill {
    height: 100%; width: 0%; background: var(--primary); /* Neon Pink */
    transition: width 0.1s linear;
}

/* CONTROLES (Fila Central) */
.fp-controls-row {
    display: flex; align-items: center; justify-content: center; gap: 40px; margin-bottom: 30px;
}

/* Botones Laterales (Prev/Next) */
.fp-btn-side {
    background: none; border: none; color: white;
    width: 50px; height: 50px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.fp-btn-side svg { width: 40px; height: 40px; fill: white; }
.fp-btn-side:active { transform: scale(0.9); opacity: 0.7; }

/* Botón Play Central */
.fp-btn-main {
    width: 80px; height: 80px; background: white; border-radius: 50%;
    color: black; border: none; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 20px rgba(255,255,255,0.2); cursor: pointer;
}
.fp-btn-main svg { width: 40px; height: 40px; fill: black; }
.fp-btn-main:active { transform: scale(0.95); background: #ddd; }

/* Barra de Volumen */
.fp-volume-container {
    display: flex; align-items: center; gap: 15px; color: #888; margin-top: auto;
}
#fp-volume-slider {
    flex: 1; height: 4px; accent-color: var(--primary); cursor: pointer;
}