/**
 * HL Product Slide Styles
 * Splide slider layout for products
 */

.hl-product-slide {
  margin-bottom: 2rem;
  position: relative;
}

/* Slide wrapper styling */
.hl-product-slide .product-slide-wrapper {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Ensure product cards are consistent height in slides */
.hl-product-slide .product {
  height: 100%;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

/* Ensure splide slides have fixed width - override Splide auto width */
.hl-product-slide .splide__slide {
  width: calc(25% - 15px) !important;
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  position: relative;
  margin-right: 20px;
  margin-left: 0px;
}

/* Override last slide margin */
.hl-product-slide .splide__slide:last-child {
  margin-right: 0;
}

/* Prevent flex inheritance from interfering with Splide calculations */
.hl-product-slide .splide__slide > * {
  flex: 0 0 auto !important;
}

/* Override any WooCommerce or theme flex styles that interfere */
.hl-product-slide .splide__slide .product {
  flex: 1 1 auto !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
}

.hl-product-slide .splide__slide .product-slide-wrapper {
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: none !important;
}

.hl-product-slide .product .box-image {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.hl-product-slide .product .box-image img {
  width: 100%;
  height: auto;
  transition: transform 0.3s ease;
  display: block;
}

.hl-product-slide .product:hover .box-image img {
  transform: scale(1.05);
}

.hl-product-slide .product .box-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

.hl-product-slide .product:hover .box-text {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.hl-product-slide .product .title-wrapper {
  margin-bottom: 0.5rem;
}

.hl-product-slide .product .woocommerce-loop-product__title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
  color: #333;
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.hl-product-slide .product .price-wrapper {
  margin-bottom: 1rem;
}

.hl-product-slide .product .price {
  font-size: 1.1rem;
  font-weight: 700;
  color: #e74c3c;
  margin: 0;
}

.hl-product-slide .product .add-to-cart-button {
  margin-top: auto;
  width: 100%;
}

/* Category tag styling */
.hl-product-slide .product .category-link {
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
  display: block;
}

/* Rating stars styling */
.hl-product-slide .product .star-rating {
  margin-bottom: 0.5rem;
}

/* Add to cart button styling */
.hl-product-slide .product .add_to_cart_button,
.hl-product-slide .product .product_type_simple,
.hl-product-slide .product .product_type_variable,
.hl-product-slide .product .product_type_external {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-weight: 600;
  text-align: center;
  transition: all 0.3s ease;
}

.hl-product-slide .product .add_to_cart_button:hover,
.hl-product-slide .product .product_type_simple:hover,
.hl-product-slide .product .product_type_variable:hover,
.hl-product-slide .product .product_type_external:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Sale badge */
.hl-product-slide .product .onsale {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: #e74c3c;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  z-index: 2;
}

/* Splide custom styling */
.hl-product-slide .splide {
  padding: 1rem 0;
}

/* Force correct slide dimensions */
.hl-product-slide .splide__list {
  display: flex;
}

.hl-product-slide .splide__track {
  overflow: hidden;
}

/* Reset any conflicting styles */
.hl-product-slide .splide__slide > * {
  width: 100% !important;
  max-width: none !important;
  flex: none !important;
}

.hl-product-slide .splide__arrow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  opacity: 0.8;
}

.hl-product-slide .splide__arrow:hover {
  background: #fff;
  opacity: 1;
}

.hl-product-slide .splide__arrow svg {
  fill: var(--primary-color);
  width: 16px;
  height: 16px;
}

.hl-product-slide .splide__arrow--prev {
  left: -20px;
}

.hl-product-slide .splide__arrow--next {
  right: -20px;
}

.hl-product-slide .splide__pagination {
  bottom: -30px;
}

.hl-product-slide .splide__pagination__page {
  width: 8px;
  height: 8px;
  background: rgba(102, 126, 234, 0.3);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.hl-product-slide .splide__pagination__page.is-active {
  background: #667eea;
  transform: scale(1.5);
}

/* Responsive adjustments */
@media screen and (max-width: 640px) {
  .hl-product-slide {
    margin-bottom: 1.5rem;
  }

  .hl-product-slide .splide__slide {
    width: calc(50% - 10px) !important;
    margin-right: 20px;
  }

  .hl-product-slide .splide__arrow--prev {
    left: -15px;
  }

  .hl-product-slide .splide__arrow--next {
    right: -15px;
  }

  .hl-product-slide .splide__arrow {
    width: 35px;
    height: 35px;
  }

  .hl-product-slide .product .woocommerce-loop-product__title {
    font-size: 0.9rem;
  }

  .hl-product-slide .product .price {
    font-size: 1rem;
  }

  .hl-product-slide .product .box-text {
    padding: 0.75rem;
  }
}

/* Loading state */
.hl-product-slide.loading {
  opacity: 0.6;
  pointer-events: none;
}

.hl-product-slide.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(102, 126, 234, 0.3);
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  transform: translate(-50%, -50%);
  z-index: 10;
}

@keyframes spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}
