:root {
    --primary-color: #0089c7;
    --dark-bg: #0b1221;
    --glass-bg: rgba(20, 20, 35, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-color: #ffffff;
    --font-main: 'Montserrat', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-main);
    background-color: var(--dark-bg);
    color: var(--text-color);
    height: 100vh;
    height: 100dvh; 
    width: 100%;
    overflow: hidden;
}

/* --- FONDO --- */
.bg-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    z-index: -2;
    transform: scale(1.05); 
}

.bg-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4); 
    backdrop-filter: none; 
    z-index: -1;
    transition: all 0.5s ease;
}

.bg-overlay.blur-active {
    backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.6);
}

/* --- CONTENEDOR PRINCIPAL --- */
.main-container {
    display: flex;
    height: 100%;
    width: 100%;
    align-items: center; 
    justify-content: center;
    position: relative;
    padding: 20px;
}

/* --- TARJETA DEL REPRODUCTOR --- */
.player-wrapper {
    width: 100%;
    max-width: 400px;
    height: 600px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-top: 1px solid rgba(255,255,255,0.2);
    border-radius: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 10;
    margin: 0 auto;
    transition: all 0.3s ease; 
}

#luna-container {
    width: 100%;
    height: 100% !important; 
    position: relative;
    z-index: 10;
}

/* --- BARRA IZQUIERDA (ICONOS) --- */
.social-sidebar {
    position: fixed; 
    left: 30px;      
    top: 50%;        
    transform: translateY(-50%); 
    display: flex;
    flex-direction: column;
    gap: 15px;       
    z-index: 20; 
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px; 
    height: 45px;
    background: rgba(255, 255, 255, 0.1); 
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;    
    color: white; 
    text-decoration: none;
    font-size: 1.3rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.social-btn:hover {
    transform: scale(1.15) translateX(5px);
    color: white;          
    border-color: transparent;
}

.social-btn.facebook:hover { background: #1877F2; }
.social-btn.instagram:hover { background: #dc2743; }
.social-btn.whatsapp:hover { background: #25D366; }
.social-btn.web:hover { background: #00a8ff; }
.social-btn.tiktok:hover { background: #000000; border-color: #00f2ea; }
.social-btn.share:hover { background: #ff9f43; }
.social-btn.tv:hover { background: #7209b7; }

/* --- BARRA DERECHA (WIDGETS + RELOJ) --- */
.widgets-sidebar {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px; 
    z-index: 20;
    width: 220px; 
}

.digital-clock {
    position: relative;
    top: auto; right: auto; 
    font-size: 2.2rem; 
    font-weight: 700;
    text-align: center;
    letter-spacing: 1px;
    color: white; 
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.6);
    margin-bottom: 15px;
    font-feature-settings: "tnum";
    z-index: 30;
}

.glass-effect {
    background: rgba(0, 0, 0, 0.5); 
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    border-radius: 15px;
    padding: 10px 15px;
    transition: transform 0.3s ease;
}

.widget-box.weather {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    min-height: 70px;
}
.weather-icon { font-size: 2rem; color: #ffd700; }
.weather-info { text-align: right; }
#temp-val { font-size: 1.5rem; font-weight: 700; }
#city-val { font-size: 0.7rem; text-transform: uppercase; }

.widget-box.ad-box {
    padding: 0; background: rgba(0,0,0,0.2); border: none; box-shadow: none; min-height: 200px; display: flex; align-items: center; justify-content: center;
}
.ad-box img {
    width: 100%; max-width: 220px; border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.5); opacity: 1; transition: opacity 0.5s ease-in-out; 
}
.ad-box img.fade-out { opacity: 0; }
.ad-label { position: absolute; top: 5px; right: 5px; font-size: 0.5rem; background: rgba(0,0,0,0.6); padding: 2px 4px; border-radius: 3px; }

/* Modales */
.history-modal {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 0; background: rgba(15, 15, 25, 0.98); border-radius: 0 0 40px 40px; transition: height 0.4s ease; overflow: hidden; z-index: 50; display: flex; flex-direction: column;
}
.history-modal.active { height: 75%; }
.history-header { display: flex; justify-content: space-between; padding: 15px; background: rgba(255,255,255,0.05); }
.tv-container iframe { width: 100%; height: 100%; aspect-ratio: 16/9; }
.history-list { padding: 10px; overflow-y: auto; }
.song-item { padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.song-title { font-weight: bold; font-size: 0.9rem; }


/* =========================================
   VERSION MÓVIL (CORRECCIÓN BLINDADA)
   ========================================= */

@media (max-width: 768px) {
    
    /* 1. OCULTAMOS BARRA DERECHA */
    .widgets-sidebar { display: none !important; }

    /* 2. CONTENEDOR PRINCIPAL: ALINEACIÓN VERTICAL SIMPLE */
    .main-container {
        display: flex;
        flex-direction: column; /* Apilar elementos */
        justify-content: flex-start; /* Empezar desde arriba */
        align-items: center; /* Centrar horizontalmente */
        padding-top: 10vh; /* Bajarlo un 10% desde el techo */
    }

    /* 3. REPRODUCTOR: ALTURA FIJA SIN RESTRICCIONES */
    .player-wrapper { 
        width: 90%; 
        max-width: 360px; /* Ancho cómodo para móvil */
        
        /* IMPORTANTE: Altura fija estándar para que el Canvas no falle */
        height: 480px !important; 
        min-height: 480px !important;
        
        /* Quitamos restricciones que lo hacen desaparecer */
        max-height: none !important; 
        
        margin: 0 !important; /* Sin márgenes extraños */
        border-radius: 30px;
    }

    /* 4. MENÚ DE ICONOS: POSICIÓN FIJA ABAJO */
    .social-sidebar {
        position: fixed;
        bottom: 40px !important; /* 40px exactos desde abajo */
        left: 0; right: 0; top: auto;
        
        flex-direction: row; 
        justify-content: center; 
        gap: 15px; 
        
        width: 100%;
        transform: none;
        background: transparent;
        pointer-events: none; /* Dejar pasar clics en el fondo */
        z-index: 100;
    }
    
    .social-btn { 
        pointer-events: auto; /* Activar clics en botones */
        width: 45px; height: 45px; font-size: 1.2rem;
        background: rgba(0, 0, 0, 0.85); 
        border: 1px solid rgba(255,255,255,0.15);
        box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    }
}