/**
 * PixelBorsch Core - Product Gallery Pro Module (1:1 Ratio)
 * Luxury square image slider & thumbnail strip for WooCommerce single product.
 * @package PixelBorsch_Core
 */

:root {
  --pb-pg-gold: #C5A059;
  --pb-pg-gold-hover: #AF8B45;
  --pb-pg-gold-subtle: rgba(197, 160, 89, 0.15);
  --pb-pg-gold-glow: rgba(197, 160, 89, 0.3);
  --pb-pg-border: #E8E2D8;
  --pb-pg-bg: #FAF6F0;
  --pb-pg-radius: 16px;
  --pb-pg-thumb-size: 70px;
  --pb-pg-thumb-gap: 12px;
}

/* 1. Main Gallery Container */
.pb-product-gallery {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  user-select: none;
}

/* 2. Main 1:1 Square Viewport */
.pb-gallery-main {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background-color: var(--pb-pg-bg);
  border: 1px solid var(--pb-pg-border);
  border-radius: var(--pb-pg-radius);
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(42, 39, 37, 0.06);
  margin-bottom: var(--pb-pg-thumb-gap);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pb-gallery-slides-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.pb-gallery-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s ease;
  z-index: 1;
}

.pb-gallery-slide.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 2;
}

.pb-gallery-slide__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hover Zoom Option */
.pb-gallery--hover-zoom .pb-gallery-main:hover .pb-gallery-slide.is-active .pb-gallery-slide__img {
  transform: scale(1.08);
}

/* Image Fit Mode: Contain with padding */
.pb-gallery--fit-contain .pb-gallery-slide__img {
  object-fit: contain;
  padding: 12px;
}

/* 3. Badges overlay */
.pb-gallery-badges {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

/* 4. Action Buttons (Zoom & Arrows) */
.pb-gallery-zoom-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(197, 160, 89, 0.3);
  color: #2A2725;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transition: all 0.25s ease;
  text-decoration: none;
}

.pb-gallery-zoom-btn:hover {
  background: var(--pb-pg-gold);
  color: #fff;
  transform: scale(1.08);
  box-shadow: 0 6px 18px var(--pb-pg-gold-glow);
}

.pb-gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(197, 160, 89, 0.25);
  color: #2A2725;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  visibility: hidden;
}

.pb-gallery-main:hover .pb-gallery-arrow {
  opacity: 1;
  visibility: visible;
}

.pb-gallery-arrow--prev {
  left: 12px;
}
.pb-gallery-arrow--next {
  right: 12px;
}

.pb-gallery-arrow:hover {
  background: var(--pb-pg-gold);
  color: #fff;
  border-color: var(--pb-pg-gold);
  transform: translateY(-50%) scale(1.08);
}

/* 5. Thumbnail Strip */
.pb-gallery-thumbs {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.pb-gallery-thumbs-track {
  display: flex;
  gap: var(--pb-pg-thumb-gap);
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 4px 2px 8px 2px;
  -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar */
.pb-gallery-thumbs-track::-webkit-scrollbar {
  height: 4px;
}
.pb-gallery-thumbs-track::-webkit-scrollbar-thumb {
  background: rgba(197, 160, 89, 0.3);
  border-radius: 4px;
}
.pb-gallery-thumbs-track::-webkit-scrollbar-track {
  background: transparent;
}

.pb-gallery-thumb {
  position: relative;
  flex: 0 0 var(--pb-pg-thumb-size);
  width: var(--pb-pg-thumb-size);
  height: var(--pb-pg-thumb-size);
  aspect-ratio: 1 / 1;
  border-radius: calc(var(--pb-pg-radius) - 6px);
  background-color: var(--pb-pg-bg);
  border: 1.5px solid var(--pb-pg-border);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0.65;
}

.pb-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pb-gallery-thumb:hover {
  opacity: 1;
  border-color: rgba(197, 160, 89, 0.6);
  transform: translateY(-2px);
}

.pb-gallery-thumb.is-active {
  opacity: 1;
  border: 2px solid var(--pb-pg-gold);
  box-shadow: 0 6px 16px var(--pb-pg-gold-glow);
  transform: translateY(-2px);
}

/* 6. Mobile Swiper & Bullets */
.pb-gallery-bullets {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.pb-gallery-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pb-pg-border);
  transition: all 0.25s ease;
  cursor: pointer;
}

.pb-gallery-bullet.is-active {
  width: 22px;
  border-radius: 10px;
  background: var(--pb-pg-gold);
}

/* 7. Responsive Rules */
@media (max-width: 767px) {
  :root {
    --pb-pg-thumb-size: 58px;
    --pb-pg-thumb-gap: 10px;
  }

  .pb-gallery-arrow {
    opacity: 1;
    visibility: visible;
    width: 36px;
    height: 36px;
  }

  .pb-gallery-arrow--prev {
    left: 8px;
  }
  .pb-gallery-arrow--next {
    right: 8px;
  }

  .pb-gallery-zoom-btn {
    width: 34px;
    height: 34px;
    top: 10px;
    right: 10px;
  }

  .pb-gallery-bullets {
    display: flex;
  }
}
