@charset 'utf-8';

/* =========================================================
   Radio Player — conceito "now playing app"
   Uma única linguagem visual: capa da música desfocada como
   fundo, superfícies translúcidas consistentes, um acento
   ciano e tipografia Poppins. Sem Bootstrap.
   ========================================================= */

:root {
    --accent: #00e1e7;
    --accent-strong: #00b8bd;
    --accent-ink: #062a2c;
    --bg: #0b0e13;
    --text: #f4f6f8;
    --text-muted: rgba(244, 246, 248, 0.62);
    --surface: rgba(255, 255, 255, 0.06);
    --surface-strong: rgba(255, 255, 255, 0.12);
    --border: rgba(255, 255, 255, 0.12);
    --radius: 20px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    min-height: 100%;
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
.hidden { display: none; }
.text-uppercase { text-transform: uppercase; }
.text-capitalize { text-transform: capitalize; }

/* ---- fundo: capa da música desfocada + gradiente ---- */

.bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

#bgCover {
    position: absolute;
    inset: 0;
    background: url('../img/cover.png') center / cover no-repeat;
    filter: blur(64px) saturate(140%);
    transform: scale(1.4);
}

.bg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 10, 15, 0.5) 0%, rgba(8, 10, 15, 0.75) 55%, var(--bg) 100%);
}

/* ---- estrutura ---- */

.app {
    position: relative;
    z-index: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: calc(20px + env(safe-area-inset-top)) 20px 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.masthead {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ---- player ---- */

.player {
    width: 100%;
    max-width: 420px;
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.cover-album {
    width: min(68vw, 300px);
    aspect-ratio: 1 / 1;
    flex: none;
    border-radius: 24px;
    background: url('../img/cover.png') center / cover no-repeat;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
}

#currentCoverArt {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.player-info {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.24em;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff5a5f;
    box-shadow: 0 0 10px #ff5a5f;
    animation: live-pulse 1.6s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.8); }
}

#currentSong {
    margin: 16px 0 4px;
    font-size: clamp(24px, 6vw, 34px);
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

#currentArtist {
    margin: 0;
    font-size: clamp(14px, 3vw, 18px);
    font-weight: 500;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

/* ---- controles ---- */

.controls {
    margin-top: 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.control-cluster {
    display: flex;
    align-items: center;
    gap: 18px;
}

/* botões utilitários circulares, mesma família visual do play */
.ctrl-btn {
    width: 52px;
    height: 52px;
    flex: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.15s ease, opacity 0.3s ease;
}

.ctrl-btn:hover { background: var(--surface-strong); }
.ctrl-btn:active { transform: scale(0.94); }
.ctrl-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.play-btn {
    width: 76px;
    height: 76px;
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: var(--text);
    background: var(--surface-strong);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease, background 0.2s ease;
}

.play-btn:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.18);
}

.play-btn:active { transform: scale(0.96); }
.play-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.play-btn .fa-play { margin-left: 5px; }

/* estado do player (#buttonPlay): o script.js atualiza o texto
   (PLAY/PAUSAR/...), mas ele fica só para leitores de tela — o ícone
   do botão já comunica o estado visualmente */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- volume: botão circular + popover (escondido no celular: botões físicos) ---- */

.volume-wrap {
    display: none;
    position: relative;
}

@media (min-width: 576px) {
    .volume-wrap { display: flex; }
}

.volume-popover {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 220px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(11, 14, 19, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.vol-value {
    flex: none;
    min-width: 42px;
    text-align: right;
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    min-width: 0;
    height: 4px;
    border-radius: 2px;
    background: var(--surface-strong);
    cursor: pointer;
}

input[type=range]:focus { outline: none; }
input[type=range]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 225, 231, 0.2);
}

input[type=range]::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: var(--surface-strong);
}

input[type=range]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 225, 231, 0.2);
}

/* o botão da letra herda .ctrl-btn; o script.js controla opacity/data-toggle */

/* ---- próxima música da fila (AzuraCast, index_azura.html) ---- */

.up-next {
    margin-top: 24px;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px 10px 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.up-next.hidden { display: none; }

.up-next-label {
    flex: none;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.up-next-cover {
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 50%;
    background: url('../img/cover.png') center / cover no-repeat;
}

.up-next-info { min-width: 0; }

.up-next-song {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.up-next-artist {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- histórico ---- */

.historic {
    width: 100%;
    max-width: 880px;
    margin-top: 56px;
}

.section-title {
    margin: 0 0 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* minmax(0, 1fr) trava a coluna na largura do container — sem isso a track
   "auto" cresce até o max-content de títulos longos (nowrap) e estoura a
   tela no celular em vez de deixar o ellipsis agir */
.history-list {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
    .history-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

#historicSong article {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
}

.cover-historic {
    width: 60px;
    height: 60px;
    flex: none;
    border-radius: 14px;
    background: url('../img/cover.png') center / cover no-repeat;
}

.music-info { min-width: 0; }

.music-info .song {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-info .artist {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- modal de letra ---- */

#modalLyrics {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(5, 8, 12, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-card {
    width: min(560px, 100%);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #12161d;
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.6);
}

.modal-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

#lyricsSong {
    margin: 0;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-close {
    flex: none;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.modal-close:hover {
    background: var(--surface-strong);
    color: var(--text);
}

#lyric {
    padding: 20px 22px;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.9;
    color: var(--text-muted);
}

body.modal-open { overflow: hidden; }

/* ---- botão instalar PWA ---- */

.install-btn {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    right: 16px;
    z-index: 40;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(11, 14, 19, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background 0.2s ease;
}

.install-btn:hover { background: rgba(255, 255, 255, 0.12); }

/* celular: no topo o botão brigava com o nome da rádio (masthead centrado);
   vira uma pílula fixa na base da tela, na zona do polegar */
@media (max-width: 575px) {
    .install-btn {
        top: auto;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        bottom: calc(16px + env(safe-area-inset-bottom));
        padding: 11px 22px;
        background: rgba(11, 14, 19, 0.85);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    }

    /* reserva espaço no fim do conteúdo enquanto o botão existe,
       para a pílula fixa não cobrir o último card do histórico */
    body:has(.install-btn:not([hidden])) .app {
        padding-bottom: calc(96px + env(safe-area-inset-bottom));
    }
}

/* ---- desktop: capa à esquerda, informações à direita ---- */

@media (min-width: 900px) {
    .player {
        max-width: 880px;
        margin-top: 56px;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 64px;
    }

    .cover-album { width: 340px; }

    .player-info {
        max-width: 440px;
        align-items: flex-start;
        text-align: left;
    }

    .controls {
        flex-direction: row;
        gap: 18px;
    }
}

/* ---- modo clipe: o vídeo da música assume o lugar da capa ---- */

.cover-album { position: relative; }

.cover-album.is-clip {
    aspect-ratio: 16 / 9;
    width: min(100%, 480px);
}

.cover-album.is-clip #currentCoverArt { visibility: hidden; }

.cover-album iframe.clip-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: inherit;
}

.clip-toggle.is-active {
    color: var(--accent);
    border-color: var(--accent);
}
