/* Prevent background scroll when modal open */
body.gmc-modal-open {
  overflow: hidden;
}

/* Video thumbnail inside gallery */
.gmc-video-thumb {
  position: relative !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure it works in thumbnails wrapper */
.woocommerce-product-gallery__thumbnails-wrapper .gmc-video-thumb {
  flex: 0 0 calc(25% - 0.5625rem) !important;
  max-width: calc(25% - 0.5625rem) !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
}

.gmc-video-thumb .gmc-video-open {
  display: block !important;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.gmc-video-thumb img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  object-fit: cover !important;
  border-radius: var(--gmc-radius-md, 12px) !important;
  border: 2px solid transparent !important;
  transition: all 200ms ease !important;
  cursor: pointer !important;
  opacity: 0.7 !important;
}

.gmc-video-thumb:hover img {
  opacity: 1 !important;
  border-color: var(--gmc-primary, #f48ca8) !important;
  transform: scale(1.05) !important;
  box-shadow: 0 4px 12px rgba(244, 140, 168, 0.3) !important;
}

/* Play icon overlay */
.gmc-video-thumb .gmc-video-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.gmc-video-thumb .gmc-video-play::before {
  content: "";
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(3px);
}

.gmc-video-thumb .gmc-video-play::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-left: 14px solid rgba(255, 255, 255, 0.95);
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  transform: translateX(2px);
}

/* Modal */
.gmc-video-modal {
  position: fixed;
  inset: 0;
  z-index: 99999 !important; /* Very high z-index to ensure it's above everything */
  display: none;
  pointer-events: none;
}

.gmc-video-modal.is-open {
  display: block !important;
  pointer-events: auto;
}

.gmc-video-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
  z-index: 1;
}

.gmc-video-modal__dialog {
  position: relative;
  max-width: 900px;
  width: calc(100% - 32px);
  max-height: 85vh;
  margin: 7.5vh auto 0;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 2; /* Above overlay */
  pointer-events: auto;
}

.gmc-video-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  font-size: 24px;
  line-height: 42px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.gmc-video-modal__close:hover {
  background: rgba(255, 255, 255, 1);
}

.gmc-video-modal__video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 75vh; /* Limit height so controls are accessible */
  background: #000;
  object-fit: contain;
}

/* Mobile */
@media (max-width: 768px) {
  .gmc-video-modal__dialog {
    margin-top: 5vh;
    width: calc(100% - 20px);
    max-height: 90vh;
    border-radius: 16px;
  }
  
  .gmc-video-modal__video {
    max-height: 80vh;
  }
}

