/**
 * JB Toolkit — Product Carousel Styles
 * Custom styles for Swiper carousels in DIVI WooCommerce Shop modules.
 *
 * Color scheme:
 *   Purple:    #4C1DA1
 *   Neon green: #91ff00
 *
 * @since 1.1.0
 */

/* ══════════════════════════════════════════════════════════
   PRODUCT TITLES — clamp to 2 lines
   ══════════════════════════════════════════════════════════ */

.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product .woocommerce-loop-product__title a {
  display: -webkit-box !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden !important;
  white-space: normal !important;
  text-overflow: ellipsis;
  line-height: 1.35;
  max-height: calc(1.35em * 2);
  word-break: break-word;
  hyphens: auto;
}

/* ══════════════════════════════════════════════════════════
   NAVIGATION ARROWS
   ══════════════════════════════════════════════════════════ */

.jb-carousel-controls {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  padding: 0 0;
}

/* Arrow base */
.jb-carousel-controls .swiper-button-next,
.jb-carousel-controls .swiper-button-prev {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  margin-top: 0;
  width: 40px;
  height: 40px;
  color: #4C1DA1;
  flex-shrink: 0;
}

.jb-carousel-controls .swiper-button-next::after,
.jb-carousel-controls .swiper-button-prev::after {
  font-size: 30px;
}

/* Arrow text shadow for depth */
.jb-carousel-controls .swiper-button-next::after {
  text-shadow: -3px 0 5px #4C1DA1;
}

.jb-carousel-controls .swiper-button-prev::after {
  text-shadow: 3px 0 5px #4C1DA1;
}

/* Arrow hover — neon green */
.jb-carousel-controls .swiper-button-next:hover::after,
.jb-carousel-controls .swiper-button-prev:hover::after {
  color: #91ff00;
  text-shadow: 0 0 5px #91ff00 !important;
}

/* Disabled arrows — hidden */
.jb-carousel-controls .swiper-button-next.swiper-button-disabled,
.jb-carousel-controls .swiper-button-prev.swiper-button-disabled {
  opacity: 0;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   PAGINATION DOTS
   ══════════════════════════════════════════════════════════ */

.jb-carousel-controls .swiper-pagination {
  position: relative;
  bottom: auto;
  width: auto !important;
  flex: 1;
  text-align: center;
}

.jb-carousel-controls .swiper-pagination-bullet {
  background-color: rgba(58, 22, 121, 0.7);
  opacity: 1;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.jb-carousel-controls .swiper-pagination-bullet:hover {
  background-color: rgba(145, 255, 0, 0.7);
}

.jb-carousel-controls .swiper-pagination-bullet-active {
  background-color: #4C1DA1 !important;
  transform: scale(1.2);
}

/* ══════════════════════════════════════════════════════════
   SWIPER CONTAINER — DIVI overrides
   ══════════════════════════════════════════════════════════ */

/* Ensure swiper wrapper doesn't inherit DIVI flex/grid */
[class*="jb-carousel"] .woocommerce.swiper {
  overflow: hidden;
}

/* Remove DIVI default bottom margin on products list */
[class*="jb-carousel"] .products.swiper-wrapper {
  display: flex !important;
  box-sizing: content-box;
  margin-bottom: 0 !important;
}

/* Single-row carousels: prevent wrapping */
.et_pb_shop[class*="jb-carousel"]:not([class*="jb-carousel-grid"]) .products.swiper-wrapper {
  flex-wrap: nowrap !important;
}

/* Grid carousels: Swiper needs flex-wrap:wrap for multi-row */
.et_pb_shop[class*="jb-carousel-grid"] .products.swiper-wrapper {
  flex-wrap: wrap !important;
}

[class*="jb-carousel"] .products.swiper-wrapper > .product.swiper-slide {
  float: none !important;
  flex-shrink: 0;
  box-sizing: border-box;
  margin-bottom: 0 !important;
}

/* Slide transition — smooth ease-in-out */
[class*="jb-carousel"] .products.swiper-wrapper {
  transition-timing-function: ease-in-out !important;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (<768px)
   ══════════════════════════════════════════════════════════ */

@media (max-width: 767px) {

  .jb-carousel-controls {
    padding: 0 10px;
    gap: 6px;
    margin-top: 4px;
  }

  .jb-carousel-controls .swiper-button-next,
  .jb-carousel-controls .swiper-button-prev {
    width: 30px;
    height: 30px;
  }

  .jb-carousel-controls .swiper-button-next::after,
  .jb-carousel-controls .swiper-button-prev::after {
    font-size: 20px;
  }

  .jb-carousel-controls .swiper-pagination-bullet {
    width: 6px;
    height: 6px;
    margin: 0 2px !important;
  }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (768px–980px)
   ══════════════════════════════════════════════════════════ */

@media (min-width: 768px) and (max-width: 980px) {

  .jb-carousel-controls {
    padding: 0 20px;
    gap: 8px;
  }

  .jb-carousel-controls .swiper-button-next::after,
  .jb-carousel-controls .swiper-button-prev::after {
    font-size: 24px;
  }

  .jb-carousel-controls .swiper-pagination-bullet {
    width: 7px;
    height: 7px;
    margin: 0 3px !important;
  }
}
