/* ============================================================
   Smart TV do Globo DAI (componente)

   Usada na home (bloco Globo DAI) e na página do Globo DAI. A programação
   ao vivo troca de cena conforme o público, com a interface de player por
   cima: "ao vivo" e "intervalo" no topo, marca-d'água da emissora, etiqueta
   de segmentação e a barra do intervalo. Marcação em includes/dai_tv.php;
   a troca das cenas em js/dai-tv.js. Largura e posição ficam com a página.
   ============================================================ */

.dai-tv {
    position: relative;
}

.dai-tv__aparelho {
    position: relative;
}

/* sombra no "chão" sob o pé */
.dai-tv__aparelho::after {
    content: "";
    position: absolute;
    left: 25%;
    right: 25%;
    bottom: -6px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(0, 0, 0, 0.22), transparent);
    filter: blur(3px);
}

.dai-tv__tela {
    position: relative;
    z-index: 1;
    aspect-ratio: 16 / 9;
    border: 6px solid #0d0d10;
    border-radius: 10px;
    background: #0d0d10;
    overflow: hidden;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.06),
        0 0 0 1px #1f1f24,
        0 28px 56px -12px rgba(16, 16, 20, 0.35);
}

/* reflexo sutil no vidro */
.dai-tv__tela::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background: linear-gradient(115deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0) 38%);
}

/* pé central: pescoço curto e base fina */
.dai-tv__pe {
    position: relative;
    width: 22%;
    height: 22px;
    margin: 0 auto;
    background: linear-gradient(180deg, #1f1f24 0%, #2c2c33 100%);
    clip-path: polygon(38% 0, 62% 0, 66% 70%, 100% 70%, 100% 100%, 0 100%, 0 70%, 34% 70%);
}

/* As cenas ficam empilhadas; só a ativa aparece */
.dai-cena {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.7s var(--tvrs-ease);
}

.dai-cena.is-ativo {
    opacity: 1;
}

.dai-cena img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.02);
    transition: transform 6s linear;
}

.dai-cena.is-ativo img {
    transform: scale(1.08);
}

/* Etiqueta de vidro com a segmentação, no canto de baixo à esquerda */
.dai-cena__alvo {
    position: absolute;
    left: 14px;
    bottom: 18px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: calc(100% - 80px);
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--tvrs-raio);
    background: rgba(12, 13, 26, 0.5);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: #ffffff;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s var(--tvrs-ease) 0.35s, transform 0.5s var(--tvrs-ease) 0.35s;
}

.dai-cena.is-ativo .dai-cena__alvo {
    opacity: 1;
    transform: none;
}

.dai-cena__rotulo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 16px;
}

.dai-cena__rotulo::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, #05a6ff, #8800f8);
}

.dai-cena__alvo strong {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 20px;
    white-space: nowrap;
}

.dai-cena__detalhe {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    line-height: 16px;
}

/* Interface do player por cima de todas as cenas */
.dai-tv__ui {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, transparent 24%),
        linear-gradient(0deg, rgba(0, 0, 0, 0.55) 0%, transparent 40%);
}

.dai-tv__topo {
    position: absolute;
    top: 12px;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dai-tv__aovivo {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px 2px 6px;
    border-radius: 4px;
    background: #e5252a;
    color: #ffffff;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 16px;
    text-transform: uppercase;
}

/* ponto que pisca, como no selo de transmissão */
.dai-tv__aovivo::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ffffff;
    animation: daiAoVivo 1.4s ease-in-out infinite;
}

@keyframes daiAoVivo {
    50% { opacity: 0.25; }
}

.dai-tv__intervalo {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 16px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* marca-d'água da emissora no canto, como na TV */
.dai-tv__marca {
    position: absolute;
    right: 14px;
    bottom: 18px;
    width: 26px;
    height: 26px;
    opacity: 0.85;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
}

/* Barra do intervalo: enche no tempo de cada cena */
.dai-tv__progresso {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.18);
}

.dai-tv__progresso i {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #05a6ff, #185cfb, #8800f8);
    transform: scaleX(0);
    transform-origin: left;
}

.dai-tv__progresso.esta-rodando i {
    animation: daiIntervalo var(--dai-intervalo, 3200ms) linear forwards;
}

@keyframes daiIntervalo {
    to { transform: scaleX(1); }
}

@media (max-width: 767.98px) {
    .dai-tv__tela {
        border-width: 4px;
        border-radius: 8px;
    }

    .dai-tv__pe {
        height: 16px;
    }

    .dai-cena__alvo {
        left: 8px;
        bottom: 12px;
        max-width: calc(100% - 56px);
        padding: 6px 10px;
    }

    .dai-cena__alvo strong {
        font-size: 0.8125rem;
        line-height: 18px;
    }

    .dai-cena__detalhe {
        display: none;
    }

    .dai-tv__marca {
        right: 8px;
        bottom: 12px;
        width: 20px;
        height: 20px;
    }
}

/* Menos movimento no sistema: a cena só troca, sem zoom nem piscar */
@media (prefers-reduced-motion: reduce) {
    .dai-tv__aovivo::before {
        animation: none;
    }

    .dai-cena img,
    .dai-cena.is-ativo img {
        transform: none;
        transition: none;
    }
}

/* ===== Tela com mídia própria (imagem parada ou vídeo), sem as cenas ===== */
.dai-tv__imagem,
.dai-tv__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #0d0d10;
}

/* botão de som no canto da tela, discreto como o de um player */
.dai-tv__som {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 5;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--tvrs-raio-pill, 999px);
    background: rgba(13, 13, 16, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #ffffff;
    font-family: var(--tvrs-fonte);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dai-tv__som:hover,
.dai-tv__som:focus-visible {
    background: rgba(13, 13, 16, 0.8);
}

/* Navegador deixou o vídeo mudo: o botão chama para ligar o som */
.dai-tv__som.is-chamando {
    border-color: transparent;
    background: var(--tvrs-azul, #185cfb);
    box-shadow: 0 0 0 0 rgba(24, 92, 251, 0.6);
}

.dai-tv__som.is-chamando:hover,
.dai-tv__som.is-chamando:focus-visible {
    background: #1450dc;
}

@media (prefers-reduced-motion: no-preference) {
    .dai-tv__som.is-chamando {
        animation: dai-som-chama 1.8s ease-out infinite;
    }
}

@keyframes dai-som-chama {
    0%   { box-shadow: 0 0 0 0 rgba(24, 92, 251, 0.6); }
    70%  { box-shadow: 0 0 0 10px rgba(24, 92, 251, 0); }
    100% { box-shadow: 0 0 0 0 rgba(24, 92, 251, 0); }
}
