/*
 * PrestaShop module created by VEKIA, a guy from official PrestaShop community ;-)
 *
 * @author    VEKIA PL MILOSZ MYSZCZUK VATEU: PL9730945634
 * @copyright 2010-2023 VEKIA
 * @license   This program is not free software and you can't resell and redistribute it
 *
 * CONTACT WITH DEVELOPER http://mypresta.eu
 * support@mypresta.eu
 */

.sb-menu-right {
    position: fixed;

    height: 100%;

    overflow-y: hidden;

    -webkit-transform: translateX(100%);
    -ms-transform: translateX(100%);
    transform: translateX(100%);
    -webkit-transition: all .5s;
    -o-transition: all .5s;
    transition: all .5s;


    -ms-transform: translateX(100%);
    transform: translateX(100%);
    position: fixed;
    box-sizing: border-box;
    background: #fff;
    height: 100%;

    text-align: left;
    right: 0px;
    top: 0px;
    z-index: 2147483647;
    /*box-shadow: rgba(0, 0, 0, 0.4) 0px 0px 4px;*/
    font-weight: 300;
    /*padding: 15px;*/
    margin: 0px;

    top: 0;
    display: block;
    position: fixed;

    -webkit-transition: all .8s ease-in-out;
    -o-transition: all .5s ease-in-out;
    -webkit-transition: all .5s ease-in-out;
    transition: all .5s ease-in-out;

    z-index: 9999999999999;
    width: 100%;
    max-width: 590px;
    height: 100%;
    background-color: #fff;
    overflow: auto;
}


@media (max-width: 480px) {
    .sb-menu-right {
        width: 320px;

    }
}

@media (max-width: 320px) {
    .sb-menu-right {
        width: 100%;
        left: 0;

    }
}

/* ===== Sidecart: footer fixe + liste scrollable ===== */

/* Le panneau occupe toute la hauteur de l'écran */
.sb-menu-right {
    position: fixed; /* si ce n'est pas déjà le cas */
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    /* width géré chez toi (ex: 420px desktop / 100% mobile) */
}

/* Le conteneur du panneau devient une colonne flex hauteur 100% */
#js-cart-sidcart {
    height: 100%; /* hérite de .sb-menu-right */
}

#js-cart-sidcart .sidcart-wrapper.cart-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100vh; /* iOS safe */
    background: #fff; /* pour que le footer soit opaque */
}

/* Le premier enfant (qui contient top + ul) prend tout l'espace dispo */
#js-cart-sidcart .sidcart-wrapper.cart-container > div:first-child {
    flex: 1 1 auto;
    min-height: 0; /* crucial pour que l'enfant puisse scroller */
    display: flex;
    flex-direction: column;
}

/* Seule la liste des produits scrolle */
#js-cart-sidcart .sidcart-wrapper .cart-items {
    flex: 1 1 auto;
    min-height: 0; /* évite que le flex-item « pousse » le footer */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* inertie iOS */
    padding-right: 8px; /* évite que le scrollbars masque le price */
}

/* Le bloc bas reste fixe, non scrollé */
#js-cart-sidcart .sidcart-wrapper .cart-bottom {
    flex: 0 0 auto;
    background: #fff;
    position: relative; /* pas de sticky nécessaire si on scroll au-dessus */
    z-index: 1;
}

/* Optionnel : garde le header (titre) visible en haut du scroll */
#js-cart-sidcart .sidcart-wrapper .top-container {
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    padding-top: 8px; /* adapte si besoin */
}

/* ===== Scrollbar verte pour la liste des produits du sidecart ===== */
:root {

    --sidcart-scroll-thumb: var(--primary-color);
    --sidcart-scroll-thumb-hover: #fff;
    --sidcart-scroll-track: transparent;
}

/* Firefox */
#js-cart-sidcart .sidcart-wrapper .cart-items {
    scrollbar-width: thin; /* auto | thin | none */
    scrollbar-color: var(--sidcart-scroll-thumb) var(--sidcart-scroll-track);
    padding-inline-end: .75rem;
}

/* WebKit (Chrome, Edge, Safari, iOS) */
#js-cart-sidcart .sidcart-wrapper .cart-items::-webkit-scrollbar {
    width: 10px; /* épaisseur verticale */
}

#js-cart-sidcart .sidcart-wrapper .cart-items::-webkit-scrollbar-track {
    background: var(--sidcart-scroll-track);
}

#js-cart-sidcart .sidcart-wrapper .cart-items::-webkit-scrollbar-thumb {
    background-color: var(--sidcart-scroll-thumb);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
}

#js-cart-sidcart .sidcart-wrapper .cart-items::-webkit-scrollbar-thumb:hover {
    background-color: var(--sidcart-scroll-thumb-hover);
}

/* Optionnel : évite les “sauts” quand la barre apparaît */
#js-cart-sidcart .sidcart-wrapper .cart-items {
    scrollbar-gutter: stable both-edges; /* Chrome/Edge/Firefox récents */
}
