/* Custom Video Player - GeoAlex Constructii */
.gallery-video-block {
  margin-top: 40px;
  margin-bottom: 30px;
}

.gallery-video-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
}

.gallery-video-row > div {
  flex: 0 1 440px;
  max-width: 440px;
  width: 100%;
}

.custom-video-player {
  position: relative;
  max-width: 440px;
  width: 100%;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.2);
  user-select: none;
  -webkit-user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
}

.custom-video-player *,
.custom-video-player *::before,
.custom-video-player *::after {
  box-sizing: border-box;
}

.custom-video-player video {
  width: 100%;
  height: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain !important;
  display: block;
  border-radius: 16px;
  background: #000;
}

/* Fullscreen mode: preserve original aspect ratio, format, center video, no zoom */
.custom-video-player:fullscreen,
.custom-video-player:-webkit-full-screen {
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  background: #000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

.custom-video-player:fullscreen video,
.custom-video-player:-webkit-full-screen video {
  width: 100% !important;
  height: 100% !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  object-fit: contain !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  background: #000 !important;
}

.custom-video-player:fullscreen .cvp-controls,
.custom-video-player:-webkit-full-screen .cvp-controls {
  max-width: 820px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 100% !important;
  padding: 16px 20px 24px !important;
}

/* Big Center Play / Pause Button */
.cvp-center-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 68px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.25s ease, background 0.2s ease;
  z-index: 5;
  border: 2px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
}

.cvp-center-play:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: rgba(255, 140, 0, 0.85);
  border-color: #FF8C00;
}

.cvp-center-play svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  margin-left: 3px;
  display: block;
}

.custom-video-player.playing .cvp-center-play {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.85);
}

/* Double click / Tap indicator (+10s / -10s) */
.cvp-tap-seek {
  position: absolute;
  top: 0;
  bottom: 60px;
  width: 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 6;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.cvp-tap-seek.left { left: 0; background: radial-gradient(circle at left, rgba(255,255,255,0.25) 0%, transparent 70%); }
.cvp-tap-seek.right { right: 0; background: radial-gradient(circle at right, rgba(255,255,255,0.25) 0%, transparent 70%); }
.cvp-tap-seek.active { opacity: 1; }

/* Bottom Control Bar */
.cvp-controls {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.55) 75%, transparent 100%) !important;
  padding: 12px 14px 12px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  opacity: 1 !important;
  transition: opacity 0.3s ease !important;
  z-index: 10 !important;
  pointer-events: auto !important;
}

.custom-video-player.playing.user-inactive .cvp-controls {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Progress / Timeline Bar */
.cvp-timeline-wrap {
  width: 100% !important;
  height: 20px !important;
  display: flex !important;
  align-items: center !important;
  cursor: pointer !important;
  position: relative !important;
  touch-action: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.cvp-timeline-bar {
  position: relative !important;
  width: 100% !important;
  height: 5px !important;
  background: rgba(255, 255, 255, 0.28) !important;
  border-radius: 3px !important;
  transition: height 0.15s ease !important;
  overflow: visible !important;
}

.cvp-timeline-wrap:hover .cvp-timeline-bar,
.cvp-timeline-wrap.dragging .cvp-timeline-bar {
  height: 7px !important;
}

.cvp-progress-loaded {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  background: rgba(255, 255, 255, 0.45) !important;
  border-radius: 3px !important;
  /* NOTE: no !important on width so JS inline width (timeupdate / scrub) wins */
  width: 0%;
  pointer-events: none !important;
}

.cvp-progress-current {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  background: #FF8C00 !important;
  border-radius: 3px !important;
  /* NOTE: no !important on width so JS inline width (timeupdate / scrub) wins */
  width: 0%;
  pointer-events: none !important;
}

.cvp-scrubber-handle {
  position: absolute !important;
  top: 50% !important;
  right: -6px !important;
  transform: translateY(-50%) scale(0) !important;
  width: 14px !important;
  height: 14px !important;
  background: #fff !important;
  border: 2px solid #FF8C00 !important;
  border-radius: 50% !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) !important;
  transition: transform 0.15s ease !important;
  pointer-events: none !important;
}

.cvp-timeline-wrap:hover .cvp-scrubber-handle,
.cvp-timeline-wrap.dragging .cvp-scrubber-handle {
  transform: translateY(-50%) scale(1) !important;
}

/* Time Tooltip when hovering timeline */
.cvp-time-tooltip {
  position: absolute !important;
  bottom: 22px !important;
  transform: translateX(-50%) !important;
  background: rgba(0, 0, 0, 0.9) !important;
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  padding: 3px 7px !important;
  border-radius: 4px !important;
  pointer-events: none !important;
  opacity: 0 !important;
  transition: opacity 0.15s ease !important;
  white-space: nowrap !important;
  line-height: 1.2 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

.cvp-timeline-wrap:hover .cvp-time-tooltip {
  opacity: 1 !important;
}

/* Buttons and Info Row */
.cvp-btn-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  color: #fff !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
  width: 100% !important;
}

.cvp-left-group {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
  flex-wrap: nowrap !important;
}

.cvp-right-group {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
  flex-wrap: nowrap !important;
}

/* Button Styling with high specificity to override Bootstrap and templates */
.cvp-btn {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: #fff !important;
  cursor: pointer !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  height: 32px !important;
  width: 32px !important;
  flex-shrink: 0 !important;
  border-radius: 6px !important;
  transition: color 0.15s ease, transform 0.1s ease !important;
}

.cvp-btn:hover {
  color: #FF8C00 !important;
  transform: scale(1.08) !important;
}

.cvp-btn svg {
  width: 22px !important;
  height: 22px !important;
  fill: currentColor !important;
  flex-shrink: 0 !important;
}

/* Explicit toggle display rules so play/pause and mute/unmute are never shown simultaneously */
.cvp-play-toggle .cvp-icon-play {
  display: block !important;
}
.cvp-play-toggle .cvp-icon-pause {
  display: none !important;
}
.custom-video-player.playing .cvp-play-toggle .cvp-icon-play {
  display: none !important;
}
.custom-video-player.playing .cvp-play-toggle .cvp-icon-pause {
  display: block !important;
}

.cvp-btn-mute .cvp-icon-vol-on {
  display: block !important;
}
.cvp-btn-mute .cvp-icon-vol-off {
  display: none !important;
}
.custom-video-player.muted .cvp-btn-mute .cvp-icon-vol-on {
  display: none !important;
}
.custom-video-player.muted .cvp-btn-mute .cvp-icon-vol-off {
  display: block !important;
}

.cvp-btn-rewind svg,
.cvp-btn-forward svg {
  width: 23px !important;
  height: 23px !important;
  display: block !important;
}

/* Time display - Prevents wrapping into multiple lines */
.cvp-time-display {
  font-size: 12px !important;
  font-weight: 500 !important;
  font-variant-numeric: tabular-nums !important;
  color: rgba(255, 255, 255, 0.95) !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
  margin-left: 4px !important;
  user-select: none !important;
}

.cvp-time-current,
.cvp-time-total {
  display: inline-block !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums !important;
}

.cvp-time-sep {
  display: inline-block !important;
  opacity: 0.65 !important;
  margin: 0 1px !important;
}

@media (max-width: 400px) {
  .cvp-controls {
    padding: 10px 10px 10px !important;
  }
  .cvp-btn {
    height: 30px !important;
    width: 30px !important;
  }
  .cvp-btn svg {
    width: 20px !important;
    height: 20px !important;
  }
  .cvp-left-group,
  .cvp-right-group {
    gap: 4px !important;
  }
  .cvp-time-display {
    font-size: 11px !important;
    margin-left: 2px !important;
  }
}

/* Loading Spinner */
.cvp-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #FF8C00;
  border-radius: 50%;
  animation: cvp-spin 0.8s linear infinite;
  display: none;
  z-index: 4;
}

.custom-video-player.buffering .cvp-spinner {
  display: block;
}

@keyframes cvp-spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ========================================================
   Gallery Video Card in #image-gallery & Lightbox Overlay
   ======================================================== */
.image.video-gallery-item .img-wrapper {
  position: relative;
  cursor: pointer;
}

.gallery-video-badge {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  z-index: 2;
  pointer-events: none;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gallery-video-badge i {
  color: #FF8C00;
  font-size: 12px;
}

/* Gallery Lightbox Overlay with Video Support */
#overlay {
  background: rgba(0, 0, 0, 0.94) !important;
  width: 100vw !important;
  height: 100vh !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  display: none !important;
  justify-content: center !important;
  align-items: center !important;
  z-index: 999999 !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  backdrop-filter: blur(8px) !important;
  opacity: 0;
  pointer-events: none;
}

#overlay.active {
  display: flex !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.overlay-media-container {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  max-width: 90vw !important;
  max-height: 85vh !important;
  position: relative !important;
}

#overlay img,
#overlay #overlayImage {
  max-width: 88vw !important;
  max-height: 82vh !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8) !important;
  margin: 0 !important;
  padding: 0 !important;
}

#overlay video,
#overlay #overlayVideo {
  max-width: 88vw !important;
  max-height: 82vh !important;
  aspect-ratio: 9 / 16 !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important; /* Preserves exact original format, NO zoom */
  border-radius: 12px !important;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.9) !important;
  background: #000 !important;
  outline: none !important;
}

#prevButton,
#nextButton {
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  color: #fff !important;
  font-size: 2.2rem !important;
  cursor: pointer !important;
  z-index: 1000001 !important;
  width: 52px !important;
  height: 52px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.15) !important;
  backdrop-filter: blur(4px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
}

#prevButton { left: 24px !important; }
#nextButton { right: 24px !important; }

#prevButton:hover,
#nextButton:hover {
  background: #FF8C00 !important;
  color: #fff !important;
  transform: translateY(-50%) scale(1.1) !important;
  border-color: #FF8C00 !important;
}

#exitButton {
  position: absolute !important;
  top: 24px !important;
  right: 24px !important;
  color: #fff !important;
  font-size: 1.8rem !important;
  cursor: pointer !important;
  z-index: 1000001 !important;
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.15) !important;
  backdrop-filter: blur(4px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 0.2s ease, transform 0.2s ease !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
}

#exitButton:hover {
  background: #FF8C00 !important;
  transform: scale(1.1) !important;
  border-color: #FF8C00 !important;
}

@media (max-width: 768px) {
  #prevButton,
  #nextButton {
    width: 42px !important;
    height: 42px !important;
    font-size: 1.6rem !important;
  }
  #prevButton { left: 10px !important; }
  #nextButton { right: 10px !important; }
  #exitButton {
    top: 14px !important;
    right: 14px !important;
    width: 38px !important;
    height: 38px !important;
    font-size: 1.4rem !important;
  }
}
