/* ===== RESET Y ESTILOS BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(145deg, #0a0912 0%, #15131f 100%);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: #fff;
    padding: 16px 20px;
}

/* ===== HEADER ===== */
.header {
    text-align: center;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.header h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 600;
    background: linear-gradient(135deg, #ffffff 0%, #c2b8ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.header p {
    color: #7f7aa3;
    font-size: clamp(0.8rem, 2vw, 1rem);
    letter-spacing: 1.2px;
}

/* ===== GRID DE RADIOS (4x4 en escritorio) ===== */
.radio-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 12px;
    min-height: 0;
    width: 100%;
}

/* ===== TARJETA DE RADIO ===== */
.radio-card {
    background: rgba(28, 25, 45, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 24px;
    padding: 12px 6px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 20px -8px rgba(0, 0, 0, 0.7);
    min-height: 0;
}

.radio-card:hover {
    transform: translateY(-4px);
    background: rgba(40, 35, 65, 0.9);
    border-color: rgba(180, 160, 255, 0.3);
    box-shadow: 0 16px 24px -10px rgba(120, 100, 255, 0.3);
}

.radio-card.playing {
    background: rgba(55, 45, 95, 0.95);
    border: 2px solid #9b87ff;
    box-shadow: 0 0 25px rgba(155, 135, 255, 0.5);
}

.radio-card.loading {
    border: 2px solid #ffdb7c;
    box-shadow: 0 0 25px rgba(255, 219, 124, 0.3);
}

/* ===== ICONO DE LA RADIO ===== */
.radio-icon {
    font-size: clamp(2rem, 4vh, 3rem);
    margin-bottom: 4px;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.6));
}

.loading .radio-icon {
    animation: spin 0.9s infinite linear;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== NOMBRE DE LA RADIO ===== */
.radio-name {
    font-size: clamp(0.7rem, 2vh, 1rem);
    font-weight: 500;
    text-align: center;
    color: #f0ebff;
    line-height: 1.2;
    max-width: 140px;
    margin-bottom: 4px;
    word-break: break-word;
}

/* ===== ONDAS VISUALES ===== */
.wave-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: clamp(16px, 3vh, 24px);
}

.wave-bar {
    width: 4px;
    height: 10px;
    background: linear-gradient(to top, #a594ff, #ddd0ff);
    border-radius: 10px;
}

.wave-animation .wave-bar {
    animation: wave 1.2s infinite ease-in-out;
}

.wave-animation .wave-bar:nth-child(1) { animation-delay: 0.0s; height: 60%; }
.wave-animation .wave-bar:nth-child(2) { animation-delay: 0.2s; height: 80%; }
.wave-animation .wave-bar:nth-child(3) { animation-delay: 0.4s; height: 100%; }
.wave-animation .wave-bar:nth-child(4) { animation-delay: 0.3s; height: 70%; }
.wave-animation .wave-bar:nth-child(5) { animation-delay: 0.1s; height: 90%; }
.wave-animation .wave-bar:nth-child(6) { animation-delay: 0.5s; height: 60%; }
.wave-animation .wave-bar:nth-child(7) { animation-delay: 0.15s; height: 70%; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.8); opacity: 0.7; }
    50% { transform: scaleY(1.4); opacity: 1; }
}

/* ===== INDICADOR DE REPRODUCCIÓN (PUNTO VERDE NEÓN) ===== */
.playing-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #00ff00;
    box-shadow: 0 0 20px #00ff00, 0 0 40px #00ff00, 0 0 60px #00ff00;
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    0% { opacity: 0.9; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.6); }
    100% { opacity: 0.9; transform: scale(1); }
}

/* ===== FOOTER ===== */
.now-playing {
    text-align: center;
    margin-top: 12px;
    padding: 8px;
    font-size: clamp(0.8rem, 2vh, 1rem);
    color: #b5add9;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.footer {
    text-align: center;
    color: #5a537f;
    font-size: clamp(0.6rem, 1.5vh, 0.8rem);
    flex-shrink: 0;
    margin-top: 4px;
}

#audioPlayer {
    display: none;
}

.error-msg {
    text-align: center;
    color: #ffa7a7;
    margin: 5px auto;
    padding: 5px 15px;
    background: rgba(255, 120, 120, 0.1);
    border-radius: 30px;
    display: none;
    font-size: 0.8rem;
    width: fit-content;
    flex-shrink: 0;
}

/* ===== MEDIA QUERIES (TABLET Y MÓVIL) ===== */
@media (max-width: 900px) {
    .radio-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(6, 1fr);
    }
}

@media (max-width: 600px) {
    body {
        padding: 8px 10px;
    }
    .header h1 {
        font-size: 1.5rem;
    }
    .header p {
        font-size: 0.6rem;
    }
    .radio-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(6, 1fr);
        gap: 4px;
    }
    .radio-card {
        padding: 4px 2px;
        border-radius: 12px;
    }
    .radio-icon {
        font-size: 1.4rem;
    }
    .radio-name {
        font-size: 0.5rem;
        max-width: 60px;
    }
    .wave-container {
        height: 10px;
        gap: 2px;
    }
    .wave-bar {
        width: 2px;
    }
    .playing-indicator {
        width: 10px;
        height: 10px;
        top: 4px;
        right: 4px;
    }
    .now-playing {
        font-size: 0.5rem;
    }
    .footer {
        font-size: 0.4rem;
    }
}