/* ════════════════════════════════════════════════════════════
   app/player.css  ·  Radio Frartma
   Desktop: layout horizontal (artwork izq | info der)
   Móvil:   layout vertical centrado
   Sin scroll — todo encaja en 100vh
   ════════════════════════════════════════════════════════════ */

/* ── Reset & Vars ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --accent:     #0099ff;
    --accent2:    #fff600;
    --bg-deep:    #020028;
    --bg2:        rgba(9,6,84,0.6);
    --playing:    #0099ff;
    --buffering:  #00e676;
    --error:      #ff1744;
    --idle:       #ffc107;
    --text:       #eeeeee;
    --text-dim:   rgba(238,238,238,0.55);
    --border:     rgba(0,153,255,0.15);
    --hdr-h:      58px;
    --ftr-h:      36px;
}

html, body {
    height: 100%; overflow: hidden;       /* sin scroll */
    font-family: 'Rubik', sans-serif;
    background: var(--bg-deep);
    color: var(--text);
}

a  { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
img { display: block; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: rgba(0,153,255,.25); border-radius: 99px; }

/* ── FONDOS ── */
.bg-layer {
    position: fixed; inset: 0; z-index: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(0,80,200,.18) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(0,50,150,.12) 0%, transparent 60%),
        #020028;
}

#artBlur {
    position: fixed; inset: 0; z-index: 0;
    background-size: cover; background-position: center;
    filter: blur(80px) saturate(1.5) brightness(.28);
    opacity: 0; transition: opacity 1.2s ease;
}
#artBlur.loaded { opacity: 1; }

/* ── HEADER ── */
#siteHeader {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--hdr-h); z-index: 200;
    background: rgba(2,0,40,.88);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
}
.header-inner {
    max-width: 1400px; margin: 0 auto;
    height: 100%;
    display: flex; align-items: center;
    justify-content: space-between; gap: 16px;
}

/* Logo — clic lleva al home */
.logo-link {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; flex-shrink: 0;
    cursor: pointer;
}
.logo-link img {
    max-height: 38px; max-width: 175px;
    width: auto; object-fit: contain;
    filter: brightness(0) invert(1); opacity: .9;
    transition: opacity .2s;
}
.logo-link:hover img { opacity: 1; }
.logo-link .logo-txt {
    font-weight: 800; font-size: 1.1rem;
    background: linear-gradient(120deg,#fff 20%,var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* Logo desktop / mobile */
.logo-desktop { display: block; }
.logo-mobile  { display: none;  }

.header-actions { display: flex; align-items: center; gap: 8px; }
.btn-back {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.14);
    color: var(--text-dim);
    padding: 7px 14px; border-radius: 30px;
    font-size: .86rem; transition: all .2s;
}
.btn-back:hover { background: rgba(255,255,255,.14); color: var(--text); }

/* ── FOOTER ── */
#siteFooter {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--ftr-h); z-index: 200;
    display: flex; align-items: center; justify-content: center;
    background: rgba(2,0,28,.7);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    font-size: .76rem; color: var(--text-dim); text-align: center;
}
#siteFooter a { color: var(--accent); }

/* ══════════════════════════════════════════════════════════
   PLAYER PAGE — ocupa exactamente el espacio entre hdr/ftr
   ══════════════════════════════════════════════════════════ */
.player-page {
    position: fixed;
    top:    var(--hdr-h);
    bottom: var(--ftr-h);
    left: 0; right: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    overflow: hidden;
}

/* ── PLAYER CARD — contenedor principal ── */
.player-card {
    position: relative; z-index: 1;
    background: linear-gradient(140deg, rgba(9,6,84,.88) 0%, rgba(2,0,40,.94) 100%);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: 0 28px 80px rgba(0,0,200,.35);
    backdrop-filter: blur(20px);
    animation: playerIn .4s cubic-bezier(.34,1.45,.64,1);

    /* ─── DESKTOP: lado a lado ─── */
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 36px;
    padding: 32px 36px;
    width: min(860px, 96vw);
    max-height: 100%;
}

@keyframes playerIn {
    from { opacity:0; transform:scale(.9) translateY(22px); }
    to   { opacity:1; transform:scale(1) translateY(0);     }
}

/* ─── COLUMNA IZQUIERDA: visualizador ─── */
.player-left {
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}

.visualizer-wrap {
    position: relative;
    /* Tamaño dinámico — se ajusta al espacio disponible */
    width:  clamp(160px, 28vh, 260px);
    height: clamp(160px, 28vh, 260px);
}
.player-artwork-wrap {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(9,6,84,.8);
    transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), box-shadow .3s;
}

.player-page.playing .player-artwork-wrap {
    transform: scale(0.75);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.15), 0 0 24px var(--accent);
}
.player-artwork-wrap img {
    width: 100%; height: 100%;
    object-fit: cover; border-radius: 50%;
    transition: opacity .4s;
}
.artwork-glow {
    position: absolute; inset: 0;
    border-radius: 50%;
    box-shadow: inset 0 0 28px rgba(0,0,0,.5);
}

/* ─── COLUMNA DERECHA: info + controles ─── */
.player-right {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
    align-items: center;       /* centrado en todas las versiones */
    gap: 18px; justify-content: center;
}

/* Info */
.player-info { width: 100%; text-align: center; }
.player-info h2 {
    font-size: clamp(1.1rem, 2.8vw, 1.7rem);
    font-weight: 800; color: var(--accent2);
    line-height: 1.15; margin-bottom: 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-location {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font-size: .88rem; color: var(--text-dim); margin-bottom: 8px;
}
.flag-img { height: 1em; border-radius: 2px; }
.player-status {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font-size: .74rem; text-transform: uppercase; letter-spacing: 1px;
}
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--idle); transition: background .3s;
    animation: blinkDot 1.2s infinite;
}
.status-dot.playing   { background: var(--playing); }
.status-dot.buffering { background: var(--buffering); animation: blinkFast .5s infinite; }
.status-dot.error     { background: var(--error); animation: none; }
.status-dot.paused    { background: rgba(238,238,238,.3); animation: none; }
@keyframes blinkDot  { 0%,100%{opacity:1} 50%{opacity:.3} }
@keyframes blinkFast { 0%,100%{opacity:1} 50%{opacity:.2} }

/* Controles */
.player-controls {
    display: flex; align-items: center; justify-content: center; gap: 14px;
}
.ctrl-btn {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    color: var(--text); border-radius: 50%;
    width: 50px; height: 50px; font-size: 1rem;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s;
}
.ctrl-btn:hover { background: rgba(255,255,255,.18); transform: scale(1.08); }
.ctrl-main {
    width: 64px; height: 64px; font-size: 1.4rem;
    background: var(--accent); border-color: var(--accent); color: #fff;
    box-shadow: 0 6px 22px rgba(0,153,255,.45);
}
.ctrl-main:hover { background: #0080dd; transform: scale(1.1); }

/* Extras — volumen + share + enlace */
.player-extras {
    display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
}
.extra-btn {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    color: var(--text-dim);
    width: 36px; height: 36px; border-radius: 50%;
    font-size: .86rem; text-decoration: none;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s; flex-shrink: 0;
}
.extra-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.volume-slider {
    flex: 1; max-width: 140px; height: 4px;
    cursor: pointer; accent-color: var(--accent);
}

/* Share inline */
.player-share { width: 100%; }
.player-share-label {
    font-size: .68rem; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px;
    text-align: center; width: 100%;
}
.player-share-btns { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.psb {
    display: flex; align-items: center; gap: 5px;
    padding: 7px 13px; border-radius: 20px;
    font-size: .78rem; font-weight: 500; color: #fff;
    text-decoration: none; transition: opacity .2s, transform .2s;
    border: none; cursor: pointer;
}
.psb:hover { opacity: .88; transform: scale(1.05); }
.psb.wa { background: #25D366; }
.psb.fb { background: #1877F2; }
.psb.tw { background: #111; border: 1px solid #333; }
.psb.tg { background: #0088cc; }
.psb.native { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); }

/* ── SHARE MODAL ── */
.share-modal {
    position: fixed; inset: 0; z-index: 400;
    display: flex; align-items: center; justify-content: center;
}
.share-modal.hidden { display: none; }
.share-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,20,.82); backdrop-filter: blur(7px); cursor: pointer;
}
.share-card {
    position: relative; z-index: 1;
    background: rgba(9,6,84,.97); border: 1px solid var(--border);
    border-radius: 20px; padding: 26px; width: min(370px,92vw);
    box-shadow: 0 20px 60px rgba(0,0,200,.3); animation: popIn .3s ease;
}
@keyframes popIn { from{opacity:0;transform:scale(.93) translateY(14px)} to{opacity:1;transform:scale(1) translateY(0)} }
.share-card h3 { font-size: 1.1rem; font-weight: 800; color: var(--accent2); margin-bottom: 6px; }
.share-card>p  { font-size: .82rem; color: var(--text-dim); margin-bottom: 14px; }
.share-url-box { display: flex; gap: 8px; margin-bottom: 14px; }
.share-url-box input {
    flex: 1; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
    color: var(--text); padding: 8px 12px; border-radius: 8px; font-size: .78rem; outline: none;
}
#btnCopyUrl {
    background: var(--accent); border: none; color: #fff;
    padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: .88rem; transition: background .2s;
}
#btnCopyUrl:hover { background: #007acc; }
.share-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 14px; }
.share-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px; border-radius: 10px; text-decoration: none;
    font-size: .82rem; font-weight: 500; color: #fff; transition: opacity .2s, transform .2s;
}
.share-btn:hover { opacity: .9; transform: scale(1.03); }
.share-btn.whatsapp { background: #25D366; } .share-btn.facebook { background: #1877F2; }
.share-btn.twitter  { background: #000; border: 1px solid #333; } .share-btn.telegram { background: #0088cc; }
.share-close {
    width: 100%; padding: 9px; border-radius: 10px;
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
    color: var(--text-dim); cursor: pointer; font-size: .88rem; transition: all .2s;
}
.share-close:hover { background: rgba(255,255,255,.16); color: #fff; }

/* ── TOAST ── */
.toast {
    position: fixed; bottom: 46px; right: 18px; z-index: 700;
    background: #1a1a3e; border: 1px solid var(--accent);
    color: var(--text); padding: 10px 18px; border-radius: 10px;
    font-size: .86rem; box-shadow: 0 8px 24px rgba(0,0,200,.3);
    transition: all .3s; pointer-events: none;
}
.toast.hidden  { opacity: 0; transform: translateY(8px); }
.toast.success { border-color: #00e676; }
.toast.danger  { border-color: #ff1744; }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet
   ════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .player-card {
        gap: 24px;
        padding: 26px 28px;
    }
    .visualizer-wrap {
        width:  clamp(140px, 24vh, 210px);
        height: clamp(140px, 24vh, 210px);
    }
    .ctrl-btn  { width: 44px; height: 44px; font-size: .95rem; }
    .ctrl-main { width: 58px; height: 58px; font-size: 1.25rem; }
    .player-info h2 { font-size: 1.2rem; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — Móvil portrait (≤ 640px): imagen arriba, info abajo
   ════════════════════════════════════════════════════════════ */
@media (max-width: 640px) and (orientation: portrait) {
    :root { --hdr-h: 52px; --ftr-h: 32px; }

    .logo-desktop { display: none; }
    .logo-mobile  { display: block; }
    .header-inner { padding: 0 14px; }

    .player-page {
        padding: 12px 16px;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    /* Card vertical centrado: imagen arriba, datos abajo */
    .player-card {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: min(400px, 94vw);
        height: auto;
        max-height: calc(100vh - var(--hdr-h) - var(--ftr-h) - 24px);
        gap: 14px;
        padding: 20px 18px 16px;
        overflow: hidden;
    }

    /* Imagen grande centrada */
    .player-left { width: 100%; display: flex; justify-content: center; flex-shrink: 0; }
    .visualizer-wrap {
        width:  clamp(130px, 42vw, 190px);
        height: clamp(130px, 42vw, 190px);
    }

    /* Info y controles centrados */
    .player-right {
        width: 100%; flex: 1; min-height: 0;
        gap: 10px;
        align-items: center;
    }
    .player-info  { text-align: center; width: 100%; }
    .player-info h2 {
        font-size: clamp(1rem, 4.5vw, 1.3rem);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .player-location { justify-content: center; font-size: .82rem; }
    .player-status   { justify-content: center; }
    .player-controls { justify-content: center; gap: 10px; }
    .ctrl-btn  { width: 42px; height: 42px; font-size: .88rem; }
    .ctrl-main { width: 56px; height: 56px; font-size: 1.2rem; }
    .player-extras { justify-content: center; gap: 10px; }
    .volume-slider { flex: 1; max-width: 140px; }
    .player-share  { text-align: center; width: 100%; }
    .player-share-btns { justify-content: center; flex-wrap: wrap; gap: 8px; }
    .psb span { display: none; }
    .psb { padding: 8px; border-radius: 50%; width: 36px; height: 36px; justify-content: center; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — Móvil landscape: imagen izquierda, info derecha
   ════════════════════════════════════════════════════════════ */
@media (max-width: 900px) and (orientation: landscape) {
    :root { --hdr-h: 44px; --ftr-h: 26px; }

    .logo-desktop { display: none; }
    .logo-mobile  { display: block; }
    .header-inner { padding: 0 12px; }

    .player-page {
        padding: 6px 16px;
        overflow: hidden;
        align-items: center;
        justify-content: center;
    }

    /* Card horizontal centrado */
    .player-card {
        flex-direction: row;
        align-items: center;
        gap: 20px;
        padding: 12px 20px;
        width: min(680px, 96vw);
        max-height: calc(100vh - var(--hdr-h) - var(--ftr-h) - 12px);
        overflow: hidden;
    }

    /* Imagen izquierda */
    .player-left { flex-shrink: 0; display: flex; align-items: center; }
    .visualizer-wrap {
        width:  clamp(100px, 28vh, 180px);
        height: clamp(100px, 28vh, 180px);
    }

    /* Info derecha centrada */
    .player-right {
        flex: 1; min-width: 0;
        gap: 8px;
        align-items: center;
        overflow: hidden;
    }
    .player-info { width: 100%; text-align: center; overflow: hidden; }
    .player-info h2 {
        font-size: clamp(.9rem, 2.4vw, 1.1rem);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .player-location { justify-content: center; font-size: .8rem; overflow: hidden; }
    #playerLocation  { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .player-status   { justify-content: center; }
    .player-controls { justify-content: center; gap: 8px; }
    .ctrl-btn  { width: 38px; height: 38px; font-size: .82rem; }
    .ctrl-main { width: 50px; height: 50px; font-size: 1.1rem; }
    .player-extras { justify-content: center; gap: 8px; }
    .volume-slider { max-width: 100px; }
    .player-share-label { display: none; }
    .player-share-btns  { justify-content: center; gap: 6px; }
    .psb span { display: none; }
    .psb { padding: 7px; border-radius: 50%; width: 32px; height: 32px; justify-content: center; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — Móvil portrait muy pequeño (≤ 380px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 380px) and (orientation: portrait) {
    .visualizer-wrap {
        width:  clamp(110px, 38vw, 155px);
        height: clamp(110px, 38vw, 155px);
    }
    .player-info h2 { font-size: .95rem; }
    .ctrl-main { width: 52px; height: 52px; font-size: 1.1rem; }
    .ctrl-btn  { width: 38px; height: 38px; }
}