/* TeDaCo Video Intro System - OPTIMIERT für Mobile Performance */
/* Version 2.0 - PageSpeed Insights Optimierung */

/* Basis Video Intro Overlay */
.video-intro-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.5s ease-out; /* Verkürzt von 1s auf 0.5s */
}

.video-intro-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.video-intro-overlay.hidden {
  display: none;
}

/* Intro Video - Mobile-First */
.intro-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

/* HERO SECTION VIDEO STYLES - Mobile-First Approach */
.intro-video.hero-video {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Video Container - Mobile Optimized */
.video-container {
  position: relative;
  width: 100%;
  height: 300px; /* Reduziert für Mobile */
  overflow: hidden;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-video-element {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  border-radius: 15px;
  background: #000;
}

.intro-video-element:hover {
  transform: scale(1.02); /* Reduziert für Performance */
}

/* RESPONSIVE VIDEO - Mobile First */
@media (max-width: 768px) {
  .video-container {
    height: 200px; /* Kleiner für Mobile */
    border-radius: 10px;
    margin-bottom: 20px;
  }

  .intro-video-element {
    border-radius: 10px;
    /* Hover-Effekte auf Mobile deaktivieren */
    transition: none;
  }

  .intro-video-element:hover {
    transform: none;
  }

  .col-lg-4.intro-video {
    order: 2;
    margin-bottom: 30px;
  }

  .col-lg-8.intro-info {
    order: 1;
    text-align: center;
  }

  #hero .container {
    padding: 20px 15px;
  }

  #hero .container {
    min-height: auto;
  }

  #hero .row {
    align-items: flex-start;
  }
}

@media (max-width: 430px) {
  .video-container {
    height: 150px; /* Noch kleiner für sehr kleine Screens */
    border-radius: 8px;
  }

  .intro-video-element {
    border-radius: 8px;
  }

  #hero .container {
    padding: 15px 10px;
  }

  .col-lg-4.intro-video {
    margin-bottom: 20px;
  }

  .col-lg-8.intro-info {
    padding: 0;
  }

  #hero .intro-info h2 {
    font-size: 24px;
    line-height: 1.3;
  }

  #hero .intro-info p {
    font-size: 14px;
  }
}

/* Landscape Mobile Optimierung */
@media (max-width: 932px) and (max-height: 430px) and (orientation: landscape) {
  .intro-video-element {
    height: 120px;
  }

  .video-container {
    height: 120px;
  }
}

/* VIDEO LOADING ANIMATION - Performance Optimized */
.video-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transform: translateX(-100%);
  animation: shimmer 2s infinite;
  z-index: 1;
  pointer-events: none;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Loading Animation - Reduced Motion */
.video-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #3fcdc7;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* System Fonts für Performance */
  font-size: 18px;
  text-align: center;
  z-index: 10;
}

.loading-spinner {
  width: 40px; /* Reduziert für Mobile */
  height: 40px;
  border: 2px solid rgba(63, 205, 199, 0.3); /* Reduziert für Performance */
  border-top: 2px solid #3fcdc7;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px; /* Reduziert */
}

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

/* Hero Background Video - Performance Optimized */
.hero-background-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  opacity: 0;
  transition: opacity 1.5s ease-in; /* Verkürzt */
  pointer-events: none; /* Performance */
}

.hero-background-video.active {
  opacity: 0.3; /* Reduziert für bessere Lesbarkeit */
}

/* Hero Content über Video */
#hero .container {
  position: relative;
  z-index: 10;
}

/* Skip Button - Mobile Optimized */
.skip-intro-btn {
  position: absolute;
  bottom: 20px; /* Reduziert für Mobile */
  right: 20px;
  background: rgba(63, 205, 199, 0.9);
  color: #fff;
  border: none;
  padding: 12px 24px; /* Größer für Touch */
  border-radius: 25px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease; /* Verkürzt für Performance */
  z-index: 10000;
  touch-action: manipulation; /* Touch-Optimierung */
  min-height: 44px; /* iOS Touch-Zielgröße */
}

.skip-intro-btn:hover {
  background: rgba(63, 205, 199, 1);
  transform: scale(1.02); /* Reduziert */
}

.skip-intro-btn:active {
  transform: scale(0.98);
}

/* Mobile Skip Button */
@media (max-width: 768px) {
  .video-loading {
    font-size: 16px;
  }
  
  .loading-spinner {
    width: 30px;
    height: 30px;
  }
  
  .skip-intro-btn {
    bottom: 15px;
    right: 15px;
    padding: 10px 20px;
    font-size: 13px;
    min-height: 44px; /* iOS Touch Standard */
    min-width: 44px;
  }
}

/* Video Fallback - Static Background */
.video-fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3fcdc7;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 20px;
  text-align: center;
}

/* Static Hero Background für Mobile */
.hero-static-background {
  background: linear-gradient(135deg, #1bb1dc 0%, #4a90e2 100%);
  background-size: cover;
  background-position: center;
  background-attachment: scroll; /* Fixed kann Performance-Probleme auf Mobile verursachen */
}

/* Smooth Transition Effects - Performance Optimized */
.page-content {
  opacity: 0;
  transition: opacity 0.5s ease-in; /* Verkürzt */
}

.page-content.visible {
  opacity: 1;
}

/* Video Controls (versteckt) */
.intro-video::-webkit-media-controls {
  display: none !important;
}

.intro-video::-webkit-media-controls-panel {
  display: none !important;
}

.intro-video::-webkit-media-controls-play-button {
  display: none !important;
}

.intro-video::-webkit-media-controls-start-playback-button {
  display: none !important;
}

/* Preload Animation - Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .video-intro-overlay {
    transition: none;
  }
  
  .intro-video-element {
    transition: none;
  }
  
  .skip-intro-btn {
    transition: none;
  }
  
  .hero-background-video {
    transition: none;
  }
  
  .loading-spinner {
    animation: none;
  }
  
  .video-container::before {
    animation: none;
  }
}

/* Logo Integration - Lazy Loading */
.intro-logo {
  position: absolute;
  bottom: 80px; /* Reduziert */
  left: 50%;
  transform: translateX(-50%);
  max-width: 200px; /* Reduziert für Mobile */
  opacity: 0;
  animation: logoFadeIn 0.8s ease-in 1.5s forwards; /* Verkürzt */
  z-index: 100;
}

@keyframes logoFadeIn {
  0% { 
    opacity: 0;
    transform: translateX(-50%) translateY(10px); /* Reduziert */
  }
  100% { 
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Mobile Logo */
@media (max-width: 768px) {
  .intro-logo {
    bottom: 60px;
    max-width: 150px;
  }
}

/* Performance Optimizations */
.video-intro-overlay *,
.hero-background-video,
.intro-video {
  will-change: auto; /* Nur wenn nötig */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* GPU-Beschleunigung nur für kritische Elemente */
.skip-intro-btn,
.loading-spinner {
  will-change: transform;
  transform: translateZ(0);
}

/* Intersection Observer Support */
.lazy-video {
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

/* Connection-aware Styles */
.slow-connection .video-intro-overlay,
.slow-connection .hero-background-video {
  display: none !important;
}

.slow-connection .hero-static-background {
  display: block;
}

/* Print Styles */
@media print {
  .video-intro-overlay,
  .hero-background-video,
  .intro-video,
  .skip-intro-btn {
    display: none !important;
  }
}

/* Video Intro System - Mobile First Approach */
.video-intro-container {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #1bb1dc, #4a90e2);
    margin: 20px 0;
    box-sizing: border-box;
}

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

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

.video-intro-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(27, 177, 220, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.5s ease;
    box-sizing: border-box;
}

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

.video-intro-content {
    text-align: center;
    color: white;
    z-index: 2;
    padding: 20px;
    max-width: 90%;
    box-sizing: border-box;
}

.video-intro-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

.video-intro-subtitle {
    font-size: 1.2rem;
    margin-bottom: 20px;
    opacity: 0.9;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.video-intro-button {
    background: rgba(255, 255, 255, 0.9);
    color: #1bb1dc;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 44px;
    min-height: 44px;
    box-sizing: border-box;
}

.video-intro-button:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.video-intro-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1bb1dc 0%, #4a90e2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    box-sizing: border-box;
}

.video-intro-fallback.active {
    opacity: 1;
}

.video-intro-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.1rem;
    opacity: 0.8;
}

/* Tablet optimiert */
@media (max-width: 768px) {
    .video-intro-container {
        height: 300px;
        margin: 15px 0;
        border-radius: 10px;
    }
    
    .video-intro-title {
        font-size: 2rem;
        margin-bottom: 12px;
    }
    
    .video-intro-subtitle {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .video-intro-button {
        padding: 12px 24px;
        font-size: 1rem;
    }
    
    .video-intro-content {
        padding: 15px;
        max-width: 95%;
    }
}

/* iPhone und kleinere Geräte */
@media (max-width: 480px) {
    .video-intro-container {
        height: 250px;
        margin: 10px 0;
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .video-intro-title {
        font-size: 1.6rem;
        margin-bottom: 10px;
        line-height: 1.1;
    }
    
    .video-intro-subtitle {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
    
    .video-intro-button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .video-intro-content {
        padding: 10px;
        max-width: 98%;
    }
    
    .video-intro-video {
        object-fit: cover;
        object-position: center;
    }
}

/* iPhone SE und sehr kleine Bildschirme */
@media (max-width: 375px) {
    .video-intro-container {
        height: 200px;
        margin: 8px 0;
        border-radius: 6px;
    }
    
    .video-intro-title {
        font-size: 1.4rem;
        margin-bottom: 8px;
    }
    
    .video-intro-subtitle {
        font-size: 0.8rem;
        margin-bottom: 12px;
    }
    
    .video-intro-button {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
    
    .video-intro-content {
        padding: 8px;
        max-width: 99%;
    }
}

/* Landscape-Modus für Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .video-intro-container {
        height: 200px;
    }
    
    .video-intro-title {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }
    
    .video-intro-subtitle {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
}

/* Slow Connection Support */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    .video-intro-video {
        display: none;
    }
    
    .video-intro-fallback {
        opacity: 1;
    }
}

/* Performance Optimizations */
@media (max-width: 768px) {
    .video-intro-container {
        transform: translateZ(0);
        backface-visibility: hidden;
        perspective: 1000px;
    }
    
    .video-intro-video {
        transform: translate3d(-50%, -50%, 0);
    }
}

/* High DPI Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .video-intro-container {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .video-intro-button {
        min-width: 48px;
        min-height: 48px;
        font-size: 1rem;
    }
    
    .video-intro-button:hover {
        transform: none;
        background: rgba(255, 255, 255, 0.95);
    }
}

/* Debug Information (Development Only) */
.video-intro-debug {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    z-index: 10;
    display: none;
}

/* Ultra-wide mobile displays */
@media (max-width: 480px) and (aspect-ratio >= 2/1) {
    .video-intro-container {
        height: 180px;
    }
    
    .video-intro-title {
        font-size: 1.3rem;
    }
}

/* Fallback for very old devices */
@media (max-width: 320px) {
    .video-intro-container {
        height: 180px;
        margin: 5px 0;
    }
    
    .video-intro-title {
        font-size: 1.2rem;
    }
    
    .video-intro-subtitle {
        font-size: 0.75rem;
    }
    
    .video-intro-content {
        padding: 5px;
    }
}
