/* Overlay */
.cart-overlay{
  position:fixed; inset:0; background:rgba(0,0,0,.35);
  opacity:0; pointer-events:none; transition:opacity .25s ease;
  z-index:9998; backdrop-filter:saturate(120%) blur(2px);
}

/* Drawer */
.cart-drawer{
  position:fixed; top:0; right:0; height:100dvh; width:min(420px, 92vw);
  background:#fff; box-shadow:-12px 0 30px rgba(0,0,0,.15);
  transform:translateX(105%); transition:transform .28s ease;
  z-index:9999; display:flex; flex-direction:column;
  border-left:1px solid rgba(0,0,0,.06);
}

/* Open state */
.cart-drawer.open{ transform:none; }
.cart-overlay.open{ opacity:1; pointer-events:auto; }

/* Header */
.cart-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 20px; border-bottom:1px solid rgba(0,0,0,.06);
}
.cart-header h2{ margin:0; font-size:1.25rem; letter-spacing:.2px; }
.cart-close{
  font-size:1.6rem; line-height:1; border:0; background:transparent; cursor:pointer;
  opacity:.6; padding:6px; border-radius:10px;
}
.cart-close:hover{ opacity:1; background:rgba(0,0,0,.05); }

/* Body */
.cart-body{ padding:14px 18px 140px; overflow:auto; flex:1; }

/* Items */
.cart-items{ list-style:none; margin:0; padding:0; display:grid; gap:12px; }
.cart-item{
  display:grid; grid-template-columns:64px 1fr auto; gap:12px; align-items:center;
  padding:10px; border:1px solid rgba(0,0,0,.06); border-radius:14px;
  background:#fff; box-shadow:0 2px 6px rgba(0,0,0,.03);
}
.cart-thumb{ width:64px; height:64px; border-radius:10px; object-fit:cover; background:#f5f5f5; }
.cart-title{ font-weight:600; margin-bottom:2px; }
.cart-meta{ font-size:.9rem; opacity:.75; }
.cart-price{ font-weight:700; white-space:nowrap; }

/* Qty + Remove */
.qty{
  display:inline-flex; align-items:center; gap:6px; border:1px solid rgba(0,0,0,.08);
  border-radius:12px; padding:4px 8px; background:#fafafa;
}
.qty button{ border:0; background:transparent; font-size:1rem; padding:2px 6px; cursor:pointer; }
.remove{ border:0; background:transparent; color:#b02a2a; cursor:pointer; font-size:.9rem; }

/* Summary */
.cart-summary{ margin-top:18px; padding:14px; border:1px dashed rgba(0,0,0,.12); border-radius:14px; }
.cart-summary .row{ display:flex; justify-content:space-between; margin:8px 0; }
.cart-summary .total{ font-size:1.1rem; }
.cart-summary .divider{ height:1px; background:rgba(0,0,0,.08); margin:10px 0; }
.cart-summary .muted{ display:block; margin-top:6px; opacity:.7; }

/* Footer */
.cart-footer{
  position:absolute; left:0; right:0; bottom:0; padding:12px 16px;
  background:linear-gradient(to top, rgba(255,255,255,.98), rgba(255,255,255,.92));
  display:flex; gap:10px; border-top:1px solid rgba(0,0,0,.06);
}
.btn{
  flex:1; padding:12px 14px; border-radius:14px; font-weight:700; cursor:pointer; border:0;
  box-shadow:0 6px 16px rgba(0,0,0,.08);
}
.btn.primary{ background:#8C6F5D; color:#fff; }
.btn.primary:hover{ filter:brightness(.95); }
.btn.ghost{ background:#f4f1ef; }
.btn.ghost:hover{ filter:brightness(.98); }

@media (max-width:420px){
  .cart-item{ grid-template-columns:56px 1fr auto; }
  .cart-thumb{ width:56px; height:56px; }
}

/* === Performance Tweaks für Drawer/Overlay === */
.cart-drawer{
  transform: translate3d(100%,0,0);          /* offscreen, kein layout-shift */
  transition: transform 260ms cubic-bezier(.2,.7,.25,1);
  will-change: transform;                    /* GPU hint */
  backface-visibility: hidden;
  contain: layout paint style;               /* isolieren */
}
.cart-drawer.open{
  transform: translate3d(0,0,0);
}

.cart-overlay{
  opacity: 0;
  transition: opacity 200ms ease-out;
  will-change: opacity;
  pointer-events: none;
}
.cart-overlay.open{
  opacity: 1;
  pointer-events: auto;
}

/* weniger Bewegung für User, die das wünschen */
@media (prefers-reduced-motion: reduce){
  .cart-drawer{ transition: none !important; }
  .cart-overlay{ transition: none !important; }
}
