/* ============================================================
   RefCentre — Product Card & Layout Fixes
   Last updated: 2026-04-11 v3 (hover crossfade fix)
   ============================================================ */

/* ------------------------------------------------------------------
   1. PRODUCT GRID — Force equal-height cards per row
   ------------------------------------------------------------------ */

.row.product-grid-5,
.row.product-grid {
  display: flex !important;
  flex-wrap: wrap !important;
}

.row.product-grid-5 > [class*="col-"],
.row.product-grid > [class*="col-"] {
  display: flex !important;
}

/* ------------------------------------------------------------------
   2. PRODUCT CARD — Flex column for internal layout
   ------------------------------------------------------------------ */

.product-cart-wrap {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: 100% !important;
}

/* ------------------------------------------------------------------
   3. PRODUCT IMAGE — Fixed-height container with hover crossfade
   ------------------------------------------------------------------ */

.product-cart-wrap .product-img-action-wrap {
  flex-shrink: 0 !important;
}

/* Container: relative positioning, fixed height, no flex (flex breaks absolute stacking) */
.product-cart-wrap .product-img-action-wrap .product-img {
  position: relative !important;
  display: block !important;
  height: 220px !important;
  overflow: hidden !important;
  background: #fff !important;
}

/* Anchor fills the container */
.product-cart-wrap .product-img-action-wrap .product-img a {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}

/* Both images absolutely stacked, filling the container */
.product-cart-wrap .product-img-action-wrap .product-img a img.default-img,
.product-cart-wrap .product-img-action-wrap .product-img a img.hover-img {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  transition: opacity 0.3s ease !important;
}

/* Default image: visible by default, hidden on hover */
.product-cart-wrap .product-img-action-wrap .product-img a img.default-img {
  opacity: 1 !important;
}

.product-cart-wrap .product-img-action-wrap .product-img:hover a img.default-img {
  opacity: 0 !important;
}

/* Hover image: hidden by default, visible on hover */
.product-cart-wrap .product-img-action-wrap .product-img a img.hover-img {
  opacity: 0 !important;
}

.product-cart-wrap .product-img-action-wrap .product-img:hover a img.hover-img {
  opacity: 1 !important;
}

/* ------------------------------------------------------------------
   4. PRODUCT CONTENT — Flex-grow, push bottom down
   ------------------------------------------------------------------ */

.product-cart-wrap .product-content-wrap {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  padding: 0 15px 15px !important;
  min-height: 0 !important;
}

.product-cart-wrap .product-content-wrap .product-category {
  min-height: 18px !important;
  margin-bottom: 5px !important;
  flex-shrink: 0 !important;
}

/* ------------------------------------------------------------------
   5. PRODUCT TITLE — Max 2 lines with ellipsis
   ------------------------------------------------------------------ */

.product-cart-wrap .product-content-wrap h2,
.product-cart-wrap .product-content-wrap h2.text-truncate {
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: normal !important;
  font-size: 14px !important;
  line-height: 20px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  margin-bottom: 8px !important;
  flex-shrink: 0 !important;
  word-break: break-word !important;
}

/* ------------------------------------------------------------------
   6. CARD BOTTOM — Price + button pinned to bottom
   ------------------------------------------------------------------ */

.product-cart-wrap .product-card-bottom {
  margin-top: auto !important;
  padding-top: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  flex-shrink: 0 !important;
  flex-wrap: nowrap !important;
}

.product-cart-wrap .product-card-bottom .product-price {
  flex-shrink: 0 !important;
  min-width: 0 !important;
}

.product-cart-wrap .product-card-bottom .product-price span {
  font-size: 15px !important;
  white-space: nowrap !important;
}

/* ------------------------------------------------------------------
   7. ADD-TO-CART BUTTON — Never overflow
   ------------------------------------------------------------------ */

.product-cart-wrap .product-card-bottom .add-cart {
  flex-shrink: 1 !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

.product-cart-wrap .product-card-bottom .add-cart .add,
.product-cart-wrap .product-card-bottom .add-cart a.action-btn {
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
  font-size: 12px !important;
  padding: 8px 12px !important;
  gap: 4px !important;
  box-sizing: border-box !important;
}

.product-cart-wrap .product-card-bottom .add-cart .add span,
.product-cart-wrap .product-card-bottom .add-cart a.action-btn span {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* ------------------------------------------------------------------
   8. SLICK CAROUSEL — Equal height slides
   ------------------------------------------------------------------ */

.slick-track {
  display: flex !important;
}

.slick-slide {
  height: auto !important;
  float: none !important;
}

.slick-slide > div {
  height: 100% !important;
}

.slick-slide .product-cart-wrap {
  height: 100% !important;
}

/* ------------------------------------------------------------------
   9. TOP CATEGORIES (card-1) — Equal heights
   ------------------------------------------------------------------ */

.carousel-8-columns .card-1 {
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
}

.card-1 figure {
  width: 100% !important;
  height: 120px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  margin-bottom: 10px !important;
  flex-shrink: 0 !important;
}

.card-1 figure img {
  max-height: 100% !important;
  max-width: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
}

.card-1 p.font-heading,
.card-1 p.h6,
.card-1 p.truncate {
  text-align: center !important;
  font-size: 13px !important;
  line-height: 18px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
  margin-bottom: 0 !important;
  width: 100% !important;
  white-space: normal !important;
}

/* ------------------------------------------------------------------
   10. BRAND LOGOS — Uniform sizing
   ------------------------------------------------------------------ */

.brand-logo {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 10px !important;
  min-height: 80px !important;
}

.brand-logo img.img-grey-hover {
  height: 50px !important;
  width: auto !important;
  max-width: 120px !important;
  object-fit: contain !important;
}

/* ------------------------------------------------------------------
   11. RESPONSIVE
   ------------------------------------------------------------------ */

@media (max-width: 575px) {
  .product-cart-wrap .product-img-action-wrap .product-img {
    height: 160px !important;
  }

  .product-cart-wrap .product-content-wrap h2,
  .product-cart-wrap .product-content-wrap h2.text-truncate {
    font-size: 12px !important;
    line-height: 17px !important;
    min-height: 34px !important;
    max-height: 34px !important;
  }

  .product-cart-wrap .product-card-bottom {
    flex-wrap: wrap !important;
  }

  .product-cart-wrap .product-card-bottom .add-cart {
    width: 100% !important;
  }

  .product-cart-wrap .product-card-bottom .add-cart .add,
  .product-cart-wrap .product-card-bottom .add-cart a.action-btn {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .card-1 figure {
    height: 80px !important;
  }

  .card-1 p.font-heading,
  .card-1 p.h6,
  .card-1 p.truncate {
    font-size: 11px !important;
    line-height: 15px !important;
    min-height: 30px !important;
    max-height: 30px !important;
  }
}

@media (min-width: 576px) and (max-width: 991px) {
  .product-cart-wrap .product-img-action-wrap .product-img {
    height: 180px !important;
  }

  .product-cart-wrap .product-card-bottom .add-cart .add,
  .product-cart-wrap .product-card-bottom .add-cart a.action-btn {
    font-size: 11px !important;
    padding: 6px 10px !important;
  }
}

/* ------------------------------------------------------------------
   12. HERO SLIDER
   ------------------------------------------------------------------ */

.hero-slider-1 .single-hero-slider {
  min-height: 350px !important;
}

/* ------------------------------------------------------------------
   13. QUICK VIEW MODAL
   ------------------------------------------------------------------ */

.product-detail-img img,
.quickview-modal img.default-img {
  max-height: 400px !important;
  object-fit: contain !important;
  width: 100% !important;
}

/* ------------------------------------------------------------------
   14. MISC
   ------------------------------------------------------------------ */

.product-cart-wrap.mb-30 {
  margin-bottom: 30px !important;
}

.featured .banner-left-icon {
  min-height: 80px !important;
}

.featured .banner-icon img {
  width: 48px !important;
  height: 48px !important;
  object-fit: contain !important;
}

/* ------------------------------------------------------------------
   15. TOP CATEGORIES — Uniform white card backgrounds
   ------------------------------------------------------------------ */

/* Override the default #f4f6fa background so all category cards
   are consistently white regardless of image transparency */
.popular-categories .card-1 {
  background: #ffffff !important;
  border-color: #e8edf2 !important;
}

.popular-categories .card-1:hover {
  background: #ffffff !important;
}

/* Ensure the figure (image container) is also white so transparent
   PNG images do not bleed the card background colour */
.popular-categories .card-1 figure {
  background: #ffffff !important;
}

/* Brand logos — always colorful, much bigger */
.img-grey-hover {
    filter: none !important;
    opacity: 1 !important;
}
.brand-logo {
    min-height: 120px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 15px 10px !important;
}
.brand-logo img,
.brand-logo .img-grey-hover {
    height: 100px !important;
    min-height: 100px !important;
    max-height: 100px !important;
    width: auto !important;
    max-width: 200px !important;
    object-fit: contain !important;
    filter: none !important;
    opacity: 1 !important;
}
.brand-logo a {
    font-size: 14px;
    font-weight: 600;
    color: #253D4E;
}

/* Products page — force 4 per row on desktop */
@media (min-width: 1200px) {
    .products-listing .row > [class*="col-"] {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }
}
@media (min-width: 992px) and (max-width: 1199px) {
    .products-listing .row > [class*="col-"] {
        flex: 0 0 33.333% !important;
        max-width: 33.333% !important;
    }
}

/* Hide empty product attribute filter block */
.bb-product-filter-attributes {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}
