@import url("ps-player-modo.css");

:root {
    --ps-vembed-bar-h: 118px;
    --ps-vembed-stage-max-h: min(58vh, calc(100vh - var(--ps-vembed-bar-h) - 20px));
    --ps-vembed-h: calc(var(--ps-vembed-stage-max-h) + var(--ps-vembed-bar-h));
}

body.ps-vembed-ativo {
    padding-bottom: var(--ps-vembed-h);
}

@media (min-width: 1024px) {
    :root {
        --ps-vembed-stage-max-h: min(68vh, calc(100vh - var(--ps-vembed-bar-h) - 28px));
    }
}

@media (max-width: 768px) {
    :root {
        --ps-vembed-bar-h: 132px;
        --ps-vembed-stage-max-h: min(46vh, calc(100vh - var(--ps-vembed-bar-h) - 16px));
    }
}

.ps-vembed[hidden] {
    display: none !important;
}

.ps-vembed {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9985;
    display: flex;
    flex-direction: column;
    width: 100%;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--ps-text, #f4f4f5);
}

.ps-vembed-stage {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    max-height: var(--ps-vembed-stage-max-h);
    background: #000;
    border-top: 1px solid var(--ps-border, rgba(255, 255, 255, 0.08));
}

.ps-vembed-stage .ps-vembed-video,
.ps-vembed-stage .ps-vembed-embed-host {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    min-height: 0;
    margin: 0;
}

.ps-vembed-stage .ps-vembed-video[hidden],
.ps-vembed-stage .ps-vembed-embed-host[hidden] {
    display: none !important;
}

.ps-vembed-video {
    display: block;
    object-fit: contain;
    background: #000;
}

.ps-vembed-embed-host,
.ps-vplayer-embed-host {
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: #000;
    overflow: hidden;
}

.ps-vembed-fb-host,
.ps-vplayer-fb-host {
    align-items: center;
}

.ps-vembed-embed-host iframe,
.ps-vplayer-embed-host iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: 0;
}

.ps-vpl-badge {
    font-size: 0.65rem;
    font-style: normal;
    opacity: 0.65;
    font-weight: 500;
}

.ps-vembed-fb-host .fb-video,
.ps-vplayer-fb-host .fb-video {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
}

.ps-vembed-fb-iframe-wrap,
.ps-vembed-fb-sdk-wrap,
.ps-vplayer-fb-host .ps-vembed-fb-iframe-wrap,
.ps-vplayer-fb-host .ps-vembed-fb-sdk-wrap {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    background: #000;
}

.ps-vembed-fb-host iframe,
.ps-vembed-fb-host .fb-video iframe,
.ps-vplayer-fb-host iframe,
.ps-vplayer-fb-host .fb-video iframe {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    border: 0;
    display: block;
}

.ps-vembed-fb-host .fb-video,
.ps-vplayer-fb-host .fb-video {
    overflow: hidden;
}

/* Modo TV: cliques só no rodapé / playlist — não no vídeo */
.ps-vpl-tv .ps-vembed-stage,
.ps-vpl-tv .ps-vplayer-stage-wrap {
    pointer-events: none;
    cursor: default;
}

.ps-vpl-tv .ps-vembed-bar,
.ps-vpl-tv .ps-vplayer-bar,
.ps-vpl-tv .ps-vembed-queue-wrap {
    pointer-events: auto;
}

/* Modo TV: só controles do rodapé; recorta chrome do Facebook */
.ps-vpl-tv .ps-vembed-stage.ps-vembed-stage--fb,
.ps-vpl-tv .ps-vplayer-stage-wrap.ps-vembed-stage--fb {
    aspect-ratio: 16 / 9;
    height: auto;
}

.ps-vpl-tv .ps-vembed-stage--fb .ps-vembed-fb-iframe-wrap,
.ps-vpl-tv .ps-vembed-stage--fb .ps-vembed-fb-sdk-wrap,
.ps-vpl-tv .ps-vplayer-stage-wrap.ps-vembed-stage--fb .ps-vembed-fb-iframe-wrap,
.ps-vpl-tv .ps-vplayer-stage-wrap.ps-vembed-stage--fb .ps-vembed-fb-sdk-wrap {
    position: relative;
    overflow: hidden;
}

.ps-vpl-tv .ps-vembed-stage--fb iframe,
.ps-vpl-tv .ps-vembed-stage--fb .fb-video iframe,
.ps-vpl-tv .ps-vplayer-stage-wrap.ps-vembed-stage--fb iframe,
.ps-vpl-tv .ps-vplayer-stage-wrap.ps-vembed-stage--fb .fb-video iframe {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 112% !important;
    height: 128% !important;
    max-width: none !important;
    max-height: none !important;
    transform: translate(-50%, -54%);
}

.ps-vembed-stage.ps-vembed-stage--fb,
.ps-vplayer-stage-wrap.ps-vembed-stage--fb {
    aspect-ratio: auto;
    height: min(calc(100vw * 9 / 16 + 4.25rem), min(64vh, calc(100vh - var(--ps-vembed-bar-h, 118px) - 20px)));
    max-height: min(64vh, calc(100vh - var(--ps-vembed-bar-h, 118px) - 20px));
}

.ps-vpl-tv .ps-vembed-stage.ps-vembed-stage--fb,
.ps-vpl-tv .ps-vplayer-stage-wrap.ps-vembed-stage--fb {
    aspect-ratio: 16 / 9;
    height: auto;
    max-height: var(--ps-vembed-stage-max-h);
}

@media (min-width: 1024px) {
    .ps-vembed-stage.ps-vembed-stage--fb,
    .ps-vplayer-stage-wrap.ps-vembed-stage--fb {
        height: min(calc(100vw * 9 / 16 + 4.25rem), min(72vh, calc(100vh - var(--ps-vembed-bar-h, 118px) - 28px)));
        max-height: min(72vh, calc(100vh - var(--ps-vembed-bar-h, 118px) - 28px));
    }
}

.ps-vembed-queue-wrap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    max-height: min(40vh, 300px);
    background: var(--ps-bg-elevated, #18181f);
    border-top: 1px solid var(--ps-border, rgba(255, 255, 255, 0.08));
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
}

.ps-vembed-queue-wrap[hidden] {
    display: none !important;
}

.ps-vembed-queue-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--ps-border, rgba(255, 255, 255, 0.08));
}

.ps-vembed-queue-head h3 {
    margin: 0;
    font-size: 1rem;
}

.ps-vembed-tracks {
    list-style: none;
    margin: 0;
    padding: 0.5rem;
    overflow-y: auto;
    flex: 1;
}

.ps-vembed-track {
    display: grid;
    grid-template-columns: 28px 48px 1fr auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    cursor: pointer;
}

.ps-vembed-track:hover {
    background: var(--ps-bg-hover, #22222c);
}

.ps-vembed-track.is-active {
    background: rgba(124, 58, 237, 0.22);
}

.ps-vembed-track-poster {
    width: 48px;
    height: 32px;
    border-radius: 4px;
    object-fit: cover;
    background: #111;
}

.ps-vembed-track-title {
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ps-vembed-track-dur {
    font-size: 0.75rem;
    color: var(--ps-text-muted, #a1a1aa);
}

.ps-vembed-bar {
    flex-shrink: 0;
    position: relative;
    z-index: 3;
    background: var(--ps-bg-elevated, #18181f);
    border-top: 1px solid var(--ps-border, rgba(255, 255, 255, 0.08));
    padding: 0.35rem 0.75rem 0.5rem;
}

.ps-vembed-progress-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.ps-vembed-progress-wrap.ps-vpl-fb-iframe-only .ps-vembed-progress,
.ps-vembed-progress-wrap.ps-vpl-fb-iframe-only .ps-vembed-time {
    visibility: hidden;
    pointer-events: none;
}

.ps-vembed-progress-wrap.ps-vpl-fb-iframe-only::after {
    content: "Progresso no player do vídeo acima";
    flex: 1;
    text-align: center;
    font-size: 0.68rem;
    color: var(--ps-text-muted, #a1a1aa);
}

.ps-vplayer-progress-wrap.ps-vpl-fb-iframe-only .ps-vplayer-progress,
.ps-vplayer-progress-wrap.ps-vpl-fb-iframe-only .ps-vplayer-time {
    visibility: hidden;
    pointer-events: none;
}

.ps-vplayer-progress-wrap.ps-vpl-fb-iframe-only::after {
    content: "Progresso no player do vídeo acima";
    flex: 1;
    text-align: center;
    font-size: 0.68rem;
    color: var(--ps-text-muted, #a1a1aa);
}

.ps-vembed-time {
    font-size: 0.7rem;
    color: var(--ps-text-muted, #a1a1aa);
    min-width: 2.2rem;
}

.ps-vembed-progress {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
    cursor: pointer;
}

.ps-vembed-progress-fill {
    height: 100%;
    width: 0;
    background: var(--ps-accent, #7c3aed);
    border-radius: 2px;
}

.ps-vembed-bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ps-vembed-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1 1 120px;
}

.ps-vembed-poster {
    width: 40px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.ps-vembed-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ps-vembed-title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ps-vembed-artist {
    font-size: 0.72rem;
    color: var(--ps-text-muted, #a1a1aa);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ps-vembed-controls {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.ps-vembed-btn {
    border: none;
    background: transparent;
    color: var(--ps-text, #f4f4f5);
    padding: 0.35rem;
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ps-vembed-btn svg {
    width: 22px;
    height: 22px;
}

.ps-vembed-btn--play svg {
    width: 28px;
    height: 28px;
}

.ps-vembed-btn.is-active {
    color: var(--ps-accent, #7c3aed);
}

.ps-vembed-extra {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.ps-vembed-link,
.ps-vembed-icon-btn {
    border: none;
    background: transparent;
    color: var(--ps-text-muted, #a1a1aa);
    font-size: 0.72rem;
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    font-family: inherit;
    text-decoration: none;
}

.ps-vembed-link:hover,
.ps-vembed-icon-btn:hover {
    color: var(--ps-text, #f4f4f5);
}
