/* Video Popup Widget Styles */
.video-popup-wrapper {
    position: relative;
    display: inline-block;
}

.video-popup-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.video-popup-btn:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.video-popup-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.video-popup-btn img {
    display: block;
    max-width: 100%;
    height: auto;
    transition: filter 0.3s ease;
}

.video-popup-btn:hover img {
    filter: brightness(1.1);
}

.video-popup-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-popup-modal.active {
    display: flex !important;
    opacity: 1;
}

.video-popup-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.8) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.video-popup-close {
    position: absolute;
    top: -50px;
    right: 0;
    color: white;
    font-size: 32px;
    cursor: pointer;
    z-index: 100000;
    line-height: 1;
    padding: 5px 10px;
    border-radius: 50%;
    transition: background-color 0.3s ease, transform 0.2s ease;
    user-select: none;
}

.video-popup-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.video-popup-iframe-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* Ratio 16:9 */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.video-popup-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

/* Loading spinner */
.video-popup-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
}

.video-popup-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid white;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .video-popup-content {
        width: 95%;
        margin: 0 auto;
    }
    
    .video-popup-close {
        top: -45px;
        font-size: 28px;
        right: 5px;
    }
}

@media (max-width: 480px) {
    .video-popup-content {
        width: 98%;
    }
    
    .video-popup-close {
        top: -40px;
        font-size: 24px;
        right: 0;
    }
    
    .video-popup-iframe-container {
        border-radius: 4px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .video-popup-modal {
        background: rgba(0, 0, 0, 0.95);
    }
    
    .video-popup-close {
        background-color: rgba(255, 255, 255, 0.1);
        border: 1px solid white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .video-popup-btn,
    .video-popup-btn img,
    .video-popup-modal,
    .video-popup-close {
        transition: none;
    }
    
    .video-popup-content {
        animation: none;
    }
    
    .video-popup-btn:hover {
        transform: none;
    }
}