/* Video Header System Styles */
.video-header-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: #000;
}

.video-header-container video {
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    object-position: center;
}

/* Controlli video minimali */
#videoControls {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    border-radius: 50px;
    padding: 12px 16px;
    transition: all 0.3s ease;
    opacity: 0.7;
}

#videoControls:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.5);
}

#videoControls button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

#videoControls button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

#videoControls i {
    font-size: 18px;
}

/* Controlli semplificati - solo play/pause e mute */
#videoControls {
    min-width: 80px; /* Larghezza fissa per 2 pulsanti */
}

#videoControls button {
    flex-shrink: 0; /* Previeni shrinking dei pulsanti */
}

/* Animazioni hover migliorate per controlli essenziali */
#videoControls button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

/* Overlay scuro per migliorare la leggibilità del contenuto */
.video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
    z-index: -1;
    pointer-events: none;
}

/* Assicuriamo che il contenuto principale sia sopra il video */
body {
    position: relative;
    z-index: 1;
}

/* Header navigation sopra il video */
.header-nav {
    position: relative;
    z-index: 100;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

/* Hero section con video di sfondo */
.hero-section {
    position: relative;
    z-index: 10;
    background: transparent;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #videoControls {
        bottom: 16px;
        right: 16px;
        padding: 10px 14px;
        gap: 10px;
    }
    
    #videoControls button {
        width: 36px;
        height: 36px;
    }
    
    #videoControls i {
        font-size: 16px;
    }
    
    #videoControls:hover #volumeSlider {
        width: 60px;
    }
}

/* Auto-hide controls after inactivity */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0.3; }
}

@keyframes fadeIn {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

.controls-auto-hide {
    animation: fadeOut 0.3s ease forwards;
}

.controls-show {
    animation: fadeIn 0.3s ease forwards;
}

/* Fallback background animations */
@keyframes slideRight {
    0% {
        transform: translateX(-100%) skewX(-12deg);
    }
    100% {
        transform: translateX(100vw) skewX(-12deg);
    }
}

.video-header-container .animate-pulse {
    animation: slideRight 8s ease-in-out infinite;
}

/* Ottimizzazioni video per rendering vivido e fluido */
.video-optimized {
    /* Hardware acceleration */
    transform: translate3d(0, 0, 0);
    will-change: transform, opacity, filter;
    backface-visibility: hidden;
    
    /* Rendering optimization */
    -webkit-font-smoothing: subpixel-antialiased;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    
    /* Vivacità colori */
    filter: contrast(1.1) saturate(1.1) brightness(1.05) hue-rotate(0deg);
    
    /* Smooth transitions */
    transition: filter 0.3s ease, transform 0.3s ease;
}

.video-optimized:hover {
    filter: contrast(1.15) saturate(1.15) brightness(1.08);
}

/* Ottimizzazioni performance specifiche per video */
@supports (backdrop-filter: blur(10px)) {
    .video-header-container {
        backdrop-filter: blur(0px);
    }
}

/* GPU rendering hints */
.video-header-container {
    contain: layout style paint;
    transform-style: preserve-3d;
}

/* Preload hints per performance */
.video-header-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 48%, rgba(255,255,255,0.03) 50%, transparent 52%);
    animation: shimmer 3s infinite;
    pointer-events: none;
    opacity: 0;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); opacity: 1; }
    50% { opacity: 0.5; }
    100% { transform: translateX(100%); opacity: 0; }
}

/* Ottimizzazioni cache e compressione */
.video-header-container video {
    /* Cache hints per browser */
    cache: force-cache;
    
    /* Compressione e ottimizzazioni */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    
    /* Smooth playback */
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
}

/* Loading indicator per video */
.video-loading {
    position: relative;
}

.video-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Ottimizzazioni per dispositivi ad alta densità */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    .video-optimized {
        filter: contrast(1.05) saturate(1.05) brightness(1.02);
    }
}