/* ============================================
   Video Popup Modal Styles
   ============================================ */

/* Video Popup Overlay */
.video-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Close Button - Outside Video Container, Inside Overlay */
.video-popup-overlay .video-popup-close {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 99999 !important;
}

.video-popup-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

/* Video Popup Container */
.video-popup-container {
    position: relative;
    width: 85%;
    max-width: 1200px;
    height: 80vh;
    max-height: 675px;
    background: #000;
    border-radius: 12px;
    border: 3px solid #fff;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.video-popup-overlay.active .video-popup-container {
    transform: scale(1);
}

/* Close Button */
.video-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    font-size: 36px;
    font-weight: 400;
    cursor: pointer;
    z-index: 99999 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 50%;
    box-shadow: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.video-popup-close:hover {
    background: transparent !important;
    transform: scale(1.1);
    box-shadow: none !important;
}

.video-popup-close::before {
    content: '×';
    font-size: 60px !important;
    line-height: 1;
    color: #fff !important;
    font-weight: 300 !important;
}

/* Video Content */
.video-popup-content {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
}

.video-popup-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

/* Play Button Overlay */
.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
}

.video-play-overlay:hover {
    background: #fff;
    transform: translate(-50%, -50%) scale(1.1);
}

.video-play-overlay::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 20px solid #333;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    margin-left: 4px;
}

/* Video Thumbnail */
.video-popup-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-popup-thumbnail.hidden {
    display: none;
}

/* Ensure black background when thumbnail is hidden (for single webinar pages) */
.video-popup-content:has(.video-popup-thumbnail.hidden) {
    background: #000;
}

/* Fallback for browsers that don't support :has() */
.video-popup-thumbnail.hidden + .video-popup-video {
    background: #000;
}

/* Loading State */
.video-popup-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 18px;
    display: none;
}

.video-popup-loading.active {
    display: block;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .video-popup-container {
        width: 90%;
        height: 70vh;
    }
    
    .video-popup-close {
        top: 15px !important;
        right: 15px !important;
        width: 55px;
        height: 55px;
        font-size: 32px;
    }
    
    .video-play-overlay {
        width: 70px;
        height: 70px;
    }
    
    .video-play-overlay::after {
        border-left: 18px solid #333;
        border-top: 11px solid transparent;
        border-bottom: 11px solid transparent;
    }
    
}

@media (max-width: 768px) {
    .video-popup-container {
        width: 95%;
        height: 60vh;
        margin: 20px;
    }
    
    .video-popup-close {
        top: 10px !important;
        right: 10px !important;
        width: 50px;
        height: 50px;
        font-size: 28px;
    }
    
    .video-play-overlay {
        width: 60px;
        height: 60px;
    }
    
    .video-play-overlay::after {
        border-left: 15px solid #333;
        border-top: 9px solid transparent;
        border-bottom: 9px solid transparent;
    }
    
}

@media (max-width: 480px) {
    .video-popup-container {
        width: 98%;
        height: 50vh;
        margin: 10px;
        border-radius: 8px;
    }
    
    .video-popup-close {
        top: 8px !important;
        right: 8px !important;
        width: 45px;
        height: 45px;
        font-size: 24px;
    }
    
    .video-play-overlay {
        width: 50px;
        height: 50px;
    }
    
    .video-play-overlay::after {
        border-left: 12px solid #333;
        border-top: 7px solid transparent;
        border-bottom: 7px solid transparent;
    }
    
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .video-popup-container {
        height: 90vh;
        width: 80%;
    }
    
    .video-popup-close {
        top: 5px !important;
        right: 5px !important;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

/* Animation for smooth entrance */
@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.video-popup-overlay.active .video-popup-container {
    animation: popupFadeIn 0.3s ease-out;
}

/* Prevent body scroll when popup is open */
body.video-popup-open {
    overflow: hidden;
    padding-right: 17px; /* Prevent layout shift from scrollbar */
}

/* Video Popup Trigger Button */
.video-popup-trigger {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    transition: transform 0.3s ease;
    z-index: 10;
}

.video-popup-trigger:hover {
    transform: scale(1.05);
}

.video-popup-trigger img {
    max-width: 92px;
    height: auto;
    transition: transform 0.3s ease;
}

.video-popup-trigger:hover img {
    transform: scale(1.1);
}

/* Integration with existing video elements */
.video-section .video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    z-index: 10;
}

.video-section .video-play-btn:hover {
    background: #fff;
    transform: translate(-50%, -50%) scale(1.1);
}

.video-section .video-play-btn img {
    width: 30px;
    height: 30px;
}
