/* ===== Panier (drawer desktop / page mobile) ===== */
.cartv {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: var(--paper-pure);
}
.cartv__head {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s4) var(--s5) var(--s3);
  border-bottom: 1px solid var(--ink-100);
}
.cartv__lead {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.cartv__title {
  flex: 1;
  text-align: center;
}
.cartv__title h2 {
  font-size: 17px;
  font-weight: 600;
}
.cartv__title p {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-500);
}
.cartv__body {
  flex: 1;
  min-height: 0;
  padding: var(--s4) var(--s5);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--paper);
}
.cartv__foot {
  padding: var(--s4) var(--s5) max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--ink-100);
  background: var(--paper-pure);
}

/* Lignes */
.clines {
  display: grid;
  gap: var(--s3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.cline {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--paper-pure);
  box-shadow: var(--shadow-1);
}
.cline__main {
  flex: 1;
  min-width: 0;
}
.cline__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.cline__name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}
.cline__price {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cline__opt,
.cline__notes {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink-500);
}
.cline__notes {
  margin-top: 6px;
  font-style: italic;
}
.cstep {
  display: inline-flex;
  align-items: center;
  height: 36px;
  margin-top: 10px;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-pill);
  background: var(--paper-pure);
}
.cstep button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--ink-700);
}
.cstep button:hover {
  background: var(--paper);
}
.cstep button svg {
  width: 16px;
  height: 16px;
}
.cstep span {
  width: 28px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Ajouter d'autres articles */
.add-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: var(--s5);
  padding: 14px;
  border: 1px dashed var(--ink-300);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-700);
  transition: background 0.15s;
}
.add-more:hover {
  background: var(--paper);
}
.add-more svg {
  width: 16px;
  height: 16px;
}

/* Récapitulatif */
.sum {
  margin: var(--s6) 0 0;
  padding-top: var(--s4);
  border-top: 1px solid var(--ink-100);
}
.sum__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--ink-700);
}
.sum__row dt small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--ink-500);
}
.sum__row dd {
  margin: 0;
  font-weight: 500;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.sum__row--main {
  margin-bottom: 0;
  font-size: 15px;
}
.sum__row--main dd {
  font-weight: 700;
}
.sum__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: var(--s4);
  padding-top: var(--s4);
  border-top: 1px solid var(--ink-100);
  font-family: var(--font-display);
  font-weight: 600;
}
.sum__total dt {
  font-size: 18px;
}
.sum__total dd {
  margin: 0;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.checkout {
  width: 100%;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 var(--s5);
  border-radius: var(--radius-md);
  background: var(--red-700);
  box-shadow: 0 3px 12px rgba(159, 13, 13, 0.39);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  transition: transform 0.15s;
}
.checkout:hover {
  transform: translateY(-1px);
}
.checkout span:last-child {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Vide */
.cartv__empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s10) var(--s6);
  text-align: center;
}
.cartv__empty-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
}
.cartv__empty-text {
  margin-top: var(--s2);
  font-size: 14px;
  color: var(--ink-500);
}
.cartv__empty .btn {
  margin-top: var(--s5);
}

/* Page (mobile) : carte blanche sous la barre du haut, au-dessus des onglets */
.cart-page {
  min-height: 60vh;
  overflow: clip;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-1);
  background: var(--paper-pure);
}
/* Bouton « Commander » fixé en bas, au-dessus des onglets ; fond plein pour que les articles ne passent pas dessous */
.cartv--page .cartv__foot {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 50;
  width: min(100%, 640px);
  padding: var(--s3) var(--s5) calc(max(12px, env(safe-area-inset-bottom)) + 76px);
  transform: translateX(-50%);
}
/* Réserve la place du bouton fixe pour que le dernier élément reste visible */
.cartv--page .cartv__body {
  padding-bottom: 150px;
}
@media (min-width: 640px) {
  .cart-page {
    max-width: 640px;
    margin: 0 auto;
  }
}

/* ===== Drawer (desktop) ===== */
.modal--drawer {
  justify-content: flex-end;
  align-items: stretch;
}
.modal__panel--drawer {
  width: 440px;
  max-width: 100%;
  height: 100dvh;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
  background: var(--paper-pure);
  opacity: 1;
  transform: translateX(100%);
  transition: transform 0.4s var(--ease);
}
.modal--drawer.is-open .modal__panel--drawer {
  transform: none;
}
.cartv-host,
.cartv-view {
  height: 100%;
}
.cartv--drawer .cartv__head {
  padding-top: var(--s5);
}

/* ===== Photo + édition des lignes ===== */
.cline__thumb {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}
.cline__img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
}
.cline__thumb .cover__label {
  padding: 4px;
  font-size: 10px;
}
.cline__thumbbtn {
  flex-shrink: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.cline__thumbbtn .cline__thumb {
  transition: transform 0.15s;
}
.cline__thumbbtn:hover .cline__thumb {
  transform: scale(1.04);
}
.cline__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: 10px;
}
.cline__actions .cstep {
  margin-top: 0;
}
.cline__edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-pill);
  background: var(--paper-pure);
  font-size: 13px;
  font-weight: 600;
  color: var(--red-700);
  transition: background 0.15s, border-color 0.15s;
}
.cline__edit:hover {
  border-color: var(--red-700);
  background: var(--red-50);
}
.cline__edit svg {
  width: 15px;
  height: 15px;
}

/* Mobile : les cartes des articles ne laissent qu'une petite marge (8 px) dans le bloc « Votre panier » (cartes + bouton Commander) */
@media (max-width: 639px) {
  .cartv--page .clines {
    margin-inline: calc(var(--s5) * -1 + var(--s2));
  }
  .cartv--page .cartv__foot {
    padding-inline: calc(var(--gutter) + var(--s2));
  }
}
