/* =============================================================================
   سنابل الخير هايبر ماركت — ملف التنسيقات الرئيسي (style.css)
   المتغيرات (Design Tokens) وتنسيقات السوبرماركت الرقمي عالي الجودة
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. متغيرات التصميم (Design Tokens) — النمط الفاتح (الافتراضي) والداكن
   ----------------------------------------------------------------------------- */
:root {
  /* ألوان الهوية الرئيسية لسنابل الخير */
  --color-primary: #008738;           /* أخضر الهايبر ماركت المشرق */
  --color-primary-hover: #00702e;     /* أخضر أغمق للتفاعل والتحويم */
  --color-primary-light: #e6f6ec;     /* خلفيات ناعمة بلون الهوية */
  --color-secondary: #ffc800;         /* أصفر سنابل الخير الذهبي */
  --color-secondary-hover: #e5b300;   /* أصفر أغمق للتفاعل */
  --color-secondary-light: #fff9e6;   /* خلفية العروض والشارات */
  
  /* ألوان الحالة والتنبيهات */
  --color-accent-offer: #d92d20;      /* أحمر الخصومات وتوفير المهرجان */
  --color-accent-offer-bg: #fee4e2;   /* خلفية بادج الخصم */
  --color-success: #12b76a;           /* أخضر النجاح وحالة مفتوح */
  --color-warning: #f79009;           /* برتقالي التحذير */
  --color-danger: #f04438;            /* أحمر الخطأ والإغلاق */

  /* ألوان السطح والخلفيات (النمط الفاتح) */
  --bg-body: #f8faf9;                 /* خلفية الصفحة العامة المريحة */
  --bg-surface: #ffffff;              /* خلفية البطاقات والقوائم */
  --bg-surface-subtle: #f2f5f3;       /* خلفيات ثانوية للرماديات الخفيفة */
  --bg-overlay: rgba(15, 23, 42, 0.6);/* تعتيم المودال والخلفيات */

  /* ألوان النصوص والتباين */
  --text-main: #101828;               /* النص الأساسي فائق الوضوح */
  --text-muted: #475467;              /* النص الثانوي والأوصاف */
  --text-subtle: #667085;             /* التلميحات والأرقام القديمة */
  --text-inverse: #ffffff;            /* النص فوق الألوان الداكنة */

  /* الحدود والظلال */
  --border-color: #e4e7ec;            /* فواصل وبطاقات */
  --border-focus: #008738;            /* تحديد لوحة المفاتيح والتركيز */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.1), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
  --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* الخطوط والمسافات والحواف */
  --font-family: 'Readex Pro', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* قياسات الوصول اللمسي */
  --touch-min: 44px;
  --transition-fast: 160ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* -----------------------------------------------------------------------------
   النمط الداكن الفاخر (Dark Theme) — يتم تفعيله عند data-theme="dark"
   ----------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg-body: #0d1410;
  --bg-surface: #151e18;
  --bg-surface-subtle: #1c2720;
  --bg-overlay: rgba(0, 0, 0, 0.75);

  --text-main: #f0f4f2;
  --text-muted: #98a2b3;
  --text-subtle: #667085;
  --text-inverse: #0d1410;

  --border-color: #243329;
  --color-primary-light: #163321;
  --color-secondary-light: #332b12;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 16px -4px rgba(0, 0, 0, 0.6);
  --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.8);
}

/* -----------------------------------------------------------------------------
   2. إعادة الضبط والتأسيس العام (CSS Reset & Base)
   ----------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  font-family: var(--font-family);
  background-color: var(--bg-body);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  line-height: 1.5;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

img, svg {
  display: block;
  max-width: 100%;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* تركيز لوحة المفاتيح للمتاحية */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* -----------------------------------------------------------------------------
   3. الأزرار العامة وعناصر التحكم
   ----------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  min-height: var(--touch-min);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--color-secondary);
  color: #101828;
  font-weight: 700;
}

.btn-secondary:hover {
  background-color: var(--color-secondary-hover);
}

.btn-subtle {
  padding: 8px 14px;
  background-color: var(--bg-surface-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-subtle:hover {
  background-color: var(--border-color);
}

.btn-subtle.btn-wa {
  background-color: #25d366;
  color: #ffffff;
  border-color: #25d366;
}

/* -----------------------------------------------------------------------------
   4. شاشة التحميل (App Loader)
   ----------------------------------------------------------------------------- */
.app-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.loader-cart-icon {
  width: 56px;
  height: 56px;
  color: var(--color-primary);
  margin-bottom: 16px;
  animation: bounce 1.4s infinite ease-in-out;
}

.loader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

.loader-msg {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* -----------------------------------------------------------------------------
   5. شاشة اختيار الفرع (Branch Selection Screen)
   ----------------------------------------------------------------------------- */
.branch-screen {
  min-height: 100vh;
  background: radial-gradient(circle at top right, var(--color-primary-light) 0%, var(--bg-body) 65%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.branch-container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

.branch-header {
  text-align: center;
  margin-bottom: 32px;
}

.branch-logo-wrap {
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  padding: 6px;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 2px solid var(--color-secondary);
}

.branch-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-lg);
}

.branch-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 6px;
}

.branch-tagline {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.branch-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 28px;
}

@media (min-width: 600px) {
  .branch-cards-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.branch-card {
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.branch-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.branch-card-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background-color: var(--color-secondary-light);
  color: #946800;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-secondary);
}

.branch-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 14px;
}

.branch-card-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

.branch-card-area {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.4;
  min-height: 38px;
}

.branch-actions-row {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-select-branch {
  width: 100%;
  min-height: 46px;
}

.btn-branch-direct-call {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border: 1px dashed var(--border-color);
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-branch-direct-call:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.branch-quick-contact {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  border: 1px solid var(--border-color);
  text-align: center;
}

.quick-contact-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.quick-phones-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* -----------------------------------------------------------------------------
   6. شاشات الأخطاء والخدمة متوقفة
   ----------------------------------------------------------------------------- */
.error-screen, .paused-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.error-content, .paused-content {
  max-width: 440px;
  background: var(--bg-surface);
  padding: 32px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.error-icon, .paused-icon {
  font-size: 3rem;
  margin-bottom: 14px;
}

.error-title, .paused-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.error-desc, .paused-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* -----------------------------------------------------------------------------
   7. التطبيق الرئيسي — الترويسة والبانرات (Header & Banners)
   ----------------------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

.header-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-start {
  display: flex;
  align-items: center;
  gap: 10px;
}

.store-logo {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

.store-text {
  display: flex;
  flex-direction: column;
}

.store-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.store-branch-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-header-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 38px;
  transition: all var(--transition-fast);
}

.btn-header-action svg {
  width: 16px;
  height: 16px;
  color: var(--color-primary);
}

.btn-header-action:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.btn-header-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.btn-header-icon svg {
  width: 18px;
  height: 18px;
}

.btn-header-icon:hover {
  background: var(--border-color);
}

/* البانرات */
.banner {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.banner-inner {
  max-width: 1200px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.banner-announcement {
  background-color: var(--color-secondary-light);
  color: #7a5400;
  border-bottom: 1px solid #ffe58f;
}

.banner-status {
  background-color: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.open {
  background-color: var(--color-success);
  box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.2);
}

.status-dot.closed {
  background-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(240, 68, 56, 0.2);
}

/* شريط البحث */
.search-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 16px 10px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  right: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-subtle);
  pointer-events: none;
}

.search-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 42px 10px 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-subtle);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.search-input:focus {
  background-color: var(--bg-surface);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 135, 56, 0.12);
}

.btn-search-clear {
  position: absolute;
  left: 14px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border-color);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.search-feedback {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 8px;
}

/* شريط تصنيفات الأقسام الأفقي */
.category-tabs {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4px 16px 10px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  min-height: 40px;
  border-radius: var(--radius-full);
  background-color: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.category-chip:hover {
  background-color: var(--border-color);
  color: var(--text-main);
}

.category-chip.active {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
  box-shadow: var(--shadow-xs);
}

/* -----------------------------------------------------------------------------
   8. محتوى الكتالوج وشبكة بطاقات السوبرماركت
   ----------------------------------------------------------------------------- */
.main-content {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 16px 100px;
}

.catalog-section {
  margin-bottom: 36px;
  scroll-margin-top: 170px;
}

.section-header {
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 8px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* شبكة المنتجات */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }
}

@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

/* بطاقة الصنف (Product Card) */
.product-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-xs);
  position: relative;
}

.product-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* صورة الصنف */
.product-thumb-wrap {
  position: relative;
  width: 100%;
  padding-top: 85%; /* نسبة العرض للارتفاع */
  background: var(--bg-surface-subtle);
  overflow: hidden;
  cursor: pointer;
}

.product-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.product-card:hover .product-thumb-img {
  transform: scale(1.04);
}

/* بديل أنيق لأي صنف بلا صورة */
.product-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-surface-subtle) 0%, var(--color-primary-light) 100%);
  color: var(--color-primary);
}

.placeholder-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
  opacity: 0.85;
}

.placeholder-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* شارات الصنف (Badges) */
.product-badges {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow-xs);
}

.badge-offer {
  background-color: var(--color-accent-offer);
  color: #ffffff;
}

.badge-best {
  background-color: var(--color-secondary);
  color: #101828;
}

.badge-new {
  background-color: var(--color-primary);
  color: #ffffff;
}

.badge-spicy {
  background-color: #ea580c;
  color: #ffffff;
}

.badge-veg {
  background-color: #16a34a;
  color: #ffffff;
}

/* جسم البطاقة والبيانات */
.product-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
  line-height: 1.35;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.product-name:hover {
  color: var(--color-primary);
}

.product-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.1em;
}

/* الأسعار */
.product-pricing {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.price-current {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary);
}

.price-currency {
  font-size: 0.8rem;
  font-weight: 500;
}

.price-old {
  font-size: 0.85rem;
  color: var(--text-subtle);
  text-decoration: line-through;
}

.price-from {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* أزرار الإضافة والتفاعل */
.product-actions {
  width: 100%;
}

.btn-card-add {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid rgba(0, 135, 56, 0.2);
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-card-add:hover {
  background-color: var(--color-primary);
  color: #ffffff;
}

.btn-card-add.btn-unavailable {
  background-color: var(--bg-surface-subtle);
  color: var(--text-subtle);
  border-color: var(--border-color);
  cursor: not-allowed;
}

/* عداد الكمية التفاعلي على البطاقة */
.card-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--color-primary);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 2px;
  min-height: 40px;
}

.btn-card-step {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.btn-card-step:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.card-step-val {
  font-weight: 700;
  font-size: 0.95rem;
}

/* -----------------------------------------------------------------------------
   9. شريط السلة العائم وزر واتساب العائم
   ----------------------------------------------------------------------------- */
.floating-cart-bar {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 500px;
  margin: 0 auto;
  z-index: 90;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-bar-button {
  width: 100%;
  min-height: 54px;
  background: linear-gradient(135deg, var(--color-primary) 0%, #006b2c 100%);
  color: #ffffff;
  border-radius: var(--radius-full);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-float);
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: transform var(--transition-fast);
}

.cart-bar-button:active {
  transform: scale(0.98);
}

.cart-bar-start {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-bar-badge {
  background-color: var(--color-secondary);
  color: #101828;
  font-size: 0.85rem;
  font-weight: 700;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-bar-title {
  font-weight: 700;
  font-size: 1rem;
}

.cart-bar-end {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-bar-total {
  font-weight: 700;
  font-size: 1.05rem;
}

.cart-bar-arrow {
  font-size: 1.2rem;
}

/* زر واتساب العائم للتواصل السريع */
.floating-wa-btn {
  position: fixed;
  bottom: 84px;
  left: 20px;
  z-index: 85;
  background-color: #25d366;
  color: #ffffff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal);
}

.floating-wa-btn svg {
  width: 24px;
  height: 24px;
}

.floating-wa-label {
  font-size: 0.85rem;
  font-weight: 700;
  display: none;
}

@media (min-width: 768px) {
  .floating-wa-label {
    display: inline;
  }
}

.floating-wa-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-float);
}

/* -----------------------------------------------------------------------------
   10. المودال والنوافذ المنبثقة (Modals & Sheets)
   ----------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background-color: var(--bg-overlay);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 24px;
  }
}

.modal-sheet, .cart-sheet {
  background-color: var(--bg-surface);
  width: 100%;
  max-height: 90vh;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-float);
  animation: slideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 640px) {
  .modal-sheet, .cart-sheet {
    max-width: 520px;
    border-radius: var(--radius-xl);
    max-height: 85vh;
  }
}

.modal-header-bar {
  padding: 12px 16px;
  display: flex;
  justify-content: flex-start;
}

.btn-close-modal {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--bg-surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.btn-close-modal:hover {
  background-color: var(--border-color);
  color: var(--text-main);
}

.modal-body {
  padding: 0 20px 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-item-image-wrap {
  width: 100%;
  height: 220px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface-subtle);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-badges-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.modal-item-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-item-prices {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.modal-item-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 18px;
}

/* خيارات الحجم والإضافات */
.modal-options-block {
  margin-bottom: 18px;
  padding: 14px;
  background-color: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.options-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}

.option-row:last-child {
  border-bottom: none;
}

.option-start {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}

.option-price {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 0.9rem;
}

.modal-note-block {
  margin-top: 14px;
}

.note-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-qty-stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  height: 48px;
}

.btn-stepper {
  width: 44px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.stepper-val {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
}

.btn-add-main {
  flex: 1;
  min-height: 48px;
  display: flex;
  justify-content: space-between;
  padding: 0 18px;
}

/* -----------------------------------------------------------------------------
   11. درج السلة وإتمام الطلب (Cart Drawer & Checkout)
   ----------------------------------------------------------------------------- */
.cart-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cart-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.cart-badge-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: 6px;
}

.cart-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.cart-alert-box {
  background-color: var(--color-secondary-light);
  border: 1px solid #ffd666;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: #874d00;
  margin-bottom: 14px;
}

.cart-empty-state {
  text-align: center;
  padding: 40px 20px;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  opacity: 0.8;
}

.empty-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.empty-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* قائمة أسطر السلة */
.cart-line-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.line-info {
  flex: 1;
}

.line-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.line-details {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.line-note-text {
  font-size: 0.78rem;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-top: 2px;
}

.line-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.line-price {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-primary);
}

.line-stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  height: 32px;
}

.btn-line-step {
  width: 28px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.line-step-qty {
  min-width: 24px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
}

/* اختيار نوع الطلب */
.order-type-tabs-wrap {
  margin: 20px 0 16px;
}

.order-type-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.order-type-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-order-type {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-surface-subtle);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.btn-order-type.active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

/* فورم بيانات الطلب */
.checkout-form {
  margin-bottom: 18px;
}

.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.required {
  color: var(--color-danger);
}

.form-input {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface-subtle);
  font-size: 0.9rem;
}

.form-input:focus {
  background-color: var(--bg-surface);
  border-color: var(--color-primary);
}

.form-textarea {
  resize: vertical;
  min-height: 64px;
}

.field-error-msg {
  display: block;
  font-size: 0.78rem;
  color: var(--color-danger);
  margin-top: 3px;
}

/* ملخص الحساب */
.cart-totals-summary {
  background-color: var(--bg-surface-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 0.9rem;
}

.totals-val {
  font-weight: 600;
}

.discount-row {
  color: var(--color-accent-offer);
  font-weight: 700;
}

.grand-total-row {
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
  padding-top: 8px;
  font-size: 1.1rem;
}

.grand-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-primary);
}

.delivery-note-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* معلومات الدفع v1.3 */
.payment-info-box {
  background-color: var(--bg-surface-subtle);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
}

.payment-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.payment-method-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.payment-method-val {
  font-family: monospace;
  font-weight: 700;
}

.payment-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* زر إرسال واتساب */
.btn-whatsapp-send {
  width: 100%;
  min-height: 52px;
  background-color: #25d366;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
  transition: all var(--transition-fast);
}

.btn-whatsapp-send:hover {
  background-color: #1eb956;
  transform: translateY(-1px);
}

.send-disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

.order-alert-box {
  background-color: var(--color-accent-offer-bg);
  color: var(--color-accent-offer);
  border: 1px solid #fecdca;
  padding: 10px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 10px;
}

/* -----------------------------------------------------------------------------
   12. الفوتر ومعلومات المتجر
   ----------------------------------------------------------------------------- */
.app-footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 40px 16px 80px;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-brand {
  text-align: center;
  margin-bottom: 30px;
}

.footer-logo {
  border-radius: var(--radius-md);
  margin: 0 auto 10px;
  border: 1px solid var(--border-color);
}

.footer-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 6px;
}

.footer-about {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

.footer-info-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 30px;
}

@media (min-width: 768px) {
  .footer-info-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.info-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  gap: 14px;
}

.info-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.info-details h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.info-details p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 8px;
}

.map-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
}

.contact-links-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-social-wrap {
  text-align: center;
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
  margin-bottom: 24px;
}

.social-heading {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.social-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.social-pill:hover {
  background: var(--border-color);
  transform: translateY(-2px);
}

.footer-copy {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-subtle);
}

/* -----------------------------------------------------------------------------
   13. الحركات والأنيميشن والانتقالات
   ----------------------------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
