/* =========================================================
   Latest Products - carrousel en FLEX
   Le nombre de cartes visibles suit exactement columns="X".
   ========================================================= */

.lp-carousel,
.lp-carousel * {
    box-sizing: border-box;
}

.lp-carousel {
    --lp-orange: #ff8500;
    --lp-cream: #ffdda4;
    --lp-text: #76573f;
    --lp-overlay: rgba(92, 67, 47, 0.72);
    --lp-gap: 64px;

    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 68px;
}

/* =========================================================
   Fenetre du carrousel
   ========================================================= */

.lp-carousel .lp-products-viewport {
    position: relative;
    display: block;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: visible;
    padding: 2px 0;
}

/* Track : largeur de la fenetre, les cartes debordent horizontalement. */
.lp-carousel .latest-products.products {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--lp-gap);

    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;

    list-style: none !important;
    scroll-behavior: smooth;
}

.lp-carousel .latest-products.products.lp-is-static {
    justify-content: center;
}

/* =========================================================
   Mode statique : flex + nombre de colonnes du shortcode
   ========================================================= */

.lp-carousel.lp-carousel--static {
    display: block;
    padding: 0;
}

.lp-carousel.lp-carousel--static .latest-products.products {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--lp-gap);

    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;

    list-style: none !important;
}

.lp-carousel .latest-products.products::before,
.lp-carousel .latest-products.products::after {
    display: none !important;
    content: none !important;
}

/* =========================================================
   Nombre de colonnes / largeur exacte des cartes
   ========================================================= */

.lp-carousel .latest-products.columns-1 {
    --lp-card-width: 100%;
}

.lp-carousel .latest-products.columns-2 {
    --lp-card-width: calc((100% - var(--lp-gap)) / 2);
}

.lp-carousel .latest-products.columns-3 {
    --lp-card-width: calc((100% - var(--lp-gap) - var(--lp-gap)) / 3);
}

.lp-carousel .latest-products.columns-4 {
    --lp-card-width: calc((100% - var(--lp-gap) - var(--lp-gap) - var(--lp-gap)) / 4);
}

.lp-carousel .latest-products.columns-5 {
    --lp-card-width: calc((100% - var(--lp-gap) - var(--lp-gap) - var(--lp-gap) - var(--lp-gap)) / 5);
}

/* =========================================================
   Carte
   ========================================================= */

.lp-carousel .latest-products.products li.product.lp-product-card {
    position: relative;

    display: flex !important;
    flex: 0 0 var(--lp-card-width) !important;
    flex-direction: column;

    float: none !important;
    clear: none !important;

    width: var(--lp-card-width) !important;
    max-width: var(--lp-card-width) !important;
    min-width: var(--lp-card-width) !important;
    margin: 0 !important;
    padding: 0 !important;

    overflow: hidden;

    background: var(--lp-cream);
    border: 2px solid var(--lp-orange);
    border-radius: 999px;

    text-align: center;
}

.lp-carousel .lp-product-card::marker {
    content: "";
}

/* =========================================================
   Image ronde
   ========================================================= */

.lp-carousel .lp-product-image {
    position: relative;
    z-index: 1;

    display: block;
    flex: 0 0 auto;

    width: 100%;
    aspect-ratio: 1 / 1;

    overflow: hidden;
    border-radius: 50%;

    background: #e7d9c7;
    text-decoration: none;
}

.lp-carousel .lp-product-image img,
.lp-carousel .lp-product-image__img {
    display: block !important;

    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;

    object-fit: cover;
    object-position: center;
    border-radius: 50%;
}

/* Overlay hover */
.lp-carousel .lp-product-image__overlay {
    position: absolute;
    inset: 0;
    z-index: 2;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    background: var(--lp-overlay);

    opacity: 0;
    visibility: hidden;

    transition: opacity 180ms ease, visibility 180ms ease;
}

.lp-carousel .lp-product-image:hover .lp-product-image__overlay,
.lp-carousel .lp-product-image:focus-visible .lp-product-image__overlay {
    opacity: 1;
    visibility: visible;
}

/* Cercle + blanc */
.lp-carousel .lp-product-image__plus {
    position: relative;
    display: block;
    width: 42px;
    height: 42px;
    border: 2px solid #fff;
    border-radius: 50%;
}

.lp-carousel .lp-product-image__plus::before,
.lp-carousel .lp-product-image__plus::after {
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    content: "";
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transform: translate(-50%, -50%);
}

.lp-carousel .lp-product-image__plus::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

/* =========================================================
   Contenu
   ========================================================= */

.lp-carousel .lp-product-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;

    width: 100%;
    min-height: 228px;
    padding: 25px 24px 16px;
}

.lp-carousel .lp-product-title-link {
    color: inherit;
    text-decoration: none;
}

.lp-carousel .lp-product-title-link:hover,
.lp-carousel .lp-product-title-link:focus {
    color: inherit;
    text-decoration: none;
}

.lp-carousel .lp-product-title,
.lp-carousel .woocommerce-loop-product__title.lp-product-title {
    margin: 0 !important;
    padding: 0 !important;
    color: var(--lp-orange) !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    text-align: center;
}

.lp-carousel .lp-product-price,
.lp-carousel .lp-product-card .price {
    display: block !important;
    margin: 1px 0 0 !important;
    color: var(--lp-orange) !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    text-align: center;
}

.lp-carousel .lp-product-price del {
    opacity: 0.55;
}

.lp-carousel .lp-product-price ins {
    text-decoration: none;
}

.lp-carousel .lp-product-description {
    width: 100%;
    margin: 18px 0 14px;
    color: var(--lp-text);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    text-align: center;
}

.lp-carousel .lp-product-description p {
    margin: 0;
}

/* =========================================================
   Bouton panier rond
   ========================================================= */

.lp-carousel .lp-cart-button,
.lp-carousel .lp-product-card a.button.lp-cart-button {
    display: flex !important;
    align-items: center;
    justify-content: center;

    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;

    margin: auto 0 0 !important;
    padding: 0 !important;

    background: var(--lp-orange) !important;
    border: 0 !important;
    border-radius: 50% !important;
    box-shadow: none !important;

    color: #fff !important;
    line-height: 1 !important;
    text-decoration: none !important;

    transition: transform 160ms ease, opacity 160ms ease;
}

.lp-carousel .lp-cart-button:hover,
.lp-carousel .lp-cart-button:focus-visible {
    background: var(--lp-orange) !important;
    color: #fff !important;
    transform: scale(1.07);
}

.lp-carousel .lp-cart-button svg {
    display: block;
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lp-carousel .lp-cart-button.loading {
    opacity: 0.55;
}

.lp-carousel .added_to_cart.wc-forward {
    display: none !important;
}

/* =========================================================
   Fleches - toujours visibles
   ========================================================= */

.lp-carousel .lp-carousel__arrow {
    position: absolute;
    top: 50%;
    z-index: 20;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    margin: 0 !important;
    padding: 0 !important;

    cursor: pointer;

    background: #fff !important;
    border: 0 !important;
    border-radius: 50% !important;
    box-shadow: none !important;

    color: var(--lp-orange) !important;
    opacity: 1;
    visibility: visible !important;

    transform: translateY(-50%);
    transition: transform 160ms ease, opacity 160ms ease;
}

.lp-carousel .lp-carousel__arrow--prev {
    left: 8px;
}

.lp-carousel .lp-carousel__arrow--next {
    right: 8px;
}

.lp-carousel .lp-carousel__arrow:hover,
.lp-carousel .lp-carousel__arrow:focus-visible {
    background: #fff !important;
    color: var(--lp-orange) !important;
    transform: translateY(-50%) scale(1.06);
}

.lp-carousel .lp-carousel__arrow svg {
    display: block !important;
    width: 25px !important;
    height: 25px !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2.2 !important;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Meme s'il n'y a rien a faire defiler, on laisse la fleche visible. */
.lp-carousel .lp-carousel__arrow:disabled {
    cursor: default;
    opacity: 0.4;
}

/* =========================================================
   Responsive
   Desktop  : nombre de cartes defini par columns="X"
   Tablette : maximum 2 cartes visibles
   Mobile   : 1 carte visible
   Fonctionne pour le carrousel et le mode statique.
   ========================================================= */

@media (max-width: 1024px) {
    .lp-carousel {
        --lp-gap: 36px;
        padding-right: 56px;
        padding-left: 56px;
    }

    /*
     * Si le shortcode demande 2, 3, 4 ou 5 colonnes,
     * on limite l'affichage a 2 cartes sur tablette.
     * columns-1 reste naturellement sur une seule carte.
     */
    .lp-carousel .latest-products.columns-2,
    .lp-carousel .latest-products.columns-3,
    .lp-carousel .latest-products.columns-4,
    .lp-carousel .latest-products.columns-5 {
        --lp-card-width: calc((100% - var(--lp-gap)) / 2);
    }

    .lp-carousel .lp-product-content {
        min-height: 220px;
        padding-right: 18px;
        padding-left: 18px;
    }

    .lp-carousel .lp-carousel__arrow--prev {
        left: 4px;
    }

    .lp-carousel .lp-carousel__arrow--next {
        right: 4px;
    }
}

@media (max-width: 640px) {
    .lp-carousel {
        --lp-gap: 16px;
        padding-right: 46px;
        padding-left: 46px;
    }

    /*
     * Une seule carte sur mobile, quelle que soit la valeur
     * de columns dans le shortcode.
     */
    .lp-carousel .latest-products.columns-1,
    .lp-carousel .latest-products.columns-2,
    .lp-carousel .latest-products.columns-3,
    .lp-carousel .latest-products.columns-4,
    .lp-carousel .latest-products.columns-5 {
        --lp-card-width: 100%;
    }

    /*
     * Le mode statique n'a pas de fleches :
     * on retire donc l'espace lateral reserve au carrousel.
     */
    .lp-carousel.lp-carousel--static {
        padding-right: 0;
        padding-left: 0;
    }

    .lp-carousel .lp-carousel__arrow {
        width: 36px !important;
        min-width: 36px !important;
        height: 36px !important;
        min-height: 36px !important;
    }

    .lp-carousel .lp-carousel__arrow svg {
        width: 22px !important;
        height: 22px !important;
    }

    .lp-carousel .lp-product-content {
        min-height: 205px;
        padding: 20px 12px 14px;
    }

    .lp-carousel .lp-product-title,
    .lp-carousel .woocommerce-loop-product__title.lp-product-title,
    .lp-carousel .lp-product-price,
    .lp-carousel .lp-product-card .price {
        font-size: 13px !important;
    }

    .lp-carousel .lp-product-description {
        margin-top: 14px;
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lp-carousel .latest-products.products {
        scroll-behavior: auto;
    }

    .lp-carousel .lp-product-image__overlay,
    .lp-carousel .lp-cart-button,
    .lp-carousel .lp-carousel__arrow {
        transition: none;
    }
}
