/* player.css
   Estilos del modulo Reproductor (estilo Spotify) de Radio Alegoria
   Editorial. Autocontenido a proposito -- reusa las variables CSS globales
   (--bg-panel, --accent, --text-muted, etc.) definidas en style.css, pero
   ninguna regla de aca depende de nada mas alla de esas variables y de las
   clases utilitarias genericas (.hidden, .btn-primary, .btn-secondary,
   .filter-chip, .search-box, .radio-cover-grid, .radio-cover-card,
   .catalog-empty-state, .disco-card-categorias, .disco-card-categoria-badge)
   que ya existen en el resto de la app. Pensado para poder copiarse a otro
   proyecto junto con player.js. */

:root {
    --player-bar-height: 0px;
}

/* ================= Vista de navegacion (carruseles estilo YouTube Music) ================= */

.player-quickbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.player-mix-btn {
    flex-shrink: 0;
}
.player-search-box {
    flex: 1;
    min-width: 180px;
}
.player-size-control {
    flex-shrink: 0;
}
.player-size-control input[type="range"] {
    width: 90px;
}

.player-carousel-section {
    margin-bottom: 30px;
}
.player-carousel-header {
    margin-bottom: 10px;
}
.player-carousel-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0;
}
.player-carousel-wrap {
    position: relative;
}
.player-carousel-scroll {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding: 2px 2px 10px;
    scrollbar-width: none;
}
.player-carousel-scroll::-webkit-scrollbar {
    display: none;
}
.player-carousel-tile {
    flex: 0 0 auto;
    width: var(--player-tile-size, 150px);
    scroll-snap-align: start;
}
.player-carousel-arrow {
    position: absolute;
    top: 0;
    bottom: 10px;
    width: 36px;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(10, 11, 18, 0.75);
    backdrop-filter: blur(4px);
    border: none;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 2;
    transition: background 0.15s;
}
.player-carousel-arrow:hover {
    background: rgba(10, 11, 18, 0.92);
}
.player-carousel-arrow-izq {
    left: 0;
    border-radius: 0 8px 8px 0;
}
.player-carousel-arrow-der {
    right: 0;
    border-radius: 8px 0 0 8px;
}
/* Las flechas solo tienen sentido con mouse -- en touch/mobile se navega
   con swipe nativo del carrusel, mas natural y sin ocupar espacio. */
@media (hover: hover) and (pointer: fine) {
    .player-carousel-wrap:hover .player-carousel-arrow {
        display: flex;
    }
}

.player-tile-noimg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
}
.player-tile-badge-destacado {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f59e0b;
    color: white;
    border-radius: 50%;
    font-size: 0.85rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.player-tile-categoria-fondo {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.6rem;
    color: rgba(255, 255, 255, 0.85);
    background: linear-gradient(135deg, var(--accent), #db2777);
}

@media (max-width: 767px) {
    .player-quickbar {
        gap: 10px;
    }
    .player-search-box {
        order: 3;
        flex-basis: 100%;
    }
    .player-size-control input[type="range"] {
        width: 70px;
    }
    .player-carousel-section {
        margin-bottom: 22px;
    }
    .player-song-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 2px 10px;
    }
    .player-carousel-header-con-boton {
        align-items: flex-start;
    }
    .player-pager {
        gap: 10px;
    }
    .player-pager button span,
    .player-pager button {
        font-size: 0.8rem;
    }
}

.player-carousel-header-con-boton {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.player-btn-reproducir-todo {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.82rem;
}

.player-song-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.player-song-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 4px 18px;
}
.player-pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 14px;
}
.player-pager-info {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.player-song-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}
.player-song-row:hover {
    background: rgba(255, 255, 255, 0.05);
}
.player-song-row-numero {
    width: 22px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}
.player-song-row img,
.player-song-row-noimg {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}
.player-song-row-noimg {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}
.player-song-row-info {
    flex: 1;
    min-width: 0;
}
.player-song-row-titulo {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-song-row-album {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-song-row-reproducciones {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.player-song-row-duracion {
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-shrink: 0;
    width: 40px;
    text-align: right;
}

.player-btn-volver {
    margin-bottom: 16px;
}
.player-album-header {
    display: flex;
    gap: 24px;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.player-album-header-img {
    width: 180px;
    height: 180px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}
.player-album-header-info h1 {
    margin: 0 0 10px;
}
.player-album-header-acciones {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

/* ================= Mini-barra persistente ================= */

.player-minibar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9500;
    height: 90px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 22px;
    background: rgba(15, 17, 26, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--panel-border);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.5);
}
.player-minibar.hidden {
    display: none;
}
.player-minibar-cover {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
}
.player-minibar-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.player-minibar-info {
    width: 170px;
    flex-shrink: 0;
    min-width: 0;
}
/* Los -wrap recortan el ancho disponible; el nombre/album de adentro se
   vuelve inline-block para poder medirse (scrollWidth) y animarse cuando
   no entra completo -- ver .desplazando mas abajo y ajustarTextoDesplazante()
   en player.js. */
.player-minibar-titulo-wrap,
.player-minibar-album-wrap {
    overflow: hidden;
    white-space: nowrap;
    width: 100%;
}
.player-minibar-titulo {
    display: inline-block;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-main);
    white-space: nowrap;
}
.player-minibar-album {
    display: inline-block;
    font-size: 0.74rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.player-minibar-titulo.desplazando,
.player-minibar-album.desplazando {
    animation: player-marquee 8s linear infinite alternate;
    animation-delay: 1s;
}
@keyframes player-marquee {
    0%, 8%   { transform: translateX(0); }
    92%, 100% { transform: translateX(calc(-1 * var(--scroll-dist, 0px))); }
}
.player-minibar-center {
    flex: 1;
    min-width: 0;
    /* Ocupa todo el alto de la barra para que .player-minibar-controls quede
       centrado igual que la portada, sin que la fila de seek (mas abajo,
       ahora posicionada en absoluto) lo empuje hacia arriba. */
    align-self: stretch;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.player-minibar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.player-minibar-seek {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 480px;
    font-size: 0.68rem;
    color: var(--text-muted);
}
.player-minibar-seek input[type="range"] {
    flex: 1;
}
.player-minibar-volume {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    width: 110px;
    flex-shrink: 0;
}
.player-minibar-volume input[type="range"] {
    width: 80px;
}

.player-ctrl-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.player-ctrl-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}
.player-ctrl-btn.activo {
    color: var(--accent);
}
.player-ctrl-btn-main {
    background: var(--accent);
    color: white;
    width: 38px;
    height: 38px;
    font-size: 1.3rem;
}
.player-ctrl-btn-main:hover {
    background: var(--accent-hover);
    color: white;
}

.player-minibar input[type="range"],
.player-fullscreen input[type="range"] {
    accent-color: var(--accent);
}

@media (max-width: 767px) {
    .player-minibar {
        /* El nav inferior mobile mide ~76-80px de alto real (min-height:64px
           + padding + safe-area) -- medido en vivo con la barra solapando en
           64px, hace falta mas clearance que el min-height nominal. */
        bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        padding: 0 10px;
        gap: 8px;
    }
    .player-minibar-info {
        width: 90px;
    }
    .player-minibar-volume {
        display: none;
    }
    /* Con cover+info+controles+cerrar+expand ya no entran 7 botones de
       controles en un telefono angosto -- se solapaban. Aleatorio/Repetir
       quedan disponibles en la pantalla "Reproduciendo ahora". */
    #player-btn-shuffle,
    #player-btn-repeat {
        display: none;
    }
    .player-minibar-seek {
        max-width: none;
    }
    body.player-bar-visible .content-area {
        /* minibar top edge queda en bottom(80) + height(90) = 170px desde el
           borde inferior real del viewport -- un poco de margen extra arriba. */
        padding-bottom: calc(178px + env(safe-area-inset-bottom, 0px)) !important;
    }
}
@media (min-width: 768px) {
    body.player-bar-visible .content-area {
        padding-bottom: 108px;
    }
}

/* ================= Pantalla completa "Reproduciendo ahora" ================= */

.player-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: radial-gradient(circle at 50% 15%, #241344 0%, #0a0b12 65%);
    display: flex;
    flex-direction: column;
    padding: 18px 20px 28px;
    overflow-y: auto;
}
.player-fullscreen.hidden {
    display: none;
}
.player-fullscreen-close {
    align-self: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    margin-bottom: 6px;
    padding: 6px 20px;
}
.player-fullscreen-close:hover {
    color: var(--text-main);
}
.player-fullscreen-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
    max-width: 920px;
    margin: 0 auto;
    width: 100%;
}
.player-fullscreen-disco-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 420px;
}
.player-disc-wrap {
    width: min(68vw, 320px);
    aspect-ratio: 1 / 1;
}
.player-disc {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 60px var(--accent-glow), 0 12px 30px rgba(0, 0, 0, 0.6);
    border: 6px solid rgba(255, 255, 255, 0.08);
    animation: player-spin 16s linear infinite;
    animation-play-state: paused;
    background: #111;
}
.player-disc.girando {
    animation-play-state: running;
}
.player-disc img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
@keyframes player-spin {
    to { transform: rotate(360deg); }
}

.player-fullscreen-titulo {
    font-size: 1.35rem;
    font-weight: 800;
    text-align: center;
    margin: 4px 0 0;
}
.player-fullscreen-album {
    color: var(--text-muted);
    text-align: center;
    margin: 0 0 6px;
}
.player-fullscreen-seek {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    font-size: 0.76rem;
    color: var(--text-muted);
}
.player-fullscreen-seek input[type="range"] {
    flex: 1;
}
.player-fullscreen-controls {
    display: flex;
    align-items: center;
    gap: 22px;
}
.player-fullscreen-controls .player-ctrl-btn {
    font-size: 1.6rem;
    width: 44px;
    height: 44px;
}
.player-fullscreen-controls .player-ctrl-btn-main {
    width: 58px;
    height: 58px;
    font-size: 1.9rem;
}
.player-fullscreen-extra {
    display: flex;
    gap: 10px;
    margin-top: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.player-fullscreen-letra-col {
    width: 100%;
    max-width: 620px;
    max-height: 46vh;
    overflow-y: auto;
    background: var(--bg-panel);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 22px;
    box-sizing: border-box;
}
.player-lyrics-text {
    white-space: pre-line;
    line-height: 1.75;
    color: var(--text-main);
    font-size: 0.95rem;
}

@media (orientation: landscape) {
    .player-fullscreen-body {
        flex-direction: row;
        align-items: flex-start;
        justify-content: center;
        max-width: 1100px;
    }
    .player-fullscreen-disco-col {
        max-width: 380px;
    }
    .player-disc-wrap {
        width: min(28vw, 260px);
    }
    .player-fullscreen-letra-col {
        flex: 1;
        max-height: 82vh;
    }
}

@media (max-width: 480px) {
    .player-fullscreen-controls {
        gap: 14px;
    }
    .player-fullscreen-extra .btn-secondary {
        padding: 8px 12px;
        font-size: 0.82rem;
    }
}
