/* Optimized Video Popup Styles with Hardware Acceleration */
.video-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #EADBC8; /* Light cream background as requested */
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
    /* Hardware acceleration */
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    /* Contain paint for better performance */
    contain: paint;
    /* Optimize for compositing */
    isolation: isolate;
    /* Gold gradient overlay */
    background-image: linear-gradient(135deg, 
        rgba(184, 148, 31, 0.2) 0%, 
        rgba(248, 242, 235, 0.1) 50%, 
        rgba(184, 148, 31, 0.05) 100%
    );
    /* Soft blur effect */
    backdrop-filter: blur(3px);
}

.video-popup.show {
    opacity: 1;
    transform: translateZ(0) scale(1);
}

.close-video {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    color: var(--white);
    cursor: pointer;
    z-index: 10001;
    background: var(--accent-gold); /* Using theme accent color */
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    /* Hardware acceleration for button */
    -webkit-transform: translateZ(1);
    backface-visibility: hidden;
    /* Subtle shadow matching theme */
    box-shadow: 0 4px 15px rgba(184, 148, 31, 0.3);
}

.close-video:hover {
    background: rgba(184, 148, 31, 1);
    transform: scale(1.1);
    -webkit-transform: translateZ(1) scale(1.1);
}

/* Video Container Wrapper */
.video-container-wrapper {
    position: relative;
    max-width: 50%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Video Loading Overlay - positioned over video area */
.video-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(234, 219, 200, 0.95);
    border-radius: 15px;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.video-loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(184, 148, 31, 0.3);
    border-top: 4px solid var(--accent-gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-text {
    font-size: 1.2rem;
    font-family: 'Montserrat', sans-serif;
    color: var(--text-charcoal);
    text-align: center;
    margin: 0;
    opacity: 0.8;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Video Play Overlay - shows when autoplay is prevented */
.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    z-index: 5;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.video-play-overlay:hover {
    background: rgba(0, 0, 0, 0.7);
}

.play-button {
    width: 80px;
    height: 80px;
    background: rgba(184, 148, 31, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    margin-bottom: 15px;
    transition: transform 0.3s ease, background 0.3s ease;
}

.video-play-overlay:hover .play-button {
    transform: scale(1.1);
    background: rgba(184, 148, 31, 1);
}

.play-text {
    font-size: 1.2rem;
    font-family: 'Montserrat', sans-serif;
    color: white;
    text-align: center;
    margin: 0;
    opacity: 0.9;
}

#introVideo {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(31, 41, 55, 0.3); /* Using theme colors with shadow */
    border: 3px solid var(--accent-gold); /* Using theme accent color */
    object-fit: contain; /* Changed from cover to contain to preserve aspect ratio */
    cursor: pointer; /* Show pointer cursor to indicate clickable */
    /* Hardware acceleration */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    /* Optimize for rendering performance */
    contain: paint;
    will-change: transform;
    isolation: isolate;
}

/* Optimized animations */
@keyframes optimizedShow {
    0% {
        opacity: 0;
        transform: translateZ(0) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateZ(0) scale(1);
    }
}

@keyframes optimizedHide {
    0% {
        opacity: 1;
        transform: translateZ(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateZ(0) scale(0.8);
    }
}

.video-popup.show {
    animation: optimizedShow 0.2s ease-out;
}

.video-popup.hide {
    animation: optimizedHide 0.15s ease-in;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .close-video {
        top: 15px;
        right: 15px;
        font-size: 1.5rem;
        width: 40px;
        height: 40px;
    }
    
    .video-container-wrapper {
        max-width: 90% !important;
        max-height: 80% !important;
    }
    
    #introVideo {
        max-width: 100% !important;
        max-height: 100% !important;
        width: auto !important;
        height: auto !important;
        border-radius: 10px;
    }
    
    .video-loading-overlay,
    .video-play-overlay {
        border-radius: 10px;
    }
    
    .play-button {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    .loading-text,
    .play-text {
        font-size: 1rem;
    }
}

/* Small mobile optimizations */
@media (max-width: 480px) {
    .video-container-wrapper {
        max-width: 95% !important;
        max-height: 85% !important;
    }
    
    #introVideo {
        max-width: 100% !important;
        max-height: 100% !important;
        border-radius: 8px;
    }
    
    .close-video {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
    
    .play-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .loading-text,
    .play-text {
        font-size: 0.9rem;
    }
}
