/* ─── Mazaya public storefront ─────────────────────────────────── */
:root {
  --bg: #f7f2ec;
  --surface: #ffffff;
  --ink: #2b2118;
  --ink-2: #7a6a5c;
  --ink-3: #a99a8b;
  --line: #eadfd3;
  --primary: #b4552d;
  --primary-dark: #96431f;
  --primary-soft: #f8e7dc;
  --green: #2e7d4f;
  --danger: #c23434;
  --danger-soft: #fbe7e7;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(43,33,24,.08), 0 4px 14px rgba(43,33,24,.05);
  --font: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.5; min-height: 100vh; }
button { font-family: inherit; font-size: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; font-size: 16px; color: var(--ink); }
[hidden] { display: none !important; }

.sh-top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 18px; font-weight: 800; }
.sh-actions { display: flex; gap: 8px; }
.sh-btn-ghost {
  position: relative; min-height: 44px; min-width: 44px; padding: 4px 12px;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  font-weight: 700; font-size: 16px;
}
.cart-count {
  position: absolute; top: -7px; inset-inline-end: -7px;
  min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 12.5px; font-weight: 800;
  display: grid; place-items: center;
}

#shop-view { padding: 14px; max-width: 860px; margin: 0 auto; padding-bottom: 60px; }

.cat-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.cat-row::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: 0 0 auto; min-height: 42px; padding: 5px 18px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--line);
  font-weight: 700; font-size: 15px; color: var(--ink-2); white-space: nowrap;
}
.cat-chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.sp-card {
  text-align: start; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
  -webkit-tap-highlight-color: transparent; transition: transform .06s ease;
}
.sp-card:active { transform: scale(.97); }
.sp-img { width: 100%; aspect-ratio: 4/5; object-fit: cover; background: var(--primary-soft); }
.sp-img-ph { width: 100%; aspect-ratio: 4/5; display: grid; place-items: center; font-size: 44px; background: var(--primary-soft); }
.sp-body { padding: 10px 12px 12px; }
.sp-name { font-weight: 800; font-size: 15px; line-height: 1.35; }
.sp-price { font-weight: 800; color: var(--primary); font-size: 16px; margin-top: 2px; }
.sp-colors { color: var(--ink-2); font-size: 12.5px; }

.sh-empty { text-align: center; color: var(--ink-2); padding: 60px 20px; font-weight: 700; }

/* Sheets */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(43,33,24,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  background: var(--bg); border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  animation: slideup .2s ease;
}
@keyframes slideup { from { transform: translateY(40px); opacity: .6; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h2 { font-size: 19px; font-weight: 800; }
.sheet-close { min-width: 44px; min-height: 44px; font-size: 22px; color: var(--ink-2); }

.pd-photos { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.pd-photos img { height: 210px; border-radius: 12px; object-fit: cover; flex: 0 0 auto; max-width: 85%; }
.pd-name { font-size: 20px; font-weight: 800; }
.pd-price { font-size: 19px; font-weight: 800; color: var(--primary); margin: 2px 0 4px; }
.pd-origin { color: var(--ink-2); font-size: 13.5px; margin-bottom: 6px; }
.opt-label { font-weight: 700; font-size: 14px; color: var(--ink-2); margin: 10px 0 6px; }
.opt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.opt-chip {
  min-height: 46px; padding: 6px 18px; border-radius: 12px;
  background: var(--surface); border: 2px solid var(--line); font-weight: 800; font-size: 15px;
}
.opt-chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.opt-chip:disabled { opacity: .4; text-decoration: line-through; }

.qty-row { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.stepper { display: flex; align-items: center; gap: 2px; }
.stepper button { width: 46px; height: 46px; border-radius: 10px; background: var(--surface); border: 1.5px solid var(--line); font-size: 22px; font-weight: 800; color: var(--primary); }
.stepper .q { min-width: 40px; text-align: center; font-weight: 800; font-size: 18px; }

.btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 54px; padding: 8px 18px; border-radius: 12px; font-weight: 800; font-size: 17px; background: var(--primary); color: #fff; transition: background .12s ease; }
.btn:active { background: var(--primary-dark); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.btn.wa { background: #1faa53; text-decoration: none; }
.btn.wa:active { background: #17853f; }

.cart-line { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 8px; }
.cart-line .cl-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cart-line .cl-name { font-weight: 800; font-size: 15px; }
.cart-line .cl-meta { color: var(--ink-2); font-size: 13px; }
.cart-line .cl-controls { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.cl-remove { color: var(--danger); font-size: 20px; min-width: 44px; min-height: 44px; }
.total-row { display: flex; justify-content: space-between; font-weight: 800; font-size: 18px; padding: 10px 4px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 700; font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }
.input { width: 100%; min-height: 50px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); outline: none; }
.input:focus { border-color: var(--primary); }

.success-box { text-align: center; padding: 30px 10px; }
.success-box .big-check { font-size: 60px; }
.success-box h2 { font-size: 22px; font-weight: 800; margin: 10px 0 6px; }
.success-box p { color: var(--ink-2); }

#toast-root { position: fixed; top: calc(14px + env(safe-area-inset-top)); inset-inline: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--ink); color: #fff; font-weight: 700; font-size: 15px; padding: 12px 22px; border-radius: 12px; max-width: min(92vw, 460px); text-align: center; animation: toastin .22s ease; }
.toast.ok { background: var(--green); }
.toast.err { background: var(--danger); }
@keyframes toastin { from { transform: translateY(-16px); opacity: 0; } }

@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 20px; }
  .sp-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}
