/* Thumbnail strip: single row that scrolls sideways */
.product-images-widget .woocommerce-product-gallery .flex-control-thumbs {
  display: flex !important;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 10px 0 0 !important;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none; /* Firefox: hide scrollbar */
  cursor: grab;
  touch-action: pan-y; /* horizontal finger drags go to the script; page can still scroll up/down */
  user-select: none;
  -webkit-user-select: none;
}

.product-images-widget
  .woocommerce-product-gallery
  .flex-control-thumbs::-webkit-scrollbar {
  display: none; /* Chrome/Safari: hide scrollbar */
}

.product-images-widget
  .woocommerce-product-gallery
  .flex-control-thumbs.is-dragging {
  cursor: grabbing;
}

/* 4 thumbnails visible at a time (change 25% to 33.333% for 3, 20% for 5) */
.product-images-widget .woocommerce-product-gallery .flex-control-thumbs li {
  flex: 0 0 calc(25% - 6px);
  /* width: auto !important; */
  width: 145px !important;
  height: 145px !important;
  float: none !important;
  margin: 0 !important;
}

.product-images-widget .woocommerce-product-gallery .flex-control-thumbs img {
  display: block;
  /* height: auto; */
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  -webkit-user-drag: none; /* no "ghost image" when dragging */
}

/*Enable prev/next arrows on the WooCommerce product gallery*/
.product-images-widget .woocommerce-product-gallery .flex-viewport {
  position: relative;
}

.product-images-widget .woocommerce-product-gallery .flex-direction-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.product-images-widget .woocommerce-product-gallery .flex-direction-nav a {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0; /* hides any leftover text */
  text-decoration: none;
  transition:
    background 0.2s,
    opacity 0.2s;
}

.product-images-widget
  .woocommerce-product-gallery
  .flex-direction-nav
  a:hover {
  background: #fff;
}

.product-images-widget
  .woocommerce-product-gallery
  .flex-direction-nav
  .flex-prev {
  left: 12px;
}
.product-images-widget
  .woocommerce-product-gallery
  .flex-direction-nav
  .flex-next {
  right: 12px;
}

/* Chevron icons */
.product-images-widget
  .woocommerce-product-gallery
  .flex-direction-nav
  a::before {
  content: "";
  width: 10px;
  height: 10px;
  border-top: 2px solid #333;
  border-left: 2px solid #333;
}

.product-images-widget
  .woocommerce-product-gallery
  .flex-direction-nav
  .flex-prev::before {
  transform: rotate(-45deg);
  margin-left: 4px;
}

.product-images-widget
  .woocommerce-product-gallery
  .flex-direction-nav
  .flex-next::before {
  transform: rotate(135deg);
  margin-right: 4px;
}

/* Fade out arrow when there's no previous/next image */
.product-images-widget
  .woocommerce-product-gallery
  .flex-direction-nav
  .flex-disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Set the Product Image to Fixed Height */
.product-images-widget .woocommerce-product-gallery__image a {
  display: block !important;
  aspect-ratio: 1 / 1;
  background: #fff;
}

.product-images-widget
  .woocommerce-product-gallery
  .woocommerce-product-gallery__image
  a
  img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

/* Set border to active image */
.product-images-widget
  .woocommerce-product-gallery
  .flex-control-thumbs
  img.flex-active {
  border: 3px solid #000000;
}

@media (max-width: 767px) {
  .product-images-widget .woocommerce-product-gallery .flex-control-thumbs li {
    flex-basis: 90px;
    width: 90px !important;
    height: 90px !important;
  }
}
