/**
 * Codersly Shop Add-on – compact single-product gallery.
 * Scope every rule to WooCommerce product galleries only.
 */
body.single-product .woocommerce div.product .woocommerce-product-gallery,
body.single-product.woocommerce div.product .woocommerce-product-gallery {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* WooCommerce's native FlexSlider thumbnail navigator, in exactly one row. */
body.single-product .woocommerce-product-gallery ol.flex-control-nav.flex-control-thumbs,
body.single-product .woocommerce-product-gallery ol.codersly-gallery-thumbnails {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 9px;
  align-items: stretch;
  width: 100% !important;
  max-width: 100%;
  margin: 12px 0 0 !important;
  padding: 2px 1px 8px !important;
  overflow-x: auto;
  overflow-y: hidden;
  list-style: none !important;
  box-sizing: border-box;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
body.single-product .woocommerce-product-gallery ol.flex-control-thumbs > li,
body.single-product .woocommerce-product-gallery ol.codersly-gallery-thumbnails > li {
  display: block !important;
  float: none !important;
  width: 76px !important;
  min-width: 76px;
  max-width: 76px;
  height: 94px;
  flex: 0 0 76px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 1px solid #d9e0e8;
  border-radius: 7px;
  background: #fff;
  box-sizing: border-box;
}
body.single-product .woocommerce-product-gallery ol.flex-control-thumbs > li img,
body.single-product .woocommerce-product-gallery ol.codersly-gallery-thumbnails > li img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 3px !important;
  border: 0 !important;
  border-radius: 0 !important;
  object-fit: contain;
  image-rendering: auto;
  filter: none !important;
  box-shadow: none !important;
  box-sizing: border-box;
  cursor: pointer;
}
body.single-product .woocommerce-product-gallery ol.flex-control-thumbs > li img {
  opacity: .72;
}
body.single-product .woocommerce-product-gallery ol.flex-control-thumbs > li img.flex-active,
body.single-product .woocommerce-product-gallery ol.flex-control-thumbs > li img:hover {
  opacity: 1;
}
body.single-product .woocommerce-product-gallery ol.flex-control-thumbs > li:has(img.flex-active),
body.single-product .woocommerce-product-gallery ol.codersly-gallery-thumbnails > li:has(button[aria-pressed="true"]) {
  border-color: #0d7465;
  box-shadow: 0 0 0 1px #0d7465;
}

/* Only the add-on owns thumbnail scrolling controls; Woo's slides and zoom
 * remain untouched by these styles. The scrollbar is replaced by arrows. */
body.single-product .woocommerce-product-gallery .codersly-gallery-thumb-shell {
  display: flex !important;
  align-items: center;
  gap: 7px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
body.single-product .woocommerce-product-gallery .codersly-gallery-thumb-shell > ol.flex-control-thumbs,
body.single-product .woocommerce-product-gallery .codersly-gallery-thumb-shell > ol.codersly-gallery-thumbnails {
  flex: 1 1 auto !important;
  min-width: 0;
  width: 100% !important;
  max-width: 100%;
  margin: 12px 0 0 !important;
  padding-bottom: 3px !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none;
}
body.single-product .woocommerce-product-gallery .codersly-gallery-thumb-shell > ol::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
body.single-product .woocommerce-product-gallery .codersly-gallery-arrow {
  display: none !important;
  flex: 0 0 33px !important;
  align-items: center;
  justify-content: center;
  width: 33px !important;
  height: 38px !important;
  min-width: 33px !important;
  min-height: 38px !important;
  max-width: 33px !important;
  margin: 12px 0 0 !important;
  padding: 0 !important;
  border: 1px solid #d4dfe1 !important;
  border-radius: 7px !important;
  background: #fff !important;
  color: #17685f !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
  cursor: pointer;
  line-height: 1 !important;
  -webkit-appearance: none;
  appearance: none;
}
body.single-product .woocommerce-product-gallery .codersly-gallery-thumb-has-overflow > .codersly-gallery-arrow {
  display: flex !important;
}
body.single-product .woocommerce-product-gallery .codersly-gallery-arrow::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}
body.single-product .woocommerce-product-gallery .codersly-gallery-arrow-previous::before {
  transform: translateX(2px) rotate(-135deg);
}
body.single-product .woocommerce-product-gallery .codersly-gallery-arrow-next::before {
  transform: translateX(-2px) rotate(45deg);
}
body.single-product .woocommerce-product-gallery .codersly-gallery-arrow:not(:disabled):hover {
  background: #e9f6f2 !important;
  border-color: #0d7465 !important;
}
body.single-product .woocommerce-product-gallery .codersly-gallery-arrow:disabled {
  opacity: .38 !important;
  cursor: default;
}
body.single-product .woocommerce-product-gallery .codersly-gallery-arrow:focus-visible {
  outline: 2px solid #0d7465 !important;
  outline-offset: 2px;
}
@media (max-width: 600px) {
  body.single-product .woocommerce-product-gallery .codersly-gallery-thumb-shell {
    gap: 5px;
  }
  body.single-product .woocommerce-product-gallery .codersly-gallery-arrow {
    flex-basis: 29px !important;
    width: 29px !important;
    min-width: 29px !important;
    max-width: 29px !important;
    height: 35px !important;
    min-height: 35px !important;
  }
}

/* Fallback navigator: only used when native WooCommerce thumbnails are absent. */
body.single-product .woocommerce-product-gallery .codersly-gallery-thumb-button {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
}
body.single-product .woocommerce-product-gallery .codersly-gallery-thumb-button:focus-visible,
body.single-product .woocommerce-product-gallery ol.flex-control-thumbs img:focus-visible {
  outline: 2px solid #0d7465 !important;
  outline-offset: -3px;
}
body.single-product .woocommerce-product-gallery.codersly-gallery-fallback {
  opacity: 1 !important;
}
body.single-product .woocommerce-product-gallery.codersly-gallery-fallback .woocommerce-product-gallery__wrapper {
  width: 100% !important;
  transform: none !important;
}
body.single-product .woocommerce-product-gallery.codersly-gallery-fallback .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image {
  display: none !important;
  float: none !important;
  width: 100% !important;
  margin: 0 !important;
}
body.single-product .woocommerce-product-gallery.codersly-gallery-fallback .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image.codersly-gallery-slide-active {
  display: block !important;
}

@media (max-width: 600px) {
  body.single-product .woocommerce-product-gallery ol.flex-control-thumbs > li,
  body.single-product .woocommerce-product-gallery ol.codersly-gallery-thumbnails > li {
    flex-basis: 62px !important;
    width: 62px !important;
    min-width: 62px;
    max-width: 62px;
    height: 78px;
  }
  body.single-product .woocommerce-product-gallery ol.flex-control-thumbs,
  body.single-product .woocommerce-product-gallery ol.codersly-gallery-thumbnails {
    gap: 7px;
  }
}
