/* =========================================================
   KIMIAMART CHILD THEME - FLASH SALE SECTION
   SUPER OVERRIDE WOOCOMMERCE
   ========================================================= */
.km-flash-sale {
    width: 100%;
    background-image: var(--km-flash-bg-desktop);
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    padding: 40px 0;
    font-family: var(--km-font-family, 'Inter', sans-serif);
    overflow: hidden;
}

@media (max-width: 767px) {
    .km-flash-sale {
        background-image: var(--km-flash-bg-mobile);
        padding: 24px 0;
    }
}

.km-flash-sale__inner {
    max-width: var(--km-container-max, 1200px);
    margin: 0 auto;
    padding: 0 var(--km-container-padding, 15px) 8px;
}

.km-flash-sale__header {
    margin-bottom: 24px;
}

.km-flash-sale__title-img {
    height: 32px;
    width: auto;
    display: block;
}

@media (max-width: 767px) {
    .km-flash-sale__title-img {
        height: 22px;
    }
}

/* =========================================================
   SCROLL CONTAINER — PAKSA FLEXBOX
   ========================================================= */
.km-flash-sale__scroll-wrap {
    position: relative;
}

.km-flash-sale__scroll {
    position: relative;
}

/* 
   Tambahkan "html body" di depan agar spesifisitasnya paling tinggi. 
   Ini akan mengalahkan semua CSS default dari WooCommerce.
*/
html body .km-flash-sale__scroll ul.products,
html body.woocommerce .km-flash-sale__scroll ul.products {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important; /* Paksa tinggi kartu sama rata */
    overflow-x: auto !important;
    overflow-y: visible !important; /* Biar shadow kartu nggak kepotong */
    scroll-snap-type: x mandatory;
    gap: 16px !important;
    margin: 0 !important;
    padding: 10px 0 24px 0 !important; /* Kasih ruang buat shadow/hover */
    width: 100% !important;
    max-width: 100% !important;
    list-style: none !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

html body .km-flash-sale__scroll ul.products::-webkit-scrollbar {
    display: none !important;
}

/* Matikan clearfix bawaan WooCommerce yang suka bikin layout patah */
html body .km-flash-sale__scroll ul.products::before,
html body .km-flash-sale__scroll ul.products::after {
    display: none !important;
    content: none !important;
}

/* =========================================================
   KARTU PRODUK (.product)
   ========================================================= */
html body .km-flash-sale__scroll ul.products > li.product,
html body.woocommerce .km-flash-sale__scroll ul.products > li.product {
    display: block !important;
    float: none !important;
    clear: none !important; /* KUNCI: Matikan efek dari class .first/.last */
    margin: 0 !important;
    padding: 0 !important;
    
    /* Lebar Desktop: 5 Kolom. (64px berasal dari 4 * 16px gap) */
    flex: 0 0 calc((100% - 64px) / 5) !important;
    width: calc((100% - 64px) / 5) !important;
    max-width: calc((100% - 64px) / 5) !important;
    min-width: 0 !important;
    
    scroll-snap-align: start;
    box-sizing: border-box !important;
}

/* Cegah elemen di dalam kartu luber ke samping */
html body .km-flash-sale__scroll ul.products > li.product > * {
    max-width: 100% !important;
}

/* =========================================================
   RESPONSIF TABLET & MOBILE
   ========================================================= */
/* Tablet (Fix Width per kartu) */
@media (max-width: 1023px) {
    html body .km-flash-sale__scroll ul.products > li.product,
    html body.woocommerce .km-flash-sale__scroll ul.products > li.product {
        flex: 0 0 220px !important;
        width: 220px !important;
        max-width: 220px !important;
    }
}

/* Mobile: PASTI 2 KOLOM (Sisa digeser) */
@media (max-width: 767px) {
    html body .km-flash-sale__scroll ul.products,
    html body.woocommerce .km-flash-sale__scroll ul.products {
        gap: 12px !important; /* Gap sedikit lebih kecil di HP */
    }
    
    html body .km-flash-sale__scroll ul.products > li.product,
    html body.woocommerce .km-flash-sale__scroll ul.products > li.product {
        /* Lebar Mobile (2 Kolom Pas). 12px adalah besar gap */
        flex: 0 0 calc((100% - 12px) / 2) !important;
        width: calc((100% - 12px) / 2) !important;
        max-width: calc((100% - 12px) / 2) !important;
    }
}

/* =========================================================
   DOTS INDICATOR
   ========================================================= */
.km-flash-sale__dots {
    display: flex; /* Biarkan JS yang urus visibility-nya kalau perlu */
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.km-flash-sale__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.km-flash-sale__dot.is-active {
    background: #0f4c3a;
    width: 20px;
    border-radius: 4px;
}

/* =========================================================
   SAMAKAN TINGGI KARTU — TARGET CLASS ASLI KM-PRODUCT-CARD
   ========================================================= */
html body .km-flash-sale__scroll ul.products > li.km-product-card {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

/* Media/gambar: rasio tetap, jangan biarkan ukuran natural beda-beda */
html body .km-flash-sale__scroll .km-product-card__media {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

html body .km-flash-sale__scroll .km-product-card__media img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Category text: kunci 1 baris */
html body .km-flash-sale__scroll .km-product-card__category {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    margin-top: 8px;
}

/* Title: kunci 2 baris, potong pakai ellipsis biar tinggi selalu sama */
html body .km-flash-sale__scroll .km-product-card__title {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-height: 2.6em !important;
    line-height: 1.3 !important;
    margin: 4px 0 !important;
}

/* Price: paksa nempel di bagian paling bawah card, sejajar semua */
html body .km-flash-sale__scroll .km-product-card__price {
    margin-top: auto !important;
    padding-top: 4px !important;
}

/* Meta-row (variant pills + wishlist) jangan ikut mekar/menyusut */
html body .km-flash-sale__scroll .km-product-card__meta-row {
    flex-shrink: 0;
}

