/* Página Ao Vivo — layout estilo YouTube (ao-vivo.js) */

.av {
    min-height: 80vh;
    padding: 5.5rem 0 3.5rem;
    background: #121212;
    color: #fff;
}
.av [hidden] { display: none !important; }

.av-ponto {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: #ff3b3b; flex: none;
    animation: av-pulsar 1.4s ease infinite;
}
@keyframes av-pulsar { 50% { opacity: .3; } }

.av-carregando { text-align: center; padding: 4rem 0; color: rgba(255,255,255,.45); }
.av-carregando i { display: inline-block; animation: av-girar 1s linear infinite; }
@keyframes av-girar { to { transform: rotate(360deg); } }

/* ── Botões ─────────────────────────────────────────────────────────── */
.av-btn-principal, .av-btn-pilula {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .6rem 1.1rem; border-radius: 999px;
    font: 600 .88rem 'DM Sans', sans-serif;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.av-btn-principal { background: var(--primary); color: #1a1a1a; border: none; }
.av-btn-principal:hover { background: var(--primary-light); }
.av-btn-pilula { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.14); }
.av-btn-pilula:hover { background: rgba(255,255,255,.14); }

/* ── AO VIVO: layout ────────────────────────────────────────────────── */
.av-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1.5rem;
    align-items: start;
}

/* Palco 16:9 */
.av-palco {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}
.av-palco iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.av-palco:fullscreen { border-radius: 0; }

.av-palco-capa {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
    background: radial-gradient(circle at 50% 40%, #3b2f10 0%, #121212 70%);
    text-align: center; padding: 1rem;
}
.av-palco-capa img { width: clamp(56px, 12%, 110px); }
.av-palco-nome { font-family: 'Bunya', sans-serif; font-size: clamp(1.1rem, 3vw, 2rem); }
.av-ondas { display: flex; align-items: flex-end; gap: 5px; height: 36px; }
.av-ondas i {
    width: 6px; border-radius: 3px; background: var(--primary);
    animation: av-onda 1.1s ease-in-out infinite;
}
.av-ondas i:nth-child(2) { animation-delay: .15s; } .av-ondas i:nth-child(3) { animation-delay: .3s; }
.av-ondas i:nth-child(4) { animation-delay: .45s; } .av-ondas i:nth-child(5) { animation-delay: .3s; }
.av-ondas i:nth-child(6) { animation-delay: .15s; } .av-ondas i:nth-child(7) { animation-delay: .05s; }
@keyframes av-onda { 0%, 100% { height: 20%; } 50% { height: 100%; } }
.av-palco.pausado .av-ondas i { animation-play-state: paused; }

/* "Toque para ouvir" antes do primeiro play */
.av-palco-iniciar {
    position: absolute; inset: 0; z-index: 2;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem;
    border: none; background: rgba(0,0,0,.45); color: #fff;
    font: 600 1rem 'DM Sans', sans-serif; cursor: pointer;
}
.av-palco-iniciar span {
    width: 76px; height: 76px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: #ff3b3b; font-size: 2rem;
    box-shadow: 0 8px 30px rgba(0,0,0,.5);
    transition: transform .15s;
}
.av-palco-iniciar:hover span { transform: scale(1.06); }
.av-palco.tocou .av-palco-iniciar { display: none; }

/* Barra de controles por cima do palco */
.av-controles {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
    display: flex; align-items: center; gap: .35rem;
    padding: 2.5rem .75rem .6rem;
    background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
    transition: opacity .25s;
}
/* No PC some enquanto toca e volta ao passar o mouse (como no YouTube) */
@media (hover: hover) {
    .av-palco.tocou:not(.pausado):not(:hover):not(:focus-within) .av-controles { opacity: 0; }
}
.av-palco:not(.tocou) .av-controles { opacity: 0; pointer-events: none; }

.av-ctrl {
    width: 40px; height: 40px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; border-radius: 50%; background: none; color: #fff;
    font-size: 1.35rem; cursor: pointer;
}
.av-ctrl:hover { background: rgba(255,255,255,.12); }
.av-ctrl.desligado { color: rgba(255,255,255,.45); }

.av-volume { display: flex; align-items: center; }
.av-volume input {
    --pct: 80%;
    -webkit-appearance: none; appearance: none;
    width: 80px; height: 4px; border-radius: 2px; cursor: pointer;
    background: linear-gradient(to right, #fff var(--pct), rgba(255,255,255,.3) var(--pct));
}
.av-volume input::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; }
.av-volume input::-moz-range-thumb { width: 13px; height: 13px; border: none; border-radius: 50%; background: #fff; }

.av-selo-vivo {
    display: inline-flex; align-items: center; gap: .4rem;
    margin-left: .35rem; padding: .2rem .6rem; border-radius: 4px;
    background: #cc0000; font: 700 .75rem 'DM Sans', sans-serif; letter-spacing: .04em;
}
.av-selo-vivo .av-ponto { background: #fff; width: 7px; height: 7px; }
.av-estado { font-size: .8rem; color: rgba(255,255,255,.75); margin-left: .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av-espaco { flex: 1; }

/* Título e "canal" abaixo do palco */
.av-info { padding: .9rem .1rem 0; }
.av-info h1 { font-size: clamp(1.15rem, 2.4vw, 1.45rem); line-height: 1.3; margin-bottom: .35rem; }
.av-info-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem; font-size: .88rem; color: rgba(255,255,255,.6); }
.av-vivo-txt { display: inline-flex; align-items: center; gap: .4rem; color: #ff5c5c; font-weight: 600; }
.av-canal { display: flex; align-items: center; gap: .75rem; margin-top: .9rem; }
.av-canal-logo { width: 40px; height: 40px; border-radius: 50%; background: #fff; padding: 4px; object-fit: contain; }
.av-canal-nome { display: flex; flex-direction: column; margin-right: auto; }
.av-canal-nome strong { font-size: .95rem; }
.av-canal-nome span { font-size: .78rem; color: rgba(255,255,255,.5); }

/* Mensagens (coluna da direita) */
.av-mensagens {
    position: sticky; top: 5.5rem;
    display: flex; flex-direction: column;
    height: min(78vh, 640px);
    border: 1px solid rgba(255,255,255,.1); border-radius: 12px;
    background: #181818;
    overflow: hidden;
}
.av-mensagens-titulo {
    display: flex; align-items: center; gap: .5rem;
    padding: .85rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08);
    font-weight: 600;
}
.av-lista { flex: 1; overflow-y: auto; padding: .5rem .25rem; }
.av-lista-vazia { padding: 2rem 1rem; text-align: center; font-size: .88rem; color: rgba(255,255,255,.4); }
.av-msg { display: flex; gap: .65rem; padding: .5rem .75rem; border-radius: 8px; }
.av-msg:hover { background: rgba(255,255,255,.04); }
.av-msg-avatar {
    width: 28px; height: 28px; flex: none; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700;
}
.av-msg-topo { display: flex; align-items: baseline; gap: .5rem; font-size: .82rem; }
.av-msg-topo strong { color: rgba(255,255,255,.75); }
.av-msg-topo span { color: rgba(255,255,255,.35); font-size: .72rem; }
.av-msg-texto { font-size: .9rem; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }

.av-form { display: flex; flex-direction: column; gap: .5rem; padding: .75rem; border-top: 1px solid rgba(255,255,255,.08); }
.av-input {
    width: 100%; padding: .6rem .75rem; border-radius: 8px;
    border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.05);
    color: #fff; font: .9rem 'DM Sans', sans-serif; resize: none;
}
.av-input:focus { outline: none; border-color: rgba(239,180,23,.5); }
.av-enviar {
    align-self: flex-end;
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .5rem 1.1rem; border: none; border-radius: 999px;
    background: var(--primary); color: #1a1a1a;
    font: 700 .85rem 'DM Sans', sans-serif; cursor: pointer;
}
.av-enviar:disabled { opacity: .5; cursor: wait; }
.av-form-aviso { font-size: .82rem; color: #4ade80; }
.av-form-aviso.erro { color: #f87171; }

/* ── FORA DO AR ─────────────────────────────────────────────────────── */
.av-proxima {
    display: grid; grid-template-columns: 300px 1fr; gap: 2rem; align-items: center;
    padding: 1.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(239,180,23,.13), rgba(255,255,255,.03) 55%);
    border: 1px solid rgba(239,180,23,.15);
}
.av-proxima-capa {
    position: relative; aspect-ratio: 1;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: radial-gradient(circle at 50% 40%, #4a3a12, #161616 75%);
}
.av-proxima-capa img { width: 38%; }
.av-selo-off {
    position: absolute; left: 12px; bottom: 12px;
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .25rem .65rem; border-radius: 999px;
    background: rgba(0,0,0,.6); font-size: .75rem; color: rgba(255,255,255,.75);
}
.av-sobretitulo { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); margin-bottom: .35rem; }
.av-proxima-info h1 { font-family: 'Bunya', sans-serif; font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.15; }
.av-proxima-quando { margin-top: .35rem; color: rgba(255,255,255,.7); }

.av-contagem { display: flex; gap: .6rem; margin: 1.25rem 0; }
.av-contagem div {
    min-width: 66px; padding: .55rem .4rem;
    border-radius: 10px; background: rgba(0,0,0,.35);
    text-align: center;
}
.av-contagem strong { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.av-contagem span { font-size: .7rem; color: rgba(255,255,255,.5); text-transform: uppercase; letter-spacing: .05em; }
.av-contagem.chegou strong { color: var(--primary); }

.av-acoes { display: flex; flex-wrap: wrap; gap: .5rem; }
.av-dica { margin-top: 1rem; font-size: .82rem; color: rgba(255,255,255,.45); display: flex; gap: .4rem; align-items: center; }

.av-secao { font-size: 1.15rem; font-weight: 600; margin: 2.25rem 0 .9rem; }
.av-secao-topo { display: flex; align-items: baseline; justify-content: space-between; }
.av-secao-topo a { color: var(--primary); font-size: .88rem; text-decoration: none; display: inline-flex; align-items: center; gap: .2rem; }

.av-cultos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.av-culto {
    display: flex; align-items: center; gap: .85rem;
    padding: .9rem 1rem; border-radius: 12px;
    background: #1b1b1b; border: 1px solid rgba(255,255,255,.07);
}
.av-culto i { font-size: 1.5rem; color: var(--primary); }
.av-culto strong { display: block; font-size: .92rem; }
.av-culto span { font-size: .8rem; color: rgba(255,255,255,.5); }

.av-recentes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.av-recente { color: #fff; text-decoration: none; min-width: 0; }
.av-recente-capa { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; margin-bottom: .55rem; background: #222; }
.av-recente-capa > img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.av-recente:hover .av-recente-capa > img { transform: scale(1.04); }
.av-recente-gerada {
    width: 100%; height: 100%; padding: 12%;
    display: flex; flex-direction: column; justify-content: space-between;
}
.av-recente-gerada img { width: 30%; }
.av-recente-gerada span { font-family: 'Bunya', sans-serif; font-weight: 700; font-size: clamp(.8rem, 1.5vw, 1.05rem); text-transform: uppercase; line-height: 1.15; }
.av-paleta-0 { background: linear-gradient(135deg, #EFB417, #7a5200); }
.av-paleta-1 { background: linear-gradient(135deg, #b91c1c, #2a0a0a); }
.av-paleta-2 { background: linear-gradient(135deg, #0f766e, #0b1f1e); }
.av-paleta-3 { background: linear-gradient(135deg, #4338ca, #14123a); }
.av-recente-duracao {
    position: absolute; right: 6px; bottom: 6px;
    padding: .1rem .4rem; border-radius: 4px;
    background: rgba(0,0,0,.8); font-size: .72rem; font-weight: 600;
}
.av-recente-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.35); font-size: 2rem;
    opacity: 0; transition: opacity .2s;
}
.av-recente:hover .av-recente-play { opacity: 1; }
.av-recente strong {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    font-size: .9rem; line-height: 1.3; margin-bottom: .15rem;
}
.av-recente > span { font-size: .78rem; color: rgba(255,255,255,.5); }

/* ── Aviso "Começou!" ───────────────────────────────────────────────── */
.av-aviso {
    position: fixed; left: 50%; bottom: 1.25rem; z-index: 400;
    transform: translate(-50%, 150%);
    display: flex; align-items: center; gap: .85rem;
    width: max-content; max-width: calc(100vw - 2rem);
    padding: .75rem .85rem .75rem 1.1rem;
    border-radius: 14px;
    background: #232323; color: #fff;
    border: 1px solid rgba(255,59,59,.45);
    box-shadow: 0 12px 40px rgba(0,0,0,.6);
    transition: transform .3s ease;
}
.av-aviso.visivel { transform: translate(-50%, 0); }
.av-aviso div { display: flex; flex-direction: column; min-width: 0; }
.av-aviso div span { font-size: .82rem; color: rgba(255,255,255,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av-aviso-fechar { border: none; background: none; color: rgba(255,255,255,.6); font-size: 1.1rem; cursor: pointer; padding: .3rem; }

/* ── Celular ────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
    .av-layout { grid-template-columns: 1fr; gap: 0; }
    /* palco "gruda" no topo enquanto rola as mensagens, como no app do YouTube */
    .av-principal { display: contents; }
    .av-palco {
        position: sticky; top: var(--av-topo, 64px); z-index: 20;  /* logo abaixo do menu (ao-vivo.js mede) */
        margin: 0 -1.5rem; border-radius: 0;
    }
    .av-info { padding-bottom: 1rem; }
    .av-mensagens { position: static; height: auto; max-height: none; }
    .av-lista { max-height: 50vh; }

    .av-proxima { grid-template-columns: 1fr; gap: 1.25rem; padding: 1.1rem; }
    .av-proxima-capa { aspect-ratio: 16 / 9; }
    .av-proxima-capa img { width: 22%; }
    .av-recentes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
    .av { padding-top: 4.5rem; }
    .av-volume input { display: none; }
    .av-contagem div { min-width: 0; flex: 1; }
    .av-acoes > * { flex: 1 1 100%; }
}
