/* Video Background Component Styles */

/* Main video background container */
.video-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-video-background);
  opacity: 0;
  transition: opacity 3s ease-in-out;
  pointer-events: none;
}

/* Video element */
.video-background__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Overlay for blending with existing effects */
.video-background__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: var(--z-video-overlay);
  mix-blend-mode: multiply;
}

/* Active state */
.video-background--active {
  opacity: 1;
}

/* Transition states */
.video-background--fade-in {
  animation: videoFadeIn 3.5s ease-in-out forwards;
}

.video-background--fade-out {
  animation: videoFadeOut 3.5s ease-in-out forwards;
}

/* Keyframe animations */
@keyframes videoFadeIn {
  from { 
    opacity: 0; 
  }
  to { 
    opacity: 1; 
  }
}

@keyframes videoFadeOut {
  from { 
    opacity: 1; 
  }
  to { 
    opacity: 0; 
  }
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .video-background__video {
    transform: scale(1.1); /* Compensate for cropping */
    filter: blur(0.5px);   /* Resource optimization */
  }
  
  .video-background {
    --scroll-threshold: 150px; /* Higher threshold for mobile */
  }
}

/* Optimize for very small devices instead of disabling */
@media (max-width: 480px) and (max-height: 800px) {
  .video-background__video {
    transform: scale(1.2); /* More aggressive scaling for small screens */
    filter: blur(1px);     /* Reduce quality to save resources */
  }
  
  .video-background {
    --scroll-threshold: 200px; /* Higher threshold for very small devices */
  }
}

/* Accessibility - respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .video-background {
    display: none;
  }
  
  .video-background--fade-in,
  .video-background--fade-out {
    animation: none;
    transition: none;
  }
}

/* Fallback play button for devices without autoplay */
.video-play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  padding: 1rem 2rem;
  font-family: var(--font-primary);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 5px;
  transition: all var(--transition-normal);
  z-index: 10;
  backdrop-filter: blur(10px);
}

.video-play-button:hover {
  background: rgba(152, 245, 225, 0.1);
  box-shadow: 0 0 20px rgba(152, 245, 225, 0.3);
  transform: translate(-50%, -50%) scale(1.05);
}

/* Mobile-specific prompt overlay */
.video-mobile-prompt {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
  backdrop-filter: blur(10px);
}

.video-mobile-prompt__content {
  text-align: center;
  color: var(--color-primary);
  padding: 2rem;
  border: 2px solid var(--color-primary);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.8);
  max-width: 300px;
}

.video-mobile-prompt__icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  animation: pulse 2s infinite;
}

.video-mobile-prompt__text {
  font-family: var(--font-primary);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.video-mobile-prompt__button {
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  padding: 0.8rem 1.5rem;
  font-family: var(--font-primary);
  font-size: 1rem;
  cursor: pointer;
  border-radius: 5px;
  transition: all var(--transition-normal);
  width: 100%;
}

.video-mobile-prompt__button:hover,
.video-mobile-prompt__button:active {
  background: rgba(152, 245, 225, 0.1);
  box-shadow: 0 0 15px rgba(152, 245, 225, 0.3);
  transform: scale(1.05);
}

/* Error message styling */
.video-error-message {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 0, 0, 0.1);
  border: 1px solid rgba(255, 0, 0, 0.3);
  color: #ff6b6b;
  padding: 0.8rem 1.5rem;
  border-radius: 5px;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  z-index: 10;
  backdrop-filter: blur(5px);
  animation: slideUp 0.3s ease-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Enhanced mobile responsiveness */
@media (max-width: 480px) {
  .video-mobile-prompt__content {
    margin: 1rem;
    padding: 1.5rem;
    max-width: none;
  }
  
  .video-mobile-prompt__icon {
    font-size: 2.5rem;
  }
  
  .video-mobile-prompt__text {
    font-size: 1rem;
  }
  
  .video-play-button {
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
  }
}