/**
 * PDP product image lightbox / zoom (T074)
 * Self-contained modal styles — child theme does not load parent Bootstrap modal CSS.
 */

#product-modal.js-product-images-modal {
  display: none !important;
  position: fixed;
  inset: 0;
  z-index: 1050;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
}

#product-modal.js-product-images-modal.mf-gallery-open {
  display: block !important;
}

.mf-gallery-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1040;
  background-color: rgba(0, 0, 0, 0.55);
}

.mf-gallery-backdrop.mf-gallery-open {
  display: block;
}

body.mf-gallery-modal-open {
  overflow: hidden;
}

#product-modal .modal-dialog {
  position: relative;
  width: auto;
  max-width: 1000px;
  margin: 1.75rem auto;
  pointer-events: none;
}

#product-modal.mf-gallery-open .modal-dialog {
  pointer-events: auto;
}

#product-modal .modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  background-color: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  outline: 0;
  overflow: hidden;
}

#product-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  z-index: 2;
}

#product-modal .modal-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

#product-modal .close {
  border: 0;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  padding: 0 0.25rem;
}

#product-modal .close:hover {
  color: #111827;
}

#product-modal .modal-body {
  padding: 0;
}

#product-modal .modal-header.mf-gallery-header {
  justify-content: flex-end;
  padding: 0.5rem 0.75rem;
  min-height: 0;
  border-bottom: 0;
}

#product-modal .mf-gallery-close {
  margin-left: auto;
}

#product-modal .easyzoom-modal,
#product-modal .mf-gallery-image-wrap {
  position: relative;
  display: block;
  text-align: center;
  background: #fff;
}

#product-modal .mf-gallery-image-wrap picture,
#product-modal .easyzoom-modal picture {
  display: block;
  width: 100%;
}

#product-modal .product-cover-modal,
#product-modal .js-modal-product-cover {
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  max-height: calc(100vh - 220px);
  object-fit: contain;
}

#product-modal .mf-zoom-flyout {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #fff;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 1;
}

#product-modal .mf-zoom-flyout img {
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 200%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  transform-origin: top left;
}

#product-modal #thumbnails {
  padding: 0.75rem 1rem 1rem;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

#product-modal #modal-product-thumbs .swiper-wrapper {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

#product-modal #modal-product-thumbs .swiper-slide {
  flex: 0 0 auto;
  width: 4.5rem;
  scroll-snap-align: start;
}

#product-modal .thumb-container {
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.25rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

#product-modal .thumb-container:has(.mf-modal-thumb-active),
#product-modal .thumb-container.mf-modal-thumb-active {
  border-color: #7cb342;
}

#product-modal .js-modal-thumb.mf-modal-thumb-active {
  outline: none;
}

#product-modal .thumb-container:hover {
  border-color: #7cb342;
}

#product-modal .js-modal-thumb {
  width: 100%;
  height: 3.5rem;
  object-fit: contain;
}

#product-modal .swiper-button-prev,
#product-modal .swiper-button-next {
  display: none;
}

@media (max-width: 767px) {
  #js-cover-wrapper.mf-gallery-disabled,
  #js-cover-wrapper {
    cursor: default;
  }

  #js-cover-wrapper .mf-gallery-zoom-hint {
    display: none !important;
  }

  #product-modal .modal-dialog {
    margin: 0;
    min-height: 100%;
    max-width: 100%;
  }

  #product-modal .modal-content {
    min-height: 100vh;
    border-radius: 0;
  }

  #product-modal .product-cover-modal,
  #product-modal .js-modal-product-cover {
    max-height: calc(100vh - 180px);
  }

  #product-modal .mf-zoom-flyout {
    display: none !important;
  }
}
