/**
 * Hero Video Background CSS
 * 
 * Responsive video background styling for the hero banner section
 * Handles desktop/mobile video display, controls, and progressive enhancement
 * 
 * Author: Development Team
 * Date: July 22, 2025
 */

/* ==================================================
   Hero Video Container & Background
   ================================================== */

.hero-banner {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.hero-banner.has-video-background {
    background-image: none !important; /* Remove static image when video is active */
}

.hero-video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.hero-video-background {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transform: translate(-50%, -50%);
    transition: opacity 0.8s ease-in-out;
    opacity: 0;
}

.hero-video-background.loaded {
    opacity: 1;
}

/* Mobile video handling - crops desktop video smartly */
@media (max-width: 767px) {
    /* Desktop video cropped for mobile */
    .hero-video-background.desktop-only-video {
        object-position: center center; /* Focus on subject area */
        width: 100%;
        height: 180%; /* Scale up slightly to ensure full coverage on mobile */
        min-width: 100vw;
        min-height: 100vh;
    }
    
    /* Mobile-specific video (when provided) */
    .hero-video-background.has-mobile-video {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center center;
    }
}

/* ==================================================
   Content Overlay & Z-Index Management
   ================================================== */

.hero-banner .content-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hero-banner .cm-row {
    position: relative;
    z-index: 11;
}

.hero-banner h1,
.hero-banner .btn_2 {
    position: relative;
    z-index: 12;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ==================================================
   Video Controls (Bottom Right)
   ================================================== */

.hero-video-controls {
    position: absolute;
    bottom: 30px;
    right: 30px;
    z-index: 15;
    display: flex;
    gap: 12px;
    align-items: center;
}

.hero-video-control-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.8);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hero-video-control-btn:hover {
    background: rgba(179, 62, 150, 0.8); /* Brand pink on hover */
    border-color: rgba(179, 62, 150, 1);
    transform: scale(1.05);
}

.hero-video-control-btn:active {
    transform: scale(0.95);
}

.hero-video-control-btn svg,
.hero-video-control-btn i {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Mute button specific styling */
.hero-video-control-btn.mute-btn.pulsing {
    animation: pulseAttention 2s ease-in-out infinite;
    background: rgba(179, 62, 150, 0.8);
    border-color: rgba(179, 62, 150, 1);
}

@keyframes pulseAttention {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(179, 62, 150, 0.4);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 0 0 8px rgba(179, 62, 150, 0);
    }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .hero-video-control-btn.mute-btn.pulsing {
        animation: none;
        background: rgba(179, 62, 150, 0.9);
        border-color: rgba(179, 62, 150, 1);
    }
}

/* ==================================================
   Loading States & Transitions
   ================================================== */

.hero-banner .mobile-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    transition: opacity 0.8s ease-in-out;
}

.hero-banner.has-video-background .mobile-bg {
    opacity: 0;
    pointer-events: none;
}

.hero-banner .mobile-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}

/* Video loading indicator */
.hero-video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: rgba(179, 62, 150, 0.8);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hero-video-loading.show {
    opacity: 1;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ==================================================
   Mobile Responsive Adjustments
   ================================================== */

@media (max-width: 768px) {
    .hero-video-controls {
        bottom: 20px;
        right: 20px;
        gap: 10px;
    }
    
    .hero-video-control-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .hero-video-control-btn svg,
    .hero-video-control-btn i {
        width: 18px;
        height: 18px;
    }
    
    /* Ensure touch targets are at least 44px */
    .hero-video-control-btn::after {
        content: '';
        position: absolute;
        top: -2px;
        left: -2px;
        right: -2px;
        bottom: -2px;
        min-width: 44px;
        min-height: 44px;
    }
}

@media (max-width: 480px) {
    .hero-video-controls {
        bottom: 15px;
        right: 15px;
        gap: 8px;
    }
    
    .hero-video-control-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
        border-width: 1px;
    }
    
    .hero-video-control-btn svg,
    .hero-video-control-btn i {
        width: 16px;
        height: 16px;
    }
}

/* ==================================================
   Accessibility & High Contrast Mode
   ================================================== */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hero-video-control-btn {
        background: rgba(0, 0, 0, 0.9);
        border-color: #ffffff;
        backdrop-filter: none;
    }
    
    .hero-video-control-btn:hover {
        background: #ffffff;
        color: #000000;
    }
}

/* Focus states for keyboard navigation */
.hero-video-control-btn:focus-visible {
    outline: 3px solid rgba(179, 62, 150, 0.8);
    outline-offset: 2px;
}

/* ==================================================
   Performance Optimizations
   ================================================== */

/* GPU acceleration for smooth animations */
.hero-video-background,
.hero-video-controls,
.hero-video-control-btn {
    will-change: transform, opacity;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

/* Optimize for mobile devices */
@media (max-width: 767px) {
    .hero-video-background {
        will-change: auto; /* Reduce GPU usage on mobile */
    }
}

/* ==================================================
   Fallback Styles for Older Browsers
   ================================================== */

/* Fallback for browsers without backdrop-filter support */
@supports not (backdrop-filter: blur(8px)) {
    .hero-video-control-btn {
        background: rgba(0, 0, 0, 0.8);
    }
}

/* Fallback for browsers without object-fit support */
@supports not (object-fit: cover) {
    .hero-video-background {
        background-size: cover;
        background-position: center center;
        background-repeat: no-repeat;
    }
}

/* ==================================================
   Print Styles
   ================================================== */

@media print {
    .hero-video-container,
    .hero-video-controls,
    .hero-video-loading {
        display: none;
    }
    
    .hero-banner.has-video-background {
        background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1 1"><rect width="1" height="1" fill="%23333"/></svg>') !important;
    }
}