/* ==========================================================================
   نظام التصميم - متجر إلكتروني عربي (RTL)
   ملف واحد مقسّم لطبقات: المتغيرات ← الأساسيات ← المكوّنات ← الصفحات ← الاستجابة
   كل الألوان والمسافات تمر عبر متغيرات CSS، فتغيير هوية المتجر يتم من :root فقط.
   ========================================================================== */

/* ==========================================================================
   1. المتغيرات (Design Tokens)
   ========================================================================== */
:root {
  /* الهوية اللونية الافتراضية — بنفسجي نيلي بلمسة كهرمانية.
     هذه قيم احتياطية فقط: صاحب المتجر يختار ثيمه من لوحة التحكم فتُحقن
     قيمه بعد هذا الملف وتتقدّم عليه. وجودها هنا يضمن متجرًا متماسكًا حتى
     قبل أول حفظ للثيم. */
  --brand-50:  #f0effa;
  --brand-100: #e2e0f3;
  --brand-200: #c3c0e6;
  --brand-300: #a5a1d6;
  --brand-400: #8a86c4;
  --brand-500: #6360a6;
  --brand-600: #55528f;
  --brand-700: #4c4a85;
  --brand-800: #3a3868;
  --brand-900: #2a294c;

  --primary: var(--brand-700);
  --primary-hover: var(--brand-800);
  --primary-soft: var(--brand-50);
  --on-primary: #ffffff;

  --accent: #f3b24a;
  --accent-soft: #fdf3e2;

  /* الرماديات */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* ألوان الحالة */
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --info: #0284c7;
  --info-soft: #f0f9ff;

  /* الأسطح */
  --surface: #ffffff;
  --surface-alt: var(--gray-50);
  --body-bg: #fafafd;
  --border: var(--gray-200);
  --text: var(--gray-900);
  --text-muted: var(--gray-500);

  /* المسافات - سلّم متناسق بدل أرقام عشوائية */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* الاستدارة */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* الظلال */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 44px rgba(15, 23, 42, 0.12);
  --shadow-brand: 0 8px 24px rgba(76, 74, 133, 0.26);

  /* الخط */
  --font: 'Tajawal', 'Segoe UI', system-ui, sans-serif;

  /* الحركة */
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);

  --header-height: 72px;

  color-scheme: light;
}

/* ==========================================================================
   1ب. الوضع الليلي
   يُفعَّل بثلاث حالات: اختيار صريح [data-theme="dark"]، أو تفضيل النظام حين
   لا يوجد اختيار. الألوان تُعاد تعريفها كرموز فقط، فتتبعها كل المكوّنات
   تلقائيًا دون تكرار أي قاعدة.
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --primary: var(--brand-300);
    --primary-hover: var(--brand-200);
    --primary-soft: #262450;
    --on-primary: #14132a;

    --surface: #131a24;
    --surface-alt: #0d131b;
    --body-bg: #0b1017;
    --border: #253143;
    --text: #e8eef6;
    --text-muted: #94a3b8;

    --gray-50:  #131a24;
    --gray-100: #1a2432;
    --gray-200: #253143;
    --gray-300: #33445c;
    --gray-400: #64748b;
    --gray-500: #94a3b8;
    --gray-600: #b6c2d2;
    --gray-700: #cbd5e1;
    --gray-800: #e2e8f0;
    --gray-900: #f1f5f9;

    --success-soft: #0c2c1a;
    --danger-soft:  #341417;
    --warning-soft: #33240c;
    --info-soft:    #0b2a3d;
    --accent-soft:  #33240c;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --primary: var(--brand-300);
  --primary-hover: var(--brand-200);
  --primary-soft: #262450;
  --on-primary: #14132a;

  --surface: #131a24;
  --surface-alt: #0d131b;
  --body-bg: #0b1017;
  --border: #253143;
  --text: #e8eef6;
  --text-muted: #94a3b8;

  --gray-50:  #131a24;
  --gray-100: #1a2432;
  --gray-200: #253143;
  --gray-300: #33445c;
  --gray-400: #64748b;
  --gray-500: #94a3b8;
  --gray-600: #b6c2d2;
  --gray-700: #cbd5e1;
  --gray-800: #e2e8f0;
  --gray-900: #f1f5f9;

  --success-soft: #0c2c1a;
  --danger-soft:  #341417;
  --warning-soft: #33240c;
  --info-soft:    #0b2a3d;
  --accent-soft:  #33240c;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   2. الأساسيات
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--body-bg);
  color: var(--text);
  margin: 0;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; transition: color var(--transition); }
img { max-width: 100%; }

h1, h2, h3, h4, h5, h6 { font-weight: 800; line-height: 1.4; color: var(--gray-900); }

/* الحقول التي تحتوي بيانات لاتينية (مفاتيح، أرقام، روابط) تبقى LTR داخل صفحة RTL */
.ltr-input, .ltr { direction: ltr; text-align: left; font-family: 'Menlo', 'Consolas', monospace; }

::selection { background: var(--brand-200); color: var(--brand-900); }

/* شريط تمرير أنيق */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: var(--radius-pill); border: 2px solid var(--gray-100); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* تجاوز واضح للوصولية عند التنقل بلوحة المفاتيح */
:focus-visible { outline: 3px solid var(--brand-300); outline-offset: 2px; border-radius: var(--radius-sm); }

/* احترام تفضيل تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* ==========================================================================
   3. المكوّنات - الأزرار
   ========================================================================== */
.btn-primary-custom,
.btn-outline-custom,
.btn-ghost,
.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 11px 22px;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary-custom {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-xs);
}
.btn-primary-custom:hover:not(:disabled) {
  background: var(--primary-hover);
  color: var(--on-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-brand);
}

.btn-outline-custom {
  background: transparent;
  border-color: var(--border);
  color: var(--gray-700);
}
.btn-outline-custom:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover:not(:disabled) { filter: brightness(0.94); color: #fff; }

.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }

.btn-primary-custom:disabled,
.btn-outline-custom:disabled,
.btn-accent:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-sm { padding: 7px 14px !important; font-size: 0.85rem !important; }
.btn-lg { padding: 14px 30px !important; font-size: 1.05rem !important; }

/* ==========================================================================
   4. المكوّنات - الترويسة والتنقل
   ========================================================================== */
.top-announcement {
  background: linear-gradient(90deg, var(--brand-800), var(--brand-600));
  color: #fff;
  text-align: center;
  padding: 9px var(--space-4);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.top-announcement i { margin-inline-end: 6px; }

.navbar-custom {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) 0;
  position: sticky;
  top: 0;
  z-index: 1030;
  backdrop-filter: saturate(180%) blur(8px);
}

.navbar-brand-custom {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--brand-800);
  letter-spacing: -0.02em;
}
.navbar-brand-custom img { height: 44px; width: auto; border-radius: var(--radius-sm); }
.navbar-brand-custom:hover { color: var(--brand-600); }

/* البحث */
.search-wrap { position: relative; flex: 1 1 320px; max-width: 460px; }
.search-box {
  width: 100%;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--gray-50);
  padding: 11px 44px 11px 18px;
  font-family: var(--font);
  font-size: 0.92rem;
  transition: all var(--transition);
}
.search-box:focus {
  outline: none;
  border-color: var(--brand-400);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--brand-50);
}
.search-wrap .search-icon {
  position: absolute;
  inset-inline-start: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}

/* أزرار الأيقونات */
.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  color: var(--gray-600);
  font-size: 1.15rem;
  transition: all var(--transition);
  /* تصفير مظهر الزر الافتراضي: بعض هذه الأيقونات <button> وبعضها <a>،
     وبدون التصفير يظهر الزر بخلفية المتصفح الفاتحة داخل الوضع الليلي */
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }

.badge-count {
  position: absolute;
  top: -2px;
  inset-inline-end: -2px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

/* شريط التصنيفات تحت الترويسة */
.category-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.category-bar::-webkit-scrollbar { display: none; }
.category-bar .inner { display: flex; gap: var(--space-2); padding: var(--space-2) 0; white-space: nowrap; }
.category-bar a {
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-600);
  transition: all var(--transition);
}
.category-bar a:hover { background: var(--gray-100); color: var(--gray-900); }
.category-bar a.active { background: var(--primary); color: var(--on-primary); }

/* ==========================================================================
   5. المكوّنات - البطاقات والأسطح
   ========================================================================== */
.surface-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
}

.section-title {
  font-size: 1.35rem;
  font-weight: 900;
  margin: var(--space-7) 0 var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
/* شريط لوني صغير يسبق العنوان كعلامة بصرية متكررة */
.section-title::before {
  content: "";
  width: 5px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, var(--brand-400), var(--brand-700));
}
.section-title .link-more {
  margin-inline-start: auto;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}
.section-title .link-more:hover { color: var(--primary-hover); }

/* ==========================================================================
   6. المكوّنات - بطاقة المنتج
   ========================================================================== */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: all var(--transition);
  position: relative;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-200);
}

.product-card .img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--gray-100);
  overflow: hidden;
}
.product-card .img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
}
.product-card:hover .img-wrap img { transform: scale(1.06); }

.product-card .img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-300);
  font-size: 2.5rem;
}

.badge-discount {
  position: absolute;
  top: var(--space-3);
  inset-inline-start: var(--space-3);
  background: var(--danger);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}

.badge-out-of-stock {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--gray-600);
  font-size: 0.95rem;
}

/* زر المفضلة العائم فوق الصورة */
.wishlist-btn {
  position: absolute;
  top: var(--space-3);
  inset-inline-end: var(--space-3);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  z-index: 2;
}
.wishlist-btn:hover { color: var(--danger); transform: scale(1.1); }
.wishlist-btn.active { color: var(--danger); }

.product-card .body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.product-card .category-label {
  font-size: 0.73rem;
  color: var(--text-muted);
  font-weight: 600;
}

.product-card .name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--gray-800);
  /* سطران كحد أقصى حتى تبقى كل البطاقات بنفس الارتفاع */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.85em;
}
.product-card:hover .name { color: var(--primary); }

.price-tag { font-weight: 900; font-size: 1.1rem; color: var(--brand-800); }
.price-tag .currency { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.price-old {
  text-decoration: line-through;
  color: var(--gray-400);
  font-size: 0.85rem;
  margin-inline-start: 6px;
}

.product-card .actions { margin-top: auto; padding-top: var(--space-2); }

/* ==========================================================================
   7. المكوّنات - التقييم بالنجوم
   ========================================================================== */
.stars { display: inline-flex; gap: 2px; color: var(--accent); font-size: 0.85rem; }
.stars .bi-star { color: var(--gray-300); }
.rating-meta { font-size: 0.78rem; color: var(--text-muted); margin-inline-start: 6px; }

/* إدخال النجوم: راديو مخفي + نجوم قابلة للنقر بترتيب معكوس يناسب RTL */
/* مكوّن اختيار النجوم.
   العناصر مرتبة في الـ DOM من 5 إلى 1، و row-reverse يعرضها بصريًا من 1 إلى 5.
   بهذا يصبح "input:checked ~ label" شاملًا للنجمة المختارة وكل ما دونها،
   وهو ما يجعل الاختيار يملأ النجوم فعليًا بدل إضاءة نجمة واحدة.
   ملاحظة: يجب أن تكون كل المدخلات والتسميات أشقّاء مباشرين (بلا <li>). */
.star-input {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
  direction: ltr;
}
.star-input input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.star-input label {
  cursor: pointer;
  font-size: 0;
  line-height: 1;
  color: var(--gray-300);
  transition: color var(--transition), transform var(--transition);
}
.star-input label::before {
  content: "\f586";           /* bi-star-fill */
  font-family: "bootstrap-icons";
  font-size: 1.7rem;
}
/* النجمة المختارة وكل ما بعدها في الـ DOM (= الأقل رقمًا) */
.star-input input:checked ~ label,
.star-input label:hover,
.star-input label:hover ~ label { color: var(--accent); }

.star-input label:hover { transform: scale(1.12); }

/* إبراز واضح عند التنقل بلوحة المفاتيح */
.star-input input:focus-visible + label {
  outline: 3px solid var(--brand-300);
  outline-offset: 2px;
  border-radius: 4px;
}

.rating-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-pill);
  overflow: hidden;
  flex: 1;
}
.rating-bar span { display: block; height: 100%; background: var(--accent); border-radius: var(--radius-pill); }

.review-item {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}
.review-item:last-child { border-bottom: none; }
.review-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}
.verified-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--success);
  background: var(--success-soft);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

/* ==========================================================================
   8. المكوّنات - الشارات وحالات الطلب
   ========================================================================== */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}
.status-pending    { background: var(--warning-soft); color: var(--warning); }
.status-confirmed  { background: var(--info-soft);    color: var(--info); }
.status-processing { background: var(--info-soft);    color: var(--info); }
.status-shipped    { background: #eef2ff;             color: #4f46e5; }
.status-delivered  { background: var(--success-soft); color: var(--success); }
.status-cancelled  { background: var(--danger-soft);  color: var(--danger); }
.status-refunded   { background: var(--gray-100);     color: var(--gray-600); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}
.chip-brand { background: var(--primary-soft); color: var(--primary); }

/* ==========================================================================
   9. المكوّنات - النماذج
   ========================================================================== */
.form-control, .form-select {
  border-radius: var(--radius) !important;
  border: 1.5px solid var(--border) !important;
  padding: 11px 14px !important;
  font-family: var(--font) !important;
  font-size: 0.93rem !important;
  transition: all var(--transition) !important;
  background: var(--surface);
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-400) !important;
  box-shadow: 0 0 0 4px var(--brand-50) !important;
}
.form-control::placeholder { color: var(--gray-400); }

.form-label { font-weight: 700; font-size: 0.88rem; margin-bottom: 6px; color: var(--gray-700); }
.form-text { font-size: 0.78rem; color: var(--text-muted); }

.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 4px var(--brand-50); border-color: var(--brand-400); }

.invalid-feedback, .errorlist {
  color: var(--danger);
  font-size: 0.82rem;
  list-style: none;
  padding: 0;
  margin-top: 4px;
}

/* اختيار طريقة الدفع كبطاقات قابلة للنقر بدل راديو عادي */
.pay-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: var(--space-3);
  background: var(--surface);
}
.pay-option:hover { border-color: var(--brand-300); background: var(--brand-50); }
.pay-option.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--brand-100);
}
.pay-option .pay-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--gray-600);
  flex-shrink: 0;
}
.pay-option.selected .pay-icon { background: var(--brand-100); color: var(--primary); }

/* ==========================================================================
   10. المكوّنات - التنبيهات والحالات الفارغة
   ========================================================================== */
.alert {
  border: none !important;
  border-radius: var(--radius) !important;
  border-inline-start: 4px solid transparent !important;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}
.alert-success { background: var(--success-soft) !important; color: #14532d !important; border-inline-start-color: var(--success) !important; }
.alert-danger, .alert-error { background: var(--danger-soft) !important; color: #7f1d1d !important; border-inline-start-color: var(--danger) !important; }
.alert-warning { background: var(--warning-soft) !important; color: #78350f !important; border-inline-start-color: var(--warning) !important; }
.alert-info { background: var(--info-soft) !important; color: #075985 !important; border-inline-start-color: var(--info) !important; }

.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
  width: 100%;
}
.empty-state .icon {
  width: 88px;
  height: 88px;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  color: var(--gray-400);
}
.empty-state h4, .empty-state h5 { color: var(--gray-700); margin-bottom: var(--space-2); }

/* ==========================================================================
   11. الصفحة الرئيسية - الهيرو والبانرات
   ========================================================================== */
.hero-banner {
  position: relative;
  min-height: 380px;
  border-radius: var(--radius-xl);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  display: flex;
  align-items: center;
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow);
}
.hero-banner .overlay {
  position: relative;
  z-index: 2;
  padding: var(--space-7);
  color: #fff;
  max-width: 620px;
}
/* تدرّج يضمن قراءة النص مهما كانت الصورة */
.hero-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(270deg, rgba(15, 23, 42, 0.15), rgba(15, 23, 42, 0.82));
  z-index: 1;
}
.hero-banner h1 { color: #fff; font-size: clamp(1.6rem, 4vw, 2.6rem); margin-bottom: var(--space-3); }
.hero-banner p { font-size: clamp(0.95rem, 2vw, 1.15rem); opacity: 0.92; margin-bottom: var(--space-4); }

/* هيرو بديل يظهر عندما لا يضيف صاحب المتجر أي بانر */
.hero-fallback {
  background: linear-gradient(135deg, var(--brand-800), var(--brand-600) 60%, var(--brand-500));
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  color: #fff;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hero-fallback h1 { color: #fff; font-size: clamp(1.7rem, 4vw, 2.8rem); }
.hero-fallback p { opacity: 0.9; max-width: 560px; margin: var(--space-3) auto var(--space-5); }

.promo-card {
  display: block;
  position: relative;
  height: 200px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-size: cover;
  background-position: center;
  transition: transform var(--transition);
  box-shadow: var(--shadow-xs);
}
.promo-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.promo-card .promo-body {
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  padding: var(--space-4);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.78), transparent);
  color: #fff;
}
.promo-card .promo-body h5 { color: #fff; margin: 0; font-size: 1.05rem; }

/* دائرة التصنيف */
.category-circle { text-align: center; display: block; }
.category-circle .circle {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 2px solid var(--border);
  margin: 0 auto var(--space-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  color: var(--gray-400);
  font-size: 1.8rem;
}
.category-circle:hover .circle {
  border-color: var(--brand-400);
  transform: translateY(-3px);
  box-shadow: var(--shadow-sm);
}
.category-circle .circle img { width: 100%; height: 100%; object-fit: cover; }
.category-circle span { font-size: 0.85rem; font-weight: 700; color: var(--gray-700); }

/* شريط مزايا الثقة */
.trust-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--space-3);
  margin: var(--space-6) 0;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.trust-item i { font-size: 1.6rem; color: var(--primary); }
.trust-item .t-title { font-weight: 800; font-size: 0.92rem; }
.trust-item .t-sub { font-size: 0.78rem; color: var(--text-muted); }

/* ==========================================================================
   12. صفحة المنتج
   ========================================================================== */
.product-gallery .main-image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.product-gallery .main-image img { width: 100%; height: 100%; object-fit: contain; }

.product-gallery .thumbs { display: flex; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }
.product-gallery .thumb {
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition);
  background: var(--surface);
}
.product-gallery .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-gallery .thumb.active, .product-gallery .thumb:hover { border-color: var(--primary); }

.price-block { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
.price-block .current { font-size: 2rem; font-weight: 900; color: var(--brand-800); }
.price-block .was { font-size: 1.1rem; color: var(--gray-400); text-decoration: line-through; }
.price-block .save {
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

/* محدد الكمية */
.qty-selector {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.qty-selector button {
  width: 42px;
  height: 44px;
  border: none;
  background: var(--surface);
  color: var(--gray-600);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background var(--transition);
}
.qty-selector button:hover { background: var(--gray-100); color: var(--primary); }
.qty-selector input {
  width: 56px;
  height: 44px;
  border: none;
  text-align: center;
  font-weight: 800;
  font-family: var(--font);
  /* إخفاء أسهم المتصفح للحفاظ على شكل المكوّن */
  -moz-appearance: textfield;
}
.qty-selector input::-webkit-outer-spin-button,
.qty-selector input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ==========================================================================
   13. السلة والدفع
   ========================================================================== */
.cart-item {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.cart-item:last-child { border-bottom: none; }
.cart-item .thumb {
  width: 92px;
  height: 92px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--gray-100);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-300);
}
.cart-item .thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ملخص الطلب يلتصق أثناء التمرير في الشاشات الكبيرة */
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
  box-shadow: var(--shadow-xs);
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) 0;
  font-size: 0.92rem;
  color: var(--gray-600);
}
.summary-row.total {
  border-top: 2px dashed var(--border);
  margin-top: var(--space-3);
  padding-top: var(--space-4);
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--gray-900);
}
.summary-row.discount { color: var(--success); font-weight: 700; }

/* خطوات إتمام الطلب */
.steps { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-5); flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: var(--space-2); font-size: 0.86rem; font-weight: 700; color: var(--gray-400); }
.step .num {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--gray-200);
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}
.step.active { color: var(--primary); }
.step.active .num { background: var(--primary); color: var(--on-primary); }
.step.done .num { background: var(--success); color: #fff; }
.steps .divider { flex: 1; height: 2px; background: var(--border); min-width: 20px; }

/* تتبع الطلب */
.timeline { position: relative; padding-inline-start: var(--space-6); }
.timeline::before {
  content: "";
  position: absolute;
  inset-inline-start: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; padding-bottom: var(--space-5); }
.timeline-item::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(-1 * var(--space-6) + 4px);
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 3px solid var(--gray-300);
}
.timeline-item.done::before { border-color: var(--success); background: var(--success); }
.timeline-item.current::before { border-color: var(--primary); box-shadow: 0 0 0 4px var(--brand-100); }

/* ==========================================================================
   14. لوحة التحكم
   ========================================================================== */
.dnav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-radius: var(--radius);
  color: var(--gray-600);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition);
}
.dnav:hover { background: var(--gray-100); color: var(--gray-900); }
.dnav.active { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-brand); }
.dnav i { font-size: 1.05rem; }

.dnav-group-title {
  font-size: 0.7rem;
  color: var(--gray-400);
  font-weight: 800;
  padding: var(--space-4) 13px var(--space-1);
  letter-spacing: 0.06em;
}

.dashboard-sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--space-3));
  max-height: calc(100vh - var(--header-height) - var(--space-5));
  overflow-y: auto;
}

.dash-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-3);
}

table.dash-table { width: 100%; }
table.dash-table th {
  font-size: 0.78rem;
  color: var(--gray-500);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--border);
  padding: var(--space-3);
}
table.dash-table td { padding: var(--space-3); border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: middle; }
table.dash-table tbody tr { transition: background var(--transition); }
table.dash-table tbody tr:hover { background: var(--gray-50); }

/* بطاقة إحصائية */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 900; line-height: 1.2; }
.stat-card .stat-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }

/* بطاقة بوابة دفع في لوحة التحكم */
.gateway-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all var(--transition);
}
.gateway-card.enabled { border-color: var(--brand-300); background: linear-gradient(180deg, var(--brand-50), var(--surface) 60%); }
.gateway-card .gw-logo {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--gray-600);
}
.gateway-card.enabled .gw-logo { background: var(--brand-100); color: var(--primary); }

.mode-badge { font-size: 0.72rem; font-weight: 800; padding: 3px 10px; border-radius: var(--radius-pill); }
.mode-simulation { background: var(--warning-soft); color: var(--warning); }
.mode-test { background: var(--info-soft); color: var(--info); }
.mode-live { background: var(--success-soft); color: var(--success); }

/* صندوق نسخ رابط الـ webhook */
.copy-box {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: #0f172a;
  color: var(--brand-300);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-size: 0.82rem;
  overflow-x: auto;
}
.copy-box code { color: inherit; white-space: nowrap; }
.copy-box button {
  margin-inline-start: auto;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.copy-box button:hover { background: rgba(255, 255, 255, 0.24); }

/* ==========================================================================
   15. التذييل
   ========================================================================== */
/* التذييل داكن دائمًا في الوضعين، فلا يستخدم --gray-900 لأنها تنقلب في
   الوضع الليلي فيصبح النص أبيض على خلفية فاتحة. */
.site-footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: var(--space-8) 0 var(--space-5);
  margin-top: var(--space-8);
}
.site-footer h6 { color: #fff; font-weight: 800; margin-bottom: var(--space-4); font-size: 0.95rem; }
.site-footer a { color: #94a3b8; font-size: 0.88rem; display: block; padding: 5px 0; }
.site-footer a:hover { color: var(--brand-300); }
.site-footer .footer-brand { font-size: 1.25rem; font-weight: 900; color: #fff; }
.site-footer .footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  font-size: 0.82rem;
  color: #94a3b8;
}
.social-links { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.social-links a {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  padding: 0;
}
.social-links a:hover { background: var(--primary); color: #fff; }

/* ==========================================================================
   15ب. الدعم الفني
   ========================================================================== */
.support-widget {
  position: fixed;
  inset-block-end: 22px;
  inset-inline-start: 22px;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.support-fab {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: var(--radius-pill);
  border: none;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition);
}
.support-fab:hover { transform: scale(1.07); }

/* نبضة خفيفة تلفت الانتباه دون إزعاج */
@keyframes support-ping {
  0%   { transform: scale(1);   opacity: 0.55; }
  70%  { transform: scale(1.7); opacity: 0; }
  100% { transform: scale(1.7); opacity: 0; }
}
.support-ping {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: var(--brand-500);
  animation: support-ping 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
  z-index: -1;
}
.support-widget.is-open .support-ping { animation: none; }

.support-bubble {
  width: 310px;
  max-width: calc(100vw - 44px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fadeInUp 260ms cubic-bezier(0.4, 0, 0.2, 1) both;
}
.support-bubble[hidden] { display: none; }

.support-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(135deg, var(--brand-700), var(--brand-600));
  color: #fff;
}
.support-title { font-weight: 800; font-size: 0.95rem; }
.support-sub { font-size: 0.78rem; opacity: 0.9; }
.support-close {
  margin-inline-start: auto;
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.support-close:hover { background: rgba(255, 255, 255, 0.32); }

.support-body { padding: 10px; display: flex; flex-direction: column; gap: 4px; }

.support-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.support-option:hover { background: var(--gray-100); }
.support-option .ico {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.support-option .t { display: block; font-weight: 700; font-size: 0.87rem; color: var(--text); }
.support-option .s { display: block; font-size: 0.76rem; color: var(--text-muted); }

@media (max-width: 767.98px) {
  .support-widget { inset-block-end: 16px; inset-inline-start: 16px; }
  .support-fab { width: 52px; height: 52px; font-size: 1.3rem; }
}

/* ==========================================================================
   15ج. ربط أدوات Bootstrap برموز الثيم
   صفحات قديمة تستخدم bg-white / bg-light / text-dark / border مباشرة، وهي
   ألوان ثابتة فاتحة. بدون هذا الربط كانت تلك الصفحات تعرض بطاقة بيضاء بنص
   فاتح في الوضع الليلي فيصبح المحتوى غير مقروء.
   ========================================================================== */
.bg-white  { background-color: var(--surface) !important; }
.bg-light  { background-color: var(--surface-alt) !important; }
.bg-body,
.bg-body-tertiary { background-color: var(--body-bg) !important; }

.text-dark  { color: var(--text) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-muted) !important; }

.border, .border-top, .border-bottom,
.border-start, .border-end { border-color: var(--border) !important; }

.card {
  background-color: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.list-group-item {
  background-color: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.table { --bs-table-bg: transparent; color: var(--text); }
.table > :not(caption) > * > * { border-color: var(--border); }

.dropdown-menu {
  background-color: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.dropdown-item { color: var(--text); }
.dropdown-item:hover, .dropdown-item:focus {
  background-color: var(--primary-soft);
  color: var(--primary);
}
.dropdown-divider { border-color: var(--border); }

.breadcrumb-item, .breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text); }

.modal-content { background-color: var(--surface); color: var(--text); }
.form-control:disabled, .form-control[readonly] { background-color: var(--gray-100); }

/* ==========================================================================
   16. مساعدات وتنقّل الصفحات
   ========================================================================== */
.pagination { gap: 6px; }
.pagination .page-link {
  border: 1.5px solid var(--border);
  border-radius: var(--radius) !important;
  color: var(--gray-600);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 8px 14px;
}
.pagination .page-link:hover { background: var(--primary-soft); border-color: var(--brand-300); color: var(--primary); }
.pagination .active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }

.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: var(--space-4) 0;
}
.divider-text::before, .divider-text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.text-brand { color: var(--primary) !important; }

/* تظليل كهرماني خلف كلمة مفتاحية — العنصر المميّز في هوية تبايُع.
   لون النص يتبع --on-accent لا الأبيض: اللون المميّز قد يكون فاتحًا. */
.text-mark {
  background: var(--accent);
  color: var(--on-accent, #14132a);
  padding: 0.05em 0.35em;
  border-radius: var(--radius-sm);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.bg-brand-soft { background: var(--primary-soft) !important; }

/* هيكل تحميل بسيط للصور البطيئة */
@keyframes shimmer { 100% { transform: translateX(-100%); } }
.skeleton { position: relative; overflow: hidden; background: var(--gray-200); }
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: shimmer 1.4s infinite;
}

/* ظهور تدريجي لطيف عند تحميل الأقسام */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.fade-in-up { animation: fadeInUp 420ms cubic-bezier(0.4, 0, 0.2, 1) both; }

/* ==========================================================================
   17. الاستجابة
   ========================================================================== */
@media (max-width: 991.98px) {
  .summary-card, .dashboard-sidebar { position: static; max-height: none; }
  .hero-banner { min-height: 300px; }
  .hero-banner .overlay { padding: var(--space-5); }
}

@media (max-width: 767.98px) {
  :root { --header-height: 64px; }

  .navbar-custom { padding: var(--space-2) 0; }
  .navbar-brand-custom { font-size: 1.1rem; }
  .navbar-brand-custom img { height: 36px; }

  /* البحث ينتقل لسطر مستقل بعرض كامل */
  .search-wrap { order: 3; flex-basis: 100%; max-width: 100%; margin-top: var(--space-2); }

  .section-title { font-size: 1.15rem; margin: var(--space-5) 0 var(--space-3); }
  .hero-banner { min-height: 240px; border-radius: var(--radius-lg); }
  .product-card .body { padding: var(--space-3); }
  .price-tag { font-size: 1rem; }
  .price-block .current { font-size: 1.5rem; }

  .cart-item { flex-wrap: wrap; gap: var(--space-3); }
  .cart-item .thumb { width: 68px; height: 68px; }

  .icon-btn { width: 38px; height: 38px; font-size: 1.05rem; }
  .empty-state { padding: var(--space-6) var(--space-3); }
  .empty-state .icon { width: 68px; height: 68px; font-size: 1.8rem; }

  .site-footer { padding: var(--space-6) 0 var(--space-4); text-align: center; }
  .social-links { justify-content: center; }

}

/* ==========================================================================
   18. الطباعة (للفواتير وتفاصيل الطلب)
   ========================================================================== */
@media print {
  .navbar-custom, .site-footer, .top-announcement, .category-bar,
  .btn-primary-custom, .btn-outline-custom, .no-print { display: none !important; }
  body { background: #fff; }
  .surface-card, .summary-card { box-shadow: none; border: 1px solid #ddd; }
}

/* ==========================================================================
   شريط الإعلانات المتحرك
   الحركة على النص لا على الشريط: تحريك الحاوية كان يزيح تخطيط الصفحة كلها.
   ========================================================================== */
.announce-bar {
  --bar-bg: var(--primary);
  --bar-fg: var(--on-primary);
  --bar-duration: 28s;

  background: var(--bar-bg);
  color: var(--bar-fg);
  font-size: 0.85rem;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  padding: 9px 0;
}
.announce-bar a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

.announce-track { display: flex; width: max-content; }

.announce-run { display: flex; align-items: center; }

.announce-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 28px;
  white-space: nowrap;
}
/* فاصل بين الرسائل بدل الاعتماد على المسافة وحدها */
.announce-item + .announce-item::before {
  content: "";
  width: 4px; height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  margin-inline-end: 24px;
}

.announce-bar.is-animated .announce-track {
  animation: announce-scroll var(--bar-duration) linear infinite;
}
/* التمرير بنسبة 50% لا بعرض ثابت: النسخة الثانية تحلّ محل الأولى بالضبط
   مهما كان طول الرسائل، فتبدو الحركة لانهائية بلا قفزة */
@keyframes announce-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(50%); }
}
.announce-bar.is-animated:hover .announce-track,
.announce-bar.is-animated:focus-within .announce-track { animation-play-state: paused; }

/* الشريط غير المتحرك يُوسَّط بدل أن يلتصق بالحافة */
.announce-bar:not(.is-animated) .announce-track {
  width: 100%;
  justify-content: center;
}
.announce-bar:not(.is-animated) .announce-run[aria-hidden="true"] { display: none; }

.announce-close {
  position: absolute;
  inset-inline-end: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  color: inherit;
  opacity: 0.75;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px 6px;
}
.announce-close:hover { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .announce-bar.is-animated .announce-track { animation: none; width: 100%; justify-content: center; }
  .announce-bar.is-animated .announce-run[aria-hidden="true"] { display: none; }
}

/* ==========================================================================
   أقسام الصفحة الرئيسية
   ========================================================================== */
.home-section + .home-section { margin-top: var(--space-6); }

.section-title > span { display: flex; flex-direction: column; }
.section-subtitle {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
}

/* شبكة المنتجات: عدد الأعمدة يأتي من التخطيط لا من أصناف Bootstrap،
   فيكفي متغيّر واحد لتغيير كثافة كل شبكات المتجر */
.product-grid {
  --cols: 4;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--space-4);
}
@media (max-width: 991px) { .product-grid { --cols: 3 !important; } }
@media (max-width: 767px) { .product-grid { --cols: 2 !important; gap: var(--space-3); } }

/* ---- الهيرو المنزلق ---- */
.hero-slider { position: relative; }
.hero-slide {
  border-radius: var(--radius-xl);
  min-height: clamp(240px, 34vw, 420px);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}
/* بلا تظليل: الصورة تُعرض بألوانها الأصلية، والنص وحده يحمل لوحه */
.hero-slide .overlay {
  position: relative;
  margin: var(--space-5);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  background: rgba(17, 18, 28, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  width: fit-content;
  max-width: 620px;
  color: #fff;
}
/* الشريحة الأولى تحمل h1 والبقية .hero-title: الشكل واحد والوزن الدلالي
   مختلف — عنوان رئيسي واحد لكل صفحة */
.hero-slide h1,
.hero-slide .hero-title { color: #fff; font-size: clamp(1.6rem, 4vw, 2.6rem); margin-bottom: var(--space-3); }
.hero-slide p { font-size: clamp(0.95rem, 2vw, 1.15rem); opacity: 0.92; margin-bottom: var(--space-4); }

/* الشرائح تتراكب في نفس المساحة، والظاهرة وحدها تستقبل النقر */
.hero-slider.is-slider .hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 550ms ease;
}
.hero-slider.is-slider { min-height: clamp(240px, 34vw, 420px); }
.hero-slider.is-slider .hero-slide.is-active { opacity: 1; pointer-events: auto; }

.hero-dots {
  position: absolute;
  bottom: var(--space-4);
  inset-inline-start: 50%;
  transform: translateX(50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}
.hero-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,0.45);
  cursor: pointer;
  padding: 0;
  transition: all var(--transition);
}
.hero-dot.is-active { background: #fff; width: 26px; border-radius: var(--radius-pill); }

/* ---- شبكة البنرات ---- */
.banner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}
.banner-grid-1 { grid-template-columns: 1fr; }

.banner-card {
  position: relative;
  min-height: 190px;
  border-radius: var(--radius-lg);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.banner-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.banner-body {
  position: relative;
  margin: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: rgba(17, 18, 28, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
}
/* بانر بلا نص = صورة خالصة بلا أي طبقة فوقها */
.banner-card .banner-body:empty { display: none; }
.banner-body h3 { color: #fff; font-size: 1.05rem; margin: 0 0 3px; }
.banner-body span { font-size: 0.84rem; opacity: 0.88; display: block; }
.banner-cta {
  display: inline-block !important;
  margin-top: 10px;
  background: var(--accent);
  color: var(--on-accent, #14132a);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem !important;
  font-weight: 800;
  opacity: 1 !important;
}

/* ---- شريط التصنيفات ---- */
.category-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: var(--space-4);
}

/* ---- صورة عريضة ---- */
.wide-image { position: relative; margin: 0; border-radius: var(--radius-xl); overflow: hidden; }
.wide-image img { width: 100%; display: block; }
.wide-image figcaption {
  position: absolute;
  inset-block-end: var(--space-5);
  inset-inline-start: var(--space-5);
  max-width: min(520px, 80%);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  background: rgba(17, 18, 28, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
}
.wide-image figcaption h3 { color: #fff; margin: 0 0 6px; }
.wide-image figcaption p { margin: 0 0 10px; opacity: 0.9; }

/* ---- كتلة نص ---- */
.text-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
}
.text-block h2 { margin-bottom: var(--space-3); }
.text-block .lead-line { color: var(--text-muted); font-size: 1.02rem; }
.text-block .body { color: var(--text-muted); max-width: 68ch; margin-inline: auto; }

/* ---- مزايا المتجر ---- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--space-4);
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
}
.feature-card .ico {
  width: 52px; height: 52px;
  margin: 0 auto var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--primary-soft);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
/* الصورة تملأ مربّع الأيقونة نفسه، فلا يتغيّر إيقاع الشبكة بين ميزة
   تحمل صورة وأخرى تحمل أيقونة */
.feature-card .ico.has-image { background: transparent; padding: 0; overflow: hidden; }
.feature-card .ico img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.feature-card h3 { font-size: 1rem; margin-bottom: 6px; }
.feature-card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

/* صورة داخل شريط الثقة في صفحة المنتج */
.trust-item .t-img {
  width: 34px; height: 34px;
  object-fit: cover;
  border-radius: var(--radius);
  flex: 0 0 auto;
}

/* شارة «موثوق» في التذييل - الموضع الوحيد لها بعد حذف الشريط المكرّر */
.footer-maroof {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: var(--space-3);
  padding: 8px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.footer-maroof i { font-size: 1.35rem; color: #34d399; }
.footer-maroof img { max-height: 44px; }
.footer-maroof .t { display: block; font-weight: 800; font-size: 0.86rem; color: #fff; }
.footer-maroof .s { display: block; font-size: 0.75rem; opacity: 0.75; }

/* البانر الرئيسي ينزل قليلًا عن الترويسة بدل أن يلتصق بها */
.home-section.hero-section { margin-top: var(--space-5); }

/* ==========================================================================
   التخطيطات — ما يجعل الثيمات متاجر مختلفة لا ألوانًا مختلفة

   كل تخطيط يعيد تعريف بنية بطاقة المنتج وعنوان القسم وكثافة الشبكة. القاعدة:
   لا نكرّر المكوّن، بل نغيّر ما يميّزه فقط، فيبقى إصلاح أي خلل في مكان واحد.
   ========================================================================== */

/* ---------- عصري (modern): الافتراضي، بطاقات مرتفعة بظلال ---------- */
[data-layout="modern"] .product-grid { --cols: 4; }

/* ---------- كلاسيكي (classic): حدود بلا ظلال، عناوين موسّطة ---------- */
[data-layout="classic"] .product-grid { --cols: 3; gap: var(--space-5); }

[data-layout="classic"] .product-card {
  border: 1px solid var(--text);
  box-shadow: none;
  text-align: center;
}
[data-layout="classic"] .product-card:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--primary);
}
[data-layout="classic"] .product-card:hover .img-wrap img { transform: none; }
[data-layout="classic"] .product-card .img-wrap { aspect-ratio: 4 / 5; background: var(--surface); }
[data-layout="classic"] .product-card .body { align-items: center; }
[data-layout="classic"] .product-card .category-label {
  letter-spacing: 0.18em;
  font-size: 0.66rem;
  text-transform: uppercase;
  color: var(--text-muted);
}
[data-layout="classic"] .product-card .name { font-weight: 500; }
[data-layout="classic"] .badge-discount { border-radius: 0; box-shadow: none; }

/* عنوان موسّط بخطّين جانبيين - التوقيع البصري لهذا التخطيط */
[data-layout="classic"] .section-title {
  justify-content: center;
  text-align: center;
  flex-direction: column;
  gap: var(--space-2);
  letter-spacing: 0.02em;
}
[data-layout="classic"] .section-title::before {
  order: 2;
  width: 64px;
  height: 2px;
  border-radius: 0;
  background: var(--text);
}
[data-layout="classic"] .section-title > span { align-items: center; }
[data-layout="classic"] .section-title .link-more { margin: 0; order: 3; }

[data-layout="classic"] .hero-slide { border-radius: 0; }
[data-layout="classic"] .banner-card { border-radius: 0; }

/* ---------- مجلّة (editorial): صور كبيرة وتباعد سخي ---------- */
[data-layout="editorial"] .product-grid { --cols: 3; gap: var(--space-6); }
[data-layout="editorial"] .home-section + .home-section { margin-top: var(--space-8); }

[data-layout="editorial"] .product-card {
  border: 0;
  background: transparent;
  border-radius: 0;
}
[data-layout="editorial"] .product-card:hover { transform: none; box-shadow: none; }
[data-layout="editorial"] .product-card .img-wrap {
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-lg);
}
[data-layout="editorial"] .product-card .body { padding-inline: 0; padding-top: var(--space-3); }
[data-layout="editorial"] .product-card .name { font-size: 1rem; }
[data-layout="editorial"] .product-card .actions { opacity: 0; transition: opacity var(--transition); }
[data-layout="editorial"] .product-card:hover .actions,
[data-layout="editorial"] .product-card:focus-within .actions { opacity: 1; }

[data-layout="editorial"] .section-title {
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-4);
}
[data-layout="editorial"] .section-title::before { display: none; }

[data-layout="editorial"] .hero-slide { min-height: clamp(320px, 44vw, 560px); }

/* ---------- مضغوط (compact): صف أفقي، منتجات أكثر في مساحة أقل ---------- */
[data-layout="compact"] .product-grid { --cols: 2; gap: var(--space-3); }
@media (max-width: 767px) { [data-layout="compact"] .product-grid { --cols: 1 !important; } }

[data-layout="compact"] .product-card { flex-direction: row; align-items: stretch; }
[data-layout="compact"] .product-card:hover { transform: none; box-shadow: var(--shadow-sm); }
[data-layout="compact"] .product-card .img-wrap {
  width: 124px;
  flex-shrink: 0;
  aspect-ratio: auto;
}
[data-layout="compact"] .product-card .body { padding: var(--space-3) var(--space-4); gap: 4px; }
[data-layout="compact"] .product-card .name { font-size: 0.88rem; }
[data-layout="compact"] .product-card .actions { margin-top: auto; }
[data-layout="compact"] .product-card .wishlist-btn { width: 30px; height: 30px; }
[data-layout="compact"] .badge-out-of-stock { font-size: 0.8rem; }

[data-layout="compact"] .section-title { font-size: 1.15rem; margin-top: var(--space-6); }
[data-layout="compact"] .category-strip { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
[data-layout="compact"] .hero-slide { min-height: clamp(190px, 26vw, 320px); }

/* ---------- جريء (bold): خط ثقيل وأسعار كبيرة وتدرّجات ---------- */
[data-layout="bold"] .product-grid { --cols: 4; }

[data-layout="bold"] .product-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
}
[data-layout="bold"] .product-card:hover {
  border-color: var(--primary);
  transform: translateY(-6px);
}
[data-layout="bold"] .product-card .name { font-weight: 900; font-size: 0.95rem; }
[data-layout="bold"] .product-card .price-tag { font-size: 1.25rem; font-weight: 900; }
[data-layout="bold"] .badge-discount {
  background: linear-gradient(135deg, var(--danger), var(--accent));
  font-size: 0.78rem;
  padding: 5px 13px;
}

[data-layout="bold"] .section-title {
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}
[data-layout="bold"] .section-title::before {
  width: 8px;
  height: 32px;
  background: linear-gradient(180deg, var(--accent), var(--primary));
}

[data-layout="bold"] .hero-slide .overlay {
  background: color-mix(in srgb, var(--primary) 88%, transparent);
}
[data-layout="bold"] .hero-slide h1,
[data-layout="bold"] .hero-slide .hero-title { font-size: clamp(1.9rem, 5vw, 3.2rem); font-weight: 900; }

/* صندوق استبدال النقاط في صفحة الدفع */
.points-box {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
}

/* ================================================================
   صفحة نقاط العميل
   ================================================================ */
.points-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark, var(--primary)));
  color: #fff;
  overflow: hidden;
}
.points-hero .label { font-size: 0.86rem; opacity: 0.85; }
.points-hero .value { font-size: 2.4rem; font-weight: 900; line-height: 1.2; }
.points-hero .value small { font-size: 1rem; font-weight: 700; opacity: 0.85; }
.points-hero .sub { font-size: 0.84rem; opacity: 0.85; }
.points-hero .art { font-size: 3.4rem; opacity: 0.28; }

.points-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
}
.points-row .amount {
  font-weight: 900;
  font-size: 1.05rem;
  color: #1f7a4d;
  font-variant-numeric: tabular-nums;
}
.points-row .amount.is-minus { color: #b4232a; }

/* ================================================================
   صفحة الطلب عند العميل
   ================================================================ */
.order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}
.order-head .ident { display: flex; align-items: center; gap: var(--space-3); }
.order-head .ico {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex: 0 0 auto;
}
.order-head .meta { font-size: 0.82rem; color: var(--gray-500); }
.order-head .actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

/* سطر الصنف: صورة + اسم + مبلغ */
.order-line { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0; }
.order-line.has-sep { border-bottom: 1px solid var(--border); }
.order-line .thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  background: var(--gray-100);
  color: var(--gray-400);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
}
.order-line .thumb img { width: 100%; height: 100%; object-fit: cover; }
.order-line .body { flex: 1 1 auto; min-width: 0; }
.order-line .name {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--gray-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-line .name:hover { color: var(--primary); }
.order-line .sub { font-size: 0.8rem; color: var(--gray-500); }
.order-line .amount { font-weight: 800; white-space: nowrap; }

/* خط تتبّع الحالات */
.order-steps { list-style: none; margin: 0; padding: 0; }
.order-steps li { position: relative; display: flex; gap: var(--space-3); padding-bottom: var(--space-4); }
.order-steps li:last-child { padding-bottom: 0; }
.order-steps .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 6px;
  flex: 0 0 auto;
}
/* الخط الواصل بين النقاط، ولا يمتد بعد آخرها */
.order-steps li:not(:last-child)::before {
  content: "";
  position: absolute;
  inset-inline-start: 4.5px;
  top: 16px;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.order-steps li:not(:first-child) .dot { background: var(--gray-300); }

/* ==========================================================================
   البانر الرئيسي على الجوال — الصورة كاملة لا مقصوصة

   الارتفاع الثابت كان يقصّ الصورة: على شاشة ضيقة يصير الإطار أقرب للمربّع
   بينما البانر عريض، فـ cover يملأ الإطار بقصّ طرفَي الصورة. هنا يتبع
   الإطار نسبة الصورة نفسها (تصل من الموديل كـ --banner-ratio)، و contain
   يضمن ظهورها كاملة حتى لو اختلفت نسب البنرات داخل الشريط الواحد.

   موضعه آخر الملف عمدًا: أنماط [data-layout] تفرض ارتفاعات خاصة بكل تخطيط،
   وهي أقوى تخصيصًا، فلا يُلغى أثرها إلا بقاعدة بمثل قوتها بعدها.
   ========================================================================== */
@media (max-width: 767.98px) {
  .hero-slider.is-slider,
  .hero-slider .hero-slide,
  [data-layout] .hero-slider.is-slider,
  [data-layout] .hero-slider .hero-slide {
    min-height: 0;
    aspect-ratio: var(--banner-ratio, 3 / 1);
  }

  [data-layout] .hero-slider .hero-slide,
  .hero-slider .hero-slide {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: var(--gray-100);
    align-items: flex-end;
  }

  /* البانر العريض يصير شريطًا قصيرًا على شاشة ضيقة، فلا يتّسع للوح النص فوقه.
     الحدّ الأدنى يُمنح لمن يحمل نصًا فقط، ليبقى البانر الصامت بلا هوامش. */
  .hero-slider.has-text,
  .hero-slider.has-text .hero-slide,
  [data-layout] .hero-slider.has-text,
  [data-layout] .hero-slider.has-text .hero-slide { min-height: 215px; }

  /* لوح النص يتقلّص ويلتصق بالأسفل ليبقى أكبر قدر من الصورة ظاهرًا */
  [data-layout] .hero-slide .overlay,
  .hero-slide .overlay {
    margin: var(--space-2);
    padding: var(--space-3) var(--space-4);
    max-width: calc(100% - var(--space-2) * 2);
  }
  /* بطاقات شبكة البنرات تُعامل بالمنطق نفسه، ولكلٍّ نسبتها لأنها لا تتراكب */
  .banner-card {
    min-height: 0;
    aspect-ratio: var(--banner-ratio, 3 / 1);
    background-size: contain;
    background-repeat: no-repeat;
    background-color: var(--gray-100);
  }
  .banner-card.has-text { min-height: 175px; }

  .hero-slide h1,
  .hero-slide .hero-title { font-size: 1.15rem; margin-bottom: var(--space-1); }
  .hero-slide p { font-size: 0.86rem; margin-bottom: var(--space-2); }
  .hero-slide .overlay .btn-primary-custom { padding: 8px 16px; font-size: 0.86rem; }
  .hero-dots { bottom: var(--space-2); }

  /* متصفّح لا يعرف aspect-ratio سيبقى بارتفاع صفر لأننا ألغينا min-height،
     أي بانر مختفٍ تمامًا. الارتفاع الثابت يعود له وحده. */
  @supports not (aspect-ratio: 3 / 1) {
    .hero-slider.is-slider,
    .hero-slider .hero-slide,
    [data-layout] .hero-slider.is-slider,
    [data-layout] .hero-slider .hero-slide { min-height: 200px; }
    .banner-card { min-height: 175px; }
  }
}

/* ==========================================================================
   الوضع الليلي: ترويض أدوات Bootstrap

   المتجر يلوّن نفسه بمتغيّراته، لكن صفحات الحساب تستعمل أدوات Bootstrap
   المباشرة (bg-white، table، form-control، text-muted) وقيمها بيضاء ثابتة،
   فكان النص الفاتح يقع على خلفية بيضاء = نص غير مقروء في الوضع الليلي.

   نضبط متغيّرات Bootstrap نفسها لا كل مكوّن على حدة، ثم نُبطل bg-white
   وحدها لأنها لون مكتوب بـ !important لا متغيّر.
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bs-body-bg: var(--body-bg);
    --bs-body-color: var(--text);
    --bs-emphasis-color: var(--gray-900);
    --bs-secondary-color: var(--text-muted);
    --bs-secondary-bg: var(--surface);
    --bs-tertiary-bg: var(--gray-100);
    --bs-border-color: var(--border);
    --bs-heading-color: var(--gray-900);
  }

  :root:not([data-theme="light"]) .bg-white { background: var(--surface) !important; }
  :root:not([data-theme="light"]) .text-muted { color: var(--text-muted) !important; }
  :root:not([data-theme="light"]) .form-control,
  :root:not([data-theme="light"]) .form-select,
  :root:not([data-theme="light"]) .dropdown-menu,
  :root:not([data-theme="light"]) .modal-content,
  :root:not([data-theme="light"]) .list-group-item,
  :root:not([data-theme="light"]) .card {
    background-color: var(--surface);
    color: var(--text);
    border-color: var(--border);
  }
  :root:not([data-theme="light"]) .dropdown-item { color: var(--text); }
  :root:not([data-theme="light"]) .dropdown-item:hover,
  :root:not([data-theme="light"]) .dropdown-item:focus {
    background-color: var(--gray-100);
    color: var(--text);
  }
  :root:not([data-theme="light"]) .table { --bs-table-color: var(--text); --bs-table-bg: transparent; }
  :root:not([data-theme="light"]) .btn-close { filter: invert(1) grayscale(1) brightness(2); }
  :root:not([data-theme="light"]) .border,
  :root:not([data-theme="light"]) .border-top,
  :root:not([data-theme="light"]) .border-bottom,
  :root:not([data-theme="light"]) .border-start,
  :root:not([data-theme="light"]) .border-end { border-color: var(--border) !important; }
}

:root[data-theme="dark"] {
  --bs-body-bg: var(--body-bg);
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--gray-900);
  --bs-secondary-color: var(--text-muted);
  --bs-secondary-bg: var(--surface);
  --bs-tertiary-bg: var(--gray-100);
  --bs-border-color: var(--border);
  --bs-heading-color: var(--gray-900);
}

:root[data-theme="dark"] .bg-white { background: var(--surface) !important; }
:root[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }
:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .form-select,
:root[data-theme="dark"] .dropdown-menu,
:root[data-theme="dark"] .modal-content,
:root[data-theme="dark"] .list-group-item,
:root[data-theme="dark"] .card {
  background-color: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
:root[data-theme="dark"] .dropdown-item { color: var(--text); }
:root[data-theme="dark"] .dropdown-item:hover,
:root[data-theme="dark"] .dropdown-item:focus {
  background-color: var(--gray-100);
  color: var(--text);
}
:root[data-theme="dark"] .table { --bs-table-color: var(--text); --bs-table-bg: transparent; }
:root[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(2); }
:root[data-theme="dark"] .border,
:root[data-theme="dark"] .border-top,
:root[data-theme="dark"] .border-bottom,
:root[data-theme="dark"] .border-start,
:root[data-theme="dark"] .border-end { border-color: var(--border) !important; }
