/*
 * Divi Shop (et_pb_shop_grid + ul.products.columns-*) uses CSS Grid.
 * JS adds .am-carousel--custom-scroll and a DOM track/thumb (.am-custom-scrollbar) so scrolling has no native/OS steppers.
 */

.am-carousel.et_pb_shop .woocommerce ul.products[class*="columns-"] {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch;
  justify-content: flex-start;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 15px !important;
  padding-bottom: 18px !important;
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;

  /* Firefox scrollbar */
  scrollbar-width: auto;
  scrollbar-color: #1a1a1a rgba(236, 236, 236, 0.4);
}

.am-carousel.et_pb_shop .woocommerce ul.products[class*="columns-"] > li.product {
  flex: 0 0 auto !important;
  width: 22% !important;
  max-width: none !important;
  float: none !important;
  clear: none !important;
  margin: 0 !important;
  min-width: 290px !important;
}

/* WebKit scrollbar (native — do not hide unless custom bar JS is present) */
.am-carousel.et_pb_shop .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar {
  height: 6px;
}

.am-carousel.et_pb_shop .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-track {
  margin-inline: 4px;
  background: linear-gradient(
    to bottom,
    transparent 0 30%,
    #ececec 30% 70%,
    transparent 70% 100%
  );
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.am-carousel.et_pb_shop .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: linear-gradient(180deg, #2a2a2a, #0f0f0f);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.12);
  border: 2px solid #ececec;
  background-clip: padding-box;
}

.am-carousel.et_pb_shop .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #111, #000);
}

.am-carousel.et_pb_shop .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-thumb:active {
  background: #000;
}

.am-carousel.et_pb_shop .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-corner {
  background: transparent;
}

/*
 * Native horizontal scrollbar steppers (left/right “arrow” buttons) — WebKit/Blink only.
 * Firefox does not support these pseudos; its scrollbars usually have no steppers on macOS.
 * Windows Firefox may still show OS scrollbars (no reliable CSS to strip only the arrows).
 */
.am-carousel .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-button {
  -webkit-appearance: none;
  appearance: none;
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  background: transparent !important;
  border: none !important;
}

.am-carousel .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-button:horizontal:start:decrement,
.am-carousel .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-button:horizontal:end:increment,
.am-carousel .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-button:horizontal:start:increment,
.am-carousel .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-button:horizontal:end:decrement,
.am-carousel .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-button:single-button:horizontal:decrement,
.am-carousel .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-button:single-button:horizontal:increment,
.am-carousel .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-button:decrement,
.am-carousel .woocommerce ul.products[class*="columns-"]::-webkit-scrollbar-button:increment {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

html,
body {
  scrollbar-gutter: stable;
}

/* --- Custom prev/next (injected by am-product-slider.js) --- */
.am-carousel {
  position: relative;
}

.am-carousel__nav {
  box-sizing: border-box;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  color: #1a1a1a;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.am-carousel__nav:hover:not(:disabled) {
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.am-carousel__nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.am-carousel__nav:focus-visible {
  outline: 2px solid #1a1a1a;
  outline-offset: 2px;
}

.am-carousel__nav--prev {
  left: 6px;
}

.am-carousel__nav--next {
  right: 6px;
}

/* Chevrons (no SVG asset) */
.am-carousel__nav--prev::before,
.am-carousel__nav--next::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-style: solid;
  border-color: currentColor;
  border-width: 0 2px 2px 0;
}

.am-carousel__nav--prev::before {
  transform: rotate(135deg);
  margin-left: 3px;
}

.am-carousel__nav--next::before {
  transform: rotate(-45deg);
  margin-right: 3px;
}

/* Hide native scrollbar when JS builds the custom bar (see am-product-slider.js) */
.am-carousel.am-carousel--custom-scroll .woocommerce ul.products[class*="columns-"] {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.am-carousel.am-carousel--custom-scroll
  .woocommerce
  ul.products[class*="columns-"]::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent;
}

/* Custom bar — injected after ul.products */
.am-custom-scrollbar {
  box-sizing: border-box;
  width: 100%;
  padding: 0 19px 8px;
  margin-top: -4px;
}

.am-custom-scrollbar__track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: #ececec66;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  cursor: pointer;
}

.am-custom-scrollbar__thumb {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  min-width: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2a2a2a, #0f0f0f);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.12);
  cursor: grab;
  touch-action: none;
}

.am-custom-scrollbar__thumb:active {
  cursor: grabbing;
  background: #000;
}

.am-custom-scrollbar.is-hidden {
  display: none;
}

/* Non-Divi Woo loops: same behavior if .am-carousel wraps .woocommerce ul.products */
.am-carousel:not(.et_pb_shop) .woocommerce ul.products[class*="columns-"] {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: #1a1a1a rgba(236, 236, 236, 0.4);
}

.am-carousel:not(.et_pb_shop) .woocommerce ul.products[class*="columns-"] > li.product {
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: none !important;
  float: none !important;
  clear: none !important;
  margin: 0 !important;
  min-width: 290px !important;
}
