/* Styles minimalistes pour le panier. Personnalise librement les couleurs
   et polices pour coller à ton site. */

#cart-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#cart-badge {
  display: inline-block;
  background: #e63946;
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 12px;
  margin-left: 4px;
}

#cart-drawer {
  position: fixed;
  top: 0;
  right: -380px;
  width: 340px;
  max-width: 90vw;
  height: 100%;
  background: #fff;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.15);
  transition: right 0.25s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  font-family: system-ui, sans-serif;
}

#cart-drawer.open {
  right: 0;
}

#cart-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #eee;
}

#cart-drawer-header h2 {
  font-size: 18px;
  margin: 0;
}

#cart-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

#cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

#cart-empty {
  color: #777;
  font-size: 14px;
}

.cart-item {
  display: grid;
  grid-template-columns: 1fr 44px minmax(64px, auto) 24px;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}

.cart-item-qty {
  width: 100%;
  max-width: 44px;
  padding: 2px;
  box-sizing: border-box;
  /* Cache les flèches +/- du champ nombre : sur certains navigateurs elles
     ajoutent une largeur non comptée dans le "width" ci-dessus, ce qui
     poussait le prix hors de sa colonne et le faisait chevaucher/couper. */
  -moz-appearance: textfield;
  text-align: center;
}

.cart-item-qty::-webkit-outer-spin-button,
.cart-item-qty::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-item-price {
  text-align: right;
  white-space: nowrap;
}

.cart-item-remove {
  background: none;
  border: none;
  color: #999;
  font-size: 18px;
  cursor: pointer;
}

#cart-footer {
  padding: 16px;
  border-top: 1px solid #eee;
}

#cart-total {
  font-weight: 600;
  margin-bottom: 10px;
}

#cart-checkout {
  width: 100%;
  padding: 12px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
}

#cart-checkout:disabled {
  opacity: 0.6;
  cursor: default;
}

#cart-error {
  color: #e63946;
  font-size: 13px;
  margin-top: 8px;
}

/* Boutons "Ajouter au panier" sur les pages produits, une fois en rupture de
   stock ou désactivés parce que la quantité max au panier est atteinte. */
[data-add-to-cart]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

[data-add-to-cart].out-of-stock {
  text-decoration: line-through;
}
