/* ----------------------------------------------------
   PANIER PREMIUM BROD'ART (2025)
   Style propre, moderne, cohérent avec ton site
---------------------------------------------------- */

/* Overlay */
.cart-sidebar.open ~ .cart-overlay,
.cart-overlay.active {
    display: block;
}

.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
    z-index: 9000;
    display: none;
}

/* Sidebar du panier */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -380px;
    width: 360px;
    height: 100vh;
    background: #ffffff;
    color: #222; /* forced for consistency across pages */
    border-left: 1px solid #e5e5e5;
    box-shadow: -6px 0 25px rgba(0,0,0,0.15);
    padding: 20px;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transition: right 0.32s ease;
    overflow-y: auto;
    border-radius: 0;
}

.cart-sidebar.open {
    right: 0;
}

/* Header */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.cart-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #444;
    transition: 0.2s;
}

.icon-btn:hover {
    color: #000;
}

/* Items */
.cart-items {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.cart-item {
    display: flex;
    background: #f9f9f9;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.cart-item-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cart-item-img img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: #222;
}



/* Infos */
.cart-item-info {
    flex-grow: 1;
}

.cart-item-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.cart-item-variants {
    font-size: 0.8rem;
    color: #666;
    margin: 3px 0 6px 0;
}

/* Prix + quantité */
.cart-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-item-price {
    font-weight: bold;
    color: #222;
}

/* Boutons +/- */
.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-btn {
    background: #eee;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: 0.2s;
}

.qty-btn:hover {
    background: #ddd;
}

.qty-value {
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}

/* Bouton supprimer */
.remove-item {
    margin-left: 10px;
    font-size: 18px;
    color: #c62828;
}

.remove-item:hover {
    color: #b71c1c;
}

/* Bouton vider le panier */
.clear-cart-btn {
    background: none;
    border: 1px solid #bbb;
    border-radius: 10px;
    padding: 8px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.9rem;
}

.clear-cart-btn:hover {
    background: #eee;
}

/* Shipping */
.cart-shipping-block {
    background: #f6f6f6;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.cart-shipping-block label {
    font-size: 0.9rem;
}

.cart-shipping-block select {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #ccc;
    margin-top: 6px;
}

.shipping-info {
    margin-top: 10px;
    font-weight: 600;
}

/* Résumé */
.cart-summary p {
    display: flex;
    justify-content: space-between;
    margin: 6px 0;
}

.cart-summary .total {
    font-size: 1.1rem;
    font-weight: bold;
    margin-top: 12px;
}

/* Checkout button */
.checkout-btn {
    background: #000;
    color: #fff;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.25s;

}

.checkout-btn:hover {
    background: #333;
}

/* Mobile optimisation */
@media (max-width: 480px) {
    .cart-sidebar {
        width: 90vw;
    }
}
/* Zone des items scrollable */
.cart-items {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;

    max-height: calc(100vh - 350px); /* ajuste selon la hauteur du header + shipping + footer */
    overflow-y: auto;

    padding-right: 6px; /* éviter que la scrollbar écrase le contenu */
}

/* Scrollbar stylée (Chrome/Edge/Safari) */
.cart-items::-webkit-scrollbar {
    width: 6px;
}

.cart-items::-webkit-scrollbar-track {
    background: transparent;
}

.cart-items::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}
/* Fixer le bouton en bas du panneau */
.checkout-btn {
    position: sticky;
    bottom: 0;
    margin-top: 12px;
    background: #000;
    z-index: 20;
}


/* Animation bounce pour le compteur du panier */
@keyframes cart-bounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.15); }
  60%  { transform: scale(0.96); }
  100% { transform: scale(1); }
}

.cart-bounce {
  animation: cart-bounce 0.4s ease-out;
}
