/*
 * M4H product cards
 * One source of truth for card title, price, sold count and swatches.
 * Loaded after Flatsome and the legacy UI stylesheet.
 */

:root {
  --m4h-card-price: #d9261c;
  --m4h-card-old-price: #888;
  --m4h-card-text: #0f172a;
}

.products .product-small:not(.m4h-fs-product-card) .box-text {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  padding: 14px 12px !important;
  text-align: left !important;
}

.products .product-title a,
.products .product-small .title-wrapper a,
.products .box-text .product-title a {
  display: -webkit-box !important;
  height: 37px;
  margin: 0 0 6px !important;
  overflow: hidden;
  color: var(--m4h-card-text) !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.products .box:hover .product-title a {
  color: var(--m4h-card-price) !important;
}

/* Price is deliberately scoped to catalogue cards; it cannot alter the
   larger summary price on the single-product page. */
.products :is(.m4h-card-price-wrapper, .m4h-card-price-wrapper .price, .box-text .price, .product-small .price, .product-card .price, .price) {
  display: flex !important;
  align-items: baseline !important;
  justify-content: flex-start !important;
  flex-wrap: wrap !important;
  width: 100% !important;
  gap: 4px !important;
  margin: 0 !important;
  text-align: left !important;
}

.products :is(.m4h-card-price-wrapper, .price, .price-wrapper .price) :is(.amount, bdi, .woocommerce-Price-amount) {
  color: var(--m4h-card-price) !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  letter-spacing: -.2px;
  text-decoration: none !important;
}

.products :is(.m4h-card-price-wrapper, .price, .price-wrapper .price) :is(ins, del) {
  display: inline-flex !important;
  align-items: baseline;
  margin: 0 !important;
  line-height: 1.15 !important;
}

.products :is(.m4h-card-price-wrapper, .price, .price-wrapper .price) ins :is(.amount, bdi, .woocommerce-Price-amount) {
  color: var(--m4h-card-price) !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  text-decoration: none !important;
}

.products :is(.m4h-card-price-wrapper, .price, .price-wrapper .price) del :is(.amount, bdi, .woocommerce-Price-amount) {
  color: var(--m4h-card-old-price) !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  text-decoration: line-through !important;
}

.products .m4h-rating-sold-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 2px 4px !important;
  width: 100% !important;
  margin: 3px 0 !important;
  line-height: 1.3 !important;
  overflow: hidden !important;
}

.products .m4h-custom-rating {
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
  margin: 0 !important;
  color: var(--m4h-card-text);
  font-size: 11px !important;
  line-height: 1.2;
  white-space: nowrap;
}

.products .m4h-star-icon {
  color: #f59e0b !important;
  font-size: 11.5px !important;
  line-height: 1;
}

.products .m4h-rating-val {
  color: #1e293b !important;
  font-size: 10.5px !important;
  font-weight: 800 !important;
}

.products .m4h-review-cnt {
  color: #64748b !important;
  font-size: 10px !important;
  font-weight: 500 !important;
}

.products .da-ban {
  margin-left: auto !important;
  color: var(--m4h-card-price) !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  line-height: 1.2;
  white-space: nowrap;
}

.products .ux-swatches.ux-swatches-in-loop {
  position: static !important;
  display: flex !important;
  align-items: center;
  gap: 6px !important;
  width: 100%;
  min-height: 24px;
  margin: 4px 0 3px !important;
  transform: none !important;
}

.products .ux-swatches-in-loop .ux-swatch {
  flex: 0 0 auto;
  margin: 0 !important;
}

@media (max-width: 849px) {
  .products .box-text {
    padding: 8px 7px !important;
  }

  .products .product-title a {
    height: 34px;
    margin-bottom: 4px !important;
    font-size: 12px !important;
  }

  .products :is(.m4h-card-price-wrapper, .price, .price-wrapper .price) :is(.amount, bdi, .woocommerce-Price-amount),
  .products :is(.m4h-card-price-wrapper, .price, .price-wrapper .price) ins :is(.amount, bdi, .woocommerce-Price-amount) {
    font-size: clamp(12px, 3.4vw, 13.5px) !important;
  }

  .products :is(.m4h-card-price-wrapper, .price, .price-wrapper .price) del :is(.amount, bdi, .woocommerce-Price-amount) {
    font-size: clamp(9px, 2.45vw, 10px) !important;
  }

  .products .ux-swatches.ux-swatches-in-loop {
    min-height: 21px;
    gap: 5px !important;
    margin: 3px 0 2px !important;
  }
}

/* Final cascade layer for Flatsome's default loop markup. Older site CSS uses
   `html body` selectors with !important, therefore these rules intentionally
   match that specificity and are limited to cards inside the main content. */
html body #main .product-small:not(.m4h-fs-product-card) .box-text {
  display: flex !important;
  flex: 1 1 auto !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  padding: 14px 12px !important;
  text-align: left !important;
}

html body #main .product-small:not(.m4h-fs-product-card) .product-title,
html body #main .product-small:not(.m4h-fs-product-card) .product-title a {
  display: -webkit-box !important;
  height: 37px !important;
  max-height: 37px !important;
  margin: 0 0 6px !important;
  overflow: hidden !important;
  color: #1e293b !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  text-align: left !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
}

html body #main .product-small:not(.m4h-fs-product-card) .price-wrapper {
  display: flex !important;
  align-items: baseline !important;
  justify-content: flex-start !important;
  flex-wrap: wrap !important;
  width: 100% !important;
  gap: 4px !important;
  margin: 0 !important;
  text-align: left !important;
}

html body #main .product-small:not(.m4h-fs-product-card) .price-wrapper :is(.amount, bdi, .woocommerce-Price-amount),
html body #main .product-small:not(.m4h-fs-product-card) .price-wrapper ins :is(.amount, bdi, .woocommerce-Price-amount) {
  color: var(--m4h-card-price) !important;
  font-size: clamp(12px, 3vw, 18px) !important;
  font-weight: 800 !important;
  text-decoration: none !important;
}

html body :is(.price, .price *, .amount, .woocommerce-Price-amount) {
  color: #d9261c !important;
}

/* This must follow the general amount rule above: Flatsome and older M4H CSS
   colour every amount red, including the crossed-out regular price. */
html body #main .product-small:not(.m4h-fs-product-card) .price-wrapper del,
html body #main .product-small:not(.m4h-fs-product-card) .price-wrapper del *,
html body #main .product-small:not(.m4h-fs-product-card) .price-wrapper del :is(.amount, bdi, .woocommerce-Price-amount) {
  color: #888 !important;
  font-size: clamp(8px, 2vw, 12px) !important;
  font-weight: 400 !important;
  text-decoration: line-through !important;
  opacity: 1 !important;
}

html body #main .product-small:not(.m4h-fs-product-card) .m4h-custom-rating {
  display: inline-flex !important;
  flex: 0 1 auto !important;
  align-items: center !important;
  gap: 2px !important;
  min-width: 0;
  white-space: nowrap !important;
}

html body #main .product-small:not(.m4h-fs-product-card) .m4h-star-icon {
  color: #f59e0b !important;
  font-size: 11.5px !important;
  line-height: 1 !important;
}

html body #main .product-small:not(.m4h-fs-product-card) .m4h-rating-val {
  color: #1e293b !important;
  font-size: 10.5px !important;
  font-weight: 800 !important;
}

html body #main .product-small:not(.m4h-fs-product-card) .m4h-review-cnt {
  color: #64748b !important;
  font-size: 10px !important;
  font-weight: 500 !important;
}

html body #main .product-small:not(.m4h-fs-product-card) .da-ban {
  display: inline-block !important;
  flex: 0 0 auto !important;
  margin: 0 0 0 auto !important;
  color: var(--m4h-card-price) !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}

.m4h-rating-sold-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 2px 4px !important;
    width: 100% !important;
    margin: 3px 0 !important;
    line-height: 1.3 !important;
    overflow: hidden !important;
}