/* ==========================================================================
   Popup de Vídeo Automático - Effects Cursos
   ========================================================================== */

.video-popup-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Fundo com opacidade moderada permitindo ver o conteúdo atrás */
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.video-popup-backdrop.video-popup-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Transição suave de fechamento (Fade Out) */
.video-popup-backdrop.video-popup-closing {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease, visibility 0.3s ease !important;
}

/* Container do Popup ampliado com animação de fade e scale */
.video-popup-container {
    position: relative;
    width: 95%;
    max-width: 1180px;
    max-height: 90vh;
    background-color: #000000;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.12);
    transform: scale(0.96) translateY(8px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-popup-backdrop.video-popup-open .video-popup-container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.video-popup-backdrop.video-popup-closing .video-popup-container {
    transform: scale(0.96) translateY(8px) !important;
    opacity: 0 !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease !important;
}

/* 16:9 Aspect Ratio Wrapper for embed players (YouTube / Vimeo) */
.video-popup-responsive {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fallback for browsers without aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
    .video-popup-responsive {
        padding-top: 56.25%;
        height: 0;
    }
    .video-popup-responsive iframe,
    .video-popup-responsive > div,
    .video-popup-responsive video {
        position: absolute;
        top: 0;
        left: 0;
    }
}

.video-popup-responsive iframe,
.video-popup-responsive > div,
.video-popup-responsive video {
    width: 100% !important;
    height: 100% !important;
    border: none;
    display: block;
}

/* HTML5 Direct Video element styling */
.video-popup-html5-video {
    width: 100%;
    height: auto;
    max-height: 88vh;
    object-fit: contain;
    display: block;
    background: #000000;
}

/* Botão Fechar "X" */
.video-popup-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1001;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
    padding: 0;
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition: opacity 0.35s ease, visibility 0.35s ease, transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Oculta botão X e botão Play quando inativo ou sem foco no popup */
.video-popup-container.hide-controls .video-popup-close-btn {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(0.85);
}

.video-popup-close-btn:hover,
.video-popup-close-btn:focus-visible {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    background-color: rgba(220, 38, 38, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.08) !important;
}

.video-popup-close-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2.5;
}

/* Botão Central Play / Pause */
.video-popup-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    z-index: 1000;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
    padding: 0;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s ease, visibility 0.35s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, border-color 0.2s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.video-popup-play-btn:hover,
.video-popup-play-btn:focus-visible {
    background-color: rgba(0, 0, 0, 0.85);
    border-color: rgba(255, 255, 255, 0.85);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-popup-play-btn .icon-play {
    width: 28px;
    height: 28px;
    margin-left: 3px;
    display: block;
    fill: currentColor;
}

.video-popup-play-btn .icon-pause {
    width: 28px;
    height: 28px;
    display: none;
    fill: currentColor;
}

/* Quando o vídeo está reproduzindo (is-playing) */
.video-popup-play-btn.is-playing .icon-play {
    display: none;
}

.video-popup-play-btn.is-playing .icon-pause {
    display: block;
}

/* Oculta botão central junto com o botão X quando inativo ou fora do popup */
.video-popup-container.hide-controls .video-popup-play-btn {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.85);
}

@media (max-width: 640px) {
    .video-popup-backdrop {
        padding: 10px;
    }
    .video-popup-container {
        width: 100%;
        border-radius: 8px;
    }
    .video-popup-close-btn {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }
    .video-popup-close-btn svg {
        width: 18px;
        height: 18px;
    }
    .video-popup-play-btn {
        width: 52px;
        height: 52px;
    }
    .video-popup-play-btn .icon-play,
    .video-popup-play-btn .icon-pause {
        width: 22px;
        height: 22px;
    }
}
