/* =========================
   Products Section Slider
========================= */

.products-row-wrapper {
    position: relative;
}

/* IMPORTANT: hide overflow ONLY for slider */
.products-row-wrapper.is-slider {
    overflow: hidden;
}

/* GRID */
.products-row-wrapper.is-grid .products-cards-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

/* =========================
   SLIDER (Animated – NO SCROLL)
========================= */

.products-row-wrapper.is-slider .products-cards-grid {
    display: flex;
    gap: 20px;

    /* disable scroll behavior */
    overflow: visible;
    scroll-snap-type: none;
    -webkit-overflow-scrolling: auto;

    /* animation handled by JS */
    transform: translateX(0);
    will-change: transform;
    padding-bottom: 0;
}

/* remove scrollbar leftovers safely */
.products-row-wrapper.is-slider .products-cards-grid::-webkit-scrollbar {
    display: none;
}
.products-row-wrapper.is-slider .products-cards-grid {
    scrollbar-width: none;
}

/* card width – unchanged */
.products-row-wrapper.is-slider .product-card-stack {
    flex: 0 0 calc((100% - (4 * 20px)) / 5);
}

/* =========================
   Product Card (FIXED HEIGHT)
========================= */

.product-card-vertical {
    position: relative;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    height: 430px;
    overflow: hidden;
    transition: border-color .25s ease, box-shadow .25s ease;
}

.product-card-vertical:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(0,0,0,.08);
}

/* =========================
   Product Image (TOP FIXED)
========================= */

.product-thumb {
    position: relative;
    width: 100%;
    height: 190px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f8f8f8;
}

.product-thumb-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    visibility: hidden;
    transform: scale(1.01);
    transition: opacity .75s ease, transform .75s ease, visibility 0s linear .75s;
    backface-visibility: hidden;
    will-change: opacity, transform;
}

.product-thumb-image.is-visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition: opacity .75s ease, transform .75s ease, visibility 0s linear 0s;
}

/* =========================
   Product Body (STRUCTURED)
========================= */

.product-body {
    display: grid;
    grid-template-rows: minmax(76px, 76px) 1fr minmax(110px, 110px);
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px;
    text-align: center;
}

/* top – variable */
.product-body-top {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: 18px 24px 24px;
    align-content: start;
    gap: 5px;
}

/* bottom – fixed */
.product-body-bottom {
    min-height: 0;
    display: grid;
    grid-template-rows: 46px 48px;
    align-content: end;
    gap: 12px;
}

/* =========================
   Category
========================= */

.product-category {
    font-size: 13px;
    color: #888;
    line-height: 18px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================
   Title
========================= */

.product-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 24px;
    margin: 0;
    color: #111;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color .25s ease;
}

.product-card-vertical:hover .product-name {
    color: var(--primary-color);
}

/* =========================
   Rating
========================= */

.product-rating {
    height: 24px;
    line-height: 24px;
    margin: 0;
    overflow: hidden;
    white-space: nowrap;
}

.star-filled { color: #f5b301; }
.star-empty  { color: #ddd; }

/* =========================
   Price (FIXED LINE)
========================= */

.product-prices {
    min-width: 0;
    height: 46px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.price-current {
    font-size: 16px;
    font-weight: 700;
    color: #111;
}

.price-old {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
    margin-inline-end: 6px;
}

/* =========================
   Product Button (LOCKED BOTTOM)
========================= */

.product-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    padding: 0 12px;
    text-align: center;

    background-color: var(--primary-color);
    background-image: url("/themes/matjari/assets/img/button-bg.svg");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;

    color: #ffffff !important;
    font-weight: 600;
    text-decoration: none;

    border: none;
    border-radius: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    transition: background-color .25s ease;
}

.product-card-vertical:hover .product-btn,
.product-btn:hover {
    background-color: var(--danger-color, #e22222);
    color: #ffffff !important;
}

/* =========================
   Section Title Decoration
========================= */

.section-head--styled h2 {
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
}

.section-head--styled h2::after {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    bottom: 0;
    width: 100%;
    height: 6px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.products-section-head {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
}

.products-section-title-wrap {
    min-width: 0;
}

.products-view-all-link {
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,.08);
    background: #fff;
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(0,0,0,.06);
    transition: border-color .2s ease, background-color .2s ease, color .2s ease;
}

.products-view-all-link:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.products-view-all-link i {
    font-size: 22px;
    line-height: 1;
}

/* =========================
   Responsive
========================= */

@media (max-width: 991px) {
    .products-row-wrapper.is-grid .products-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .products-row-wrapper.is-slider .product-card-stack {
        flex: 0 0 calc((100% - (2 * 20px)) / 3);
    }
}

@media (max-width: 575px) {
    .product-card-vertical {
        height: 405px;
    }

    .product-thumb {
        height: 170px;
    }

    .product-body {
        grid-template-rows: minmax(74px, 74px) 1fr minmax(104px, 104px);
        padding: 12px;
    }

    .product-name {
        font-size: 14px;
    }

    .product-btn {
        height: 46px;
        font-size: 14px;
    }

    .products-section-head {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .products-view-all-link {
        height: 40px;
        padding: 0 12px;
    }

    .products-row-wrapper.is-grid .products-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .products-row-wrapper.is-slider .product-card-stack {
        flex: 0 0 calc((100% - 20px) / 2);
    }
}




.product-card-floating-badge span:last-child{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}


.product-card-stack {
    position: relative;
    padding-top: 18px;
    min-width: 0;
}

.products-row-wrapper.is-grid .product-card-stack {
    width: 100%;
}

.product-card-floating-badge {
    position: absolute;
    top: 0;
    inset-inline-start: 12px;
    z-index: 5;
    max-width: calc(100% - 24px);
    box-shadow: 0 8px 20px rgba(15,23,42,.14);
    pointer-events: none;
}

/* Stable product cards */
.product-card-stack {
    height: 100%;
}

.product-card-vertical {
    height: 430px;
}

.product-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.product-body-top {
    display: flex;
    flex-direction: column;
    flex: 0 0 82px;
    min-width: 0;
    align-items: stretch;
    justify-content: flex-start;
}

.product-body-bottom {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    margin-top: auto;
    gap: 12px;
}

.product-category,
.product-name,
.product-rating,
.product-prices,
.product-btn {
    max-width: 100%;
}

.product-category,
.product-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-category {
    height: 18px;
    line-height: 18px;
    margin: 0 0 5px;
}

.product-name {
    height: 24px;
    line-height: 24px;
    margin: 0 0 5px;
}

.product-rating {
    display: block;
    height: 24px;
    line-height: 24px;
    margin: 0;
    color: #f5b301;
}

.star-filled {
    color: #f5b301;
}

.star-empty {
    color: #ddd;
}

.product-prices {
    height: 46px;
    margin: 0;
}

.product-btn {
    height: 48px;
    min-height: 48px;
}

.products-view-all-wrap {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

@media (max-width: 575px) {
    .product-card-vertical {
        height: 405px;
    }

    .product-thumb {
        height: 170px;
    }

    .product-body {
        padding: 12px;
    }

    .product-btn {
        height: 46px;
        min-height: 46px;
        font-size: 14px;
    }
}
