/* ==========================================================================
   player.css — Rediseño 2026 del reproductor.
   Se carga DESPUÉS de style.css y site.css: solo sobreescribe presentación,
   nunca la lógica de script.js (todos los IDs se conservan).
   ========================================================================== */

:root, :root[data-theme="dark"] {
    --p-card-bg: rgba(20, 16, 38, 0.72);
    --p-card-border: rgba(255, 255, 255, 0.10);
    --p-glow-1: rgba(233, 69, 96, 0.55);
    --p-glow-2: rgba(255, 123, 84, 0.35);
    --p-chip-bg: rgba(255, 255, 255, 0.06);
    --p-chip-border: rgba(255, 255, 255, 0.10);
    --p-cover-shadow: rgba(0, 0, 0, 0.55);
}
:root[data-theme="light"] {
    --p-card-bg: rgba(255, 255, 255, 0.75);
    --p-card-border: rgba(0, 0, 0, 0.08);
    --p-glow-1: rgba(233, 69, 96, 0.30);
    --p-glow-2: rgba(255, 123, 84, 0.20);
    --p-chip-bg: rgba(0, 0, 0, 0.04);
    --p-chip-border: rgba(0, 0, 0, 0.08);
    --p-cover-shadow: rgba(0, 0, 0, 0.20);
}

/* --- Tarjeta principal --- */
.player-container {
    max-width: 420px;
    padding: 1.4rem 1.4rem 1.6rem 1.4rem;
    border-radius: 28px;
    background:
        linear-gradient(var(--p-card-bg), var(--p-card-bg)) padding-box,
        linear-gradient(160deg, rgba(233,69,96,0.55), rgba(255,255,255,0.08) 35%, rgba(233,69,96,0.15) 70%, rgba(255,123,84,0.45)) border-box;
    border: 1px solid transparent;
    box-shadow: 0 24px 60px -18px var(--p-cover-shadow), 0 0 0 1px var(--p-card-border) inset;
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    overflow: hidden;
    isolation: isolate;
}

/* Blobs de luz ambiental dentro de la tarjeta */
.player-container::before,
.player-container::after {
    content: "";
    position: absolute;
    z-index: -1;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.55;
    transition: opacity 1s ease;
    pointer-events: none;
}
.player-container::before {
    background: radial-gradient(circle, var(--p-glow-1), transparent 65%);
    top: -110px;
    left: -110px;
    animation: blobFloatA 14s ease-in-out infinite alternate;
}
.player-container::after {
    background: radial-gradient(circle, var(--p-glow-2), transparent 65%);
    bottom: -130px;
    right: -110px;
    animation: blobFloatB 18s ease-in-out infinite alternate;
}
.player-container.is-playing::before,
.player-container.is-playing::after { opacity: 0.9; }
@keyframes blobFloatA {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(50px, 35px) scale(1.15); }
}
@keyframes blobFloatB {
    from { transform: translate(0, 0) scale(1.1); }
    to   { transform: translate(-45px, -30px) scale(0.95); }
}

/* --- Fila superior: EN VIVO + marca + tema --- */
.player-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--p-chip-bg);
    border: 1px solid var(--p-chip-border);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-primary);
}
.live-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 0 0 rgba(233, 69, 96, 0.6);
    animation: liveDot 1.8s ease-out infinite;
}
@keyframes liveDot {
    0%   { box-shadow: 0 0 0 0 rgba(233, 69, 96, 0.55); }
    70%  { box-shadow: 0 0 0 9px rgba(233, 69, 96, 0); }
    100% { box-shadow: 0 0 0 0 rgba(233, 69, 96, 0); }
}
.player-brand {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#themeToggleBtn {
    position: static;           /* ya no flota en la esquina */
    width: 38px;
    height: 38px;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    flex-shrink: 0;
}

/* --- Carátula con glow --- */
.cover-wrap {
    position: relative;
    width: min(230px, 62vw);
    margin: 0.25rem auto 1.1rem auto;
}
.cover-wrap::before {
    content: "";
    position: absolute;
    inset: 8%;
    border-radius: 26px;
    background: linear-gradient(135deg, var(--p-glow-1), var(--p-glow-2));
    filter: blur(32px);
    opacity: 0.5;
    transition: opacity 0.8s ease, transform 0.8s ease;
    z-index: -1;
}
.player-container.is-playing .cover-wrap::before {
    opacity: 0.95;
    animation: coverGlow 3.2s ease-in-out infinite alternate;
}
@keyframes coverGlow {
    from { transform: scale(0.96); }
    to   { transform: scale(1.07); }
}
#npCover {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 22px;
    border: 1px solid var(--p-card-border);
    box-shadow: 0 18px 40px -12px var(--p-cover-shadow);
    background: linear-gradient(145deg, #2a1c3a, #16213e);
    transition: opacity 0.45s ease, transform 0.45s ease;
}
#npCover.swapping { opacity: 0; transform: scale(0.97); }

/* Fallback con el logo (rectangular): no recortar, centrarlo con aire */
#npCover.is-logo {
    object-fit: contain;
    padding: 14%;
    background:
        radial-gradient(circle at 30% 25%, rgba(233, 69, 96, 0.28), transparent 60%),
        radial-gradient(circle at 75% 80%, rgba(255, 123, 84, 0.18), transparent 55%),
        linear-gradient(145deg, #241934, #141d33);
}
:root[data-theme="light"] #npCover.is-logo {
    background:
        radial-gradient(circle at 30% 25%, rgba(233, 69, 96, 0.14), transparent 60%),
        linear-gradient(145deg, #ffffff, #eef0f5);
}

/* El logo pasa a ser marca discreta dentro de la carátula fallback:
   lo ocultamos como imagen suelta (queda en la topbar como texto) */
#logo {
    display: none;
}

/* --- Info de la pista --- */
.np-info {
    text-align: center;
    margin-bottom: 0.35rem;
    min-height: 3.1rem;
}
#npTitle {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
#npArtist {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Estado (Cargando / Reproduciendo / errores) — píldora discreta */
#stationInfo {
    font-style: normal;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 0.3rem auto 0.6rem auto;
    min-height: 1.4em;
}
#stationInfo.error { color: var(--accent-color); }

/* --- Visualizador --- */
#visualizer {
    width: 100%;
    height: 56px;
    margin: 0.4rem auto 0.9rem auto;
    border-radius: 14px;
    background-color: var(--visualizer-bg);
    border: 1px solid var(--p-chip-border);
}

/* --- Botón Play héroe --- */
.play-row {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 0.4rem 0 0.8rem 0;
}
#playPauseBtn {
    position: relative;
    width: 84px;
    height: 84px;
    font-size: 1.9rem;
    margin: 0;
    background: linear-gradient(145deg, var(--accent-color), #ff7b54);
    box-shadow:
        0 14px 34px -8px rgba(233, 69, 96, 0.65),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    transition: transform 0.2s ease, box-shadow 0.3s ease, filter 0.3s ease;
}
#playPauseBtn:hover { transform: scale(1.06); filter: brightness(1.08); background: linear-gradient(145deg, var(--accent-hover-color), #ff8a63); }
#playPauseBtn:active { transform: scale(0.96); }

/* Anillos pulsantes cuando está sonando */
.play-row::before,
.play-row::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 84px;
    height: 84px;
    margin: -42px 0 0 -42px;
    border-radius: 50%;
    border: 2px solid rgba(233, 69, 96, 0.5);
    opacity: 0;
    pointer-events: none;
}
.player-container.is-playing .play-row::before { animation: playRing 2.6s ease-out infinite; }
.player-container.is-playing .play-row::after  { animation: playRing 2.6s ease-out 1.3s infinite; }
@keyframes playRing {
    0%   { transform: scale(1); opacity: 0.55; }
    100% { transform: scale(1.75); opacity: 0; }
}

/* --- Volumen --- */
.volume-controls {
    width: 82%;
    margin: 0.2rem auto 1rem auto;
}
#volumeSlider {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-color) 0%, var(--accent-color) calc(var(--vol, 0.8) * 100%), var(--slider-track-bg) calc(var(--vol, 0.8) * 100%));
}
#volumeSlider::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    border: 2px solid #fff;
}
#volumeSlider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.35);
    border: 2px solid #fff;
}

/* --- Chips de acciones --- */
.controls-row { gap: 0.45rem; margin-top: 0.35rem; }
.control-button {
    background: var(--p-chip-bg);
    border: 1px solid var(--p-chip-border);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    font-size: 0.76rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.control-button:hover {
    border-color: rgba(233, 69, 96, 0.45);
    background: rgba(233, 69, 96, 0.10);
    transform: translateY(-2px);
}

@media (max-width: 400px) {
    .player-container { padding: 1.1rem 1rem 1.3rem 1rem; border-radius: 24px; }
    #playPauseBtn { width: 74px; height: 74px; font-size: 1.7rem; }
    .player-brand { display: none; }
}

/* ==========================================================================
   Mini-player persistente (páginas interiores, body.layout-sub)
   El mismo DOM del player se compacta en una barra fija estilo Spotify.
   La navegación interna es SPA (site.js): el audio nunca se corta.
   ========================================================================== */
body.layout-sub { padding-bottom: 96px; }

.layout-sub .home-player-wrap { padding: 0; }
.layout-sub .player-container {
    position: fixed;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 520px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.55rem 0.7rem 0.55rem 0.6rem;
    margin: 0;
    border-radius: 999px;
    z-index: 300;
    text-align: left;
}
.layout-sub .player-container::before,
.layout-sub .player-container::after { width: 180px; height: 180px; filter: blur(50px); }

.layout-sub .player-topbar,
.layout-sub #stationInfo,
.layout-sub #visualizer,
.layout-sub .volume-controls,
.layout-sub .controls-row { display: none; }

.layout-sub .cover-wrap {
    width: 48px;
    margin: 0;
    flex-shrink: 0;
}
.layout-sub .cover-wrap::before { display: none; }
.layout-sub #npCover { border-radius: 12px; }
.layout-sub #npCover.is-logo { padding: 8%; }

.layout-sub .np-info {
    flex: 1;
    min-width: 0;
    margin: 0;
    min-height: 0;
    text-align: left;
}
.layout-sub #npTitle {
    font-size: 0.86rem;
    -webkit-line-clamp: 1;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: block;
}
.layout-sub #npArtist { font-size: 0.72rem; }

.layout-sub .play-row { margin: 0; flex-shrink: 0; }
.layout-sub .play-row::before,
.layout-sub .play-row::after { display: none; }
.layout-sub #playPauseBtn {
    width: 46px;
    height: 46px;
    font-size: 1rem;
    box-shadow: 0 8px 20px -6px rgba(233, 69, 96, 0.6);
}
.layout-sub .loading-overlay { border-radius: 999px; }

/* --- Aviso "Toca para activar el sonido" (autoplay muteado) --- */
.unmute-hint {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(145deg, var(--accent-color), #ff7b54);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.6rem 1.2rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px -8px rgba(233, 69, 96, 0.7);
    animation: hintPulse 1.8s ease-in-out infinite;
}
@keyframes hintPulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50%      { transform: translateX(-50%) scale(1.05); }
}
