/* Valencianismo Lo-Fi — Sistema de Estilos Premium */

:root {
    --primary-color: #ff9f1c; /* Naranja valencianista cálido */
    --accent-color: #2ec4b6;  /* Azul relajante */
    --bg-glass: rgba(15, 18, 26, 0.45);
    --border-glass: rgba(255, 255, 255, 0.08);
    --shadow-premium: 0 20px 50px rgba(0, 0, 0, 0.5);
    --font-sans: 'Outfit', sans-serif;
    --font-serif: 'Playfair Display', serif;
    --transition-smooth: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #08090c;
    font-family: var(--font-sans);
    color: #f1f3f9;
}

/* Contenedor de Fondos de Ambiente */
.background-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: scale(1.02);
    filter: brightness(0.7) contrast(1.05);
}

/* Efecto de viñeta oscura para enfocar el centro */
.background-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 20%, rgba(5, 6, 8, 0.75) 100%);
    pointer-events: none;
}

/* Contenedor General de la Aplicación */
.app-container {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 2.5rem;
    pointer-events: none;
}

.app-container * {
    pointer-events: auto;
}

/* --- Widget del Reloj Analógico --- */
.clock-widget {
    align-self: flex-end;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    padding: 1rem 1.2rem;
    border-radius: 1.5rem;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: var(--transition-smooth);
}

.clock-widget:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(15, 18, 26, 0.55);
}

.clock {
    width: 70px;
    height: 70px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    border-radius: 4px;
    background: #ffffff;
    transition: transform 0.1s cubic-bezier(0.4, 2.08, 0.55, 0.44);
}

.hand.hour {
    width: 3px;
    height: 20px;
    margin-left: -1.5px;
    background: #ffffff;
}

.hand.minute {
    width: 2px;
    height: 28px;
    margin-left: -1px;
    background: rgba(255, 255, 255, 0.85);
}

.hand.second {
    width: 1px;
    height: 31px;
    margin-left: -0.5px;
    background: var(--primary-color);
}

.center-dot {
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 5px var(--primary-color);
}

.digital-time {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.7);
    font-feature-settings: "tnum";
}

/* --- Panel Central del Reproductor --- */
.player-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 10;
    width: calc(100% - 40px);
    max-width: 440px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 1.6rem;
    padding: 1.2rem 1.4rem;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    transition: var(--transition-smooth);
}

.player-panel.dragging {
    transition: none !important;
}

.player-panel:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    cursor: grab;
    user-select: none;
    gap: 0.8rem;
}

.logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
}

.logo-link:hover {
    transform: scale(1.08) rotate(3deg);
}

.player-logo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2.5px solid var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    object-fit: cover;
    background: #0f121a;
    transition: var(--transition-smooth);
}

.player-panel.minimized .player-logo {
    width: 36px;
    height: 36px;
    border-color: rgba(255, 255, 255, 0.2);
}

.player-header-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    overflow: hidden;
    flex: 1;
}

.title-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
}

.player-header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.badge {
    background: rgba(255, 159, 28, 0.15);
    color: var(--primary-color);
    border: 1px solid rgba(255, 159, 28, 0.3);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 2.5px;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    display: inline-block;
    margin-bottom: 0.2rem;
}

.radio-title {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #ffffff;
    white-space: nowrap;
}

.tagline {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 300;
    margin-top: 0.1rem;
}

/* Botón Play/Pausa General */
.play-btn {
    border-radius: 50%;
    border: none;
    background: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 -2px 0px rgba(0, 0, 0, 0.1);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none;
    flex-shrink: 0;
}

.play-btn:hover {
    transform: scale(1.08);
    background: #ffffff;
    box-shadow: 0 6px 15px rgba(255, 159, 28, 0.35);
}

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

.play-btn svg {
    fill: #0c0d12;
}

/* Play de Cabecera (Oculto por defecto en maximizado, visible en minimizado) */
.header-play-btn {
    display: none;
    width: 32px;
    height: 32px;
}

.header-play-btn svg {
    width: 12px;
    height: 12px;
}

/* Play de Cuerpo (Visible por defecto) */
.body-play-btn {
    width: 44px;
    height: 44px;
}

.body-play-btn svg {
    width: 16px;
    height: 16px;
}

/* Botones de Cabecera (Fullscreen y Minimizar) */
.player-fullscreen-btn,
.player-toggle-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.55);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 0.72rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    outline: none;
}

.player-fullscreen-btn:hover,
.player-toggle-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.18);
}

/* Cuerpo del Reproductor */
.player-body {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.player-controls-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
}

.now-playing {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.7rem 0.9rem;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
    overflow: hidden;
    flex: 1;
}

.music-icon {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    width: 20px;
    height: 16px;
    flex-shrink: 0;
}

.music-icon .bar {
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    border-radius: 10px;
    animation: bounce 0.8s ease-in-out infinite alternate;
}

.music-icon .bar:nth-child(2) {
    animation-delay: 0.2s;
    animation-duration: 0.6s;
}

.music-icon .bar:nth-child(3) {
    animation-delay: 0.4s;
    animation-duration: 0.9s;
}

.music-icon.paused .bar {
    animation-play-state: paused;
    height: 4px;
}

@keyframes bounce {
    0% { height: 4px; }
    100% { height: 16px; }
}

.track-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    width: 100%;
}

.now-playing-label {
    font-size: 0.6rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
}

.track-title-wrapper {
    overflow: hidden;
    width: 100%;
    white-space: nowrap;
}

.track-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #ffffff;
    display: inline-block;
    will-change: transform;
}

.track-title.marquee {
    animation: marquee 15s linear infinite;
    padding-left: 100%;
}

@keyframes marquee {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

/* --- Panel de Sintonización de Ambiente (Desplegable integrado) --- */
.player-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
}

.ambient-controls {
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 2px 4px;
    border-radius: 20px;
}

.footer-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    outline: none;
}

.footer-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.ambient-selector-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 160px;
    opacity: 1;
    overflow: hidden;
    margin-top: 0.1rem;
}

.ambient-selector-wrapper.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.ambient-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    text-align: center;
}

.ambient-label strong {
    color: var(--primary-color);
}

.ambient-hint {
    display: block;
    font-size: 0.58rem;
    color: rgba(255, 255, 255, 0.3);
    text-transform: none;
    font-weight: 400;
    margin-top: 1px;
}

/* Selector de ambientes agrupado en 2 filas de 4 */
.ambient-selector.grid-2x4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 0.4rem;
    width: 100%;
}

.ambient-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.65);
    padding: 0.45rem 0.2rem;
    border-radius: 0.6rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    outline: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.ambient-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.12);
}

.ambient-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #0c0d12;
    box-shadow: 0 4px 12px rgba(255, 159, 28, 0.2);
}

/* --- Estado Minimizado del Reproductor --- */
.player-panel.minimized {
    padding: 0.8rem 1.2rem !important;
    gap: 0 !important;
    width: 440px !important;
    max-width: 440px !important;
}

.player-panel.minimized .badge,
.player-panel.minimized .tagline,
.player-panel.minimized .player-body,
.player-panel.minimized .player-footer {
    display: none !important;
}

.player-panel.minimized .player-header-text {
    overflow: visible !important;
}

/* Al estar minimizado, el play de cabecera sí se muestra */
.player-panel.minimized .header-play-btn {
    display: flex !important;
    flex-shrink: 0 !important;
}

/* --- Marca de agua y extras --- */
.watermark {
    font-size: 0.75rem;
    letter-spacing: 5px;
    color: rgba(255, 255, 255, 0.12);
    font-weight: 800;
    text-transform: uppercase;
    margin-top: 1rem;
}

.hidden {
    display: none !important;
}

/* --- Adaptación Responsive --- */
@media (max-width: 580px) {
    .app-container {
        padding: 1rem;
    }
    
    .clock-widget {
        align-self: center;
        margin-top: 1rem;
    }
    
    .player-panel {
        bottom: 15px;
        left: 15px;
        width: calc(100% - 30px);
        padding: 1.2rem;
        gap: 1.2rem;
    }

    /* En móvil, al minimizar, se oculta todo excepto la flecha en un círculo abajo izquierda */
    .player-panel.minimized {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        padding: 0 !important;
        width: 50px !important;
        height: 50px !important;
        bottom: 15px !important;
        left: 15px !important;
        overflow: visible !important;
    }

    .player-panel.minimized .player-header-text,
    .player-panel.minimized .player-header-actions .play-btn,
    .player-panel.minimized .player-header-actions .player-fullscreen-btn {
        display: none !important;
    }

    .player-panel.minimized .player-toggle-btn {
        position: relative !important;
        top: 0 !important;
        right: 0 !important;
        width: 44px !important;
        height: 44px !important;
        border-radius: 50% !important;
        background: var(--bg-glass) !important;
        border: 1px solid var(--border-glass) !important;
        box-shadow: var(--shadow-premium) !important;
        backdrop-filter: blur(15px) !important;
        -webkit-backdrop-filter: blur(15px) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: #ffffff !important;
    }

    .radio-title {
        font-size: 1.4rem;
    }
}
