/* =============================================
   KM Slider Produit
   ============================================= */

.km-sp {
    --sp-gap: 20px;
    position: relative;
    width: 100%;
}

.km-sp__viewport {
    overflow-x: hidden;
    overflow-y: visible;
    cursor: grab;
    padding-bottom: 24px;
    margin-bottom: -24px;
    padding-top: 24px;
    margin-top: -24px;
}

.km-sp--dragging .km-sp__track {
    transition: none;
}

.km-sp--dragging {
    cursor: grabbing;
}

/* =============================================
   Header integration with section-header
   ============================================= */

.km-sp__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 28px;
}

.km-sp__header-right {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-shrink: 1;
}

.km-sp__header-nav {
    display: none;
    gap: 8px;
    flex-shrink: 0;
}

.km-sp__link-wrap {
    flex-shrink: 0;
    align-self: center;
}

/* Responsive hide classes */
.km-sp__hide-desktop {
    display: none !important;
}

/* =============================================
   Nav arrows - bottom right (desktop)
   ============================================= */

.km-sp__nav {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

.km-sp__arrow {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    border: 1.5px solid currentColor !important;
    background: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: var(--sp-arrow-color, #494949) !important;
    padding: 0 !important;
    transition: background 0.2s ease, opacity 0.2s ease !important;
}

.km-sp__arrow:hover {
    background: rgba(0, 0, 0, 0.05) !important;
}

.km-sp__arrow:disabled {
    opacity: 0.3 !important;
    cursor: default !important;
}

.km-sp__arrow:disabled:hover {
    background: none !important;
}

/* =============================================
   Track
   ============================================= */

.km-sp__track {
    display: flex;
    gap: var(--sp-gap);
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* =============================================
   Card (flex sizing for slider, visual styles from km-pg)
   ============================================= */

.km-sp__card {
    flex: 0 0 calc((100% - (var(--sp-visible) - 1) * var(--sp-gap)) / var(--sp-visible));
    min-width: 0;
}

/* Masquer le lien "Voir le panier" injecté par WooCommerce */
.km-sp__card a.added_to_cart.wc-forward {
    display: none !important;
}

/* =============================================
   Responsive - Tablet
   ============================================= */

@media (max-width: 1024px) {
    .km-sp {
        --sp-visible: 3 !important;
    }

    .km-sp__header {
        flex-wrap: wrap;
        gap: 16px;
    }

    .km-sp__hide-tablet {
        display: none !important;
    }

    .km-sp__hide-desktop {
        display: initial !important;
    }
}

/* =============================================
   Responsive - Mobile
   ============================================= */

@media (max-width: 768px) {
    .km-sp {
        --sp-visible: 2 !important;
        --sp-gap: 12px;
    }

    .km-sp__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }

    .km-sp__header-right {
        width: 100%;
        justify-content: space-between;
        align-items: center;
    }

    /* Show header arrows, hide bottom nav on mobile */
    .km-sp__header-nav {
        display: flex;
    }

    .km-sp__nav {
        display: none;
    }

    .km-sp__arrow {
        width: 36px;
        height: 36px;
    }

    .km-sp__hide-mobile {
        display: none !important;
    }

    .km-sp__hide-desktop {
        display: initial !important;
    }
}