/* Video Player Block Styles */
.video-player-block {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 2rem auto;
  transition: transform 0.3s ease;
  z-index: 1;
}

/* Playing state - make bigger and elevated */
.video-player-block.is-playing {
  transform: scale(1.05);
  z-index: 10000;
}

/* Center the video container in native full screen */
.video-player-block:fullscreen .video-container {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 90vw !important;
  height: auto !important;
}

/* Full-screen backdrop overlay */
.video-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 9999;
  pointer-events: none;
}

/* Show backdrop when playing */
.video-backdrop.is-active {
  opacity: 1;
  visibility: visible;
  /* Allow clicks to reach the backdrop only when it's active */
  pointer-events: auto;
}

/* Video Container */
.video-container {
  position: relative;
  width: 100%;
  background: transparent;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.3s ease;
}

/* Enhanced shadow when playing */
.video-player-block.is-playing .video-container {
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

/* Aspect Ratio Helper */
.video-aspect {
  aspect-ratio: 16 / 9;
  width: 100%;
}

/* Video Element */
.video-el {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: black;
  object-fit: contain;
  border-radius: inherit;
}

/* Video Overlay for Play Button */
.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.video-overlay.is-playing {
  opacity: 0;
  pointer-events: none;
}

/* Overlay Text */
.overlay-text {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: white;
  pointer-events: none;
  z-index: 2;
}

.overlay-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.overlay-subtitle {
  font-size: 1.125rem;
  margin: 0;
  opacity: 0.9;
  color: white;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* Overlay Play Button */
.overlay-play {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: all;
}

.overlay-play:hover {
  background: rgba(255, 255, 255, 0.1);
}

.overlay-play:active {
  transform: scale(0.98);
}

.overlay-play img {
  width: 80px;
  height: 80px;
  /* Keep original SVG colors - no filter applied */
}

/* Custom Video Controls */
.custom-controls {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  opacity: 1; /* Always visible for now */
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 3;
}

/* Controls grouping */
.controls-left,
.controls-right {
  display: flex;
  gap: 12px;
}

/* Show controls when video is playing */
.video-player-block.is-playing .custom-controls {
  opacity: 1;
  visibility: visible;
}

/* Hide controls when overlay is visible (not playing) */
.video-overlay:not(.is-playing) ~ .custom-controls {
  opacity: 0;
  visibility: hidden;
}

/* Control Buttons */
.control-btn {
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.control-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.4);
}

.control-btn:active {
  transform: scale(0.95);
}

.control-btn svg {
  width: 24px;
  height: 24px;
  fill: white;
}


/* Responsive Design */
@media (max-width: 768px) {
  .video-player-block {
    margin: 1rem auto;
  }
  
  .video-container {
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  }
  
  .overlay-title {
    font-size: 1.5rem;
  }
  
  .overlay-subtitle {
    font-size: 1rem;
  }
  
  .overlay-text {
    top: 20%;
  }
  
  .overlay-play img {
    width: 60px;
    height: 60px;
  }
  
  .custom-controls {
    bottom: 15px;
    left: 15px;
    right: 15px;
  }
  
  .controls-left,
  .controls-right {
    gap: 10px;
  }
  
  .control-btn {
    width: 42px;
    height: 42px;
  }
  
  .control-btn svg {
    width: 20px;
    height: 20px;
  }
  
  /* Make video cover on mobile */
  .video-el {
    object-fit: contain;
  }
}

@media (max-width: 480px) {
  .video-player-block {
    margin: 0.5rem auto;
  }
  
  .video-container {
    border-radius: 6px;
  }
  
  .overlay-title {
    font-size: 1.2rem;
  }
  
  .overlay-subtitle {
    font-size: 0.7rem;
  }
  
  .overlay-text {
    top: 8%;
  }
  
  .overlay-play img {
    width: 50px;
    height: 50px;
  }
  
  .custom-controls {
    bottom: 10px;
    left: 10px;
    right: 10px;
  }
  
  .controls-left,
  .controls-right {
    gap: 8px;
  }
  
  .control-btn {
    width: 36px;
    height: 36px;
  }
  
  .control-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* Focus Styles for Accessibility */
.overlay-play:focus {
  outline: 3px solid #007cba;
  outline-offset: 2px;
}

.video-el:focus {
  outline: 3px solid #007cba;
  outline-offset: 2px;
}
