/* =====================================================================
   MTJR Store — storefront theme
   Brand colours are injected inline from settings (--brand, --dark, --accent).
   ===================================================================== */
:root {
  --brand:#a4161a; --brand-2:#7a1013; --dark:#14161a; --accent:#e5b23b;
  --ink:#191c21; --muted:#6d7480; --line:#e8eaee; --bg:#f6f7f9; --card:#fff;
  --ok:#15803d; --warn:#b45309; --bad:#b91c1c;
  --r:16px; --r-sm:10px;
  --shadow:0 1px 2px rgba(16,20,28,.04), 0 8px 24px rgba(16,20,28,.06);
  --shadow-lg:0 12px 40px rgba(16,20,28,.14);
  --font:'Tajawal','Segoe UI',system-ui,-apple-system,sans-serif;
}
* { box-sizing:border-box; }
html,body { margin:0; padding:0; }
body {
  font-family:var(--font); background:var(--bg); color:var(--ink);
  font-size:15px; line-height:1.7; -webkit-font-smoothing:antialiased;
}
img { max-width:100%; display:block; }
a { color:inherit; text-decoration:none; }
button, input, select, textarea { font-family:inherit; font-size:inherit; }
h1,h2,h3,h4 { margin:0 0 .5em; line-height:1.35; font-weight:800; letter-spacing:-.2px; }
.wrap { max-width:1200px; margin:0 auto; padding:0 16px; }
.muted { color:var(--muted); }
.center { text-align:center; }
.hide { display:none !important; }

/* ─── Header ─────────────────────────────────────────────────────── */
.topbar { background:var(--dark); color:#cfd4dc; font-size:13px; padding:7px 0; }
.topbar .wrap { display:flex; gap:14px; align-items:center; justify-content:space-between; flex-wrap:wrap; }
.topbar a { color:#cfd4dc; }
.topbar a:hover { color:#fff; }

header.site {
  position:sticky; top:0; z-index:60; background:rgba(255,255,255,.92);
  backdrop-filter:saturate(160%) blur(12px); border-bottom:1px solid var(--line);
}
/* NOTE: use the padding longhands here — a `padding: 12px 0` shorthand would
   wipe the 16px side padding .wrap gives, gluing the header to the screen edge. */
.head-row { display:flex; align-items:center; gap:16px; padding-top:12px; padding-bottom:12px; }
.brand { display:flex; align-items:center; gap:10px; font-weight:800; font-size:19px; white-space:nowrap; }
.brand .mark {
  width:38px; height:38px; border-radius:11px; display:grid; place-items:center; color:#fff;
  background:linear-gradient(135deg,var(--brand),var(--brand-2)); font-size:18px; font-weight:900;
  box-shadow:0 4px 12px rgba(164,22,26,.35);
}
.brand img { height:38px; width:auto; border-radius:8px; }
.search { flex:1; position:relative; min-width:0; }
.search input {
  width:100%; padding:11px 42px 11px 14px; border:1px solid var(--line); background:#fff;
  border-radius:999px; outline:none; transition:.18s;
}
.search input:focus { border-color:var(--brand); box-shadow:0 0 0 4px rgba(164,22,26,.10); }
.search button {
  position:absolute; inset-inline-start:6px; top:50%; transform:translateY(-50%);
  border:0; background:transparent; cursor:pointer; font-size:17px; color:var(--muted); padding:4px 6px;
}
.head-actions { display:flex; align-items:center; gap:8px; }
.icon-btn {
  position:relative; display:inline-flex; align-items:center; gap:7px; padding:9px 14px;
  border-radius:999px; border:1px solid var(--line); background:#fff; cursor:pointer;
  font-weight:600; font-size:14px; transition:.16s; white-space:nowrap;
}
.icon-btn:hover { border-color:var(--brand); color:var(--brand); }
.icon-btn.solid { background:var(--brand); border-color:var(--brand); color:#fff; }
.icon-btn.solid:hover { background:var(--brand-2); color:#fff; }
.badge-count {
  position:absolute; top:-6px; inset-inline-end:-6px; min-width:19px; height:19px; padding:0 5px;
  background:var(--accent); color:#3a2a00; border-radius:999px; font-size:11px; font-weight:800;
  display:grid; place-items:center;
}
nav.cats { border-top:1px solid var(--line); background:#fff; }
nav.cats .wrap { display:flex; gap:6px; overflow-x:auto; padding-top:8px; padding-bottom:8px; }
/* The category strip is swiped, not dragged — no need for a visible bar. */
nav.cats .wrap { scrollbar-width:none; -ms-overflow-style:none; }
nav.cats .wrap::-webkit-scrollbar { display:none; }
nav.cats a {
  padding:7px 14px; border-radius:999px; font-size:14px; font-weight:600; color:var(--muted);
  white-space:nowrap; transition:.15s;
}
nav.cats a:hover { background:#f2f3f5; color:var(--ink); }
nav.cats a.on { background:var(--brand); color:#fff; }

/* ─── Buttons / forms ────────────────────────────────────────────── */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px; cursor:pointer;
  padding:11px 20px; border-radius:12px; border:1px solid transparent; font-weight:700;
  background:var(--brand); color:#fff; transition:.16s; font-size:15px;
}
.btn:hover { background:var(--brand-2); transform:translateY(-1px); }
.btn:disabled, .btn.disabled { opacity:.5; cursor:not-allowed; transform:none; }
.btn.ghost { background:#fff; border-color:var(--line); color:var(--ink); }
.btn.ghost:hover { border-color:var(--brand); color:var(--brand); background:#fff; }
.btn.dark { background:var(--dark); }
.btn.dark:hover { background:#000; }
.btn.block { width:100%; }
.btn.sm { padding:7px 13px; font-size:13.5px; border-radius:10px; }
.btn.lg { padding:14px 28px; font-size:16.5px; }

label.f { display:block; margin-bottom:14px; }
label.f > span { display:block; font-size:13.5px; font-weight:700; margin-bottom:6px; color:#3b414b; }
.inp, input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=date], select, textarea {
  width:100%; padding:11px 13px; border:1px solid var(--line); border-radius:11px; background:#fff;
  outline:none; transition:.15s;
}
.inp:focus, input:focus, select:focus, textarea:focus { border-color:var(--brand); box-shadow:0 0 0 4px rgba(164,22,26,.09); }
textarea { min-height:92px; resize:vertical; }
/* Date boxes (2026-10-31): Chrome on an Arabic phone writes the picked day as 15/11/2026 with hidden
   right-to-left marks, so the box read «152026/11/» (or 2026/11/15). Keep its characters in order: 15/11/2026.
   Date type only (digits only); not on iPhone (WebKit), whose text can carry Arabic month names. */
@supports not (-webkit-touch-callout:none) {
  input[type=date]::-webkit-date-and-time-value { direction:ltr; unicode-bidi:bidi-override; }
  input[type=date]:dir(rtl)::-webkit-date-and-time-value { text-align:right; }
}
.row2 { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.check { display:flex; align-items:flex-start; gap:9px; cursor:pointer; margin-bottom:10px; }
.check input { width:18px; height:18px; margin-top:3px; accent-color:var(--brand); }

/* ─── Cards & layout ─────────────────────────────────────────────── */
.card { background:var(--card); border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow); }
.card.pad { padding:20px; }
/* Longhands: `.section` is often combined with `.wrap` (<div class="wrap section">),
   and a `padding: 44px 0` shorthand would cancel .wrap's 16px side padding. */
.section { padding-top:44px; padding-bottom:44px; }
.section-head { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:22px; }
.section-head h2 { font-size:25px; margin:0; }
.section-head p { margin:4px 0 0; color:var(--muted); font-size:14.5px; }

.alert { padding:12px 16px; border-radius:12px; margin-bottom:14px; font-weight:600; font-size:14.5px; }
.alert.ok  { background:#e9f8ef; color:#14663a; border:1px solid #bfe8d0; }
.alert.bad { background:#fdecec; color:#93221f; border:1px solid #f6c9c7; }
.alert.warn{ background:#fff6e6; color:#8a5a08; border:1px solid #f6dfae; }

.badge { display:inline-block; padding:3px 10px; border-radius:999px; font-size:12px; font-weight:700; }
.b-ok { background:#e9f8ef; color:#15803d; } .b-warn { background:#fff4e0; color:#b45309; }
.b-bad { background:#fdecec; color:#b91c1c; } .b-info { background:#eaf1fd; color:#1d4ed8; }

/* ─── Hero ───────────────────────────────────────────────────────── */
.hero {
  position:relative; overflow:hidden; border-radius:24px; margin:22px 0;
  background:linear-gradient(120deg,var(--dark) 0%, #23262d 45%, var(--brand-2) 130%);
  color:#fff; padding:58px 44px; box-shadow:var(--shadow-lg);
}
.hero::after {
  content:''; position:absolute; inset-inline-end:-90px; top:-90px; width:340px; height:340px;
  background:radial-gradient(circle,rgba(229,178,59,.28),transparent 65%); border-radius:50%;
}
.hero h1 { font-size:40px; margin:0 0 14px; max-width:16ch; }
.hero p { font-size:17px; opacity:.9; max-width:52ch; margin:0 0 26px; }
.hero .btn.ghost { background:rgba(255,255,255,.1); border-color:rgba(255,255,255,.35); color:#fff; }
.hero-img { position:absolute; inset-inline-end:36px; bottom:0; max-height:78%; opacity:.95; }

/* ─── Product grid ───────────────────────────────────────────────── */
.grid-products { display:grid; grid-template-columns:repeat(auto-fill,minmax(215px,1fr)); gap:18px; }
.p-card {
  background:#fff; border:1px solid var(--line); border-radius:var(--r); overflow:hidden;
  display:flex; flex-direction:column; transition:.2s; position:relative;
}
.p-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-lg); border-color:#dfe2e8; }
.p-thumb { position:relative; aspect-ratio:1/1; background:#f2f3f5; overflow:hidden; }
.p-thumb img { width:100%; height:100%; object-fit:cover; transition:.35s; }
.p-card:hover .p-thumb img { transform:scale(1.05); }
.p-tag {
  position:absolute; top:10px; inset-inline-start:10px; background:var(--brand); color:#fff;
  padding:3px 10px; border-radius:999px; font-size:11.5px; font-weight:800;
}
.p-tag.out { background:#454b55; }
.p-tag.new { background:var(--accent); color:#3a2a00; }
.p-body { padding:13px 14px 15px; display:flex; flex-direction:column; gap:7px; flex:1; }
.p-cat { font-size:11.5px; color:var(--muted); font-weight:600; }
.p-name { font-weight:700; font-size:15px; line-height:1.5; min-height:2.9em; }
.p-price { display:flex; align-items:baseline; gap:8px; margin-top:auto; }
.p-price .now { font-size:18px; font-weight:800; color:var(--brand); }
.p-price .was { font-size:13px; color:var(--muted); text-decoration:line-through; }
.p-stock { font-size:12px; font-weight:700; }
.p-stock.ok { color:var(--ok); } .p-stock.low { color:var(--warn); } .p-stock.out { color:var(--bad); }
.p-actions { display:flex; gap:7px; margin-top:6px; }
.p-actions .btn { flex:1; padding:9px 12px; font-size:14px; border-radius:10px; }

/* ─── Filters sidebar ────────────────────────────────────────────── */
.shop-layout { display:grid; grid-template-columns:250px 1fr; gap:22px; align-items:start; }
/* Grid children default to min-width:auto, so a wide table would blow the page
   out horizontally instead of scrolling inside .table-wrap. */
.shop-layout > * { min-width:0; }
.filters { position:sticky; top:96px; }
.filters h4 { font-size:14.5px; margin:16px 0 8px; }
.filters .list a { display:flex; justify-content:space-between; padding:6px 10px; border-radius:9px; font-size:14px; color:#464c56; }
.filters .list a:hover { background:#f4f5f7; }
.filters .list a.on { background:var(--brand); color:#fff; }
.filters .list a.on span { color:#fff; }
.toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.filters-toggle { display:none; }

/* ─── Product detail ─────────────────────────────────────────────── */
.pd { display:grid; grid-template-columns:1.05fr 1fr; gap:34px; align-items:start; }
.pd-gallery { background:#fff; border:1px solid var(--line); border-radius:var(--r); overflow:hidden; }
.pd-gallery .main { aspect-ratio:1/1; background:#f2f3f5; }
.pd-gallery .main img { width:100%; height:100%; object-fit:cover; }
.pd-thumbs { display:flex; gap:8px; padding:10px; overflow-x:auto; }
.pd-thumbs img { width:66px; height:66px; object-fit:cover; border-radius:10px; border:2px solid transparent; cursor:pointer; }
.pd-thumbs img.on { border-color:var(--brand); }
.pd h1 { font-size:28px; }
.price-big { font-size:31px; font-weight:900; color:var(--brand); }
.qty { display:inline-flex; align-items:center; border:1px solid var(--line); border-radius:12px; overflow:hidden; background:#fff; }
.qty button { width:40px; height:44px; border:0; background:#fff; font-size:19px; cursor:pointer; color:var(--ink); }
.qty button:hover { background:#f4f5f7; }
.qty input { width:56px; height:44px; border:0; text-align:center; font-weight:700; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance:none; margin:0; }

/* ─── Tables (cart, orders, invoice) ─────────────────────────────── */
table.tbl { width:100%; border-collapse:collapse; background:#fff; }
table.tbl th, table.tbl td { padding:12px 14px; border-bottom:1px solid var(--line); text-align:start; }
table.tbl th { background:#fafbfc; font-size:13px; color:#4b515b; font-weight:800; }
table.tbl tr:last-child td { border-bottom:0; }
.table-wrap { overflow-x:auto; border:1px solid var(--line); border-radius:var(--r); background:#fff; }
/* Slim, blended scrollbars instead of the chunky default ones. */
.table-wrap, .pd-thumbs { scrollbar-width:thin; scrollbar-color:#d9dde3 transparent; }
.table-wrap::-webkit-scrollbar, .pd-thumbs::-webkit-scrollbar { width:8px; height:8px; }
.table-wrap::-webkit-scrollbar-track, .pd-thumbs::-webkit-scrollbar-track { background:transparent; }
.table-wrap::-webkit-scrollbar-thumb, .pd-thumbs::-webkit-scrollbar-thumb { background:#d9dde3; border-radius:999px; }
.table-wrap::-webkit-scrollbar-thumb:hover, .pd-thumbs::-webkit-scrollbar-thumb:hover { background:#bfc5cf; }
.cart-thumb { width:56px; height:56px; border-radius:10px; object-fit:cover; background:#f2f3f5; }

.summary { position:sticky; top:96px; }
.sum-row { display:flex; justify-content:space-between; padding:8px 0; font-size:14.5px; }
.sum-row.total { border-top:1px dashed var(--line); margin-top:8px; padding-top:14px; font-size:18px; font-weight:800; }

/* ─── Footer ─────────────────────────────────────────────────────── */
footer.site { background:var(--dark); color:#aab1bd; margin-top:56px; padding:44px 0 0; }
footer.site h4 { color:#fff; font-size:15.5px; margin-bottom:12px; }
footer.site a { color:#aab1bd; display:block; padding:3px 0; }
footer.site a:hover { color:#fff; }
.foot-grid { display:grid; grid-template-columns:1.6fr 1fr 1fr 1.2fr; gap:28px; padding-bottom:30px; }
.foot-bottom { border-top:1px solid #262a31; padding-top:16px; padding-bottom:16px; font-size:13px; display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.pay-icons { display:flex; gap:8px; align-items:center; }
.pay-icons span { background:#20242b; border-radius:7px; padding:4px 9px; font-size:11.5px; color:#c9cfd8; }

/* ─── Mobile bottom nav ──────────────────────────────────────────── */
.botnav { display:none; }
@media (max-width:900px) {
  /* !important on purpose: several pages set an inline two-column
     grid-template-columns, and an inline style would otherwise win here and
     squeeze the main column to 0px on phones. */
  .shop-layout { grid-template-columns:1fr !important; }
  .filters { position:static; padding:12px; }
  /* Filters collapse behind a button so products stay above the fold. */
  .filters-toggle { display:flex; }
  .filters .filter-body { display:none; }
  .filters.open .filter-body { display:block; }
  .pd { grid-template-columns:1fr; }
  .foot-grid { grid-template-columns:1fr 1fr; }
  .hero { padding:38px 24px; border-radius:20px; }
  .hero h1 { font-size:29px; }
  .hero p { font-size:15.5px; }
  .head-actions .lbl { display:none; }
  .botnav {
    display:flex; position:fixed; bottom:0; inset-inline:0; z-index:70; background:#fff;
    border-top:1px solid var(--line); padding:6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content:space-around; box-shadow:0 -4px 18px rgba(0,0,0,.06);
  }
  .botnav a { flex:1; text-align:center; font-size:11px; color:var(--muted); font-weight:600; padding:4px 0; }
  .botnav a .ic { font-size:19px; display:block; line-height:1.35; }
  .botnav a.on { color:var(--brand); }
  body { padding-bottom:64px; }
  .summary { position:static; }
}
@media (max-width:700px) {
  /* Give the search box its own full-width row instead of squeezing it. */
  .head-row { flex-wrap:wrap; row-gap:10px; }
  .brand { flex:1; font-size:17px; }
  .search { order:3; flex-basis:100%; }
}
@media (max-width:560px) {
  .grid-products { grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:12px; }
  .row2 { grid-template-columns:1fr; }
  .foot-grid { grid-template-columns:1fr; }
  .section { padding-top:30px; padding-bottom:30px; }
  .p-name { font-size:14px; }
}

/* ─── Landing blocks ─────────────────────────────────────────────── */
.features { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:16px; }
.feature { background:#fff; border:1px solid var(--line); border-radius:var(--r); padding:22px; text-align:center; transition:.2s; }
.feature:hover { transform:translateY(-3px); box-shadow:var(--shadow); }
.feature .ic { font-size:30px; }
.feature h3 { font-size:16.5px; margin:10px 0 5px; }
.feature p { margin:0; color:var(--muted); font-size:14px; }
.cta-band {
  background:linear-gradient(120deg,var(--brand),var(--brand-2)); color:#fff; border-radius:22px;
  padding:38px; display:flex; align-items:center; justify-content:space-between; gap:20px; flex-wrap:wrap;
}
.cta-band h2 { margin:0; font-size:26px; }
.cta-band .btn { background:#fff; color:var(--brand); }
.cta-band .btn:hover { background:#f5f5f5; }
.cat-strip { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:14px; }
.cat-tile {
  background:#fff; border:1px solid var(--line); border-radius:var(--r); padding:18px 12px; text-align:center;
  font-weight:700; transition:.18s;
}
.cat-tile:hover { border-color:var(--brand); color:var(--brand); transform:translateY(-2px); }
.cat-tile .ic { font-size:26px; display:block; margin-bottom:6px; }

/* ─── Steps / misc ───────────────────────────────────────────────── */
.steps { display:flex; gap:8px; margin-bottom:20px; flex-wrap:wrap; }
.step { flex:1; min-width:120px; padding:10px 12px; border-radius:12px; background:#fff; border:1px solid var(--line); font-size:13.5px; font-weight:700; color:var(--muted); text-align:center; }
.step.on { background:var(--brand); border-color:var(--brand); color:#fff; }
.step.done { color:var(--ok); border-color:#bfe8d0; background:#f2fbf5; }
.pager { display:flex; gap:6px; justify-content:center; margin-top:24px; flex-wrap:wrap; }
.pager a { padding:7px 13px; border:1px solid var(--line); border-radius:10px; background:#fff; font-weight:600; }
.pager a.on { background:var(--brand); border-color:var(--brand); color:#fff; }
.empty { text-align:center; padding:56px 20px; color:var(--muted); }
.empty .ic { font-size:44px; margin-bottom:10px; }
.chip { display:inline-flex; align-items:center; gap:6px; background:#f2f3f5; border-radius:999px; padding:5px 12px; font-size:13px; font-weight:600; }
.print-only { display:none; }
@media print {
  .no-print, header.site, footer.site, .botnav, .topbar { display:none !important; }
  body { background:#fff; }
  .print-only { display:block; }
  .card { box-shadow:none; border:0; }
}

/* Store pages (من نحن + the policies, 2026-10-30): the page text and the footer row of links */
.store-page p { margin:0 0 14px; line-height:1.9; }
.store-page a { color:var(--brand); text-decoration:underline; }
footer.site .foot-legal { display:flex; flex-wrap:wrap; justify-content:center; gap:4px 20px; border-top:1px solid #262a31; padding-top:12px; padding-bottom:12px; font-size:13.5px; }
footer.site .foot-legal a { display:inline-block; }
/* Order page on a phone (2026-10-31): each line as a compact card instead of a narrow table —
   the name on its own line (code under it), then «90 × 12.035 ر.ع.» with the line total at the other end.
   The order number never breaks inside itself. The computer keeps the table. */
.ord-title .ord-no { white-space:nowrap; }
@media (max-width:600px) {
  .ord-title { font-size:19px !important; }
  table.ord-items, table.ord-items tbody { display:block; }
  table.ord-items thead { display:none; }
  table.ord-items tr { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 6px; padding:11px 14px; border-bottom:1px solid var(--line); }
  table.ord-items tr:last-child { border-bottom:0; }
  table.ord-items td { padding:0; border:0; }
  table.ord-items .oi-name { flex:0 0 100%; order:1; font-weight:600; line-height:1.55; }
  table.ord-items .oi-qty { order:2; font-size:14px; color:#4b515b; }
  table.ord-items .oi-qty::after { content:"\00a0×"; }
  table.ord-items .oi-price { order:3; font-size:14px; color:#4b515b; }
  table.ord-items .oi-total { order:4; margin-inline-start:auto; text-align:end; }
}
