/**
 * IA Radio Player - Mini Player Styles
 * Diseño integrado con radionet.tv
 * ✅ ACTUALIZADO: Portadas cuadradas responsivas
 */

/* ============================================
   MINI PLAYER EN HEADER
   ============================================ */

.ia-radio-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 15px;
    background: rgba(255, 183, 0, 0.1);
    border: 1px solid rgba(255, 183, 0, 0.3);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.ia-radio-player:hover {
    background: rgba(255, 183, 0, 0.2);
    border-color: rgba(255, 183, 0, 0.5);
}

/* Botón Play/Pause */
.ia-radio-btn {
    background: linear-gradient(135deg, #ffb700 0%, #ff8c00 100%);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
}

.ia-radio-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 183, 0, 0.5);
}

.ia-radio-btn:active {
    transform: scale(0.95);
}

.ia-radio-btn .play-icon,
.ia-radio-btn .pause-icon {
    font-size: 16px;
    line-height: 1;
}

/* Indicador de Estado */
.ia-radio-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #fff;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #666;
    transition: all 0.3s ease;
}

.ia-radio-player.playing .status-dot {
    background: #00ff00;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 5px #00ff00;
    }
    50% {
        opacity: 0.5;
        box-shadow: 0 0 15px #00ff00;
    }
}

.status-text {
    font-weight: 500;
    white-space: nowrap;
}

/* Botón Portada */
.ia-radio-portada-btn {
    background: rgba(255, 183, 0, 0.2);
    border: 1px solid rgba(255, 183, 0, 0.5);
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    color: #fff;
}

.ia-radio-portada-btn:hover {
    background: rgba(255, 183, 0, 0.3);
    transform: translateY(-2px);
}

/* ============================================
   MODAL DE PORTADA
   ============================================ */

.ia-radio-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.ia-radio-modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.ia-radio-modal-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 2px solid #ffb700;
    border-radius: 20px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    position: relative;
    animation: slideIn 0.3s ease;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    /* ✅ Asegurar que el contexto de apilamiento esté correcto */
    z-index: 1;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Botón Cerrar */
.ia-radio-close {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid rgba(255, 0, 0, 0.5);
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    /* ✅ CRÍTICO: z-index MUY alto para estar sobre ABSOLUTAMENTE TODO */
    z-index: 9999 !important;
    pointer-events: auto !important;
}

.ia-radio-close:hover {
    background: rgba(255, 0, 0, 0.5);
    transform: rotate(90deg);
}

/* ============================================
   ✅ PORTADA DE CANCIÓN - CUADRADA
   ============================================ */

.ia-radio-artwork {
    width: 100%;
    /* ✅ Aspect ratio 1:1 para mantenerlo cuadrado */
    aspect-ratio: 1 / 1;
    /* Fallback para navegadores antiguos */
    padding-bottom: 100%;
    position: relative;
    background: linear-gradient(135deg, #333 0%, #111 100%);
    border-radius: 15px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    /* ✅ z-index bajo para que el botón X quede arriba */
    z-index: 0;
    /* ✅ Centrar contenido (emoji) perfectamente */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Para que el contenido se posicione correctamente con aspect-ratio */
.ia-radio-artwork > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* ✅ Asegurar que el contenido de la portada esté debajo */
    z-index: 1;
}

.ia-radio-artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 2;
}

.ia-radio-artwork .default-artwork {
    font-size: 80px;
    color: #ffb700;
    /* ✅ Centrado perfecto del emoji */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* Info de Canción */
.ia-radio-info {
    text-align: center;
    margin-bottom: 20px;
}

.ia-radio-song-title {
    font-size: 18px;
    font-weight: bold;
    color: #ffb700;
    margin-bottom: 8px;
    word-wrap: break-word;
}

.ia-radio-artist {
    font-size: 14px;
    color: #999;
}

/* Botones de Acción */
.ia-radio-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ia-radio-action-btn {
    background: linear-gradient(135deg, #ffb700 0%, #ff8c00 100%);
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.ia-radio-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 183, 0, 0.4);
}

.ia-radio-action-btn:active {
    transform: translateY(0);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .ia-radio-player {
        padding: 4px 10px;
        gap: 6px;
    }
    
    .ia-radio-btn {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .ia-radio-indicator {
        font-size: 11px;
    }
    
    .status-text {
        display: none;
    }
    
    .ia-radio-portada-btn {
        padding: 4px 8px;
        font-size: 14px;
    }
    
    .ia-radio-modal-content {
        padding: 20px;
        max-width: 320px;
    }
    
    /* ✅ Portada sigue siendo cuadrada en mobile */
    .ia-radio-artwork {
        /* aspect-ratio se mantiene automáticamente */
        border-radius: 12px;
    }
    
    .ia-radio-artwork .default-artwork {
        font-size: 60px;
    }
    
    .ia-radio-song-title {
        font-size: 16px;
    }
}

/* ============================================
   LOADING STATE
   ============================================ */

.ia-radio-player.loading .ia-radio-btn {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   MODAL DE COMPARTIR
   ============================================ */

.ia-share-modal {
    /* Usa los mismos estilos de ia-radio-modal */
}

.ia-share-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.ia-share-btn {
    background: rgba(255, 183, 0, 0.1);
    border: 1px solid rgba(255, 183, 0, 0.3);
    padding: 12px;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
}

.ia-share-btn:hover {
    background: rgba(255, 183, 0, 0.2);
    border-color: rgba(255, 183, 0, 0.5);
    transform: translateY(-2px);
}

.ia-share-btn i {
    font-size: 18px;
}

/* ============================================
   ✅ SOPORTE PARA NAVEGADORES ANTIGUOS
   ============================================ */

/* Si aspect-ratio no está soportado, usar padding-bottom */
@supports not (aspect-ratio: 1 / 1) {
    .ia-radio-artwork {
        height: 0;
        padding-bottom: 100%; /* Crea un cuadrado */
        position: relative;
    }
    
    .ia-radio-artwork > * {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}