/* ==========================================================================
   GIFTOOZE UNIVERSAL PRODUCT GALLERY (VNext)
   One Universal PDP Gallery • Premium Responsive Design • Zero Overflow
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Universal PDP Layout Grid
   -------------------------------------------------------------------------- */
.v10-pdp-layout,
.pdp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  gap: 40px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-bottom: 50px;
}

/* Ensure details column never forces grid track expansion */
.v10-pdp-details-wrap,
.pdp-details-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

/* Ensure wholesale price tier ladder never overflows its container */
#pdpTierTableWrapper {
  max-width: 100% !important;
  width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  display: block !important;
  box-sizing: border-box !important;
}

#pdpTierTableWrapper table {
  max-width: 100%;
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   2. Gallery Composition (Desktop Base: >= 1200px)
   -------------------------------------------------------------------------- */
.product-gallery,
.v10-pdp-gallery-wrap {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.product-gallery.is-single,
.v10-pdp-gallery-wrap.is-single {
  grid-template-columns: minmax(0, 1fr);
}

/* Vertical Thumbnail Rail */
.product-gallery__thumbs,
.v10-pdp-thumbnails {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 80px;
  max-height: 520px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #D1D5DB transparent;
  padding: 2px 1px;
  box-sizing: border-box;
}

.product-gallery__thumbs::-webkit-scrollbar,
.v10-pdp-thumbnails::-webkit-scrollbar {
  width: 4px;
}
.product-gallery__thumbs::-webkit-scrollbar-thumb,
.v10-pdp-thumbnails::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 4px;
}

/* Thumbnail Item */
.product-gallery__thumb,
.v10-pdp-thumb-item {
  width: 80px;
  height: 80px;
  min-width: 80px;
  min-height: 80px;
  padding: 6px;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  background: #FAF9F6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  appearance: none;
  outline: none;
}

.product-gallery__thumb:hover,
.v10-pdp-thumb-item:hover {
  border-color: var(--gtz-forest-primary, #06442F);
  transform: translateY(-1px);
}

.product-gallery__thumb:focus-visible,
.v10-pdp-thumb-item:focus-visible {
  outline: 2px solid var(--gtz-forest-primary, #06442F);
  outline-offset: 2px;
}

.product-gallery__thumb.is-active,
.product-gallery__thumb.active,
.v10-pdp-thumb-item.active {
  border-color: var(--gtz-forest-primary, #06442F);
  box-shadow: 0 0 0 2px rgba(6, 68, 47, 0.2);
}

.product-gallery__thumb img,
.v10-pdp-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   3. Main Product Image Viewport
   -------------------------------------------------------------------------- */
.product-gallery__viewport,
.v10-pdp-hero-image-card {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 520px;
  min-height: 340px;
  height: auto;
  background: #FAF9F6;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.product-gallery__image,
.v10-pdp-hero-image-card img#mainPdpImage {
  width: auto;
  height: auto;
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
  cursor: zoom-in;
  transition: transform 0.25s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.product-gallery__viewport:hover .product-gallery__image {
  transform: scale(1.02);
}

/* Wishlist Heart Button */
.product-gallery__favorite,
.v10-pdp-hero-image-card .pdp-wish-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6B7280;
  cursor: pointer;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.15s ease, background 0.2s ease;
  outline: none;
  box-sizing: border-box;
}

.product-gallery__favorite:hover,
.v10-pdp-hero-image-card .pdp-wish-btn:hover {
  color: #E53935;
  border-color: #FCA5A5;
  transform: scale(1.06);
}

.product-gallery__favorite:focus-visible,
.v10-pdp-hero-image-card .pdp-wish-btn:focus-visible {
  outline: 2px solid var(--gtz-forest-primary, #06442F);
  outline-offset: 2px;
}

.product-gallery__favorite.saved,
.v10-pdp-hero-image-card .pdp-wish-btn.saved {
  color: #E53935;
  fill: #E53935;
  border-color: #FECACA;
  background: #FEF2F2;
}

.product-gallery__favorite.saved svg,
.v10-pdp-hero-image-card .pdp-wish-btn.saved svg {
  fill: #E53935;
}

/* Image Zoom Trigger Button */
.product-gallery__zoom-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4B5563;
  cursor: pointer;
  z-index: 4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
  outline: none;
  box-sizing: border-box;
}

.product-gallery__zoom-btn:hover {
  background: #FFFFFF;
  color: var(--gtz-forest-primary, #06442F);
  transform: scale(1.08);
}

.product-gallery__zoom-btn:focus-visible {
  outline: 2px solid var(--gtz-forest-primary, #06442F);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   4. Accessible Image Lightbox Modal
   -------------------------------------------------------------------------- */
.product-gallery-lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  padding: 0;
  margin: 0;
  border: none;
  background: rgba(10, 15, 12, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.product-gallery-lightbox[open],
.product-gallery-lightbox.is-open {
  display: flex;
}

.product-gallery-lightbox::backdrop {
  background: transparent;
}

.product-gallery-lightbox__dialog {
  position: relative;
  width: 90vw;
  max-width: 920px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-sizing: border-box;
}

.product-gallery-lightbox__close {
  position: absolute;
  top: -46px;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  z-index: 10;
  outline: none;
}

.product-gallery-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.08);
}

.product-gallery-lightbox__stage {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.product-gallery-lightbox__img-wrap {
  width: 100%;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
}

.product-gallery-lightbox__img-wrap img {
  max-width: 100%;
  max-height: calc(70vh - 48px);
  width: auto;
  height: auto;
  object-fit: contain;
}

.product-gallery-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #D1D5DB;
  color: #1F2937;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: background 0.2s ease, transform 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  outline: none;
}

.product-gallery-lightbox__nav:hover {
  background: #FFFFFF;
  transform: translateY(-50%) scale(1.08);
}

.product-gallery-lightbox__nav.prev {
  left: 12px;
}

.product-gallery-lightbox__nav.next {
  right: 12px;
}

.product-gallery-lightbox__strip {
  display: flex;
  gap: 10px;
  max-width: 100%;
  overflow-x: auto;
  padding: 6px 2px;
  box-sizing: border-box;
}

.product-gallery-lightbox__thumb {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 0.2s ease, transform 0.15s ease;
  outline: none;
}

.product-gallery-lightbox__thumb:hover,
.product-gallery-lightbox__thumb.is-active,
.product-gallery-lightbox__thumb.active {
  border-color: #FFFFFF;
  background: rgba(255, 255, 255, 0.4);
}

.product-gallery-lightbox__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body.lightbox-open {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   5. Tablet Responsive Refinement (768px – 1199px)
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) {
  .v10-pdp-layout,
  .pdp-layout {
    gap: 32px;
  }
}

@media (max-width: 1080px) {
  .v10-pdp-layout,
  .pdp-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 32px;
  }

  .product-gallery,
  .v10-pdp-gallery-wrap {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    max-width: 620px;
    margin: 0 auto !important;
    width: 100% !important;
  }

  .product-gallery__viewport,
  .v10-pdp-hero-image-card {
    order: 1 !important;
    max-height: 480px !important;
    width: 100% !important;
  }

  .product-gallery__thumbs,
  .v10-pdp-thumbnails {
    order: 2 !important;
    flex-direction: row !important;
    width: 100% !important;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    justify-content: center !important;
    padding: 4px 2px !important;
  }

  .product-gallery__thumb,
  .v10-pdp-thumb-item {
    width: 72px !important;
    height: 72px !important;
    min-width: 72px !important;
    min-height: 72px !important;
  }
}

/* --------------------------------------------------------------------------
   6. Mobile-First Responsive Layout (< 768px down to 320px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .pdp-page-container {
    padding: 0 14px !important;
    margin-top: 14px !important;
  }

  .v10-pdp-layout,
  .pdp-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 20px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-bottom: 30px !important;
  }

  .product-gallery,
  .v10-pdp-gallery-wrap {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
  }

  .product-gallery__viewport,
  .v10-pdp-hero-image-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    max-height: 380px !important;
    min-height: 260px !important;
    padding: 16px !important;
    border-radius: 12px !important;
    order: 1 !important;
    box-sizing: border-box !important;
  }

  .product-gallery__image,
  .v10-pdp-hero-image-card img#mainPdpImage {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
  }

  .product-gallery__thumbs,
  .v10-pdp-thumbnails {
    order: 2 !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
    justify-content: flex-start !important;
    padding: 2px 1px 6px 1px !important;
    box-sizing: border-box !important;
  }

  .product-gallery__thumb,
  .v10-pdp-thumb-item {
    flex: 0 0 60px !important;
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    min-height: 60px !important;
    scroll-snap-align: start !important;
    border-radius: 8px !important;
    padding: 4px !important;
    box-sizing: border-box !important;
  }

  .product-gallery__favorite,
  .v10-pdp-hero-image-card .pdp-wish-btn {
    top: 12px !important;
    right: 12px !important;
    width: 36px !important;
    height: 36px !important;
  }

  .product-gallery__zoom-btn {
    bottom: 12px !important;
    right: 12px !important;
    width: 32px !important;
    height: 32px !important;
  }

  .product-gallery-lightbox__dialog {
    width: 95vw;
    max-height: 95vh;
  }

  .product-gallery-lightbox__img-wrap {
    padding: 12px;
    max-height: 60vh;
  }

  .product-gallery-lightbox__img-wrap img {
    max-height: calc(60vh - 24px);
  }

  .product-gallery-lightbox__nav {
    width: 36px;
    height: 36px;
  }
}

/* Extra small mobile screens (<= 360px) */
@media (max-width: 360px) {
  .product-gallery__viewport,
  .v10-pdp-hero-image-card {
    max-height: 300px !important;
    min-height: 220px !important;
    padding: 10px !important;
  }

  .product-gallery__thumb,
  .v10-pdp-thumb-item {
    flex: 0 0 52px !important;
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    min-height: 52px !important;
  }
}

