/**
 * Video Optimization CSS
 * Video performansını artırmak için CSS optimizasyonları
 */

/* Video container optimizasyonları */
.video-background {
    position: relative;
    overflow: hidden;
    background-color: #000; /* Video yüklenene kadar siyah arka plan */
}

/* Lazy video loading states */
.lazy-video {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-video.loaded {
    opacity: 1;
}

/* Video placeholder (yükleme sırasında gösterilecek resim) */
.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.video-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Video yüklendiğinde placeholder'ı gizle */
.video-background video.loaded ~ .video-placeholder {
    opacity: 0;
    pointer-events: none;
}

/* Video optimizasyonları */
video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    will-change: transform; /* GPU hızlandırma */
    transform: translateZ(0); /* Hardware acceleration */
    backface-visibility: hidden; /* Performance optimization */
}

/* Mobil optimizasyonları */
@media (max-width: 768px) {
    .video-background {
        /* Mobilde video yerine resim kullan */
        background-image: var(--mobile-bg-image, url('../img/mobile-hero-bg.jpg'));
        background-size: cover;
        background-position: center;
    }
    
    .video-background video {
        display: none; /* Mobilde video gizle */
    }
    
    /* Yavaş bağlantıda video yerine resim */
    .slow-connection .video-background video {
        display: none;
    }
    
    .slow-connection .video-background {
        background-image: var(--fallback-bg-image, url('../img/hero-bg.jpg'));
    }
}

/* Tablet optimizasyonları */
@media (min-width: 769px) and (max-width: 1024px) {
    video {
        /* Tablet'te daha düşük kalite */
        filter: brightness(1.1) contrast(1.05);
    }
}

/* Yavaş bağlantı optimizasyonları */
@media (prefers-reduced-motion: reduce) {
    .video-background video {
        display: none; /* Motion sensitivity olan kullanıcılar için video gizle */
    }
    
    .video-background {
        background-image: var(--reduced-motion-bg, url('../img/static-hero-bg.jpg'));
        background-size: cover;
        background-position: center;
    }
}

/* Video loading spinner */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 40px;
    height: 40px;
    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: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Video error state */
.video-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    z-index: 3;
}

.video-error::before {
    content: "🎥";
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

/* Performance monitoring için debug styles */
.debug-video-performance {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    z-index: 9999;
    display: none;
}

.debug-video-performance.show {
    display: block;
}

/* Video preload optimizasyonları */
video[preload="none"] {
    /* Preload none olan videolar için özel stiller */
    background: #000;
}

video[preload="metadata"] {
    /* Metadata preload için özel stiller */
    background: #111;
}

/* Video quality selector (gelecekte kullanım için) */
.video-quality-selector {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 5px;
    padding: 5px;
}

.video-quality-selector select {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    padding: 2px 5px;
    font-size: 12px;
}

/* Video compression indicator */
.video-compression-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 255, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    z-index: 10;
}

/* High compression warning */
.video-compression-indicator.high {
    background: rgba(255, 165, 0, 0.8);
}

/* Critical compression warning */
.video-compression-indicator.critical {
    background: rgba(255, 0, 0, 0.8);
} 