/* ================================================================
   رفد / RAFD — نظام التصميم الكامل
   Mobile-first · تطبيق احترافي على الهاتف والآيباد والكمبيوتر
   ================================================================ */

/* ──────────────────────────────────────────
   1. متغيرات النظام (Light / Dark)
────────────────────────────────────────── */
:root {
  /* الألوان الأساسية */
  --blue:     #1B4DAF;
  --blue-dk:  #143A85;
  --blue-el:  #2563EB;
  --sky:      #0EA5E9;
  --red:      #DC2626;
  --green:    #16a34a;
  --gold:     #F59E0B;
  --purple:   #6366F1;

  /* الواجهة */
  --ink:    #1F2937;
  --paper:  #FFFFFF;
  --mist:   #F4F6FB;
  --line:   #E5E9F0;
  --sub:    #6B7280;
  --card-r: 18px;

  /* الظل */
  --shadow-sm: 0 1px 6px rgba(27,77,175,.07);
  --shadow:    0 4px 20px rgba(27,77,175,.09);
  --shadow-md: 0 8px 30px rgba(27,77,175,.13);
  --shadow-lg: 0 16px 48px rgba(27,77,175,.18);
}

[data-theme="dark"] {
  --blue:    #3B82F6;
  --blue-dk: #2563EB;
  --blue-el: #60A5FA;
  --sky:     #38BDF8;
  --ink:     #F3F4F6;
  --paper:   #161A23;
  --mist:    #0E1118;
  --line:    #2A3040;
  --sub:     #9CA3B4;
  --shadow:  0 6px 24px rgba(0,0,0,.4);
  --shadow-md: 0 10px 36px rgba(0,0,0,.5);
}

/* ──────────────────────────────────────────
   2. إعادة التعيين الشامل
────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* تحسين التمرير على iOS */
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--mist);
  color: var(--ink);
  line-height: 1.55;
  overflow-x: hidden;
  /* تسريع الانتقالات بالـ GPU */
  transition: background .3s, color .3s;
  /* دعم Safe Area للـ iPhone ذو الشق */
  padding-bottom: env(safe-area-inset-bottom);
}

a    { color: inherit; text-decoration: none; }
img  { max-width: 100%; height: auto; display: block; }
ul   { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* منع تكبير الحقول في iOS — أهم من أي شيء */
@media (max-width: 1024px) {
  input, textarea, select { font-size: 16px !important; }
}

/* ──────────────────────────────────────────
   3. الحاوية
────────────────────────────────────────── */
.wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(12px, 3vw, 24px);
}

/* ──────────────────────────────────────────
   4. الأزرار
────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--blue);
  color: #fff;
  border-radius: 12px;
  padding: 11px 20px;
  font-weight: 700;
  font-size: 14.5px;
  min-height: 44px;
  /* tap target لـ iOS */
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  /* تأثيرات */
  box-shadow: 0 4px 14px rgba(27,77,175,.22);
  transition: transform .14s, box-shadow .14s, background .14s, opacity .14s;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}
.btn:hover    { transform: translateY(-1px); box-shadow: var(--shadow-md); background: var(--blue-dk); }
.btn:active   { transform: translateY(1px); box-shadow: none; opacity: .88; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* variants */
.btn--ghost {
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line);
}
.btn--ghost:hover { background: var(--mist); box-shadow: inset 0 0 0 1.5px var(--blue); color: var(--blue); }

.btn--block { width: 100%; }
.btn--ink   { background: var(--ink); box-shadow: none; }
.btn--sm    { min-height: 36px; font-size: 13px; padding: 7px 14px; border-radius: 9px; }
.btn--lg    { min-height: 52px; font-size: 16px; padding: 14px 28px; border-radius: 14px; }

/* ──────────────────────────────────────────
   5. البطاقات
────────────────────────────────────────── */
.card {
  background: var(--paper);
  border-radius: var(--card-r);
  border: 1px solid var(--line);
  overflow: hidden;
  /* GPU compositing للأنيميشن */
  will-change: transform;
  transition: box-shadow .2s, transform .2s;
}
.card:not(.no-hover):hover {
  box-shadow: var(--shadow-md);
}

/* ──────────────────────────────────────────
   6. حقول الإدخال
────────────────────────────────────────── */
.input {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  padding: 0 14px;
  font-size: 15px;
  outline: none;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
  /* نفس الأيباد والجوال */
  -webkit-appearance: none;
  appearance: none;
}
.input:focus {
  border-color: var(--blue-el);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea.input {
  padding: 12px 14px;
  min-height: 90px;
  resize: vertical;
  line-height: 1.65;
}
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 36px;
  cursor: pointer;
}
.label { font-size: 13.5px; font-weight: 700; margin-bottom: 6px; display: block; color: var(--ink); }
.field { margin-bottom: 14px; }

/* ──────────────────────────────────────────
   7. الشبكات
────────────────────────────────────────── */
/* شبكة المنتجات */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, 1fr);
}
.grid--main { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1200px) { .grid              { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1024px) { .grid--main        { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 880px)  { .grid              { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
@media (max-width: 420px)  {
  .grid, .grid--main { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* ──────────────────────────────────────────
   8. الهيدر
────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 12px rgba(27,77,175,.06);
  /* blur للجوال */
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* شريط البحث */
.search-bar {
  display: flex;
  flex: 1;
  max-width: 520px;
}
.search-bar input {
  flex: 1;
  min-height: 44px;
  border-radius: 11px 0 0 11px;
  border-inline-end: none;
  background: var(--mist);
}
.search-bar button {
  width: 50px;
  min-height: 44px;
  background: var(--blue);
  color: #fff;
  border-radius: 0 11px 11px 0;
  font-size: 18px;
  display: grid;
  place-items: center;
  transition: background .15s;
}
.search-bar button:hover { background: var(--blue-dk); }

/* ──────────────────────────────────────────
   9. التنقل السفلي (شريط التطبيق)
────────────────────────────────────────── */
.bnav {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 40;
  background: var(--paper);
  border-top: 1px solid var(--line);
  display: none; /* يُفعَّل بـ .mob */
  padding: 4px 0 calc(4px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(27,77,175,.08);
  /* blur احترافي */
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
}
.bnav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--sub);
  padding: 6px 4px;
  text-decoration: none;
  transition: color .15s;
  min-height: 52px;
  justify-content: center;
}
.bnav a .nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform .2s;
}
.bnav a.on { color: var(--blue); }
.bnav a.on .nav-icon { transform: scale(1.18); }
.bnav a:active .nav-icon { transform: scale(.9); }

/* badge للسلة */
.bnav-badge {
  position: absolute;
  top: 2px;
  inset-inline-start: calc(50% + 6px);
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 2px solid var(--paper);
  padding: 0 3px;
}

/* ──────────────────────────────────────────
   10. التخطيط الرئيسي للمتجر
────────────────────────────────────────── */
.shop-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 22px;
  align-items: start;
}
.shop-side { position: sticky; top: 130px; }
.side-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
  box-shadow: var(--shadow-sm);
}
.side-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--sub);
  padding: 6px 10px 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}
.side-link span { font-size: 18px; }
.side-link:hover { background: var(--mist); }
.side-link.on {
  background: #EAF0FB;
  color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

/* ──────────────────────────────────────────
   11. شارات وعلامات
────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
}
.tag--red  { background: var(--red);  color: #fff; }
.tag--gold { background: #fff7e0; color: #9a6b00; }
.tag--ink  { background: var(--ink);  color: #fff; }
.tag--blue { background: #EFF4FF; color: var(--blue); }

.chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 700;
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, box-shadow .15s;
}
.chip:hover, .chip.on {
  background: var(--blue);
  color: #fff;
  box-shadow: none;
}

/* تبويبات لوحة التحكم */
.atab {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  background: var(--mist);
  color: var(--sub);
  text-decoration: none;
  transition: background .12s, color .12s;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.atab.on { background: var(--blue); color: #fff; }
.atab:hover:not(.on) { background: var(--line); color: var(--ink); }

/* ──────────────────────────────────────────
   12. Hero
────────────────────────────────────────── */
.hero {
  background: linear-gradient(115deg, var(--blue-dk) 0%, #1B4DAF 55%, var(--blue-el) 140%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 80% 50%, rgba(37,99,235,.4) 0%, transparent 70%);
  pointer-events: none;
}
.hero-in {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 28px;
  align-items: center;
  padding: clamp(38px, 7vw, 64px) 0;
}

/* ──────────────────────────────────────────
   13. بطاقة المنتج
────────────────────────────────────────── */
.card--featured {
  border: 2px solid var(--gold);
  box-shadow: 0 6px 24px rgba(245,159,28,.18);
}

/* ──────────────────────────────────────────
   14. العروض السريعة (Flash Deals)
────────────────────────────────────────── */
.flash-wrap {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  align-items: start;
}
.flash-timer {
  background: linear-gradient(160deg, var(--blue), #2563EB);
  border-radius: 16px;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: #fff;
  box-shadow: 0 6px 20px rgba(27,77,175,.25);
  position: sticky;
  top: 130px;
}
.flash-cd { display: flex; align-items: center; gap: 5px; justify-content: center; }
.fcd-box {
  background: rgba(255,255,255,.18);
  border-radius: 10px;
  padding: 9px 7px;
  text-align: center;
  min-width: 46px;
}
.fcd-box span  { font-size: 21px; font-weight: 900; line-height: 1; display: block; }
.fcd-box small { font-size: 10px; opacity: .85; margin-top: 3px; display: block; }
.fcd-sep { font-size: 18px; font-weight: 900; opacity: .5; }
.flash-products { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }

/* ──────────────────────────────────────────
   15. المزادات
────────────────────────────────────────── */
.auction-card {
  transition: transform .2s, box-shadow .2s;
  will-change: transform;
}
.auction-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e; display: inline-block;
  box-shadow: 0 0 0 0 rgba(34,197,94,.5);
  animation: livePulse 1.4s infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0   rgba(34,197,94,.5); }
  70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0);  }
  100% { box-shadow: 0 0 0 0   rgba(34,197,94,0);  }
}
.count-box {
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
  min-width: 50px;
}
.count-box b     { font-size: 19px; font-weight: 800; display: block; line-height: 1; }
.count-box small { font-size: 10px; color: #aab4d0; }

/* ──────────────────────────────────────────
   16. البنر/سلايدر
────────────────────────────────────────── */
.banslide {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 2.77 / 1;
  box-shadow: var(--shadow-lg);
}
.ban-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform .48s cubic-bezier(.4,0,.2,1);
  direction: ltr;
}
.ban-item { flex: 0 0 100%; width: 100%; height: 100%; direction: rtl; }

/* ──────────────────────────────────────────
   17. التذييل
────────────────────────────────────────── */
.site-footer {
  background: var(--ink);
  color: #C9D4EC;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 24px;
  padding: clamp(28px, 5vw, 44px) 0;
}
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.09);
  padding: 16px 0;
  text-align: center;
  font-size: 12.5px;
}

/* ──────────────────────────────────────────
   18. إظهار / إخفاء حسب الجهاز
────────────────────────────────────────── */
@media (max-width: 820px) { .desk { display: none !important; } }
@media (min-width: 821px) { .mob  { display: none !important; } }

/* ──────────────────────────────────────────
   19. الأدوات المساعدة
────────────────────────────────────────── */
/* تمرير أفقي ناعم */
.scroll-x {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.scroll-x > * { scroll-snap-align: start; }
.scroll-x::-webkit-scrollbar { display: none; }

/* قطع النص */
.clamp1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* overlay */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10,16,36,.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
}

/* Modal */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(10,16,36,.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--paper);
  border-radius: 20px;
  width: min(480px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: popIn .28s cubic-bezier(.4,0,.2,1);
}

/* أيقونة صغيرة قابلة للنقر */
.imini {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--mist);
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: grid;
  place-items: center;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  transition: background .12s;
}
.imini:hover { background: var(--line); }

/* صف لوحة التحكم */
.arow {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

/* ──────────────────────────────────────────
   20. الرسوم المتحركة
────────────────────────────────────────── */
@keyframes slideUp  { from { transform: translateY(22px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn    { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pulse    { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes shimmer  {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

.anim-up   { animation: slideUp .3s cubic-bezier(.4,0,.2,1) both; }
.anim-in   { animation: fadeIn .25s ease both; }
.pulse     { animation: pulse 1.4s ease infinite; }
.anim-down { animation: slideDown .3s cubic-bezier(.4,0,.2,1); }

/* Shimmer للتحميل */
.shimmer {
  background: linear-gradient(90deg, var(--mist) 25%, var(--line) 50%, var(--mist) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease infinite;
  border-radius: 8px;
}

/* Toast */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-18px);
  z-index: 10000;
  background: linear-gradient(120deg, #16a34a, #22c55e);
  color: #fff;
  font-weight: 800;
  font-size: 14.5px;
  padding: 12px 24px;
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(22,163,74,.4);
  opacity: 0;
  transition: opacity .35s, transform .35s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ──────────────────────────────────────────
   21. أيقونات عائمة (FAB)
────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  inset-inline-start: 18px;
  z-index: 35;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--blue-el));
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 20px rgba(27,77,175,.35);
  border: 2px solid rgba(255,255,255,.25);
  cursor: pointer;
  transition: transform .18s, box-shadow .18s;
  font-size: 24px;
}
.fab:hover  { transform: scale(1.08); box-shadow: var(--shadow-lg); }
.fab:active { transform: scale(.95); }

/* ──────────────────────────────────────────
   22. لوحة التحكم — Dashboard
────────────────────────────────────────── */
.dash-kpi   { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.kpi        { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; box-shadow: var(--shadow-sm); }
.kpi:hover  { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-ic     { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; flex-shrink: 0; }
.kpi-n      { font-size: 24px; font-weight: 900; line-height: 1; color: var(--ink); }
.kpi-l      { font-size: 12px; color: var(--sub); font-weight: 600; margin-top: 4px; }
.rev-grid   { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.rev-c      { border-radius: 16px; padding: 22px; color: #fff; box-shadow: 0 8px 24px rgba(27,77,175,.18); }
.rev-lbl    { font-size: 13px; opacity: .9; font-weight: 600; margin-bottom: 6px; }
.rev-val    { font-size: 26px; font-weight: 900; line-height: 1; margin-bottom: 4px; }
.rev-sub    { font-size: 12px; opacity: .8; }
.ost-row    { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px; }
.ost        { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; padding: 14px 10px; text-align: center; text-decoration: none; transition: transform .15s; }
.ost:hover  { transform: translateY(-2px); }
.ost-n      { font-size: 26px; font-weight: 900; line-height: 1; }
.ost-l      { font-size: 12px; color: var(--sub); font-weight: 700; margin-top: 5px; }
.charts3    { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.dp         { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow-sm); }
.dp-h       { font-size: 15px; font-weight: 800; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.dp-h a     { font-size: 12px; color: var(--blue); font-weight: 700; text-decoration: none; }
.dp-empty   { text-align: center; padding: 24px; color: var(--sub); font-size: 13.5px; }
.dash-2     { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; margin-bottom: 20px; }
.d-row      { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.d-row:last-child { border-bottom: none; }
.warn-bar   { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 13px 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 13.5px; text-decoration: none; }
/* قسم الإدارة */
.dash-panel       { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow-sm); }
.dash-panel-head  { margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.dash-panel-head h3 { font-size: 15px; font-weight: 800; }
.dash-panel-head a  { font-size: 12.5px; color: var(--blue); font-weight: 700; }
.dash-empty       { text-align: center; padding: 28px 10px; color: var(--sub); font-size: 13.5px; }
.dash-line        { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.dash-line:last-child { border-bottom: none; }
.dash-cols        { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 22px; }
.dash-rev         { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 22px; }
.rev-card         { border-radius: 18px; padding: 24px; color: #fff; box-shadow: 0 8px 24px rgba(27,77,175,.18); }
.stat-card        { display: flex; align-items: center; gap: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; box-shadow: var(--shadow-sm); }
.stat-card:hover  { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-ic          { width: 50px; height: 50px; border-radius: 13px; display: grid; place-items: center; font-size: 24px; flex-shrink: 0; }
.stat-num         { font-size: 26px; font-weight: 900; line-height: 1; }
.stat-lbl         { font-size: 12.5px; color: var(--sub); font-weight: 600; margin-top: 5px; }
.dash-grid        { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }

/* ──────────────────────────────────────────
   23. المساعد
────────────────────────────────────────── */
@keyframes bd {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}
.assistant-fab         { transition: transform .15s; }
.assistant-fab:hover   { transform: scale(1.06); }

/* ──────────────────────────────────────────
   24. Promo Cards
────────────────────────────────────────── */
.promo {
  border-radius: 16px;
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: center;
  min-height: 78px;
  color: #fff;
  text-decoration: none;
}
.promo b     { display: block; font-size: 16px; font-weight: 800; }
.promo span  { font-size: 12.5px; opacity: .9; }

/* ──────────────────────────────────────────
   25. إمكانية الوصول (Accessibility)
────────────────────────────────────────── */
:focus-visible {
  outline: 2.5px solid var(--blue-el);
  outline-offset: 3px;
  border-radius: 4px;
}

/* تحسين اللمس على الشاشات اللمسية */
@media (hover: none) and (pointer: coarse) {
  .btn, .chip, .atab, .imini, .bnav a {
    min-height: 44px;
    -webkit-tap-highlight-color: rgba(27,77,175,.14);
  }
  /* إزالة hover effects المربكة على اللمس */
  .card:not(.no-hover):hover { box-shadow: var(--shadow-sm); }
  .btn:hover { transform: none; }
  .kpi:hover, .ost:hover, .stat-card:hover { transform: none; }
}

/* ──────────────────────────────────────────
   26. تفضيلات تقليل الحركة
────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ──────────────────────────────────────────
   27. ═══ Breakpoints (Mobile First) ═══
────────────────────────────────────────── */

/* ── الهاتف الصغير < 400px ── */
@media (max-width: 399px) {
  .wrap    { padding: 0 10px; }
  .banslide { border-radius: 14px; aspect-ratio: 4/3; }
  .hero-in { grid-template-columns: 1fr; padding: 28px 0; }
  .hero-in .desk { display: none !important; }
  .grid, .grid--main { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .flash-wrap { grid-template-columns: 1fr; }
  .flash-timer { position: static; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 14px; }
  .flash-products { grid-template-columns: repeat(2, 1fr); gap: 9px; }
}

/* ── الهاتف العادي 400–767px ── */
@media (max-width: 767px) {
  /* الهيدر */
  .search-bar { display: none; }

  /* المتجر: الشريط الجانبي يتحول لتمرير أفقي */
  .shop-layout { grid-template-columns: 1fr; gap: 14px; }
  .shop-side   { position: static; }
  .side-box {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px;
    scrollbar-width: none;
    border-radius: 14px;
  }
  .side-box::-webkit-scrollbar { display: none; }
  .side-title { display: none; }
  .side-link {
    flex-direction: column;
    gap: 4px;
    min-width: 68px;
    text-align: center;
    font-size: 11.5px;
    padding: 9px 7px;
    margin-bottom: 0;
    white-space: nowrap;
    border-radius: 10px;
  }
  .side-link span { font-size: 22px; }
  .side-link.on { box-shadow: none; }

  /* Hero */
  .hero-in { grid-template-columns: 1fr; padding: 30px 0 34px; }
  .hero-in .desk { display: none !important; }

  /* البنر */
  .banslide { aspect-ratio: 16/10; border-radius: 16px; }

  /* الشبكة */
  .grid--main { grid-template-columns: repeat(2, 1fr); gap: 11px; }

  /* العروض */
  .flash-wrap { grid-template-columns: 1fr; }
  .flash-timer { position: static; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 16px; }
  .flash-products { grid-template-columns: repeat(2, 1fr); gap: 11px; }

  /* التذييل */
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 20px; }

  /* شريط التنقل السفلي: يظهر */
  .bnav { display: flex; }

  /* مسافة سفلية لتجنب الشريط */
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }

  /* لوحة تحكم */
  .dash-kpi   { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .rev-grid   { grid-template-columns: 1fr; }
  .ost-row    { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .charts3    { grid-template-columns: 1fr; }
  .dash-2     { grid-template-columns: 1fr; }
  .dash-cols  { grid-template-columns: 1fr; }
  .dash-grid  { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dash-rev   { grid-template-columns: 1fr; }

  /* تذاكر الدعم */
  #tab-orders, #tab-bids, #tab-notifs, #tab-tickets, #tab-tier { font-size: 13.5px; }

  /* صفحة المنتج: عمود واحد */
  #pd { grid-template-columns: 1fr !important; }
}

/* ── الآيباد العمودي 768–1023px ── */
@media (min-width: 768px) and (max-width: 1023px) {
  .wrap { padding: 0 20px; }

  /* Hero محسوب */
  .hero-in { padding: 42px 0 48px; gap: 20px; }

  /* المتجر: الشريط الجانبي أضيق */
  .shop-layout  { grid-template-columns: 200px 1fr; gap: 18px; }

  /* الشبكة: 2-3 أعمدة */
  .grid         { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .grid--main   { grid-template-columns: repeat(2, 1fr); }

  /* البنر */
  .banslide     { border-radius: 18px; }

  /* العروض */
  .flash-wrap     { grid-template-columns: 200px 1fr; }
  .flash-products { grid-template-columns: repeat(2, 1fr); }

  /* التذييل */
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; gap: 20px; }
  /* العمود الرابع ينضم للثالث */
  .footer-grid > *:last-child { grid-column: 3; grid-row: 1 / 3; display: none; }

  /* الشريط السفلي: يظهر على الآيباد أيضاً */
  .bnav { display: flex; }
  body  { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }

  /* لوحة التحكم */
  .dash-kpi   { grid-template-columns: repeat(2, 1fr); }
  .rev-grid   { grid-template-columns: repeat(2, 1fr); }
  .ost-row    { grid-template-columns: repeat(3, 1fr); }
  .charts3    { grid-template-columns: repeat(2, 1fr); }
  .dash-2     { grid-template-columns: 1.2fr 1fr; }
  .dash-grid  { grid-template-columns: repeat(2, 1fr); }

  /* صفحة المنتج: عمود واحد */
  #pd { grid-template-columns: 1fr !important; }
}

/* ── الآيباد الأفقي 1024–1199px ── */
@media (min-width: 1024px) and (max-width: 1199px) {
  .grid       { grid-template-columns: repeat(3, 1fr); }
  .grid--main { grid-template-columns: repeat(3, 1fr); }
  .shop-layout { grid-template-columns: 218px 1fr; }
  .dash-kpi   { grid-template-columns: repeat(3, 1fr); }
  .rev-grid   { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; }
  .footer-grid > *:last-child { display: none; }
}

/* ── الكمبيوتر 1200px+ ── */
@media (min-width: 1200px) {
  .grid       { grid-template-columns: repeat(4, 1fr); }
  .grid--main { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
}

/* ──────────────────────────────────────────
   28. أنماط خاصة
────────────────────────────────────────── */

/* منع تجاوز المحتوى */
img, video, iframe { max-width: 100%; }
.card { overflow-wrap: anywhere; word-break: break-word; }

/* نموذج الدفع */
.pay-option label {
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.pay-option label:has(input:checked),
.wallet-opt:has(input:checked) {
  border-color: var(--blue);
  background: #EFF4FF;
}

/* سياسات */
.policy-content { font-size: 15px; line-height: 2; max-width: 720px; }

/* Trust badges */
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

/* مستوى العضوية */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
}

/* التذاكر */
.ticket-msg-member {
  background: var(--mist);
  border-radius: 4px 14px 14px 14px;
}
.ticket-msg-admin {
  background: linear-gradient(135deg, var(--blue), var(--blue-el));
  color: #fff;
  border-radius: 14px 4px 14px 14px;
}

/* Admin panel */
.admin    { display: flex; min-height: 100vh; }
.side     { width: 252px; background: var(--ink); color: #cbd5e1; flex-shrink: 0; position: fixed; top: 0; bottom: 0; right: 0; overflow-y: auto; z-index: 50; transition: transform .25s cubic-bezier(.4,0,.2,1); }
.main     { margin-right: 252px; flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar   { background: var(--paper); border-bottom: 1px solid var(--line); padding: 0 22px; height: 64px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30; }
.main-body { padding: clamp(14px, 3vw, 24px); flex: 1; }

@media (max-width: 900px) {
  .side       { transform: translateX(252px); }
  .side.open  { transform: translateX(0); }
  .main       { margin-right: 0; }
  .mob-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 49;
  }
  .mob-overlay.show { display: block; }
  .main-body  { padding: 12px; }
}

/* صفحة الصيانة */
.maintenance-page {
  font-family: 'Cairo', sans-serif;
  background: linear-gradient(135deg, var(--blue-dk), var(--blue));
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* DB Manager */
.dbm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 24px; }
.dbm-stat { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; padding: 14px; text-align: center; }
.op-card  { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 10px; }
.op-form  { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 900px) {
  .dbm-grid { grid-template-columns: repeat(2, 1fr); }
}
