/* Smart Idea demo — Bunn Coffee Roasters. Warm espresso and cream with a copper
   accent, a serif for English headings: a small speciality brand, not a
   marketplace. Logical properties throughout so Arabic (rtl) and English (ltr) both work. */
:root {
  --bg: #F7F1E8;
  --paper: #FFFDF9;
  --ink: #2B1B12;
  --ink-2: #5E4A3C;
  --mut: #8C7867;
  --line: #E8DCCB;
  --copper: #C26A2B;
  --copper-2: #A65720;
  --ok: #2F7D4F;
  --bad: #B42318;
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.6 Inter, system-ui, sans-serif; }
:lang(ar) body { font-family: Cairo, Inter, system-ui, sans-serif; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
:lang(en) h1 { font-family: Fraunces, Georgia, serif; font-weight: 700; letter-spacing: -.01em; }
:lang(ar) h1 { font-weight: 800; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--mut); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; }
.pad { padding: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 22px;
  border-radius: 99px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--copper); border-color: var(--copper); }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 13px; border-width: 1px; }
.btn.ghost { border-color: transparent; color: var(--mut); }
.btn.ghost:hover { background: transparent; color: var(--bad); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; background: transparent; color: var(--ink); }
.btn.primary:disabled { background: var(--ink); color: var(--paper); }
.linkish { border: 0; background: none; color: var(--mut); font-size: 12.5px; text-decoration: underline; cursor: pointer; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--copper); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }

/* ── Header ── */
.st-top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px clamp(16px, 4vw, 48px); background: var(--paper); border-bottom: 1px solid var(--line);
}
.st-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.st-brand b { display: block; font-size: 20px; line-height: 1.1; }
:lang(en) .st-brand b { font-family: Fraunces, Georgia, serif; }
.st-brand small { display: block; font-size: 12px; color: var(--mut); }
.st-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); margin-inline-start: auto; }
.st-tabs button { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border: 0; border-radius: 99px; background: transparent; color: var(--ink-2); font-weight: 700; cursor: pointer; }
.st-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.cart-btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 99px; border: 1.5px solid var(--ink); background: var(--paper); font-weight: 700; cursor: pointer; }
.cart-btn:hover { background: var(--ink); color: var(--paper); }

/* ── Shop ── */
#view-list, .page, .admin { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px) 60px; }
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: end; margin: 24px 0;
  padding: clamp(28px, 5vw, 56px); border-radius: 26px; color: #F7F1E8;
  background: radial-gradient(600px 300px at 85% 0%, rgba(194, 106, 43, .55), transparent 70%), linear-gradient(135deg, #3B271B, #1E130C);
}
.hero h1 { font-size: clamp(30px, 4.6vw, 52px); max-width: 16ch; }
.hero p { color: #E6D7C6; margin: 12px 0 22px; max-width: 52ch; }
.hero .btn { background: #F7F1E8; color: var(--ink); border-color: #F7F1E8; }
.hero .btn:hover { background: var(--copper); border-color: var(--copper); color: #fff; }
.perks { list-style: none; display: grid; gap: 10px; font-weight: 600; font-size: 14px; }
.perks li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); white-space: nowrap; }
.perks li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--copper); flex: none; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; scroll-margin-top: 16px; }
.cats { display: flex; gap: 8px; flex-wrap: wrap; }
.cats button { height: 38px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--line); background: var(--paper); font-weight: 600; cursor: pointer; }
.cats button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.sel { display: flex; gap: 8px; }
.sel select, .a-filter select { height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.pcard-btn { width: 100%; display: flex; flex-direction: column; text-align: start; border: 0; background: none; cursor: pointer; }
.pimg {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: 18px; overflow: hidden;
  background: linear-gradient(160deg, hsl(var(--h) 45% 92%), hsl(var(--h) 40% 84%));
}
.pimg .art svg { transition: transform .35s ease; }
.pcard-btn:hover .pimg .art svg { transform: translateY(-4px) rotate(-3deg); }
.flag { position: absolute; top: 10px; inset-inline-start: 10px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.flag.best { background: var(--ink); color: var(--paper); }
.flag.low { background: #FDE7C8; color: #8A4B0F; }
.flag.out { background: #EFE8DE; color: var(--mut); }
.pcard.is-out .pimg { filter: grayscale(.7); opacity: .75; }
.pbody { display: grid; gap: 2px; padding: 10px 4px 0; }
.pbody b { font-size: 15.5px; }
.pbody small { color: var(--mut); font-size: 13px; }
.pprice { font-weight: 700; margin-top: 4px; }
.pprice em { font-style: normal; font-weight: 500; color: var(--mut); font-size: 13px; }
.art { display: inline-grid; place-items: center; }
.art.tool { color: hsl(var(--h) 35% 30%); }

.mine { padding: 20px; margin-top: 30px; }
.mine h2 { font-size: 17px; margin-bottom: 12px; }
.mine ul { list-style: none; display: grid; gap: 10px; }
.mine li { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.mine li small { display: block; color: var(--mut); font-size: 13px; }

.track { list-style: none; display: flex; gap: 0; min-width: 280px; }
.track li { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--mut); text-align: center; }
.track i { width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 2px solid #D9CBB8; position: relative; z-index: 1; }
.track li + li::before { content: ""; position: absolute; top: 6px; inset-inline-end: 50%; width: 100%; height: 2px; background: #D9CBB8; }
.track li.done, .track li.now { color: var(--ink); }
.track li.done i { background: var(--ok); border-color: var(--ok); }
.track li.done::before, .track li.now::before { background: var(--ok) !important; }
.track li.now i { border-color: var(--ok); box-shadow: 0 0 0 4px rgba(47, 125, 79, .18); }

/* ── Product page ── */
.link-back { border: 0; background: none; color: var(--ink-2); font-weight: 600; cursor: pointer; margin: 20px 0 14px; }
.pd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 50px); align-items: start; }
.pd-img { display: grid; place-items: center; aspect-ratio: 1; border-radius: 26px; background: linear-gradient(160deg, hsl(var(--h) 45% 92%), hsl(var(--h) 40% 82%)); }
.pd h1 { font-size: clamp(28px, 3.6vw, 42px); }
.pd-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 14px 0; font-size: 14.5px; }
.pd-meta dt { color: var(--mut); }
.pd-meta dd { font-weight: 600; }
.pd-price { font-size: 26px; font-weight: 800; margin: 10px 0 16px; }
.opts { border: 0; margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.opts legend { font-weight: 700; font-size: 14px; margin-bottom: 8px; width: 100%; }
.opts button { min-height: 44px; padding: 6px 16px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; line-height: 1.3; }
.opts button small { color: var(--mut); font-size: 12px; font-weight: 500; }
.opts button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.opts button[aria-pressed="true"] small { color: #D9C9B6; }
.pd-buy { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.pd-buy .btn { flex: 1; }
.qty { display: inline-flex; align-items: center; height: 46px; border: 1.5px solid var(--line); border-radius: 99px; background: var(--paper); }
.qty button { width: 40px; height: 100%; border: 0; background: none; font-size: 18px; font-weight: 700; cursor: pointer; }
.qty b { min-width: 24px; text-align: center; }
.qty.small { height: 32px; }
.qty.small button { width: 30px; font-size: 16px; }
.pd-low { color: #8A4B0F; font-weight: 600; font-size: 13.5px; margin-top: 10px; }
.pd-added { color: var(--ok); font-weight: 700; margin-top: 10px; }
.pd-added:empty { display: none; }

/* ── Cart drawer ── */
.drawer { position: fixed; inset: 0; z-index: 60; background: rgba(43, 27, 18, .45); display: flex; justify-content: flex-end; }
.drawer-panel { width: min(420px, 100%); height: 100%; overflow-y: auto; background: var(--paper); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.drawer-panel header { display: flex; justify-content: space-between; align-items: center; }
.drawer-panel h2 { font-size: 20px; }
.drawer-panel h2:focus { outline: none; }
.x { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 22px; cursor: pointer; }
.cart-lines { list-style: none; display: grid; gap: 12px; }
.cart-lines li { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.cart-lines li.empty { color: var(--mut); border: 0; padding: 20px 0; justify-content: center; }
.cart-lines .art { width: 56px; height: 56px; border-radius: 12px; background: var(--bg); flex: none; }
.cl-txt { flex: 1; display: grid; gap: 4px; min-width: 0; }
.cl-txt small { color: var(--mut); font-size: 12.5px; }
.cl-end { display: grid; justify-items: end; gap: 6px; }
.coupon { display: flex; gap: 8px; }
.coupon label { flex: 1; }
.coupon input { width: 100%; height: 46px; padding: 0 14px; border-radius: 99px; border: 1.5px solid var(--line); background: #fff; font-size: 16px; text-transform: uppercase; }
:lang(ar) .coupon input { text-align: right; }
.coupon-msg { font-size: 13px; font-weight: 600; margin-top: -6px; }
.coupon-msg:empty { display: none; }
.coupon-msg.ok { color: var(--ok); }
.coupon-msg.bad { color: var(--bad); }
.sums { display: grid; gap: 6px; padding-top: 12px; border-top: 1px dashed var(--line); }
.sums p { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.sums small { color: var(--mut); font-weight: 500; }
.sums .disc { color: var(--ok); }
.sums .grand { font-size: 18px; padding-top: 8px; border-top: 1px solid var(--line); }
.drawer-panel .btn.wide { margin-top: auto; }

/* ── Checkout ── */
.page > h1 { font-size: clamp(26px, 3.4vw, 36px); margin-bottom: 18px; }
.co { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.co-form { padding: 24px; display: grid; gap: 14px; }
.co-form h2, .co-sum h2 { font-size: 17px; }
.co-form h2 + .fld { margin-top: -4px; }
.fld { display: grid; gap: 6px; }
.fld > span { font-weight: 600; font-size: 14px; }
.fld input, .fld select, .fld textarea { width: 100%; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; }
.fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--ink); outline: none; }
.fld [aria-invalid="true"] { border-color: var(--bad); }
:lang(ar) #f-phone { text-align: right; }
.err { color: var(--bad); font-size: 13px; font-style: normal; font-weight: 600; }
.err:empty { display: none; }
.radio { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border: 1.5px solid var(--ink); border-radius: 12px; font-weight: 600; }
.radio input { accent-color: var(--ink); width: 18px; height: 18px; }
.radio.is-off { border-color: var(--line); color: var(--mut); }
.radio small { width: 100%; font-weight: 400; font-size: 12.5px; }
.co-sum { padding: 20px; position: sticky; top: 16px; display: grid; gap: 12px; }
.co-sum ul { list-style: none; display: grid; gap: 8px; font-size: 14px; }
.co-sum li { display: flex; justify-content: space-between; gap: 10px; }
.done { max-width: 620px; margin: 40px auto; padding: 36px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.done h1 { font-size: 30px; }
.done h1:focus { outline: none; }
.done-mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: #E3F1E8; color: var(--ok); font-size: 30px; font-weight: 700; }
.done .track { width: 100%; max-width: 420px; margin: 8px 0; }
.done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ── Admin ── */
.a-tabs { display: flex; gap: 4px; padding: 4px; width: fit-content; border-radius: 12px; background: #EDE3D5; margin: 24px 0 18px; }
.a-tabs button { height: 38px; padding: 0 18px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.a-tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.kpi span { display: block; color: var(--mut); font-size: 13px; font-weight: 600; }
.kpi b { font-size: 24px; font-variant-numeric: tabular-nums; }
.a-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 16px; align-items: start; }
.a-grid h2 { font-size: 15.5px; margin-bottom: 14px; }
.chart { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 190px; }
.chart li { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.chart .bar { width: 100%; max-width: 30px; height: calc(var(--v) * 150px + 4px); border-radius: 8px 8px 3px 3px; background: #E2CDB4; }
.chart li.on .bar { background: var(--copper); }
.chart small { font-size: 11.5px; color: var(--mut); }
.toplist, .lowlist { list-style: none; display: grid; gap: 10px; }
.toplist li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.toplist .art { width: 40px; height: 40px; border-radius: 10px; background: var(--bg); flex: none; }
.toplist span { flex: 1; font-weight: 600; }
.toplist small { color: var(--mut); font-weight: 400; }
.lowlist li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.lowlist em, .s-flag em { font-style: normal; font-size: 12px; padding: 1px 8px; border-radius: 99px; margin-inline-start: 4px; }
em.w { background: #FDE7C8; color: #8A4B0F; }
em.x { background: #F6DCD8; color: var(--bad); }
.a-filter { display: block; margin-bottom: 12px; }
.olist { list-style: none; padding: 6px; }
.orow { display: grid; grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1.4fr) 100px 110px auto; gap: 12px; align-items: center; padding: 14px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.orow:last-child { border-bottom: 0; }
.orow small { display: block; color: var(--mut); font-size: 12.5px; }
.orow.is-mine { background: #FFF6E9; border-radius: 12px; }
.o-items { color: var(--ink-2); font-size: 13px; }
.o-total { font-weight: 700; }
.o-act { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.tag { display: inline-block; margin-top: 4px; padding: 0 8px; border-radius: 99px; background: #FDE7C8; color: #8A4B0F; font-size: 11.5px; font-style: normal; font-weight: 700; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.s-new { background: #FDE7C8; color: #8A4B0F; }
.s-confirmed { background: #E0EAFB; color: #1E3A8A; }
.s-shipped { background: #EDE3FB; color: #5B21B6; }
.s-delivered { background: #DDF0E4; color: #1F6A3F; }
.s-cancelled { background: #EFE8DE; color: var(--mut); }
.slist { list-style: none; padding: 6px; margin-top: 12px; }
.slist li { display: flex; align-items: center; gap: 12px; padding: 10px; border-bottom: 1px solid var(--line); }
.slist li:last-child { border-bottom: 0; }
.slist .art { width: 46px; height: 46px; border-radius: 10px; background: var(--bg); flex: none; }
.s-name { flex: 1; min-width: 0; }
.s-name b { display: block; font-size: 14.5px; }
.s-name small { color: var(--mut); font-size: 12.5px; }
.s-flag { min-width: 110px; }

/* ── Responsive ── */
@media (max-width: 1000px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .a-grid { grid-template-columns: 1fr 1fr; }
  .a-grid > :first-child { grid-column: 1 / -1; }
  .orow { grid-template-columns: 80px minmax(0, 1fr) auto; }
  .o-items { grid-column: 2 / -1; }
  .o-total { grid-column: 2; }
  .o-st { grid-column: 3; grid-row: 1; justify-self: end; }
  .o-act { grid-column: 1 / -1; justify-content: flex-start; }
  .o-act:empty { display: none; }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .perks li { white-space: normal; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .pd, .co { grid-template-columns: 1fr; }
  .co-sum { position: static; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .a-grid { grid-template-columns: 1fr; }
  .st-tabs { order: 3; width: 100%; margin: 0; }
  .st-tabs button { flex: 1; justify-content: center; }
  .cart-btn { margin-inline-start: auto; }
  .st-brand small { display: none; }
  .s-flag { display: none; }
  .slist li { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .pd-buy { flex-wrap: wrap; }
  .pd-buy .btn { flex: 1 1 100%; }
  .slist .btn { margin-inline-start: auto; }
}
