/* specs/037-boutique-conversion — Lot A
   Tiroir panier + preuve sociale + barres. Namespace apse-*. Variables du
   thème boutique utilisées en surcouche (aucun conflit d'ordre global). */
#apse-root { pointer-events: none; }
#apse-root > * { pointer-events: auto; }

/* ── Tiroir panier ─────────────────────────────── */
.apse-drawer {
  position: fixed; top: 0; z-index: 1060;
  width: 380px; max-width: 92vw; height: 100%;
  background: #fff; color: #1f2937;
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
  transform: translateX(105%); transition: transform .32s ease;
  display: flex; flex-direction: column;
}
[dir="rtl"] .apse-drawer { left: 0; transform: translateX(-105%); }
body.apse-drawer-open .apse-drawer,
.apse-drawer.apse-open { transform: translateX(0); }
[dir="rtl"] body.apse-drawer-open .apse-drawer,
[dir="rtl"] .apse-drawer.apse-open { transform: translateX(0); }

.apse-drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid #eceff3;
}
.apse-drawer__title { font-weight: 700; font-size: 15px; }
.apse-drawer__title i { margin-inline-end: 8px; color: #10b981; }
.apse-drawer__close {
  border: 0; background: #f3f4f6; border-radius: 50%;
  width: 32px; height: 32px; font-size: 18px; line-height: 1; cursor: pointer;
  color: #374151;
}
.apse-drawer__body { flex: 1; overflow-y: auto; padding: 6px 18px; }
.apse-drawer__foot { border-top: 1px solid #eceff3; padding: 14px 18px; }

.apse-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f3f4f6; }
.apse-item:last-child { border-bottom: 0; }
.apse-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; }
.apse-item__name { font-size: 13.5px; font-weight: 600; color: #111827; text-decoration: none; display: block; }
.apse-item__name:hover { text-decoration: underline; }
.apse-item__meta { font-size: 12px; color: #6b7280; margin-top: 4px; }
.apse-item__right { margin-inline-start: auto; text-align: end; }
.apse-item__total { font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.apse-item__remove {
  border: 0; background: none; color: #9ca3af; cursor: pointer;
  font-size: 15px; margin-top: 6px; padding: 2px 6px;
}
.apse-item__remove:hover { color: #ef4444; }

.apse-drawer__empty { text-align: center; padding: 42px 10px; color: #6b7280; }
.apse-drawer__empty i { font-size: 34px; opacity: .5; display: block; margin-bottom: 10px; }

.apse-drawer__total {
  display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 10px;
}
.apse-drawer__total b { font-size: 16px; }
.apse-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 11px 16px; border-radius: 10px;
  font-weight: 700; font-size: 14px; text-decoration: none; margin-bottom: 8px;
  border: 1px solid transparent; cursor: pointer;
}
.apse-btn--primary { background: var(--apse-primary, #10b981); color: #fff; }
.apse-btn--primary:hover { filter: brightness(1.06); text-decoration: none; color:#fff; }
.apse-btn--light { background: #f3f4f6; color: #111827; }
.apse-btn--light:hover { background: #e9ecf1; text-decoration: none; }

/* Barre livraison gratuite (affichée tiroir ET fiche produit) */
.apse-freeship {
  margin: 10px 0; font-size: 12.5px; color: #374151;
}
.apse-freeship__bar {
  height: 8px; border-radius: 999px; background: #e5e7eb; overflow: hidden; margin-top: 6px;
}
.apse-freeship__fill {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--apse-primary, #10b981), #34d399);
  transition: width .5s ease;
}
.apse-freeship--done .apse-freeship__bar { background: #d1fae5; }

/* Barre de stock (fiche produit) */
.apse-stock { margin: 10px 0 4px; font-size: 12.5px; color: #374151; max-width: 420px; }
.apse-stock__bar {
  height: 8px; border-radius: 999px; background: #fde8e8; overflow: hidden; margin-top: 6px;
}
.apse-stock__fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #f97316, #ef4444);
  transition: width .5s ease;
}

/* ── Preuve sociale (popups) ───────────────────── */
.apse-social {
  position: fixed; left: 18px; bottom: 18px; z-index: 1055;
  max-width: 330px; min-width: 260px;
}
.apse-popup {
  display: flex; gap: 10px; align-items: center;
  background: #fff; border: 1px solid #eceff3; border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.14); padding: 10px 12px;
  transform: translateY(12px); opacity: 0; transition: all .35s ease;
  text-decoration: none; color: inherit;
}
.apse-popup.apse-show { transform: translateY(0); opacity: 1; }
.apse-popup img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; }
.apse-popup__txt { font-size: 12.5px; line-height: 1.35; }
.apse-popup__head { color: #6b7280; }
.apse-popup__head b { color: #111827; }
.apse-popup__prod { color: #111827; font-weight: 600; display: block; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.apse-popup__when { color: #9ca3af; font-size: 11px; margin-top: 2px; }

@media (max-width: 767.98px) {
  .apse-drawer { width: 100%; max-width: 100%; height: auto; top: auto; bottom: 0;
    max-height: 78vh; border-radius: 16px 16px 0 0;
    transform: translateY(110%); }
  .apse-drawer.apse-open { transform: translateY(0); }
  .apse-social { left: 10px; right: 10px; bottom: 10px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  .apse-drawer, .apse-popup, .apse-freeship__fill, .apse-stock__fill { transition: none !important; }
}

/* Modale confirmation existante masquée quand le tiroir la remplace */
body.apse-replaces-confirm #cart-confirm { display: none !important; }
