/**
 * Product Gallery Widget Styles
 * Bricks Addon By NUTSWP (PRO)
 * 
 * Supports:
 * - Fluid aspect ratios (1:1, 4:3, 16:9, portrait, custom)
 * - Object-fit & object-position
 * - Multi-position thumbnail nav (bottom, top, left, right)
 * - Responsive thumbnail counts & gaps
 * - High-performance hardware-accelerated zoom magnifier
 * - Fullscreen lightbox gallery
 * - First slide video embed (YouTube, Vimeo, MP4) with thumbnail play badge
 */

:root {
  --nutswp-pg-primary: #2563eb;
}

/* ==========================================================================
   Root Container & Layouts
   ========================================================================== */
.nutswp-product-gallery {
  --pg-main-aspect-ratio: 1/1;
  --pg-main-fit: cover;
  --pg-main-pos: center center;
  --pg-thumbs-count: 5;
  --pg-thumbs-vertical-width: 90px;
  --pg-vertical-viewport-height: 490px;
  --pg-main-thumbs-gap: 16px;
  --pg-thumbs-gap: 10px;
  --pg-thumb-aspect-ratio: 1/1;
  --pg-thumb-border-color: #e5e7eb;
  --pg-thumb-active-border-color: #2563eb;
  --pg-thumb-active-border-width: 2px;
  --pg-thumb-inactive-opacity: 0.7;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  margin: 0;
  padding: 0;
}

.nutswp-product-gallery.thumb-ratio-same {
  --pg-thumb-aspect-ratio: var(--pg-main-aspect-ratio, 1/1);
}

.nutswp-product-gallery * {
  box-sizing: border-box;
}

/* Position: Bottom (Default) */
.nutswp-product-gallery.pos-bottom {
  flex-direction: column;
  gap: var(--pg-main-thumbs-gap, 16px);
}
.nutswp-product-gallery.pos-bottom .nutswp-pg-main-wrapper {
  order: 1;
}
.nutswp-product-gallery.pos-bottom .nutswp-pg-thumbs-wrapper {
  order: 2;
}

/* Position: Top */
.nutswp-product-gallery.pos-top {
  flex-direction: column;
  gap: var(--pg-main-thumbs-gap, 16px);
}
.nutswp-product-gallery.pos-top .nutswp-pg-thumbs-wrapper {
  order: 1;
}
.nutswp-product-gallery.pos-top .nutswp-pg-main-wrapper {
  order: 2;
}

/* Position: Left */
.nutswp-product-gallery.pos-left {
  flex-direction: row;
  gap: var(--pg-main-thumbs-gap, 16px);
  align-items: flex-start;
}
.nutswp-product-gallery.pos-left .nutswp-pg-thumbs-wrapper {
  order: 1;
  width: var(--pg-thumbs-vertical-width, 90px);
  min-width: 60px;
  max-width: 250px;
  flex-shrink: 0;
}
.nutswp-product-gallery.pos-left .nutswp-pg-main-wrapper {
  order: 2;
  flex: 1;
  min-width: 0;
}

/* Position: Right */
.nutswp-product-gallery.pos-right {
  flex-direction: row;
  gap: var(--pg-main-thumbs-gap, 16px);
  align-items: flex-start;
}
.nutswp-product-gallery.pos-right .nutswp-pg-main-wrapper {
  order: 1;
  flex: 1;
  min-width: 0;
}
.nutswp-product-gallery.pos-right .nutswp-pg-thumbs-wrapper {
  order: 2;
  width: var(--pg-thumbs-vertical-width, 90px);
  min-width: 60px;
  max-width: 250px;
  flex-shrink: 0;
}

/* ==========================================================================
   Main Slider Stage
   ========================================================================== */
.nutswp-pg-main-wrapper {
  position: relative;
  width: 100%;
}

.nutswp-pg-main-stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--pg-main-aspect-ratio, 1 / 1);
  background-color: var(--pg-main-bg, #ffffff);
  border-style: var(--pg-main-border-style, solid);
  border-width: var(--pg-main-border-width, 1px);
  border-color: var(--pg-main-border-color, #e5e7eb);
  border-radius: var(--pg-main-radius, 12px);
  overflow: hidden;
  user-select: none;
  touch-action: pan-y pinch-zoom;
}

/* ==========================================================================
   Main Slider Stage Aspect Ratio Presets
   ========================================================================== */
.nutswp-product-gallery.ratio-1-1 .nutswp-pg-main-stage { aspect-ratio: 1 / 1; }
.nutswp-product-gallery.ratio-4-3 .nutswp-pg-main-stage { aspect-ratio: 4 / 3; }
.nutswp-product-gallery.ratio-3-2 .nutswp-pg-main-stage { aspect-ratio: 3 / 2; }
.nutswp-product-gallery.ratio-16-9 .nutswp-pg-main-stage { aspect-ratio: 16 / 9; }
.nutswp-product-gallery.ratio-3-4 .nutswp-pg-main-stage { aspect-ratio: 3 / 4; }
.nutswp-product-gallery.ratio-2-3 .nutswp-pg-main-stage { aspect-ratio: 2 / 3; }
.nutswp-product-gallery.ratio-auto .nutswp-pg-main-stage { aspect-ratio: auto; height: auto; }
.nutswp-product-gallery.ratio-auto .nutswp-pg-main-track,
.nutswp-product-gallery.ratio-auto .nutswp-pg-main-slide,
.nutswp-product-gallery.ratio-auto .nutswp-pg-main-image-wrap { height: auto; }
.nutswp-product-gallery.ratio-auto .nutswp-pg-main-image { height: auto; max-height: 75vh; object-fit: contain; }

/* Thumbnail Aspect Ratio Presets */
.nutswp-product-gallery.thumb-ratio-1-1 .nutswp-pg-thumb-item { aspect-ratio: 1 / 1; }
.nutswp-product-gallery.thumb-ratio-4-3 .nutswp-pg-thumb-item { aspect-ratio: 4 / 3; }
.nutswp-product-gallery.thumb-ratio-3-4 .nutswp-pg-thumb-item { aspect-ratio: 3 / 4; }

/* Thumbnail same as main */
.nutswp-product-gallery.thumb-ratio-same .nutswp-pg-thumb-item { aspect-ratio: var(--pg-main-aspect-ratio, 1 / 1); }
.nutswp-product-gallery.ratio-1-1.thumb-ratio-same .nutswp-pg-thumb-item { aspect-ratio: 1 / 1; }
.nutswp-product-gallery.ratio-4-3.thumb-ratio-same .nutswp-pg-thumb-item { aspect-ratio: 4 / 3; }
.nutswp-product-gallery.ratio-3-2.thumb-ratio-same .nutswp-pg-thumb-item { aspect-ratio: 3 / 2; }
.nutswp-product-gallery.ratio-16-9.thumb-ratio-same .nutswp-pg-thumb-item { aspect-ratio: 16 / 9; }
.nutswp-product-gallery.ratio-3-4.thumb-ratio-same .nutswp-pg-thumb-item { aspect-ratio: 3 / 4; }
.nutswp-product-gallery.ratio-2-3.thumb-ratio-same .nutswp-pg-thumb-item { aspect-ratio: 2 / 3; }

/* Box Shadow Presets */
.nutswp-pg-main-stage.shadow-sm {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
}
.nutswp-pg-main-stage.shadow-md {
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.1), 0 2px 6px -2px rgba(0, 0, 0, 0.06);
}
.nutswp-pg-main-stage.shadow-lg {
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.12), 0 4px 10px -2px rgba(0, 0, 0, 0.05);
}

.nutswp-pg-main-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

/* Fade Transition Mode */
.nutswp-product-gallery.effect-fade .nutswp-pg-main-track {
  position: relative;
  display: block;
}
.nutswp-product-gallery.effect-fade .nutswp-pg-main-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  z-index: 1;
}
.nutswp-product-gallery.effect-fade .nutswp-pg-main-slide.is-active {
  opacity: 1;
  visibility: visible;
  position: relative;
  z-index: 2;
}

/* Slide Item */
.nutswp-pg-main-slide {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

/* Main Image */
.nutswp-pg-main-image-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.nutswp-product-gallery.has-lightbox .nutswp-pg-main-image-wrap {
  cursor: pointer;
}

.nutswp-product-gallery.has-zoom .nutswp-pg-main-image-wrap {
  cursor: zoom-in;
}

.nutswp-product-gallery.no-zoom.no-lightbox .nutswp-pg-main-image-wrap {
  cursor: default !important;
}


.nutswp-pg-main-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: var(--pg-main-fit, cover);
  object-position: var(--pg-main-pos, center center);
  transform-origin: center center;
  transition: transform 0.15s ease-out;
  pointer-events: none;
}

/* When inner zoom is active */
.nutswp-pg-main-image-wrap.is-zoomed .nutswp-pg-main-image {
  transition: none;
}

/* ==========================================================================
   Video Slide & Interactive Poster
   ========================================================================== */
.nutswp-pg-video-slide {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nutswp-pg-video-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #000000;
}

.nutswp-pg-video-container iframe,
.nutswp-pg-video-container video {
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  object-fit: contain;
}

.nutswp-pg-video-poster-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000000;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nutswp-pg-video-container.is-playing .nutswp-pg-video-poster-wrap {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.nutswp-pg-video-poster {
  width: 100%;
  height: 100%;
  object-fit: var(--pg-main-fit, cover);
  object-position: var(--pg-main-pos, center center);
  display: block;
}

.nutswp-pg-video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--pg-video-btn-size, 68px);
  height: var(--pg-video-btn-size, 68px);
  background-color: var(--pg-video-btn-bg, var(--nutswp-pg-primary, #2563eb));
  border: 3px solid #ffffff;
  border-radius: 50%;
  color: var(--pg-video-btn-color, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  margin: 0;
  outline: none;
  box-sizing: border-box;
  z-index: 7;
}

.nutswp-pg-video-poster-wrap:hover .nutswp-pg-video-play-btn {
  transform: translate(-50%, -50%) scale(1.12);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.55);
}

.nutswp-pg-video-play-btn svg {
  width: var(--pg-video-btn-icon-size, 28px);
  height: var(--pg-video-btn-icon-size, 28px);
  fill: currentColor !important;
  color: inherit !important;
  margin-left: 4px;
  pointer-events: none;
  transition: fill 0.2s ease, color 0.2s ease;
}

.nutswp-pg-video-play-btn svg polygon,
.nutswp-pg-video-play-btn polygon {
  fill: currentColor !important;
  color: inherit !important;
  pointer-events: none;
  transition: fill 0.2s ease;
}

.nutswp-pg-video-play-btn:hover svg,
.nutswp-pg-video-play-btn:hover svg polygon,
.nutswp-pg-video-play-btn:hover polygon {
  fill: currentColor !important;
  color: inherit !important;
}

/* ==========================================================================
   Main Stage Arrows
   ========================================================================== */
.nutswp-pg-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: var(--pg-arrow-size, 40px);
  height: var(--pg-arrow-size, 40px);
  background-color: var(--pg-arrow-bg, rgba(255, 255, 255, 0.92));
  color: var(--pg-arrow-color, #1f2937);
  border-style: solid;
  border-width: 1px;
  border-color: rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  padding: 0;
  box-sizing: border-box;
}

.nutswp-pg-arrow:hover {
  background-color: var(--pg-arrow-hover-bg, #ffffff);
  color: var(--nutswp-pg-primary, #2563eb);
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.nutswp-product-gallery.has-arrow-hover-border .nutswp-pg-arrow:hover,
.nutswp-pg-arrow[style*="--pg-arrow-hover-border-color"]:hover,
.nutswp-product-gallery[style*="--pg-arrow-hover-border-color"] .nutswp-pg-arrow:hover {
  border-color: var(--pg-arrow-hover-border-color) !important;
}

.nutswp-pg-arrow svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nutswp-pg-arrow.nutswp-pg-prev {
  left: 12px;
}

.nutswp-pg-arrow.nutswp-pg-next {
  right: 12px;
}

/* Hover-only mode */
.nutswp-pg-main-stage.arrows-hover .nutswp-pg-arrow {
  opacity: 0;
  visibility: hidden;
}
.nutswp-pg-main-stage.arrows-hover:hover .nutswp-pg-arrow {
  opacity: 1;
  visibility: visible;
}

/* Ensure arrows, thumbnails and dots are always clickable and receive pointer events in editor and frontend */
.nutswp-pg-arrow,
.nutswp-pg-thumb-arrow,
.nutswp-pg-thumb-item,
.nutswp-pg-dot {
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* In Bricks Builder editor canvas: keep hover arrows visible on container hover or when selected */
body:not(.bricks-is-frontend) .nutswp-product-gallery:hover .nutswp-pg-arrow,
body:not(.bricks-is-frontend) .nutswp-product-gallery.brx-active .nutswp-pg-arrow,
body:not(.bricks-is-frontend) .nutswp-product-gallery.brxe-selected .nutswp-pg-arrow,
.bricks-is-builder .nutswp-product-gallery:hover .nutswp-pg-arrow,
.bricks-is-builder .nutswp-product-gallery.brx-active .nutswp-pg-arrow,
.bricks-is-builder .nutswp-product-gallery.brxe-selected .nutswp-pg-arrow {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Zoom Hint Badge */
.nutswp-pg-zoom-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.nutswp-pg-zoom-badge:hover {
  background: #ffffff;
  color: var(--nutswp-pg-primary);
  transform: scale(1.06);
}

.nutswp-pg-zoom-badge svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Pagination Dots */
.nutswp-pg-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
  pointer-events: none;
}

.nutswp-pg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.2);
  transition: all 0.25s ease;
}

.nutswp-pg-dot.is-active {
  width: 22px;
  border-radius: 4px;
  background: var(--nutswp-pg-primary, #2563eb);
  border-color: transparent;
}

/* ==========================================================================
   Thumbnails Navigation Slider
   ========================================================================== */
.nutswp-pg-thumbs-wrapper {
  position: relative;
  width: 100%;
}

/* Horizontal Thumbs (Bottom / Top) */
.nutswp-product-gallery.pos-bottom .nutswp-pg-thumbs-wrapper,
.nutswp-product-gallery.pos-top .nutswp-pg-thumbs-wrapper {
  display: block;
}

.nutswp-pg-thumbs-viewport {
  position: relative;
  width: 100%;
  overflow: hidden;
  user-select: none;
}

.nutswp-pg-thumbs-track {
  display: flex;
  width: 100%;
  gap: var(--pg-thumbs-gap, 10px);
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

/* Vertical Thumbs (Left / Right) */
.nutswp-product-gallery.pos-left .nutswp-pg-thumbs-wrapper,
.nutswp-product-gallery.pos-right .nutswp-pg-thumbs-wrapper {
  display: block;
  width: var(--pg-thumbs-vertical-width, 90px);
  min-width: 60px;
  max-width: 250px;
  flex-shrink: 0;
}

.nutswp-product-gallery.pos-left .nutswp-pg-thumbs-viewport,
.nutswp-product-gallery.pos-right .nutswp-pg-thumbs-viewport {
  width: 100%;
  height: var(--pg-vertical-viewport-height, calc((var(--pg-thumbs-vertical-width, 90px) * var(--pg-thumbs-count, 5)) + (var(--pg-thumbs-gap, 10px) * (var(--pg-thumbs-count, 5) - 1))));
  max-height: none;
  overflow: hidden;
}

.nutswp-product-gallery.pos-left .nutswp-pg-thumbs-track,
.nutswp-product-gallery.pos-right .nutswp-pg-thumbs-track {
  width: 100%;
  flex-direction: column;
}

/* Thumbnail Item */
.nutswp-pg-thumb-item {
  position: relative;
  flex: 0 0 calc((100% - (var(--pg-thumbs-gap, 10px) * (var(--pg-thumbs-count, 5) - 1))) / var(--pg-thumbs-count, 5));
  aspect-ratio: var(--pg-thumb-aspect-ratio, 1 / 1);
  background-color: var(--pg-thumb-bg, #f9fafb);
  border-style: var(--pg-thumb-border-style, solid);
  border-width: var(--pg-thumb-border-width, 1px);
  border-color: var(--pg-thumb-border-color, #e5e7eb);
  border-radius: var(--pg-thumb-radius, 8px);
  overflow: hidden;
  cursor: pointer;
  opacity: var(--pg-thumb-inactive-opacity, 0.7);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Left / Right Vertical Thumbnail Sizing */
.nutswp-product-gallery.pos-left .nutswp-pg-thumb-item,
.nutswp-product-gallery.pos-right .nutswp-pg-thumb-item {
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: var(--pg-thumb-aspect-ratio, 1 / 1);
}

.nutswp-pg-thumb-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  transition: transform 0.25s ease;
}

.nutswp-pg-thumb-item:hover {
  opacity: 1;
  border-color: var(--pg-thumb-active-border-color, #2563eb);
}

.nutswp-pg-thumb-item:hover img {
  transform: scale(1.05);
}

/* Active Thumbnail */
.nutswp-pg-thumb-item.is-active {
  opacity: 1;
  border-color: var(--pg-thumb-active-border-color, #2563eb);
  border-width: var(--pg-thumb-active-border-width, 2px);
  box-shadow: 0 0 0 1px var(--pg-thumb-active-border-color, #2563eb);
}

/* Video Badge on Thumbnail */
.nutswp-pg-video-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--pg-thumb-video-badge-size, 26px);
  height: var(--pg-thumb-video-badge-size, 26px);
  padding: 0;
  margin: 0;
  background-color: var(--pg-thumb-video-badge-bg, rgba(0, 0, 0, 0.65));
  backdrop-filter: blur(4px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--pg-thumb-video-badge-color, #ffffff);
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
  box-sizing: border-box;
}

.nutswp-pg-thumb-item:hover .nutswp-pg-video-badge,
.nutswp-pg-thumb-item.is-active .nutswp-pg-video-badge,
.nutswp-pg-video-badge:hover {
  background-color: var(--pg-thumb-video-badge-hover-bg, var(--nutswp-pg-primary, #2563eb));
  color: var(--pg-thumb-video-badge-hover-color, #ffffff);
  transform: translate(-50%, -50%) scale(1.1);
}

.nutswp-pg-video-badge svg {
  width: var(--pg-thumb-video-badge-icon-size, 12px);
  height: var(--pg-thumb-video-badge-icon-size, 12px);
  fill: currentColor !important;
  color: inherit !important;
  margin-left: 2px;
  pointer-events: none;
  transition: fill 0.2s ease, color 0.2s ease;
}

.nutswp-pg-video-badge svg polygon,
.nutswp-pg-video-badge polygon {
  fill: currentColor !important;
  color: inherit !important;
  pointer-events: none;
  transition: fill 0.2s ease;
}

.nutswp-pg-thumb-item:hover .nutswp-pg-video-badge svg,
.nutswp-pg-thumb-item:hover .nutswp-pg-video-badge polygon,
.nutswp-pg-thumb-item.is-active .nutswp-pg-video-badge svg,
.nutswp-pg-thumb-item.is-active .nutswp-pg-video-badge polygon,
.nutswp-pg-video-badge:hover svg,
.nutswp-pg-video-badge:hover polygon {
  fill: currentColor !important;
  color: inherit !important;
}

/* Thumbnail Arrows - Overlay positioning to NOT steal width */
.nutswp-pg-thumb-arrow {
  position: absolute;
  width: 28px;
  height: 28px;
  background-color: rgba(255, 255, 255, 0.92);
  color: #374151;
  border-style: solid;
  border-width: 1px;
  border-color: rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nutswp-pg-thumb-arrow:hover {
  background-color: #ffffff;
  color: var(--nutswp-pg-primary, #2563eb);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
}

.nutswp-product-gallery.has-thumb-arrow-hover-border .nutswp-pg-thumb-arrow:hover,
.nutswp-pg-thumb-arrow[style*="--pg-thumb-arrow-hover-border-color"]:hover,
.nutswp-product-gallery[style*="--pg-thumb-arrow-hover-border-color"] .nutswp-pg-thumb-arrow:hover {
  border-color: var(--pg-thumb-arrow-hover-border-color) !important;
}

.nutswp-pg-thumb-arrow svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  flex-shrink: 0;
}

/* Horizontal layout arrows (bottom / top) */
.nutswp-product-gallery.pos-bottom .nutswp-pg-thumb-arrow,
.nutswp-product-gallery.pos-top .nutswp-pg-thumb-arrow {
  top: 50%;
  transform: translateY(-50%);
}
.nutswp-product-gallery.pos-bottom .nutswp-pg-thumb-prev,
.nutswp-product-gallery.pos-top .nutswp-pg-thumb-prev {
  left: 4px;
}
.nutswp-product-gallery.pos-bottom .nutswp-pg-thumb-next,
.nutswp-product-gallery.pos-top .nutswp-pg-thumb-next {
  right: 4px;
}

/* Vertical layout arrows (left / right) */
.nutswp-product-gallery.pos-left .nutswp-pg-thumb-arrow,
.nutswp-product-gallery.pos-right .nutswp-pg-thumb-arrow {
  left: 50%;
  transform: translateX(-50%);
}
.nutswp-product-gallery.pos-left .nutswp-pg-thumb-prev,
.nutswp-product-gallery.pos-right .nutswp-pg-thumb-prev {
  top: 4px;
}
.nutswp-product-gallery.pos-left .nutswp-pg-thumb-next,
.nutswp-product-gallery.pos-right .nutswp-pg-thumb-next {
  bottom: 4px;
}

/* ==========================================================================
   Fullscreen Lightbox Viewer
   ========================================================================== */
.nutswp-pg-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 15, 28, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
}

.nutswp-pg-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.nutswp-pg-lightbox-stage {
  position: relative;
  width: 90vw;
  height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.nutswp-pg-lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.nutswp-pg-lightbox-img.is-zoomed {
  cursor: grab;
  transform: scale(1.8);
}

/* Lightbox Top Bar */
.nutswp-pg-lightbox-topbar {
  position: absolute;
  top: 20px;
  left: 30px;
  right: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000000;
  color: #ffffff;
}

.nutswp-pg-lightbox-counter {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.5px;
}

.nutswp-pg-lightbox-actions {
  display: flex;
  gap: 12px;
}

.nutswp-pg-lightbox-btn {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.nutswp-pg-lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.08);
}

.nutswp-pg-lightbox-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Lightbox Nav Arrows */
.nutswp-pg-lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000000;
  transition: all 0.2s ease;
  outline: none;
}

.nutswp-pg-lightbox-arrow:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) scale(1.1);
}

.nutswp-pg-lightbox-arrow svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
}

.nutswp-pg-lightbox-prev {
  left: 24px;
}

.nutswp-pg-lightbox-next {
  right: 24px;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 991px) {
  /* Tablet adjustments */
  .nutswp-product-gallery {
    --pg-thumbs-count: 4;
  }
}

@media (max-width: 767px) {
  /* On mobile: keep main image on top and thumbnails underneath across all positions */
  .nutswp-product-gallery .nutswp-pg-main-wrapper {
    order: 1 !important;
  }
  .nutswp-product-gallery .nutswp-pg-thumbs-wrapper {
    order: 2 !important;
  }

  /* Mobile adjustments: auto collapse vertical thumbs to bottom */
  .nutswp-product-gallery.pos-left,
  .nutswp-product-gallery.pos-right {
    flex-direction: column !important;
  }

  .nutswp-product-gallery.pos-left .nutswp-pg-thumbs-wrapper,
  .nutswp-product-gallery.pos-right .nutswp-pg-thumbs-wrapper {
    width: 100% !important;
    flex-direction: row !important;
  }

  .nutswp-product-gallery.pos-left .nutswp-pg-thumbs-viewport,
  .nutswp-product-gallery.pos-right .nutswp-pg-thumbs-viewport {
    height: auto !important;
    max-height: none !important;
  }

  .nutswp-product-gallery.pos-left .nutswp-pg-thumb-item,
  .nutswp-product-gallery.pos-right .nutswp-pg-thumb-item {
    flex: 0 0 calc((100% - (var(--pg-thumbs-gap, 10px) * (var(--pg-thumbs-count, 4) - 1))) / var(--pg-thumbs-count, 4)) !important;
    width: auto !important;
  }

  .nutswp-product-gallery.pos-left .nutswp-pg-thumb-arrow,
  .nutswp-product-gallery.pos-right .nutswp-pg-thumb-arrow {
    top: 50% !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    transform: translateY(-50%) !important;
  }
  .nutswp-product-gallery.pos-left .nutswp-pg-thumb-prev,
  .nutswp-product-gallery.pos-right .nutswp-pg-thumb-prev {
    left: 4px !important;
    top: 50% !important;
  }
  .nutswp-product-gallery.pos-left .nutswp-pg-thumb-next,
  .nutswp-product-gallery.pos-right .nutswp-pg-thumb-next {
    right: 4px !important;
    top: 50% !important;
  }

  .nutswp-product-gallery.pos-left .nutswp-pg-thumbs-track,
  .nutswp-product-gallery.pos-right .nutswp-pg-thumbs-track {
    flex-direction: row !important;
  }

  .nutswp-product-gallery {
    --pg-thumbs-count: 4;
  }

  .nutswp-pg-arrow {
    width: 34px;
    height: 34px;
  }

  .nutswp-pg-arrow.nutswp-pg-prev {
    left: 8px;
  }
  .nutswp-pg-arrow.nutswp-pg-next {
    right: 8px;
  }

  .nutswp-pg-lightbox-arrow {
    width: 40px;
    height: 40px;
  }
  .nutswp-pg-lightbox-prev {
    left: 10px;
  }
  .nutswp-pg-lightbox-next {
    right: 10px;
  }
}

@media (max-width: 480px) {
  .nutswp-product-gallery {
    --pg-thumbs-count: 3;
  }
}
