/*
 * Player de aula da Lari Decola.
 *
 * O vídeo continua no YouTube; o que muda é quem desenha os controles.
 * O quadro do YouTube entra com controls=0 e sem receber mouse, e tudo que
 * o aluno vê e clica é feito aqui.
 *
 * Por que o quadro não recebe mouse: passando o mouse sobre ele, o YouTube
 * reexibe o título, o ícone de link e o logo. Sem evento de mouse, nada disso
 * aparece. Os comandos chegam ao vídeo pela API oficial, não pelo clique.
 *
 * A capa existe porque o estado "ainda não começou" do YouTube mostra a marca
 * dele de qualquer jeito, com ou sem mouse. Ela cobre só esse momento e some
 * no primeiro play.
 */

.lp-player {
    position: relative;
    width: 100%;
    background: #000;
    overflow: hidden;
    user-select: none;
}

/* ---------------------------------------------------------------- palco */

.lp-stage {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;   /* 16:9 sem depender de JavaScript */
    height: 0;
    background: #000;
}

.lp-stage > iframe,
.lp-stage > .lp-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;

    /* O clique nunca chega ao YouTube: é isso que mantém o quadro limpo.
       Quem comanda a reprodução é a barra de controles, pela API. */
    pointer-events: none;
}

/* ----------------------------------------------------------------- capa */

.lp-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    cursor: pointer;
    background-color: #000;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .25s ease;
}

.lp-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,.45), rgba(0,0,0,.05) 45%);
}

.lp-cover-play {
    position: relative;
    z-index: 1;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--primary-600, #F4611B);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    transition: transform .18s ease, background-color .18s ease;
}

.lp-cover:hover .lp-cover-play {
    transform: scale(1.08);
    background: var(--primary-700, #D64F0F);
}

.lp-cover-play svg { width: 30px; height: 30px; margin-left: 4px; }

.lp-player.lp-iniciado .lp-cover { opacity: 0; pointer-events: none; }

/* ------------------------------------------------------- clique no vídeo */

/* Uma camada transparente só para pausar e despausar clicando no vídeo,
   como o aluno espera. Ela fica abaixo da barra e acima do quadro. */
.lp-clique {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: transparent;
    border: 0;
    padding: 0;
    display: none;
}

.lp-player.lp-iniciado .lp-clique { display: block; }

.lp-aviso {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    color: #fff;
    text-align: center;
    padding: 1rem;
}

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

.lp-barra {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2.25rem .75rem .6rem;
    background: linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,0));
    display: flex;
    align-items: center;
    gap: .55rem;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}

.lp-player.lp-iniciado.lp-ativo .lp-barra,
.lp-player.lp-iniciado.lp-pausado .lp-barra {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.lp-btn {
    background: transparent;
    border: 0;
    padding: .25rem;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    flex-shrink: 0;
    transition: background-color .15s ease;
}

.lp-btn:hover { background: rgba(255,255,255,.16); }
.lp-btn svg { width: 20px; height: 20px; display: block; }
.lp-btn:focus-visible { outline: 2px solid var(--primary-400, #F68C52); outline-offset: 1px; }

.lp-tempo {
    color: #fff;
    font-size: .75rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
    opacity: .9;
}

/* ------------------------------------------------------------- progresso */

.lp-progresso {
    flex: 1 1 auto;
    height: 16px;
    display: flex;
    align-items: center;
    cursor: pointer;
    min-width: 60px;
}

.lp-trilho {
    position: relative;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,.3);
    transition: height .15s ease;
}

.lp-progresso:hover .lp-trilho { height: 6px; }

.lp-carregado,
.lp-tocado {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 2px;
}

.lp-carregado { background: rgba(255,255,255,.35); }
.lp-tocado    { background: var(--primary-600, #F4611B); }

.lp-bolinha {
    position: absolute;
    top: 50%;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #fff;
    transform: translate(-50%, -50%) scale(0);
    transition: transform .15s ease;
}

.lp-progresso:hover .lp-bolinha { transform: translate(-50%, -50%) scale(1); }

/* ---------------------------------------------------------------- volume */

.lp-volume { display: flex; align-items: center; gap: .2rem; flex-shrink: 0; }

.lp-volume-trilho {
    width: 0;
    opacity: 0;
    transition: width .2s ease, opacity .2s ease;
    overflow: hidden;
}

.lp-volume:hover .lp-volume-trilho,
.lp-volume:focus-within .lp-volume-trilho { width: 62px; opacity: 1; }

.lp-volume-trilho input {
    width: 62px;
    accent-color: var(--primary-600, #F4611B);
    cursor: pointer;
    display: block;
}

/* --------------------------------------------------------------- rotação */

.lp-velocidade {
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    padding: .25rem .4rem;
    min-width: 34px;
}

/* ------------------------------------------------------------ tela cheia */

.lp-player:fullscreen { background: #000; display: flex; align-items: center; }
.lp-player:fullscreen .lp-stage { padding-bottom: 0; height: 100vh; width: 100%; }

/* ------------------------------------------------------------- celulares */

@media (max-width: 575.98px) {
    .lp-barra { padding: 1.8rem .4rem .45rem; gap: .3rem; }
    .lp-tempo { font-size: .68rem; }
    .lp-btn svg { width: 18px; height: 18px; }
    .lp-cover-play { width: 60px; height: 60px; }
    .lp-cover-play svg { width: 24px; height: 24px; }

    /* Sem hover no toque: o controle de volume do aparelho já resolve. */
    .lp-volume { display: none; }
}
