/* =========================================================
   ألوان الهوية (بتتغيّر كمان من لوحة الإدارة)
   ========================================================= */
:root {
  --brand: #e10f18;
  --brand-dark: #a90b12;
  --brand-soft: #fde7e8;
  --accent: #f5ab00;
  --bg: #f7f6f3;
  --card: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #e7e5e0;
  --danger: #c0392b;
  --wa: #25d366;

  /* مقياس مسافات واحد لكل الموقع */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  /* مقاسات الخط */
  --fs-xs: 13px; --fs-sm: 14px; --fs-md: 16px; --fs-lg: 18px; --fs-xl: 22px;
  --radius: 16px; --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: var(--fs-md); line-height: 1.6;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.3; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
img { display: block; max-width: 100%; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--s4); }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 2px; }

/* =========================================================
   أزرار وحقول
   ========================================================= */
.btn {
  border: 0; border-radius: var(--radius-sm); min-height: 44px; padding: 0 var(--s4);
  font-weight: 600; font-size: var(--fs-md); line-height: 1.2;
  background: var(--brand); color: #fff; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid #f0d0cc; }
.btn.sm { min-height: 36px; padding: 0 var(--s3); font-size: var(--fs-sm); border-radius: 10px; }
.btn.block { width: 100%; }
.btn.wa { background: var(--wa); }
.btn.wa:hover { background: #1ebe5a; }

.field { display: block; margin-bottom: var(--s4); }
.field > span { display: block; font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--s1); line-height: 1.4; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 46px; border: 1px solid var(--line); background: #fff;
  border-radius: var(--radius-sm); padding: var(--s2) var(--s3); outline: none; line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field textarea { resize: vertical; min-height: 84px; }
.hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* =========================================================
   الشرائط العلوية والهيدر
   ========================================================= */
.announce { background: var(--brand); color: #fff; text-align: center; font-weight: 600; font-size: var(--fs-sm); line-height: 1.4; padding: var(--s2) var(--s4); }
.demo-note { background: #fff4e0; color: #7a5200; text-align: center; font-size: var(--fs-sm); line-height: 1.4; padding: var(--s2) var(--s4); }
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.94); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: var(--s3); }
.brand { display: flex; align-items: center; gap: var(--s2); min-width: 0; font-weight: 700; font-size: var(--fs-lg); line-height: 1.2; text-decoration: none; color: var(--text); }
.brand img { height: 44px; width: 44px; object-fit: contain; flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: var(--s2); flex: none; }
.lang-btn { min-height: 42px; padding: 0 var(--s3); border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: var(--fs-sm); }
.cart-btn { border: 0; background: var(--brand); color: #fff; border-radius: var(--radius-sm); height: 42px; padding: 0 var(--s3); display: flex; align-items: center; gap: var(--s2); font-weight: 600; }
.cart-btn .count { background: #fff; color: var(--brand); border-radius: 99px; min-width: 22px; height: 22px; font-size: var(--fs-xs); font-weight: 700; display: grid; place-items: center; padding: 0 6px; }

/* =========================================================
   الغلاف
   ========================================================= */
.hero {
  position: relative; margin-top: var(--s4); padding: var(--s6) var(--s4); text-align: center;
  border-radius: 22px; overflow: hidden;
  background: #f1c752 var(--hero, url("../img/hero.jpg")) center / cover no-repeat;
}
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.38)); pointer-events: none; }
.hero > * { position: relative; }
.hero .logo-big { height: clamp(128px, 26vw, 184px); width: auto; margin: 0 auto var(--s3); filter: drop-shadow(0 8px 18px rgba(0,0,0,.18)); }
.hero h1 { font-size: clamp(26px, 5vw, 40px); color: #2b1d00; margin-bottom: var(--s2); }
.hero p { color: #3a2a06; font-size: var(--fs-lg); font-weight: 600; line-height: 1.5; }
.info-row { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); margin-top: var(--s4); }
.info-row > * { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.88); color: #3a2a06; padding: 6px var(--s3); border-radius: 99px; font-size: var(--fs-sm); line-height: 1.4; text-decoration: none; }
.info-row svg { flex: none; opacity: .75; }
.closed-banner { background: #fff; color: #8a5a00; border: 1px solid #f5dfb5; padding: var(--s2) var(--s4); border-radius: var(--radius-sm); margin: var(--s4) auto 0; max-width: 560px; font-weight: 600; line-height: 1.5; }

/* =========================================================
   البحث والأقسام
   ========================================================= */
.toolbar { position: sticky; top: 64px; z-index: 20; background: var(--bg); padding: var(--s4) 0 var(--s2); }
.search { position: relative; }
.search input { width: 100%; min-height: 52px; padding: 0 var(--s4); padding-inline-start: 48px; border-radius: 14px; border: 1px solid var(--line); background: #fff; outline: none; font-size: var(--fs-md); }
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search svg { position: absolute; inset-inline-start: var(--s4); top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.chips { display: flex; gap: var(--s2); overflow-x: auto; padding: var(--s3) 0 var(--s1); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; min-height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 0 var(--s4); font-weight: 600; font-size: var(--fs-sm); color: var(--muted); }
.chip:hover { color: var(--text); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* =========================================================
   كروت المنتجات
   ========================================================= */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); padding: var(--s2) 0 var(--s6); }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s3); display: flex; flex-direction: column; gap: var(--s1); position: relative; }
.card .pic { aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: #fff; margin-bottom: var(--s2); }
.card .pic img { width: 100%; height: 100%; object-fit: contain; }
.card h3 { font-size: var(--fs-md); font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
.card .unit { font-size: var(--fs-xs); color: var(--muted); line-height: 1.4; min-height: 1.4em; }
.card .price { font-weight: 700; color: var(--brand-dark); font-size: var(--fs-lg); line-height: 1.3; margin: var(--s1) 0 var(--s2); display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s2); }
.card .price s { color: var(--muted); font-weight: 400; font-size: var(--fs-xs); }
.card .badge { position: absolute; top: var(--s4); inset-inline-start: var(--s4); background: var(--accent); color: #2b1d00; font-size: var(--fs-xs); font-weight: 700; line-height: 1; padding: 6px 10px; border-radius: 99px; }
.card .act { margin-top: auto; }
.card .act .btn { width: 100%; }
.card .offer { align-self: flex-start; background: color-mix(in srgb, var(--accent) 18%, #fff); color: #6b4700; border: 1px solid color-mix(in srgb, var(--accent) 45%, #fff); font-size: var(--fs-xs); font-weight: 700; line-height: 1.3; padding: 4px 10px; border-radius: 99px; margin-bottom: var(--s2); }
.card .left { font-size: var(--fs-xs); font-weight: 600; color: var(--danger); line-height: 1.4; margin-bottom: var(--s2); }
.totals .saved { color: #1e7a3c; font-weight: 600; }
.card.off { opacity: .55; }
.card.off .act { text-align: center; color: var(--muted); font-size: var(--fs-sm); min-height: 44px; display: grid; place-items: center; }
.stepper { display: flex; align-items: center; justify-content: space-between; background: var(--brand-soft); border-radius: var(--radius-sm); padding: var(--s1); min-height: 44px; }
.stepper button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: #fff; color: var(--brand); font-size: 20px; font-weight: 700; line-height: 1; display: grid; place-items: center; }
.stepper b { min-width: 28px; text-align: center; font-weight: 700; }
.empty { text-align: center; color: var(--muted); padding: var(--s7) 0; grid-column: 1 / -1; line-height: 1.6; }

/* شريط السلة على الموبايل */
.cartbar { position: fixed; inset-inline: var(--s4); bottom: var(--s4); z-index: 25; display: none; }
.cartbar button { width: 100%; justify-content: space-between; min-height: 54px; border-radius: 14px; box-shadow: 0 10px 28px rgba(0,0,0,.2); }
.cartbar.show { display: block; }
body.has-cartbar .foot { padding-bottom: 96px; }
@media (min-width: 960px) { .cartbar.show { display: none; } body.has-cartbar .foot { padding-bottom: var(--s6); } }

/* =========================================================
   درج السلة
   ========================================================= */
.overlay { position: fixed; inset: 0; background: rgba(15,15,15,.45); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(440px, 100%); background: #fff; z-index: 50; transform: translateX(-100%); transition: transform .25s ease; display: flex; flex-direction: column; }
[dir="ltr"] .drawer { transform: translateX(100%); }
.drawer.show, [dir="ltr"] .drawer.show { transform: none; }
.drawer header { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4); border-bottom: 1px solid var(--line); }
.drawer header h2 { font-size: var(--fs-xl); }
.x { border: 0; background: var(--bg); width: 40px; height: 40px; border-radius: 10px; font-size: 22px; line-height: 1; display: grid; place-items: center; }
.drawer .body { flex: 1; overflow-y: auto; padding: var(--s2) var(--s4) var(--s4); }
.drawer footer { padding: var(--s4); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--s2); }
.line { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.line img { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); flex: none; }
.line .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.line .info b { font-size: var(--fs-md); font-weight: 600; line-height: 1.4; }
.line .info small { color: var(--muted); font-size: var(--fs-sm); line-height: 1.4; }
.line .stepper { width: 116px; min-height: 40px; flex: none; }
.line .stepper button { width: 32px; height: 32px; font-size: 18px; }
.totals { margin: var(--s4) 0; display: flex; flex-direction: column; gap: var(--s2); }
.totals div { display: flex; justify-content: space-between; color: var(--muted); line-height: 1.4; }
.totals .grand { color: var(--text); font-weight: 700; font-size: var(--fs-lg); border-top: 1px dashed var(--line); padding-top: var(--s3); }
.note { color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
.err { color: var(--danger); font-size: var(--fs-sm); line-height: 1.5; }
.err:empty { display: none; }
.row-btns { display: flex; gap: var(--s2); }
.row-btns .grow { flex: 1; }
.success { text-align: center; padding: var(--s6) var(--s2); display: flex; flex-direction: column; align-items: center; gap: var(--s2); }
.success .tick { width: 72px; height: 72px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 34px; margin-bottom: var(--s2); }
.success h3 { font-size: var(--fs-xl); }
.success p { color: var(--muted); line-height: 1.6; max-width: 320px; }

.toast { position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%) translateY(16px); background: #1d1d1f; color: #fff; padding: var(--s2) var(--s4); border-radius: var(--radius-sm); z-index: 60; opacity: 0; transition: .2s; pointer-events: none; font-size: var(--fs-sm); line-height: 1.4; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.foot { text-align: center; color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; padding: var(--s5) var(--s4) var(--s6); border-top: 1px solid var(--line); }
.foot a { color: inherit; }

/* الموبايل الصغير: اللوجو كفاية في الهيدر لأن الاسم مكتوب جواه */
@media (max-width: 440px) {
  .brand span { display: none; }
  .hero { padding: var(--s5) var(--s3); }
  .hero p { font-size: var(--fs-md); }
}
.free-hint { background: var(--brand-soft); color: var(--brand-dark); padding: var(--s2) var(--s3); border-radius: var(--radius-sm); font-weight: 600; margin-bottom: var(--s3); }
