/* ============================================================
   متجر الترف — Al Taraf Market
   الثيم: أزرق هادئ + أبيض + لمسة برتقالية — مشتقّ مباشرةً من ألوان اللوغو
     اللوغو: عربة برتقالية #FF8104 · «الترف» أحمر #FE0207 · «الترف ماركت» أزرق #2780FF
   الأزرق الداكن للهوية والنصوص، والبرتقالي لأزرار الشراء فقط، والأحمر للتنزيلات
   والحذف — فتبقى الواجهة هادئة ونظيفة كما في متاجر التسوّق الكبرى.
   ============================================================ */

:root {
  /* الأزرق — الهوية والنصوص والروابط */
  --brand-900: #0C2545;
  --brand-800: #103457;
  --brand-700: #164B85;   /* نص أزرق على أبيض — تباين 8.5:1 */
  --brand-600: #1C5FA8;
  --brand-500: #2780FF;   /* أزرق اللوغو — الحدود والتمييز */
  --brand-300: #8FBEFF;
  --brand-100: #E6F0FF;
  --brand-50:  #F3F8FF;

  /* البرتقالي — أزرار الإضافة والشراء فقط */
  --accent-700: #8F4A00;
  --accent-600: #B85E00;  /* نص برتقالي على أبيض — تباين 4.6:1 */
  --accent-500: #FF8104;  /* برتقالي اللوغو */
  --accent-400: #FF9E3D;
  --accent-100: #FFF1E2;
  --accent-line: #FFD9B3;
  --on-accent: #3A1B00;   /* نص داكن فوق البرتقالي — تباين 7:1 */

  /* الأحمر — الخصومات والحذف */
  --red-700: #A5121A;
  --red-600: #D91419;
  --red-50:  #FDECEC;

  --green-600: #15803D;
  --green-50:  #E8F7EE;
  --amber-600: #A16207;
  --amber-50:  #FEF6E4;

  /* محايدات */
  --ink: #16212E;
  --ink-2: #3E4C5C;
  --muted: #64748B;       /* تباين 4.8:1 على الأبيض */
  --line: #E3E9F1;
  --line-2: #EFF3F8;
  --bg: #F5F8FC;
  --card: #FFFFFF;

  --ring: #2780FF;

  --shadow-xs: 0 1px 2px rgba(16, 38, 66, .06);
  --shadow-sm: 0 2px 8px rgba(16, 38, 66, .07);
  --shadow-md: 0 8px 24px rgba(16, 38, 66, .10);
  --shadow-lg: 0 20px 52px rgba(16, 38, 66, .18);

  --r-xs: 8px;
  --r-sm: 12px;
  --r: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  --maxw: 1180px;
  --tap: 44px;            /* أصغر مساحة لمس مسموحة */
  --fast: .15s;
  --med: .25s;

  --font: "Cairo", "Rubik", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-num: "Rubik", "Cairo", system-ui, sans-serif;
}
/* الإنجليزية: Rubik أنسب للحروف اللاتينية والأرقام */
html[data-lang="en"] { --font: "Rubik", "Cairo", "Segoe UI", system-ui, -apple-system, sans-serif; }

* { box-sizing: border-box; margin: 0; padding: 0; }

/* السمة hidden تعني الإخفاء فعلاً — تتقدّم على أي display صريح في الأصناف */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* حارس: لا تمرير أفقي على الهاتف مهما طال نص أدخله المدير.
   clip بدل hidden كي لا يُعطَّل position:sticky للهيدر. */
html, body { overflow-x: clip; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-wrap: anywhere;
}
body.intro-open { overflow: hidden; height: 100vh; height: 100dvh; }
body.locked { overflow: hidden; }
/* ⚠️ القفل الفعلي هنا لا على body. قاعدة انتشار overflow إلى المنفذ تشترط أن
   يكون overflow عنصر html هو visible في المحورين، والسطر أعلاه (overflow-x:clip)
   يكسر الشرط — فيبقى body.locked بلا أثر والصفحة تُمرَّر خلف الورقة المفتوحة.
   (المقياس: شريط التمرير 15px مع body.locked وحده، و0 مع هذا السطر.)
   overflow-y وليس الاختصار: كي يبقى clip الأفقي حارساً ولا يُعطَّل sticky. */
html.locked { overflow-y: hidden; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
svg.ic { flex: none; }

/* بؤرة واضحة لمستخدمي لوحة المفاتيح — لا تُزال أبداً */
:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
}

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ============================================================
   المناطق القابلة للتمرير — قاعدة موحّدة
   ------------------------------------------------------------
   كل صندوق يمرّر عمودياً (قائمة الأنواع · السلة · نوافذ اللوحة) يأخذ:
     · min-height: 0        كي ينكمش داخل الـflex فيعمل التمرير في كل المتصفحات
     · overscroll-behavior  كي لا يتسرّب التمرير إلى الصفحة خلف الورقة عند بلوغ النهاية
     · شريط تمرير رفيع ظاهر  فيعرف الزبون أن تحته مزيداً (على الهاتف يظهر عند اللمس)
     · تمرير بالزخم على iOS
   ============================================================ */
.scroll-y {
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--brand-300) transparent;
}
.scroll-y::-webkit-scrollbar { width: 8px; }
.scroll-y::-webkit-scrollbar-track { background: transparent; }
.scroll-y::-webkit-scrollbar-thumb {
  background: var(--brand-300);
  border-radius: var(--r-pill);
  border: 2px solid var(--card);
}
.scroll-y::-webkit-scrollbar-thumb:hover { background: var(--brand-500); }

/* تلميح بصري: تدرّج خفيف أسفل الصندوق يختفي عند بلوغ النهاية،
   فيفهم الزبون أن القائمة تكمل تحت. (مبني على mask فلا يضيف عنصراً) */
.scroll-fade {
  --fade: 22px;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - var(--fade)), transparent 100%);
          mask-image: linear-gradient(to bottom, #000 calc(100% - var(--fade)), transparent 100%);
}
.scroll-fade.at-end { --fade: 0px; }
@media (prefers-reduced-motion: reduce) { .scroll-fade { --fade: 0px; } }

/* الأرقام والأسعار بأرقام لاتينية متساوية العرض فلا يقفز التخطيط */
.num, .price, .co-total b, .cr-price { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* ============================================================
   شاشة التحميل
   ============================================================ */
.app-loader {
  position: fixed; inset: 0; z-index: 9000;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity .45s ease, visibility .45s;
}
.app-loader.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.al-inner { display: grid; justify-items: center; gap: 14px; padding: 24px; text-align: center; }
.al-logo { width: 120px; height: auto; }
.al-text { color: var(--muted); font-size: 14px; font-weight: 600; }
.al-bar { width: 180px; max-width: 60vw; height: 4px; border-radius: var(--r-pill); background: var(--brand-100); overflow: hidden; }
.al-bar span {
  display: block; width: 40%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
  animation: alSlide 1.1s ease-in-out infinite;
}
@keyframes alSlide { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }

/* ============================================================
   شاشة الافتتاح — فيديو الخلفية
   ------------------------------------------------------------
   الفيديو عمودي 576×1024 بلا صوت. القاعدة التي تجعله «مرتّباً» على كل جهاز:
     · الشاشات الطولية (الهاتف)      → يملأ الشاشة كاملة بـ object-fit: cover
                                        وبما أنه 9:16 أصلاً لا يُقصّ منه شيء يُذكر.
     · الشاشات العريضة (لابتوب/تابلت) → لا نمطّه ولا نقصّه: يُعرض داخل إطار
                                        مركزي بنسبة 9:16، وخلفه نسخة مكبَّرة
                                        مموّهة تملأ الفراغ فيبدو المشهد متكاملاً.
       التمويه محصور بالشاشات العريضة فقط لأنه مكلف على معالج الهاتف.
     · صورة الغلاف (41 كيلوبايت) تظهر في الإطار الأول، والفيديو يذوب فوقها عند
       الجهوزية — فلا شاشة سوداء ولا وميض.
   ============================================================ */
.intro {
  position: fixed; inset: 0; z-index: 8000;
  display: grid; place-items: center;
  background: var(--brand-900);
  overflow: hidden;
  transition: opacity .6s ease, visibility .6s;
}
.intro.leaving { opacity: 0; visibility: hidden; pointer-events: none; }

/* الخلفية المموّهة — للشاشات العريضة فقط (تُفعَّل في media query أدناه) */
.intro-back { display: none; }

/* إطار الفيديو */
.intro-media {
  position: absolute; inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--brand-900) center / cover no-repeat;
}
.intro-media img.intro-poster,
.intro-media video.intro-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
}
.intro-media img.intro-poster { z-index: 0; filter: saturate(1.02); }
/* الفيديو يبدأ شفافاً ويذوب فوق صورة الغلاف عند أول إطار جاهز */
.intro-media video.intro-video {
  z-index: 1;
  opacity: 0;
  transition: opacity .7s ease;
  /* لا تلتقط لمسات المستخدم ولا تدخل ترتيب التنقّل */
  pointer-events: none;
}
.intro-media video.intro-video.ready { opacity: 1; }
.intro-media.no-video video.intro-video { display: none; }

/* طبقة تعتيم متدرّجة تضمن قراءة النص فوق أي مشهد */
.intro-scrim {
  position: absolute; inset: 0; z-index: 2;
  background:
    linear-gradient(to bottom, rgba(8,22,42,.55) 0%, rgba(8,22,42,.20) 32%, rgba(8,22,42,.55) 62%, rgba(8,22,42,.88) 100%);
}

/* الهاتف أفقياً: المحتوى المكدَّس ≈475px ولا يسعه ارتفاع 344px، و.intro
   لا تمرّر (overflow:hidden) فيُقصّ زر الدخول بلا وسيلة للوصول إليه. */
@media (orientation: landscape) and (max-height: 520px) {
  .intro-inner { gap: 8px; padding-block: 12px calc(12px + env(safe-area-inset-bottom)); }
}
.intro-inner {
  position: relative; z-index: 3;
  display: grid; justify-items: center; gap: 14px;
  text-align: center;
  width: 100%;
  max-width: 460px;
  padding: 28px 20px calc(30px + env(safe-area-inset-bottom));
  /* المحتوى في الثلث السفلي كي لا يغطي وجه المشهد */
  align-self: end;
}
.intro-logo {
  width: min(58vw, 230px);
  padding: 12px 16px;
  background: rgba(255, 255, 255, .94);
  border-radius: var(--r-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.intro-logo img { width: 100%; height: auto; }
.intro-title {
  color: #fff; font-size: clamp(22px, 6vw, 32px); font-weight: 800; line-height: 1.25;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .5);
}
.intro-tag {
  color: rgba(255, 255, 255, .92); font-size: clamp(13px, 3.6vw, 16px); font-weight: 500;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .5);
  max-width: 34ch;
}
.intro-lang { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.intro-lang .lang-btn {
  min-height: var(--tap); padding: 0 22px;
  background: rgba(255, 255, 255, .16);
  border: 1.5px solid rgba(255, 255, 255, .42);
  color: #fff; font-weight: 700; border-radius: var(--r-pill);
  backdrop-filter: blur(6px);
  transition: background var(--fast), border-color var(--fast);
}
.intro-lang .lang-btn:hover { background: rgba(255, 255, 255, .28); }
.intro-lang .lang-btn.on { background: #fff; color: var(--brand-800); border-color: #fff; }

.intro-btn {
  width: 100%; min-height: 56px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--accent-500); color: var(--on-accent);
  font-weight: 800; font-size: 18px; border-radius: var(--r);
  box-shadow: 0 10px 30px rgba(255, 129, 4, .38);
  transition: transform var(--fast), box-shadow var(--fast), background var(--fast);
}
.intro-btn:hover { background: var(--accent-400); box-shadow: 0 14px 36px rgba(255, 129, 4, .5); }
.intro-btn:active { transform: scale(.985); }
.intro-btn .ic, .intro-skip .ic { transform: rotate(180deg); }
html[dir="ltr"] .intro-btn .ic, html[dir="ltr"] .intro-skip .ic { transform: none; }

.intro-hint {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  color: rgba(255, 255, 255, .88); font-size: 13px; font-weight: 600;
}
.intro-hint .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-400); }
/* زر تخطّي صغير أعلى الشاشة — احترام لمن لا يريد انتظار الفيديو */
.intro-skip {
  position: absolute; z-index: 4; top: calc(12px + env(safe-area-inset-top)); inset-inline-end: 12px;
  min-height: 38px; padding: 0 14px;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(8, 22, 42, .45); color: #fff;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: var(--r-pill); font-size: 13px; font-weight: 700;
  backdrop-filter: blur(6px);
}
.intro-skip:hover { background: rgba(8, 22, 42, .68); }

/* الشاشات العريضة: الفيديو داخل إطار 9:16 وخلفه نسخة مموّهة تملأ الفراغ */
@media (min-width: 900px) and (orientation: landscape) {
  .intro-back {
    display: block; position: absolute; inset: -6%; z-index: 0;
    background: var(--brand-900) center / cover no-repeat;
    filter: blur(38px) saturate(1.25) brightness(.55);
    transform: scale(1.12);
  }
  .intro-media {
    position: relative;
    inset: auto;
    width: min(calc(88vh * 9 / 16), 430px);
    height: min(88vh, 764px);
    border-radius: 26px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
    border: 1px solid rgba(255, 255, 255, .16);
  }
  .intro-scrim {
    border-radius: 26px;
    background: linear-gradient(to bottom, rgba(8,22,42,.35) 0%, rgba(8,22,42,.05) 40%, rgba(8,22,42,.62) 78%, rgba(8,22,42,.92) 100%);
    inset: 0;
  }
  .intro { grid-template-columns: 1fr; place-items: center; }
  .intro-inner {
    position: absolute; z-index: 3;
    inset-inline: 0; bottom: 0;
    align-self: auto;
    max-width: min(calc(88vh * 9 / 16), 430px);
    margin: 0 auto;
    padding-bottom: 26px;
  }
  .intro-logo { width: 190px; }
}

/* شاشات عريضة جداً — نعرض الهوية بجانب الفيديو بدل أسفله */
@media (min-width: 1200px) and (orientation: landscape) {
  /* الحشوة الجانبية تمنع التصاق الوصف الطويل بحافة الشاشة */
  .intro { grid-auto-flow: column; gap: clamp(32px, 6vw, 90px); align-content: center; padding-inline: 40px; }
  .intro-inner {
    position: static; margin: 0; max-width: 440px;
    justify-items: start; text-align: start; padding: 0;
  }
  .intro-title { font-size: 40px; }
  .intro-tag { font-size: 18px; }
  .intro-lang { justify-content: flex-start; }
  .intro-btn { width: auto; padding: 0 44px; }
  .intro-hint { justify-content: flex-start; }
}

/* من يطلب تقليل الحركة: لا فيديو متحرّك — صورة الغلاف الثابتة وحدها */
@media (prefers-reduced-motion: reduce) {
  .intro-media video.intro-video { display: none; }
  .al-bar span { animation: none; width: 100%; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   الهيدر
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 400;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar.scrolled { box-shadow: var(--shadow-sm); }
.tb-row {
  display: flex; align-items: center; gap: 10px;
  min-height: 62px;
}
.tb-brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.tb-logo { width: 42px; height: 42px; flex: none; }
.tb-logo img { width: 100%; height: 100%; object-fit: contain; }
/* الاسم والوصف سطران مستقلان يُقصّان عند الضيق — لولا ذلك لالتصقا في سطر
   واحد لا يقبل الانكماش ودفعا الصفحة لتمرير أفقي على الهاتف */
.tb-txt { min-width: 0; flex: 1; }
.tb-name, .tb-tag { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-name { font-size: 16px; font-weight: 800; color: var(--brand-800); line-height: 1.25; }
.tb-tag { font-size: 11.5px; font-weight: 600; color: var(--muted); line-height: 1.3; }
@media (max-width: 400px) { .tb-tag { display: none; } }

.tb-actions { display: flex; align-items: center; gap: 6px; flex: none; }
/* زر تبديل اللغة داخل المنيو — واضح ومسمّى بالنص لا بالعلم */
.lang-toggle {
  min-height: var(--tap); min-width: var(--tap); padding: 0 12px;
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--card); color: var(--brand-700);
  font-weight: 800; font-size: 13.5px;
  transition: background var(--fast), border-color var(--fast);
}
.lang-toggle:hover { background: var(--brand-50); border-color: var(--brand-300); }
.lang-toggle .lt-txt { line-height: 1; }

.lang-switch { display: inline-flex; gap: 6px; }
.lang-switch .lang-btn {
  min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--card); color: var(--ink-2); font-weight: 700; font-size: 13.5px;
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.lang-switch .lang-btn.on { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }

/* شريط البحث */
.searchbar { padding: 0 0 12px; }
.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--r-pill);
  padding: 0 14px;
  min-height: 48px;
  transition: border-color var(--fast), background var(--fast);
}
.search:focus-within { border-color: var(--brand-500); background: var(--card); }
.search .ic { color: var(--muted); }
.search input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  font-size: 16px; font-weight: 500;   /* 16px يمنع تكبير آيفون التلقائي */
  padding: 10px 0;
}
.search input::placeholder { color: var(--muted); font-weight: 500; }
.search-clear {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center;
  border-radius: 50%; color: var(--muted); background: var(--line-2);
}
.search-clear:hover { background: var(--line); color: var(--ink); }

/* ============================================================
   المحتوى العام
   ============================================================ */
main { padding: 18px 0 110px; min-height: 55vh; }
.section { margin-bottom: 30px; }
.section-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.section-head h2 { font-size: 20px; font-weight: 800; color: var(--brand-800); line-height: 1.3; }
.section-head .note { font-size: 13px; color: var(--muted); font-weight: 500; }
.section-head .count {
  margin-inline-start: auto;
  background: var(--brand-50); color: var(--brand-700);
  border: 1px solid var(--brand-100);
  border-radius: var(--r-pill); padding: 5px 12px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
}

.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
}
.empty .ic { color: var(--brand-300); margin: 0 auto 12px; }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

/* ============================================================
   شبكة الأقسام (الصفحة الرئيسية)
   ============================================================ */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 480px) { .cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; } }
@media (min-width: 768px) { .cat-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 1024px) { .cat-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .cat-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); } }

.cat-tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center;
  padding: 0 0 6px;
  border-radius: var(--r);
  transition: transform var(--fast);
}
.cat-tile:hover { transform: translateY(-3px); }
.cat-tile:active { transform: scale(.97); }
.cat-thumb {
  width: 100%; aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  color: var(--brand-600);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.cat-tile:hover .cat-thumb { border-color: var(--brand-300); box-shadow: var(--shadow-sm); }
.cat-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cat-thumb .cat-art { width: 58%; height: 58%; }
.cat-name {
  font-size: 12.5px; font-weight: 700; color: var(--ink);
  line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (min-width: 768px) { .cat-name { font-size: 13.5px; } }
.cat-tile .cat-n { font-size: 11px; color: var(--muted); font-weight: 600; }

/* ============================================================
   شريط الأقسام الأفقي (داخل صفحة القسم ونتائج البحث)
   ============================================================ */
.cat-chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px;
  scrollbar-width: none; -ms-overflow-style: none;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
}
.cat-chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 0 16px;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 13.5px; font-weight: 700; color: var(--ink-2);
  white-space: nowrap; scroll-snap-align: start;
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.chip:hover { border-color: var(--brand-300); color: var(--brand-700); }
.chip.active { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.chip.offers { color: var(--accent-600); border-color: var(--accent-line); background: var(--accent-100); }
.chip.offers.active { background: var(--accent-500); border-color: var(--accent-500); color: var(--on-accent); }

/* رأس صفحة القسم */
.view-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.back-btn {
  min-height: var(--tap); min-width: var(--tap); padding: 0 14px;
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--card); color: var(--brand-700); font-weight: 700; font-size: 13.5px;
  transition: background var(--fast), border-color var(--fast);
}
.back-btn:hover { background: var(--brand-50); border-color: var(--brand-300); }
.back-btn .ic { transform: none; }
html[dir="rtl"] .back-btn .ic { transform: scaleX(-1); }
.view-title { min-width: 0; }
.view-title h1 { font-size: 20px; font-weight: 800; color: var(--brand-800); line-height: 1.3; }
.view-title .sub { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* ============================================================
   بطاقة المنتج
   ============================================================ */
.items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 640px) { .items { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .items { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 1200px) { .items { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.prod {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}
.prod:hover { border-color: var(--brand-300); box-shadow: var(--shadow-sm); }
.prod.out { opacity: .62; }

.prod-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--brand-50);
  display: grid; place-items: center;
  overflow: hidden;
  color: var(--brand-300);
}
.prod-media img { width: 100%; height: 100%; object-fit: cover; }
.prod-media img.zoomable { cursor: zoom-in; }
.prod-media .cat-art { width: 46%; height: 46%; }

.prod-badge {
  position: absolute; top: 8px; inset-inline-start: 8px;
  background: var(--red-600); color: #fff;
  font-size: 11.5px; font-weight: 800;
  padding: 4px 9px; border-radius: var(--r-pill);
  box-shadow: var(--shadow-xs);
}
.prod-out {
  position: absolute; inset: auto 0 0 0;
  background: rgba(22, 33, 46, .82); color: #fff;
  font-size: 12px; font-weight: 800; text-align: center; padding: 6px 4px;
}
.prod-types-tag {
  position: absolute; top: 8px; inset-inline-end: 8px;
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255, 255, 255, .95); color: var(--brand-700);
  border: 1px solid var(--brand-100);
  font-size: 11px; font-weight: 800;
  padding: 3px 8px; border-radius: var(--r-pill);
}

.prod-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.prod-brand { font-size: 11px; font-weight: 700; color: var(--brand-600); letter-spacing: .2px; }
.prod-name {
  font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.8em;
}
.prod-unit { font-size: 11.5px; font-weight: 600; color: var(--muted); }

.prod-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.prod-price { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.pp-from { font-size: 10.5px; font-weight: 600; color: var(--muted); }
.pp-now { font-size: 16px; font-weight: 800; color: var(--brand-800); font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.pp-now small { font-size: 11px; font-weight: 700; color: var(--muted); margin-inline-start: 2px; }
.pp-old { font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: line-through; }
.prod-price.free .pp-now { font-size: 13.5px; color: var(--muted); }

/* زر الإضافة — البرتقالي محجوز لهذا الفعل وحده */
.add-btn {
  min-height: var(--tap); min-width: var(--tap);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 14px;
  background: var(--accent-500); color: var(--on-accent);
  font-weight: 800; font-size: 13.5px; border-radius: var(--r-sm);
  transition: background var(--fast), transform var(--fast);
  white-space: nowrap;
}
.add-btn:hover { background: var(--accent-400); }
.add-btn:active { transform: scale(.95); }
.add-btn.pulse { animation: pulse .45s ease; }
@keyframes pulse { 50% { transform: scale(1.1); } }
/* زر «اختيار الأنواع» — ثانوي بصرياً لأنه يفتح نافذة لا يضيف مباشرة */
.types-btn {
  width: 100%;
  min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--brand-50); color: var(--brand-700);
  border: 1.5px solid var(--brand-100);
  font-weight: 800; font-size: 13.5px; border-radius: var(--r-sm);
  transition: background var(--fast), border-color var(--fast);
}
.types-btn:hover { background: var(--brand-100); border-color: var(--brand-300); }
.types-btn:active { transform: scale(.98); }
.prod-foot.stacked { flex-direction: column; align-items: stretch; }

/* ============================================================
   شريط العروض
   ============================================================ */
.offers-strip {
  display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 12px;
  scrollbar-width: none; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
}
.offers-strip::-webkit-scrollbar { display: none; }
/* الشريطان يخفيان شريط التمرير كلياً. على أجهزة الفأرة لا بديل لمسي عنه،
   فنعيده رفيعاً كي يُعرف أن وراءهما أقساماً/عروضاً أخرى. */
@media (hover: hover) and (pointer: fine) {
  .cat-chips, .offers-strip { scrollbar-width: thin; scrollbar-color: var(--brand-300) transparent; }
  .cat-chips::-webkit-scrollbar, .offers-strip::-webkit-scrollbar { display: block; height: 7px; }
  .cat-chips::-webkit-scrollbar-thumb, .offers-strip::-webkit-scrollbar-thumb {
    background: var(--brand-300); border-radius: var(--r-pill);
  }
}
.offers-strip > * { flex: 0 0 min(76vw, 220px); scroll-snap-align: start; }
.offer-banner {
  background: linear-gradient(135deg, var(--accent-500), var(--accent-400));
  color: var(--on-accent);
  border-radius: var(--r); padding: 16px;
  display: flex; flex-direction: column; gap: 5px; justify-content: center;
  min-height: 130px;
}
.ob-title { font-size: 13px; font-weight: 800; opacity: .85; }
.ob-main { font-size: 17px; font-weight: 800; line-height: 1.3; }
.ob-cond { font-size: 11.5px; font-weight: 600; opacity: .8; display: flex; flex-direction: column; }

/* ============================================================
   الفوتر
   ============================================================ */
.footer {
  background: var(--brand-900); color: rgba(255, 255, 255, .86);
  padding: 34px 0 calc(28px + env(safe-area-inset-bottom));
  margin-top: 20px;
}
.foot-top { display: flex; gap: 18px; flex-wrap: wrap; align-items: start; margin-bottom: 22px; }
.foot-brand { display: flex; gap: 12px; align-items: center; min-width: 0; flex: 1; }
.foot-logo { width: 54px; height: 54px; flex: none; background: #fff; border-radius: var(--r-sm); padding: 5px; }
.foot-logo img { width: 100%; height: 100%; object-fit: contain; }
.foot-brand h3 { font-size: 17px; font-weight: 800; color: #fff; line-height: 1.3; }
.foot-brand .addr { font-size: 12.5px; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.foot-social { display: flex; gap: 8px; flex-wrap: wrap; }
.foot-soc {
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #fff;
  transition: background var(--fast), transform var(--fast);
}
.foot-soc:hover { background: rgba(255, 255, 255, .22); transform: translateY(-2px); }
.foot-soc.whatsapp:hover { background: #25D366; border-color: #25D366; color: #06331a; }

.foot-methods { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.foot-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--r-pill); padding: 6px 13px;
  font-size: 12.5px; font-weight: 600;
}
.foot-complaints { font-size: 13px; margin-bottom: 16px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.foot-complaints a { color: var(--accent-400); font-weight: 800; }
.foot-bottom {
  border-top: 1px solid rgba(255, 255, 255, .13);
  padding-top: 16px;
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center; justify-content: space-between;
}
.copyright { font-size: 12.5px; color: rgba(255, 255, 255, .6); }
.foot-links { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.foot-links a {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 12px;
  font-size: 12.5px; font-weight: 700;
  border-radius: var(--r-pill);
  border: 1px solid rgba(255, 255, 255, .18);
  color: rgba(255, 255, 255, .8);
}
.foot-links a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.footer .lang-switch .lang-btn {
  background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: rgba(255, 255, 255, .85);
}
.footer .lang-switch .lang-btn.on { background: #fff; color: var(--brand-800); border-color: #fff; }

/* ============================================================
   زر السلة العائم
   ============================================================ */
.cart-fab {
  position: fixed; z-index: 500;
  inset-inline-end: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  min-height: 56px; padding: 0 20px;
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--brand-700); color: #fff;
  border-radius: var(--r-pill);
  font-weight: 800; font-size: 15px;
  box-shadow: 0 10px 30px rgba(12, 37, 69, .35);
  transition: transform var(--fast), background var(--fast);
}
.cart-fab:hover { background: var(--brand-600); }
.cart-fab:active { transform: scale(.96); }
.cart-fab.bump { animation: bump .5s ease; }
@keyframes bump { 30% { transform: scale(1.12); } 60% { transform: scale(.96); } }
.cf-count {
  min-width: 24px; height: 24px; padding: 0 6px;
  display: grid; place-items: center;
  background: var(--accent-500); color: var(--on-accent);
  border-radius: var(--r-pill); font-size: 13px; font-weight: 800;
  font-family: var(--font-num);
}
.cf-total { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
@media (max-width: 400px) { .cart-fab .cf-label { display: none; } }

/* ============================================================
   زر تتبّع الطلب — مستقلّ عن السلة
   ------------------------------------------------------------
   السلة تُفرَّغ بعد إرسال الطلب فيختفي زرها، لذلك لا يصحّ أن يكون
   التتبّع داخلها. هذا الزر يظهر ما دام هناك طلب نشط، في الجهة
   المقابلة لزر السلة فلا يزاحمه.
   ============================================================ */
.track-fab {
  position: fixed; z-index: 500;
  inset-inline-start: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  min-height: 56px; padding: 0 16px;
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--card); color: var(--brand-800);
  border: 1.5px solid var(--brand-300);
  border-radius: var(--r-pill);
  box-shadow: 0 10px 30px rgba(12, 37, 69, .18);
  text-align: start;
  max-width: calc(100% - 32px);
  transition: transform var(--fast), border-color var(--fast);
}
.track-fab:hover { border-color: var(--brand-500); }
.track-fab:active { transform: scale(.96); }
.track-fab .tf-ico { color: var(--brand-600); display: grid; place-items: center; flex: none; }
.tf-txt { display: grid; line-height: 1.25; min-width: 0; }
.tf-label { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.tf-stage {
  font-size: 13.5px; font-weight: 800; color: var(--brand-800);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tf-dot {
  width: 9px; height: 9px; flex: none; border-radius: 50%;
  background: var(--accent-500);
  box-shadow: 0 0 0 0 rgba(255, 129, 4, .55);
  animation: tfPulse 1.8s ease-out infinite;
}
@keyframes tfPulse {
  70% { box-shadow: 0 0 0 9px rgba(255, 129, 4, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 129, 4, 0); }
}
@media (prefers-reduced-motion: reduce) { .tf-dot { animation: none; } }
/* هاتف ضيّق: نكتفي بالأيقونة والمرحلة كي لا يتزاحم الزران */
@media (max-width: 400px) {
  .track-fab { padding: 0 13px; gap: 8px; }
  .tf-label { display: none; }
  .tf-stage { font-size: 12.5px; max-width: 108px; }
}

/* حالة «لا طلبات» داخل ورقة التتبّع */
.track-empty { text-align: center; padding: 38px 18px; color: var(--muted); }
.track-empty .ic { color: var(--brand-300); margin: 0 auto 12px; }
.track-empty b { display: block; color: var(--ink); font-size: 16px; font-weight: 800; margin-bottom: 4px; }
/* زر التتبّع داخل نافذة نجاح الطلب — مميّز عن زر العودة */
.ok-close.ok-track { border-color: var(--brand-300); background: var(--brand-50); }

/* ============================================================
   الطبقات المنبثقة (السلة · الأنواع · النجاح)
   ============================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 700;
  background: rgba(12, 28, 48, .55);
  backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity var(--med), visibility var(--med);
  display: flex;
}
.overlay.show { opacity: 1; visibility: visible; }

/* درج السلة — من الجانب على الشاشات الكبيرة، من الأسفل على الهاتف */
.drawer {
  background: var(--card);
  width: 100%; max-width: 440px;
  margin-inline-start: auto;
  display: flex; flex-direction: column;
  height: 100%;
  transform: translateX(var(--slide, 100%));
  transition: transform var(--med) ease;
  box-shadow: var(--shadow-lg);
}
html[dir="rtl"] .drawer { --slide: -100%; }
.overlay.show .drawer { transform: translateX(0); }
@media (max-width: 560px) {
  .drawer {
    max-width: none; margin: auto 0 0; height: 94vh; height: 94dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform: translateY(100%) !important;
  }
  .overlay.show .drawer { transform: translateY(0) !important; }
}
.drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  flex: none;
}
.drawer-head h3 { font-size: 17px; font-weight: 800; color: var(--brand-800); flex: 1; display: flex; align-items: center; gap: 8px; }
.icon-x {
  width: var(--tap); height: var(--tap); flex: none;
  display: grid; place-items: center; border-radius: 50%;
  color: var(--muted); background: var(--line-2);
}
.icon-x:hover { background: var(--line); color: var(--ink); }
.drawer-body { flex: 1 1 auto; padding: 14px 18px; }
.drawer-foot { flex: none; border-top: 1px solid var(--line); padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); background: var(--card); }

/* سطر السلة */
.cart-row {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line-2);
}
.cart-row:last-child { border-bottom: 0; }
.cr-thumb {
  width: 64px; height: 64px; flex: none;
  border-radius: var(--r-sm); overflow: hidden;
  background: var(--brand-50); display: grid; place-items: center; color: var(--brand-300);
}
.cr-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cr-main { flex: 1; min-width: 0; }
.cr-name { font-size: 14px; font-weight: 700; line-height: 1.35; }
.cr-variant {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--brand-50); color: var(--brand-700);
  border: 1px solid var(--brand-100); border-radius: var(--r-pill);
  padding: 2px 9px; font-size: 11.5px; font-weight: 700; margin-top: 3px;
}
.cr-price { font-size: 13.5px; font-weight: 800; color: var(--brand-800); margin-top: 4px; }
.cr-old { font-size: 12px; color: var(--muted); text-decoration: line-through; font-weight: 600; margin-inline-end: 5px; }
.cr-controls { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.qty {
  display: inline-flex; align-items: center; gap: 2px;
  border: 1px solid var(--line); border-radius: var(--r-pill); overflow: hidden;
}
.qty button {
  width: 38px; height: 38px; display: grid; place-items: center;
  color: var(--brand-700); background: var(--card);
  transition: background var(--fast);
}
.qty button:hover { background: var(--brand-50); }
.qty .q-num { min-width: 30px; text-align: center; font-weight: 800; font-family: var(--font-num); }
.cr-del {
  min-height: 38px; min-width: 38px; padding: 0 10px;
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--red-600); background: var(--red-50);
  border-radius: var(--r-pill); font-size: 12.5px; font-weight: 700;
}
.cr-del:hover { background: #FBDCDC; }

.cart-empty {
  text-align: center; padding: 50px 18px; color: var(--muted);
}
.cart-empty .ic { color: var(--brand-300); margin: 0 auto 14px; }
.cart-empty b { display: block; color: var(--ink); font-size: 17px; font-weight: 800; margin-bottom: 4px; }

/* ============================================================
   نموذج إتمام الطلب
   ============================================================ */
.checkout { display: grid; gap: 14px; }
.fulfill-seg {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
}
.fulfill-seg.single { grid-template-columns: 1fr; }
.fulfill-btn {
  min-height: 52px; padding: 8px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--card); color: var(--ink-2); font-weight: 700; font-size: 13px;
  transition: border-color var(--fast), background var(--fast), color var(--fast);
}
.fulfill-btn:hover { border-color: var(--brand-300); }
.fulfill-btn.active { border-color: var(--brand-700); background: var(--brand-50); color: var(--brand-700); }
.fulfill-static {
  min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--r-sm);
  color: var(--brand-700); font-weight: 700; font-size: 14px;
}

.field { display: grid; gap: 6px; }
/* :not(.btn) ضروري — بعض الأزرار عبارة عن <label for> (اختيار ملف)،
   وبدون الاستثناء يطمس لونُ هذه القاعدة لونَ الزر فيصبح النص غير واضح. */
.field label:not(.btn) { font-size: 13px; font-weight: 700; color: var(--ink-2); }
label.btn { cursor: pointer; }
.field input, .field select, .field textarea {
  width: 100%; min-height: var(--tap);
  padding: 11px 13px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--card); font-size: 16px; outline: none;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.field textarea { min-height: 76px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(39, 128, 255, .16);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.co-fields { display: grid; gap: 12px; }

/* صندوق مشاركة الموقع — مفصول بصرياً عن الحقول الإلزامية كي يفهم الزبون
   أنه اختياري ولا يمنعه من إرسال الطلب */
.loc-box {
  background: var(--brand-50);
  border: 1.5px dashed var(--brand-300);
  border-radius: var(--r-sm);
  padding: 13px;
  display: grid; gap: 10px;
}
.loc-head { display: flex; align-items: flex-start; gap: 10px; }
.loc-head .ic { color: var(--brand-600); flex: none; margin-top: 2px; }
.loc-title { font-size: 13.5px; font-weight: 800; color: var(--brand-800); line-height: 1.4; }
.loc-sub { font-size: 12px; font-weight: 500; color: var(--muted); line-height: 1.55; }
.loc-btn {
  width: 100%; min-height: var(--tap); padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1.5px solid var(--brand-300); border-radius: var(--r-sm);
  background: var(--card); color: var(--brand-700); font-size: 13.5px; font-weight: 700;
  transition: background var(--fast), border-color var(--fast);
}
.loc-btn:hover { background: var(--brand-100); border-color: var(--brand-500); }
.loc-btn:disabled { opacity: .65; cursor: progress; }
.loc-status {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  color: var(--green-600); background: var(--green-50);
  border: 1px solid #BFE6CD;
  border-radius: var(--r-sm); padding: 9px 12px; font-size: 13px; font-weight: 700;
}
.loc-status .loc-clear { margin-inline-start: auto; }
.loc-clear { color: var(--red-600); font-weight: 700; font-size: 12.5px; text-decoration: underline; }

.pickup-note {
  background: var(--brand-50); border: 1px solid var(--brand-100);
  border-radius: var(--r-sm); padding: 12px 14px;
  font-size: 13.5px; color: var(--brand-800); display: flex; gap: 8px; align-items: start;
}
.pickup-note .ic { flex: none; color: var(--brand-600); margin-top: 2px; }

/* الكوبون */
.coupon-box { display: grid; gap: 8px; }
.coupon-row { display: flex; gap: 8px; }
.coupon-row input {
  flex: 1; min-width: 0; min-height: var(--tap);
  padding: 11px 13px; border: 1.5px solid var(--line); border-radius: var(--r-sm);
  font-size: 15px; font-weight: 700; letter-spacing: .5px; outline: none; text-transform: uppercase;
}
.coupon-row input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(39, 128, 255, .16); }
.coupon-apply {
  min-height: var(--tap); padding: 0 18px; flex: none;
  background: var(--brand-700); color: #fff; border-radius: var(--r-sm); font-weight: 800; font-size: 14px;
}
.coupon-apply:hover { background: var(--brand-600); }
.coupon-chip {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--green-50); border: 1px solid #BFE6CD;
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; font-weight: 700; color: var(--green-600);
}
.coupon-chip b { font-family: var(--font-num); letter-spacing: .5px; }
.coupon-remove { margin-inline-start: auto; color: var(--red-600); font-weight: 700; font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; }
.coupon-msg { font-size: 12.5px; font-weight: 700; padding: 8px 12px; border-radius: var(--r-xs); }
.coupon-msg.err { background: var(--red-50); color: var(--red-700); }
.coupon-msg.ok { background: var(--green-50); color: var(--green-600); }
.coupon-msg.info { background: var(--brand-50); color: var(--brand-700); }

.loyal-banner {
  background: linear-gradient(135deg, var(--accent-100), #FFF8EE);
  border: 1px solid var(--accent-line); color: var(--accent-700);
  border-radius: var(--r-sm); padding: 11px 14px; font-size: 13px; font-weight: 700;
  display: flex; gap: 8px; align-items: center;
}

/* الإجماليات */
.co-total {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px; display: grid; gap: 9px;
}
.co-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.co-line b { font-weight: 800; color: var(--ink); white-space: nowrap; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.co-line span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.co-line.save b, .co-line.offer b, .co-line.coupon b, .co-line.loyal b { color: var(--green-600); }
.co-line.grand {
  border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 2px;
  font-size: 16px; font-weight: 800; color: var(--brand-800);
}
.co-line.grand b { font-size: 19px; color: var(--brand-800); }
.co-line.del s { color: var(--muted); margin-inline-end: 5px; }

.min-note {
  background: var(--amber-50); border: 1px solid #F3E0B5; color: var(--amber-600);
  border-radius: var(--r-sm); padding: 11px 13px; font-size: 13px; font-weight: 700;
  display: flex; gap: 8px; align-items: start;
}
.min-note .ic { flex: none; margin-top: 2px; }

/* طرق الدفع */
.pay-title { font-size: 13px; font-weight: 800; color: var(--ink-2); margin-bottom: 8px; }
.pay-list { display: grid; gap: 8px; }
.pay-opt {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--tap); padding: 10px 13px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  cursor: pointer; font-size: 14px; font-weight: 700;
  transition: border-color var(--fast), background var(--fast);
}
.pay-opt:hover { border-color: var(--brand-300); }
.pay-opt.on { border-color: var(--brand-700); background: var(--brand-50); color: var(--brand-700); }
.pay-opt input { width: 19px; height: 19px; accent-color: var(--brand-700); flex: none; }
.pay-static {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 12px 14px; font-size: 13.5px; font-weight: 700; color: var(--ink-2);
}

.co-submit {
  width: 100%; min-height: 54px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--accent-500); color: var(--on-accent);
  border-radius: var(--r); font-weight: 800; font-size: 16.5px;
  box-shadow: 0 8px 22px rgba(255, 129, 4, .32);
  transition: background var(--fast), transform var(--fast);
}
.co-submit:hover:not(:disabled) { background: var(--accent-400); }
.co-submit:active:not(:disabled) { transform: scale(.985); }
.co-submit:disabled { background: var(--line); color: var(--muted); box-shadow: none; cursor: not-allowed; }

/* ============================================================
   ورقة اختيار الأنواع (النكهات)
   ============================================================ */
.sheet {
  background: var(--card);
  width: 100%; max-width: 520px;
  margin: auto;
  max-height: 92vh;
  max-height: 92dvh;
  display: flex; flex-direction: column;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  transform: translateY(18px) scale(.98);
  opacity: 0;
  transition: transform var(--med) ease, opacity var(--med) ease;
}
.overlay.show .sheet { transform: none; opacity: 1; }
@media (max-width: 560px) {
  .sheet {
    margin: auto 0 0; max-width: none; max-height: 90vh; max-height: 90dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform: translateY(100%);
  }
  .overlay.show .sheet { transform: translateY(0); }
}
.sheet-head { display: flex; align-items: start; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-head .sh-thumb {
  width: 54px; height: 54px; flex: none; border-radius: var(--r-sm); overflow: hidden;
  background: var(--brand-50); display: grid; place-items: center; color: var(--brand-300);
}
.sheet-head .sh-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sheet-head .sh-txt { flex: 1; min-width: 0; }
.sheet-head h3 { font-size: 16.5px; font-weight: 800; color: var(--brand-800); line-height: 1.35; }
.sheet-head .sh-sub { font-size: 12.5px; color: var(--muted); font-weight: 600; }
/* ⚠️ flex-basis لا بد أن يكون auto لا 0: الورقة ارتفاعها تلقائي مقيَّد بـmax-height،
   فلو كان الأساس 0 لما ساهمت القائمة بارتفاعها وانهار الصندوق إلى سطر واحد.
   مع min-height:0 (من .scroll-y) تنكمش القائمة داخل الحد وتُمرَّر. */
.sheet-body { flex: 1 1 auto; padding: 8px 18px 12px; }
.sheet-foot {
  flex: none; border-top: 1px solid var(--line);
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  display: grid; gap: 8px;
}

.var-row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 0; border-bottom: 1px solid var(--line-2);
}
.var-row:last-child { border-bottom: 0; }
.var-row.out { opacity: .5; }
.var-thumb {
  width: 46px; height: 46px; flex: none; border-radius: var(--r-xs); overflow: hidden;
  background: var(--brand-50); display: grid; place-items: center; color: var(--brand-300);
}
.var-thumb img { width: 100%; height: 100%; object-fit: cover; }
.var-main { flex: 1; min-width: 0; }
.var-name { font-size: 14px; font-weight: 700; line-height: 1.35; }
.var-price { font-size: 13px; font-weight: 800; color: var(--brand-700); font-family: var(--font-num); }
.var-price .vp-old { color: var(--muted); text-decoration: line-through; font-weight: 600; margin-inline-end: 5px; }
.var-out-tag { font-size: 11.5px; font-weight: 700; color: var(--red-600); background: var(--red-50); border-radius: var(--r-pill); padding: 2px 9px; }
.var-add {
  min-height: 40px; min-width: 40px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-100); color: var(--accent-700);
  border: 1.5px solid var(--accent-line);
  border-radius: var(--r-sm);
  transition: background var(--fast);
}
.var-add:hover { background: var(--accent-line); }
.var-qty { flex: none; }
.var-total-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.var-total-row b { font-size: 18px; font-weight: 800; color: var(--brand-800); font-family: var(--font-num); }

/* ============================================================
   تتبّع الطلب
   ============================================================ */
.order-track { display: grid; gap: 10px; margin-bottom: 14px; }
.track-title { font-size: 14px; font-weight: 800; color: var(--brand-800); display: flex; align-items: center; gap: 7px; }
.track-card {
  background: var(--brand-50); border: 1px solid var(--brand-100);
  border-radius: var(--r-sm); padding: 12px;
}
.track-card.cancelled { background: var(--red-50); border-color: #F4CFCF; }
.track-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.track-head b { font-family: var(--font-num); letter-spacing: .3px; }
.track-dismiss { margin-inline-start: auto; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.track-dismiss:hover { background: rgba(0, 0, 0, .06); }
.track-now { display: flex; align-items: center; gap: 8px; margin: 9px 0 8px; font-size: 14.5px; font-weight: 800; color: var(--brand-700); }
.track-progress { display: flex; align-items: center; gap: 3px; }
.tp-node { width: 11px; height: 11px; border-radius: 50%; background: var(--line); flex: none; }
.tp-node.done { background: var(--green-600); }
.tp-node.active { background: var(--accent-500); box-shadow: 0 0 0 4px rgba(255, 129, 4, .22); }
.tp-line { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.tp-line.done { background: var(--green-600); }
.track-driver { margin-top: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.track-cancelled { margin-top: 8px; font-size: 13.5px; font-weight: 700; color: var(--red-700); }

/* ============================================================
   نافذة نجاح الطلب
   ============================================================ */
.ok-card {
  background: var(--card); width: 100%; max-width: 420px; margin: auto;
  border-radius: var(--r-lg); padding: 28px 22px calc(24px + env(safe-area-inset-bottom));
  text-align: center; box-shadow: var(--shadow-lg);
  max-height: 94vh;
  max-height: 94dvh;
  transform: translateY(16px) scale(.97); opacity: 0;
  transition: transform var(--med), opacity var(--med);
}
.overlay.show .ok-card { transform: none; opacity: 1; }
@media (max-width: 560px) { .ok-card { margin: auto 0 0; max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; } }
.ok-badge {
  width: 70px; height: 70px; margin: 0 auto 14px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--green-50); color: var(--green-600);
}
.ok-card h3 { font-size: 21px; font-weight: 800; color: var(--brand-800); }
.ok-card p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.ok-num {
  font-family: var(--font-num); font-size: 22px; font-weight: 800; letter-spacing: 1px;
  color: var(--brand-700); background: var(--brand-50); border: 1px dashed var(--brand-300);
  border-radius: var(--r-sm); padding: 9px 14px; margin: 10px 0 12px; direction: ltr;
}
.ok-sub { font-size: 13.5px !important; color: var(--ink-2) !important; line-height: 1.6; }
.ok-wa-auto { margin-top: 14px; font-size: 13px; color: var(--green-600); font-weight: 700; }
.ok-wa-again { display: block; margin: 8px auto 0; color: var(--brand-700); font-weight: 700; font-size: 13px; text-decoration: underline; }
.ok-wa-box { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 9px; }
.ok-wa-title { font-size: 13.5px; font-weight: 800; }
.ok-wa-btns { display: grid; gap: 8px; }
.ok-wa-btn {
  min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 8px; flex-direction: column;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); font-weight: 800; font-size: 14px;
}
.ok-wa-btn small { font-size: 11px; font-weight: 600; color: var(--muted); }
.ok-wa-btn:hover { border-color: #25D366; background: #F0FCF5; }
.ok-wa-btn.pref { border-color: #25D366; background: #F0FCF5; }
.ok-wa-note { font-size: 12.5px; color: var(--amber-600); background: var(--amber-50); border-radius: var(--r-xs); padding: 8px 10px; }
.ok-wa-note a { color: var(--brand-700); font-weight: 700; text-decoration: underline; }
.ok-wa-remember { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); justify-content: center; }
.ok-wa-remember input { width: 18px; height: 18px; accent-color: var(--brand-700); }
.ok-wa-pref { font-size: 12.5px; color: var(--muted); }
.ok-wa-pref button { color: var(--brand-700); font-weight: 700; text-decoration: underline; }
.ok-wa {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; margin-top: 14px;
  background: #25D366; color: #06331a; border-radius: var(--r-sm); font-weight: 800; font-size: 15px;
}
.ok-close {
  width: 100%; min-height: var(--tap); margin-top: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  color: var(--brand-700); font-weight: 800; font-size: 14.5px;
}
.ok-close:hover { background: var(--brand-50); border-color: var(--brand-300); }

/* ============================================================
   عارض الصورة
   ============================================================ */
.img-lightbox {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(8, 18, 32, .94);
  display: grid; place-items: center; padding: 60px 16px 24px;
  opacity: 0; visibility: hidden; transition: opacity var(--med), visibility var(--med);
}
.img-lightbox.show { opacity: 1; visibility: visible; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-sm); }
.lb-back {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); inset-inline-start: 14px;
  min-height: var(--tap); padding: 0 16px;
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .3);
  color: #fff; border-radius: var(--r-pill); font-weight: 700; font-size: 14px;
}
html[dir="rtl"] .lb-back .ic { transform: scaleX(-1); }

/* ============================================================
   الإشعارات العائمة
   ============================================================ */
.note-toast {
  position: fixed; z-index: 950;
  left: 50%; transform: translate(-50%, -18px);
  top: calc(14px + env(safe-area-inset-top));
  width: calc(100% - 28px); max-width: 420px;
  background: var(--brand-900); color: #fff;
  border-radius: var(--r-sm); padding: 13px 16px;
  font-size: 13.5px; font-weight: 600; line-height: 1.5;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  opacity: 0; visibility: hidden;
  transition: opacity var(--med), transform var(--med), visibility var(--med);
}
.note-toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.note-toast .ic { flex: none; }
.note-toast b { font-weight: 800; }
.note-toast.ok .ic { color: #6EE7A8; }
.note-toast.warn { background: var(--amber-600); }
.note-toast.err { background: var(--red-700); }

/* طبقة تأثير الطيران إلى السلة */
.fly-layer { position: fixed; inset: 0; z-index: 600; pointer-events: none; }
.fly-item {
  position: absolute; width: 64px; height: 64px; border-radius: var(--r-sm); overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform .7s cubic-bezier(.4, 0, .2, 1), opacity .7s ease;
}
.fly-item img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   ورقة اختيار تطبيق واتساب (wa.js)
   ============================================================ */
.wa-sheet-overlay {
  position: fixed; inset: 0; z-index: 960;
  background: rgba(12, 28, 48, .55);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity var(--med), visibility var(--med);
}
.wa-sheet-overlay.show { opacity: 1; visibility: visible; }
.wa-sheet {
  background: var(--card); width: 100%; max-width: 460px;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  display: grid; gap: 10px; text-align: center;
  /* الحاوية محاذاتها flex-end، والفائض نحو بداية حاوية flex لا يمكن بلوغه —
     فبلا هذا الحدّ تُقصّ الورقة من أعلى على الشاشة الأفقية القصيرة.
     .scroll-y (في wa.js) يوفّر بقية خصائص التمرير. */
  max-height: 92vh; max-height: 92dvh;
  transform: translateY(100%); transition: transform var(--med);
}
.wa-sheet-overlay.show .wa-sheet { transform: none; }
@media (min-width: 560px) { .wa-sheet-overlay { align-items: center; } .wa-sheet { border-radius: var(--r-lg); transform: scale(.96); } .wa-sheet-overlay.show .wa-sheet { transform: none; } }
.wa-sheet-grip { width: 42px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 6px; }
.wa-sheet h3 { font-size: 17px; font-weight: 800; color: var(--brand-800); }
.wa-sheet-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.wa-app-btn {
  min-height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); text-align: start;
}
.wa-app-btn:hover { border-color: #25D366; background: #F0FCF5; }
.wa-app-ico { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #25D366; color: #fff; flex: none; }
.wa-app-ico .b {
  position: absolute; inset-inline-end: -3px; bottom: -3px;
  width: 17px; height: 17px; border-radius: 50%; background: var(--brand-700); color: #fff;
  font-size: 10px; font-style: normal; font-weight: 800; display: grid; place-items: center;
}
.wa-app-btn b { display: block; font-size: 14.5px; font-weight: 800; }
.wa-app-btn small { font-size: 11.5px; color: var(--muted); }
.wa-sheet-note { font-size: 12.5px; color: var(--amber-600); background: var(--amber-50); border-radius: var(--r-xs); padding: 9px 11px; }
.wa-remember { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.wa-remember input { width: 18px; height: 18px; accent-color: var(--brand-700); }
.wa-web { font-size: 13px; color: var(--brand-700); font-weight: 700; text-decoration: underline; }
.wa-cancel { min-height: var(--tap); border-radius: var(--r-sm); border: 1px solid var(--line); font-weight: 700; color: var(--ink-2); }

/* ============================================================
   الهياكل المؤقتة أثناء التحميل (Skeleton)
   ============================================================ */
.sk { background: linear-gradient(90deg, var(--line-2) 25%, #F7FAFD 50%, var(--line-2) 75%); background-size: 200% 100%; animation: skShine 1.3s linear infinite; border-radius: var(--r-xs); }
@keyframes skShine { to { background-position: -200% 0; } }
.sk-tile { display: grid; gap: 8px; }
.sk-tile .sk-img { aspect-ratio: 1/1; border-radius: var(--r); }
.sk-tile .sk-line { height: 11px; width: 80%; margin: 0 auto; }
.prod.skeleton .prod-media { background: var(--line-2); }
.prod.skeleton .sk-line { height: 12px; margin-bottom: 7px; }
.prod.skeleton .sk-line.w60 { width: 60%; }
.prod.skeleton .sk-line.w40 { width: 40%; }

/* مؤشر تحميل باقي الأقسام في الخلفية (للبحث الشامل) */
.bg-load {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  background: var(--brand-50); border: 1px solid var(--brand-100);
  border-radius: var(--r-pill); padding: 7px 14px; margin-bottom: 12px;
}
.bg-load .spin {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--brand-100); border-top-color: var(--brand-500);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* شريط تقدّم التمرير */
.scroll-progress {
  position: fixed; top: 0; inset-inline-start: 0; z-index: 500;
  height: 3px; width: 0;
  background: linear-gradient(90deg, var(--brand-500), var(--accent-500));
  transition: width .1s linear;
}
