/* ── Modal overlay ───────────────────────────────────────────── */
body.pm-open { overflow: hidden; }

.pm-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  align-items: flex-end;
  justify-content: center;
}
.pm-modal.open { display: flex; }

.pm-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  animation: pm-fade .2s ease;
}
@keyframes pm-fade { from { opacity: 0; } to { opacity: 1; } }

/* ── Sheet ───────────────────────────────────────────────────── */
.pm-sheet {
  position: relative; z-index: 1;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  width: 100%; max-height: 93dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: pm-up .3s cubic-bezier(.16,1,.3,1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@keyframes pm-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

.pm-handle {
  width: 40px; height: 4px;
  background: rgba(255,255,255,.12);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

/* ── Product image ───────────────────────────────────────────── */
.pm-img {
  width: 100%; aspect-ratio: 16/7;
  overflow: hidden; flex-shrink: 0;
  background: var(--surface3);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.pm-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pm-img-ph  { font-size: 4rem; }

/* ── Body (scrollable) ───────────────────────────────────────── */
.pm-body {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 20px 20px 12px;
  display: flex; flex-direction: column; gap: 18px;
}

/* ── Product info ────────────────────────────────────────────── */
.pm-product {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.pm-product-name  { font-size: 1.05rem; font-weight: 700; color: var(--text); line-height: 1.4; flex: 1; }
.pm-product-price { font-size: 1.55rem; font-weight: 900; color: var(--brand); letter-spacing: -.5px; white-space: nowrap; }

/* ── Total row ───────────────────────────────────────────────── */
.pm-total-row {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(var(--brand-rgb),.07);
  border: 1px solid rgba(var(--brand-rgb),.2);
  border-radius: 12px; padding: 12px 16px;
}
.pm-total-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.pm-total-val   { font-size: 1.45rem; font-weight: 900; color: var(--brand); letter-spacing: -.5px; }

/* ── Type selector ───────────────────────────────────────────── */
.pm-type-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pm-type-btn {
  padding: 13px 8px;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 12px; color: var(--muted);
  font-family: 'Poppins', sans-serif; font-size: .84rem; font-weight: 600;
  cursor: pointer; transition: background .12s, border-color .12s, color .12s;
  -webkit-tap-highlight-color: transparent; line-height: 1.3;
}
.pm-type-btn.active {
  background: rgba(var(--brand-rgb),.12);
  border-color: rgba(var(--brand-rgb),.45);
  color: var(--brand);
}

/* ── Quantity row ────────────────────────────────────────────── */
.pm-qty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pm-qty-label { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.pm-qty {
  display: flex; align-items: center;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.pm-qty-btn {
  width: 46px; height: 46px; background: none; border: none;
  color: var(--text); font-size: 1.4rem; font-weight: 300;
  font-family: 'Poppins', sans-serif; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s; -webkit-tap-highlight-color: transparent;
}
.pm-qty-btn:active { background: var(--surface3); }
.pm-qty-val {
  min-width: 52px; text-align: center;
  font-size: 1.15rem; font-weight: 800; color: var(--text);
  border-left: 1.5px solid var(--border); border-right: 1.5px solid var(--border);
  line-height: 46px;
}

/* ── Desktop: centered card ──────────────────────────────────── */
@media (min-width: 600px) {
  .pm-modal  { align-items: center; }
  .pm-sheet  { border-radius: 20px; max-width: 460px; max-height: 88dvh; animation: pm-pop .25s cubic-bezier(.16,1,.3,1); }
  .pm-handle { display: none; }
}
@keyframes pm-pop {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}
