/* =====================================================================
   Mayart – Cart Drawer & Overlay
   Chargé sur TOUTES les pages (front page incluse)
   Les variables CSS (--bg, --border, etc.) sont définies par
   front-page.css ou nav.css chargé avant ce fichier.
   ===================================================================== */

/* ── OVERLAY ─────────────────────────────────────────────────────── */
#mayart-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 20, 26, .45);
  z-index: 199998;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

#mayart-drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ── DRAWER PANEL ────────────────────────────────────────────────── */
#mayart-cart-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: #fff;
  z-index: 199999;
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0, 0, 0, .12);
}

#mayart-cart-drawer.open {
  transform: translateX(0);
}

/* ── HEADER DRAWER ───────────────────────────────────────────────── */
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--border, #e6e8ea);
}

.drawer-head h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text, #0d141a);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-head h2 .drawer-count-badge {
  background: var(--peach-dark, #d4754a);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 50px;
}

.drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0d141a;
  transition: opacity .2s;
  flex-shrink: 0;
}

.drawer-close:hover {
  opacity: .6;
}

.drawer-close svg {
  width: 24px;
  height: 24px;
  stroke: #0d141a;
  stroke-width: 2.5;
}

/* ── ITEMS LIST ──────────────────────────────────────────────────── */
.drawer-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.drawer-items::-webkit-scrollbar { width: 4px; }
.drawer-items::-webkit-scrollbar-track { background: transparent; }
.drawer-items::-webkit-scrollbar-thumb { background: #e0d4f0; border-radius: 2px; }

.drawer-item {
  display: flex;
  gap: 16px;
  padding: 16px 28px;
  transition: background .15s;
}

.drawer-item:hover {
  background: #fafafa;
}

.drawer-item__img {
  width: 72px; height: 72px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border, #e6e8ea);
}

.drawer-item__info {
  flex: 1;
  min-width: 0;
}

.drawer-item__name {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text, #0d141a);
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-item__qty {
  font-size: .8rem;
  color: #9a8a9a;
  margin: 0 0 6px;
}

.drawer-item__price {
  font-size: .92rem;
  font-weight: 600;
  color: var(--peach-dark, #d4754a);
  margin: 0;
}

.drawer-item__remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #c0b8cc;
  font-size: .75rem;
  padding: 0;
  margin-top: 4px;
  transition: color .2s;
  text-decoration: underline;
}

.drawer-item__remove:hover {
  color: #d4754a;
}

/* ── PANIER VIDE ─────────────────────────────────────────────────── */
.drawer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  padding: 40px;
  text-align: center;
}

.drawer-empty svg { opacity: .25; }

.drawer-empty p {
  color: #9a8a9a;
  font-size: .95rem;
  margin: 0;
}

.drawer-empty a {
  color: var(--peach-dark, #d4754a);
  font-weight: 600;
  text-decoration: none;
  font-size: .9rem;
}

/* ── FOOTER DRAWER ───────────────────────────────────────────────── */
.drawer-foot {
  padding: 20px 28px;
  border-top: 1px solid var(--border, #e6e8ea);
}

.drawer-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.drawer-total span:first-child {
  font-size: .85rem;
  color: #7a6a8a;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.drawer-total strong {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text, #0d141a);
}

.drawer-btn-checkout {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--peach-dark, #d4754a);
  color: #fff;
  text-align: center;
  border-radius: 50px;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  transition: background .2s;
  border: none;
  cursor: pointer;
  margin-bottom: 10px;
}

.drawer-btn-checkout:hover { background: #b85f38; }

.drawer-btn-cart {
  display: block;
  width: 100%;
  padding: 12px;
  background: transparent;
  color: var(--text, #0d141a);
  text-align: center;
  border-radius: 50px;
  font-weight: 500;
  font-size: .88rem;
  text-decoration: none;
  transition: background .2s;
  border: 1px solid var(--border, #e6e8ea);
}

.drawer-btn-cart:hover { background: var(--bg, #F6F8FA); }

/* ── CHARGEMENT ──────────────────────────────────────────────────── */
.drawer-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
}

.drawer-spinner {
  width: 28px; height: 28px;
  border: 3px solid #f0e8f5;
  border-top-color: var(--peach-dark, #d4754a);
  border-radius: 50%;
  animation: mayart-spin .7s linear infinite;
}

@keyframes mayart-spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #mayart-cart-drawer { width: 100vw; }
}
