/* ====== إعدادات Tailwind المخصصة ====== */
/* ملاحظة: خطوط Cairo يتم تحميلها من HTML مباشرة لتحسين الأداء */
html { 
  scroll-behavior: smooth; 
}

.no-scrollbar::-webkit-scrollbar { 
  display: none; 
}

/* ====== تحسينات للهواتف المحمولة ====== */
@media (max-height: 600px) {
  #customerModal .max-h-\[90vh\] {
    max-height: 95vh;
  }
}

/* ====== تحسين التمرير في النافذة ====== */
#customerModal .overflow-y-auto {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

#customerModal .overflow-y-auto::-webkit-scrollbar {
  width: 6px;
}

#customerModal .overflow-y-auto::-webkit-scrollbar-track {
  background: transparent;
}

#customerModal .overflow-y-auto::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

#customerModal .overflow-y-auto::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.5);
}

/* ====== متغيرات CSS المخصصة ====== */
:root {
  --base-bg: #0B0B0C;
  --base-card: #131316;
  --base-stroke: #222226;
  --base-text: #EDEDED;
  --base-sub: #B7B7BA;
  --base-brand: #26D07C;
  --transition-base: all 0.3s ease;
  --shadow-soft: 0 10px 30px rgba(0,0,0,0.35);
}

/* ====== إعدادات عامة ====== */
body {
  font-family: 'Cairo', system-ui, sans-serif;
  background-color: var(--base-bg);
  color: var(--base-text);
}

/* ====== تحسينات البطاقات والأزرار ====== */
.product-card {
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  /* منع الـ ring transition اللي يسبب الـ glitch */
  --tw-ring-color: rgb(34 34 38 / 0.7);
}

.product-card:hover {
  transform: translateY(-3px) translateZ(0);
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
  --tw-ring-color: rgb(38 208 124 / 0.3);
}

.payment-btn {
  transition: var(--transition-base);
}

.payment-btn:hover {
  transform: translateY(-1px);
}

/* ====== القائمة الجانبية للهواتف ====== */
#mobileMenu {
  transition: opacity 0.3s ease;
}

#mobileMenu .transform {
  transition: transform 0.3s ease;
}

#mobileMenu.show .transform {
  transform: translateX(0);
}

#mobileMenu.show {
  display: block;
}

/* ====== Toast Notifications - تصميم حديث وجميل ====== */
.toast {
  @apply rounded-3xl shadow-2xl backdrop-blur-2xl;
  @apply transform translate-x-full opacity-0 transition-all duration-400 ease-out;
  @apply pointer-events-auto relative overflow-hidden;
  min-width: 360px;
  max-width: 480px;
  padding: 1.75rem;
  border: 1px solid;
  background: rgba(19, 19, 26, 0.95);
  box-shadow: 
    0 25px 70px -12px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  position: relative;
}

/* تأثير الإضاءة الخلفية */
.toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.toast.show {
  @apply translate-x-0 opacity-100;
  animation: toastSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show::before {
  animation: shimmer 2s infinite;
}

.toast.hiding {
  animation: toastSlideOut 0.35s cubic-bezier(0.4, 0, 1, 1) forwards;
  opacity: 0;
}

@keyframes toastSlideOut {
  0% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateX(120%) scale(0.9);
    opacity: 0;
  }
}

@keyframes toastSlideIn {
  0% {
    transform: translateX(120%) scale(0.9);
    opacity: 0;
  }
  60% {
    transform: translateX(-5px) scale(1.02);
  }
  100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

@keyframes shimmer {
  0% {
    background-position: -100% 0;
  }
  100% {
    background-position: 100% 0;
  }
}

.toast.success {
  background: linear-gradient(145deg, rgba(16, 28, 20, 0.98) 0%, rgba(20, 38, 26, 0.96) 100%);
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 
    0 25px 70px -12px rgba(34, 197, 94, 0.35),
    0 0 0 1px rgba(34, 197, 94, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 60px rgba(34, 197, 94, 0.15);
}

.toast.success::before {
  background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.8), transparent);
  background-size: 200% 100%;
}

.toast.error {
  background: linear-gradient(145deg, rgba(38, 16, 16, 0.98) 0%, rgba(48, 20, 20, 0.96) 100%);
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 
    0 25px 70px -12px rgba(239, 68, 68, 0.35),
    0 0 0 1px rgba(239, 68, 68, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 60px rgba(239, 68, 68, 0.15);
}

.toast.error::before {
  background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.8), transparent);
  background-size: 200% 100%;
}

.toast.warning {
  background: linear-gradient(145deg, rgba(38, 32, 16, 0.98) 0%, rgba(48, 38, 20, 0.96) 100%);
  border-color: rgba(234, 179, 8, 0.4);
  box-shadow: 
    0 25px 70px -12px rgba(234, 179, 8, 0.35),
    0 0 0 1px rgba(234, 179, 8, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 60px rgba(234, 179, 8, 0.15);
}

.toast.warning::before {
  background: linear-gradient(90deg, transparent, rgba(234, 179, 8, 0.8), transparent);
  background-size: 200% 100%;
}

.toast.info {
  background: linear-gradient(145deg, rgba(16, 24, 38, 0.98) 0%, rgba(20, 30, 46, 0.96) 100%);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 
    0 25px 70px -12px rgba(59, 130, 246, 0.35),
    0 0 0 1px rgba(59, 130, 246, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 60px rgba(59, 130, 246, 0.15);
}

.toast.info::before {
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.8), transparent);
  background-size: 200% 100%;
}

.toast-content {
  @apply flex items-start gap-4;
}

.toast-icon {
  @apply w-16 h-16 rounded-2xl flex items-center justify-center flex-shrink-0 relative;
  font-size: 1.75rem;
  box-shadow: 
    0 10px 30px -5px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  animation: iconPulse 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes iconPulse {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  60% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.toast.success .toast-icon {
  background: linear-gradient(145deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
  color: white;
  box-shadow: 
    0 10px 30px -5px rgba(34, 197, 94, 0.6),
    inset 0 2px 4px rgba(255, 255, 255, 0.3),
    0 0 20px rgba(34, 197, 94, 0.3);
}

.toast.error .toast-icon {
  background: linear-gradient(145deg, #ef4444 0%, #dc2626 50%, #b91c1c 100%);
  color: white;
  box-shadow: 
    0 10px 30px -5px rgba(239, 68, 68, 0.6),
    inset 0 2px 4px rgba(255, 255, 255, 0.3),
    0 0 20px rgba(239, 68, 68, 0.3);
}

.toast.warning .toast-icon {
  background: linear-gradient(145deg, #eab308 0%, #ca8a04 50%, #a16207 100%);
  color: white;
  box-shadow: 
    0 10px 30px -5px rgba(234, 179, 8, 0.6),
    inset 0 2px 4px rgba(255, 255, 255, 0.3),
    0 0 20px rgba(234, 179, 8, 0.3);
}

.toast.info .toast-icon {
  background: linear-gradient(145deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
  color: white;
  box-shadow: 
    0 10px 30px -5px rgba(59, 130, 246, 0.6),
    inset 0 2px 4px rgba(255, 255, 255, 0.3),
    0 0 20px rgba(59, 130, 246, 0.3);
}

.toast-message {
  @apply flex-1;
  min-width: 0;
}

.toast-title {
  @apply font-black text-xl;
  color: #ffffff;
  text-shadow: 
    0 2px 10px rgba(0, 0, 0, 0.6),
    0 0 20px rgba(255, 255, 255, 0.08);
  margin-bottom: 0.625rem;
  letter-spacing: 0.5px;
  line-height: 1.35;
  font-weight: 900;
}

.toast-description {
  @apply text-sm mt-1;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
  line-height: 1.65;
  font-weight: 500;
  opacity: 0.9;
}

/*
 * إعادة تصميم زر إجراء التوست (toast-action-btn)
 * التصميم الجديد أبسط ويستخدم ألوان ثابتة للتوافق مع نوع التوست (نجاح/خطأ/تحذير/معلومات).
 * تم تقليل الظلال والتدرجات وجعل الحافة مستديرة لملاءمة التصميم العام.
 */
.toast-action-btn {
  margin-top: 0.5rem !important;
  padding: 0.5rem 0.75rem !important;
  border-radius: 0.5rem !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  color: #ffffff !important;
  border: 1px solid transparent !important;
  cursor: pointer !important;
  transition: background-color 0.25s ease, transform 0.25s ease !important;
  text-align: center !important;
}

/* لون الخلفية والأطراف بناءً على نوع التوست */
.toast.success .toast-action-btn {
  background-color: #15803d !important; /* أخضر داكن */
  border-color: #15803d !important;
}

.toast.error .toast-action-btn {
  background-color: #b91c1c !important; /* أحمر داكن */
  border-color: #b91c1c !important;
}

.toast.warning .toast-action-btn {
  background-color: #d97706 !important; /* برتقالي غامق */
  border-color: #d97706 !important;
}

.toast.info .toast-action-btn {
  background-color: #0369a1 !important; /* أزرق غامق */
  border-color: #0369a1 !important;
}

.toast-action-btn:hover {
  transform: translateY(-2px) !important;
  filter: brightness(1.05) !important;
}

.toast-action-btn:active {
  transform: translateY(0) scale(0.97) !important;
}

/*
 * زر إغلاق التوست (toast-close)
 * تم اعتماد تصميم بسيط بحجم صغير وخلفية شفافة قليلاً. يزداد وضوح اللون عند التحويم.
 */
.toast-close {
  width: 1.5rem !important;
  height: 1.5rem !important;
  border-radius: 0.375rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background-color: rgba(255,255,255,0.08) !important;
  color: #e5e7eb !important;
  border: none !important;
  cursor: pointer !important;
  transition: background-color 0.2s ease !important;
}

.toast-close:hover {
  background-color: rgba(255,255,255,0.15) !important;
}

.toast-close:active {
  background-color: rgba(255,255,255,0.1) !important;
}

/* تمت إزالة تعريفات قديمة لزر إغلاق التوست هنا لأننا استبدلناها بتعريف مبسط في الأسفل. */

/* تحسينات للهواتف المحمولة */
@media (max-width: 640px) {
  .toast {
    min-width: calc(100vw - 2rem) !important;
    max-width: calc(100vw - 2rem) !important;
    padding: 1.5rem !important;
    border-width: 1px !important;
    border-radius: 1.5rem !important;
  }
  
  .toast-icon {
    width: 3.75rem !important;
    height: 3.75rem !important;
    font-size: 1.875rem !important;
    border-radius: 1rem !important;
  }
  
  .toast-title {
    font-size: 1.125rem !important;
    font-weight: 900 !important;
    margin-bottom: 0.625rem !important;
  }
  
  .toast-description {
    font-size: 0.9375rem !important;
    line-height: 1.7 !important;
    font-weight: 500 !important;
  }
  
  /* تعديلات زر الإجراء على الهواتف المحمولة لتتماشى مع التصميم العام */
  .toast-action-btn {
    margin-top: 0.4rem !important;
    padding: 0.4rem 0.75rem !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    border-radius: 0.5rem !important;
  }

  /* حجم أصغر لزر الإغلاق على الهواتف المحمولة */
  .toast-close {
    width: 1.25rem !important;
    height: 1.25rem !important;
    border-radius: 0.375rem !important;
  }
  
  #toastContainer {
    top: 5rem !important; /* تحت الـ header على الهواتف */
    right: 1rem !important;
    left: 1rem !important;
    z-index: 9999;
  }
  
  .toast.show {
    animation: toastSlideInMobile 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  @keyframes toastSlideInMobile {
    0% {
      transform: translateY(-120%) scale(0.9);
      opacity: 0;
    }
    60% {
      transform: translateY(5px) scale(1.02);
    }
    100% {
      transform: translateY(0) scale(1);
      opacity: 1;
    }
  }
}

/*
 * ======================================================================
 * Updated Toast Notification Styles
 *
 * الهدف: تبسيط مظهر التوست ليكون أكثر أناقة، مع تقليل التدرجات الكثيفة
 *        والظلال الثقيلة. يتم هنا استخدام ألوان غامقة موحدة ولون بارز في
 *        الحدود الجانبية لكل نوع (success, error, warning, info).
 *        هذه التعريفات تستخدم !important لضمان تغليبها على التعريفات
 *        السابقة فى الملف.
 * ======================================================================
 */

.toast {
  pointer-events: auto !important;
  position: relative !important;
  display: flex !important;
  align-items: flex-start !important;
  gap: 0.75rem !important;
  min-width: 320px !important;
  max-width: 440px !important;
  padding: 1rem 1.25rem !important;
  border-radius: 0.75rem !important;
  background-color: #111827 !important; /* خلفية داكنة موحدة */
  border-left: 4px solid transparent !important; /* سيتم استبدالها بالألوان المميزة */
  color: #f3f4f6 !important;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3) !important;
  transform: translateX(120%) scale(0.95) !important;
  opacity: 0 !important;
  transition: transform 0.35s ease, opacity 0.35s ease !important;
}

/* إظهار التوست */
.toast.show {
  transform: translateX(0) scale(1) !important;
  opacity: 1 !important;
}

/* إخفاء التوست */
.toast.hiding {
  transform: translateX(120%) scale(0.95) !important;
  opacity: 0 !important;
  transition: transform 0.3s ease, opacity 0.3s ease !important;
}

/* الألوان المميزة للأنواع المختلفة */
.toast.success {
  border-left-color: #16a34a !important;
}

.toast.error {
  border-left-color: #dc2626 !important;
}

.toast.warning {
  border-left-color: #ca8a04 !important;
}

.toast.info {
  border-left-color: #2563eb !important;
}

/* أيقونة التوست */
.toast-icon {
  width: 2.5rem !important;
  height: 2.5rem !important;
  border-radius: 9999px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #ffffff !important;
  font-size: 1.25rem !important;
  /* مبدئياً بدون خلفية، ستعطى أدناه حسب النوع */
  background-color: rgba(255,255,255,0.08) !important;
}

.toast.success .toast-icon {
  background-color: #16a34a !important;
}

.toast.error .toast-icon {
  background-color: #dc2626 !important;
}

.toast.warning .toast-icon {
  background-color: #ca8a04 !important;
}

.toast.info .toast-icon {
  background-color: #2563eb !important;
}

/* عنوان التوست */
.toast-title {
  font-weight: 600 !important;
  font-size: 1rem !important;
  margin-bottom: 0.25rem !important;
  color: #f9fafb !important;
}

/* وصف التوست */
.toast-description {
  font-size: 0.875rem !important;
  color: #d1d5db !important;
  line-height: 1.4 !important;
  font-weight: 400 !important;
  margin-top: 0.125rem !important;
}

/* تمت إزالة تعريفات قديمة لزر الإجراء وزر الإغلاق للتوست هنا لأننا أعادنا تعريفها أعلاه بتصميم مبسط. */

/* نسخة مصغرة للهواتف المحمولة */
@media (max-width: 640px) {
  .toast {
    min-width: calc(100vw - 2rem) !important;
    max-width: calc(100vw - 2rem) !important;
    padding: 0.875rem 1rem !important;
    border-radius: 0.875rem !important;
  }
  .toast-icon {
    width: 2rem !important;
    height: 2rem !important;
    font-size: 1rem !important;
  }
  .toast-title {
    font-size: 0.95rem !important;
    margin-bottom: 0.2rem !important;
  }
  .toast-description {
    font-size: 0.8125rem !important;
  }
  .toast-action-btn {
    padding: 0.4rem 0.875rem !important;
    font-size: 0.8rem !important;
  }
  .toast-close {
    width: 1.25rem !important;
    height: 1.25rem !important;
  }
}

/* ====== نافذة الترحيب ====== */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-fade-in {
  animation: fade-in 0.3s ease-out;
}

/* ====== تحسينات للشاشات الصغيرة ====== */
@media (max-width: 640px) {
  .grid-cols-2 {
    /* minmax(0,1fr) وليس 1fr: البارة 1fr = minmax(auto,1fr) فتتمدد الأعمدة حسب
       min-content للمحتوى وتتجاوز الشبكةُ الشاشةَ (تمرير أفقي على الجوال) */
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  .text-4xl {
    font-size: 2rem;
  }
  
  .text-2xl {
    font-size: 1.5rem;
  }
  
  /* تحسين عرض القائمة الجانبية على الشاشات الصغيرة جداً */
  #mobileMenu .w-80 {
    width: 100vw;
    max-width: 320px;
  }
}

/* ====== تحسينات القوائم المنسدلة للفئات ====== */
.variant,
select.variant,
.variant select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  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='%23B7B7BA' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: left 0.75rem center !important;
  background-size: 12px !important;
  padding-left: 2.5rem !important;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #EDEDED !important;
  background-color: #0B0B0C !important;
}

.variant:hover,
select.variant:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
  border-color: var(--base-brand);
  color: #EDEDED !important;
}

.variant:focus,
select.variant:focus {
  outline: none !important;
  ring: 2px;
  ring-color: var(--base-brand);
  border-color: var(--base-brand);
  background-color: #0B0B0C !important;
  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='%23B7B7BA' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
  color: #EDEDED !important;
}

/* تحسين مظهر الخيارات في القائمة المنسدلة */
.variant option,
select.variant option,
select option {
  background-color: #131316 !important;
  color: #EDEDED !important;
  padding: 0.5rem !important;
}

/* للقوائم المنسدلة بشكل عام - قواعد شاملة */
select {
  color: #EDEDED !important;
  background-color: #0B0B0C !important;
}

select option {
  background-color: #131316 !important;
  color: #EDEDED !important;
}

/* للقوائم المفتوحة (dropdown menu) */
select:not([multiple]) {
  color: #EDEDED !important;
  background-color: #0B0B0C !important;
}

/* إصلاح خاص لمتصفحات WebKit (Chrome, Safari) */
select::-webkit-select-placeholder {
  color: #B7B7BA !important;
}

/* إصلاح خاص لمتصفح Firefox */
select:-moz-focusring {
  color: #EDEDED !important;
  text-shadow: 0 0 0 #EDEDED;
}

/* إصلاح خاص للقوائم المفتوحة في جميع المتصفحات */
select:focus option:checked {
  background-color: #26D07C !important;
  color: #0B0B0C !important;
}

/* ====== أزرار واتساب وتيليجرام ====== */
#sendViaWhatsApp {
  background: linear-gradient(to bottom right, #22c55e, #16a34a) !important;
  background-color: #22c55e !important;
}

#sendViaWhatsApp:hover {
  background: linear-gradient(to bottom right, #16a34a, #15803d) !important;
  background-color: #16a34a !important;
}

#sendViaTelegram {
  background: linear-gradient(to bottom right, #3b82f6, #2563eb) !important;
  background-color: #3b82f6 !important;
}

#sendViaTelegram:hover {
  background: linear-gradient(to bottom right, #2563eb, #1d4ed8) !important;
  background-color: #2563eb !important;
}

/* ضمان ظهور الألوان في جميع المتصفحات */
#sendViaWhatsApp,
#sendViaTelegram {
  -webkit-background-size: 100% 100% !important;
  background-size: 100% 100% !important;
  background-repeat: no-repeat !important;
}

/* ====== تحسينات للطباعة ====== */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
}

/* ====== إصلاح الهيدر في صفحات الأدمن للهواتف ====== */
@media (max-width: 768px) {
  /* زيادة z-index للهيدر لضمان ظهوره فوق كل شيء */
  header.admin-header,
  header.sticky {
    z-index: 9999 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    background: rgba(11, 11, 12, 0.98) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    will-change: transform !important;
  }
  
  /* جعل الأزرار قابلة للتمرير أفقياً */
  .admin-header-buttons,
  header .flex.items-center.gap-3:last-child {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE and Edge */
    flex-wrap: nowrap !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding-right: 0.5rem !important;
    padding-left: 0.5rem !important;
  }
  
  /* إخفاء شريط التمرير */
  .admin-header-buttons::-webkit-scrollbar,
  header .flex.items-center.gap-3:last-child::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }
  
  /* منع الأزرار من الانكماش */
  .admin-header-buttons a,
  header .flex.items-center.gap-3:last-child a {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    min-width: fit-content !important;
  }
  
  /* تحسين المسافات بين الأزرار */
  .admin-header-buttons,
  header .flex.items-center.gap-3:last-child {
    gap: 0.5rem !important;
  }
  
  /* تقليل حجم الأزرار قليلاً على الهواتف */
  .admin-header-buttons a,
  header .flex.items-center.gap-3:last-child a {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.75rem !important;
  }
  
  /* التأكد من أن المحتوى لا يختفي خلف الهيدر */
  main {
    margin-top: 0 !important;
    padding-top: 5.5rem !important;
  }
  
  /* تحسين التخطيط العام */
  header .max-w-7xl {
    gap: 0.5rem !important;
  }
}

/* ====== إصلاح خاص عند التكبير (zoom) على الهواتف ====== */
@media (max-width: 768px) {
  header.admin-header,
  header.sticky {
    z-index: 99999 !important;
    position: fixed !important;
    transform: translateZ(0) !important;
    -webkit-transform: translateZ(0) !important;
    will-change: transform !important;
    -webkit-perspective: 1000 !important;
    perspective: 1000 !important;
  }
  
  /* ضمان بقاء الأزرار مرئية حتى عند التكبير */
  .admin-header-buttons {
    max-width: calc(100vw - 8rem) !important;
  }
}

/* ====== إصلاح للشاشات الصغيرة جداً ====== */
@media (max-width: 480px) {
  /* تقليل حجم الأزرار أكثر */
  .admin-header-buttons a,
  header .flex.items-center.gap-3:last-child a {
    padding: 0.4rem 0.6rem !important;
    font-size: 0.7rem !important;
  }
  
  /* إخفاء بعض النصوص الطويلة */
  header .flex.items-center.gap-3:first-child p.text-xs {
    display: none !important;
  }
  
  /* تقليل حجم اللوجو */
  header .w-9.h-9 {
    width: 2rem !important;
    height: 2rem !important;
  }
  
  /* تحسين المسافات */
  header .max-w-7xl {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
  
  /* زيادة المساحة للأزرار */
  .admin-header-buttons {
    max-width: calc(100vw - 6rem) !important;
  }
}

/* ====== تحسينات القائمة المنسدلة (User Menu) ====== */
#userMenu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 99999;
}

#userMenu.hidden {
  display: none;
}

#userMenu:not(.hidden) {
  display: block;
}

/* التأكد من أن القائمة تظهر في الموبايل */
@media (max-width: 768px) {
  #userMenu {
    right: 0 !important;
    left: auto !important;
    width: 12rem !important;
    max-width: calc(100vw - 2rem) !important;
  }
  
  /* التأكد من أن الهيدر لا يخفي القائمة */
  header {
    overflow: visible !important;
  }
  
  header > div {
    overflow: visible !important;
  }
}

/* ================================================================
   تحسينات الواجهة الرئيسية (مستوحاة من تصميم MDCard الجديد)
   كل الأصناف بادئة md- لتجنّب أي تعارض مع Tailwind
   ================================================================ */

/* --- شريط الثقة المتحرك --- */
@keyframes md-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.md-trust-bar { overflow: hidden; white-space: nowrap; }
.md-trust-inner {
  display: inline-flex;
  gap: 48px;
  animation: md-marquee 24s linear infinite;
  will-change: transform;
}
.md-trust-bar:hover .md-trust-inner { animation-play-state: paused; }
.md-trust-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #B7B7BA;
  font-size: 13px;
}
@media (prefers-reduced-motion: reduce) {
  .md-trust-inner { animation: none; }
}

/* --- بطاقات الخدمات الطايرة في الهيرو --- */
@keyframes md-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.md-float { animation: md-float 3s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .md-float { animation: none; }
}
.md-hero-card {
  background: #131316;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 18px;
  text-align: center;
}

/* --- صور العملاء المتراكبة (social proof) --- */
.md-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid #0B0B0C;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  margin-left: -8px;
}

/* --- بطاقات خطوات الطلب --- */
.md-step-card {
  background: #131316;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.md-step-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(38,208,124,0.13);
  border: 1px solid rgba(38,208,124,0.5);
  color: #26D07C;
  font-weight: 800;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.md-step-card::before {
  content: '';
  position: absolute;
  top: -10px; right: -10px;
  width: 70px; height: 70px;
  border-radius: 50%;
  background: rgba(38,208,124,0.05);
}

/* --- شبكة بطاقات الهيرو (بديل md:grid غير المتوفّر في بناء Tailwind) --- */
.md-hero-cards { display: none; }
@media (min-width: 768px) {
  .md-hero-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}

/* --- فاصل عمودي لإحصائيات التقييمات --- */
.md-vdivider { width: 1px; align-self: stretch; background: rgba(34,34,38,0.7); }
@media (max-width: 639px) { .md-vdivider { display: none; } }

/* ====== فلاتر الأقسام الأفقية (بدل شبكة البوابات) ====== */
.category-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.category-chips.hidden { display: none; }
.category-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: 9999px;
  background: var(--base-card);
  border: 1px solid rgba(34,34,38,0.9);
  color: var(--base-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}
.category-chip:hover { border-color: rgba(38,208,124,0.5); }
.category-chip.active {
  background: var(--base-brand);
  border-color: var(--base-brand);
  color: #0B0B0C;
}
.category-chip .chip-count {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 9999px;
  background: rgba(255,255,255,0.08);
  color: var(--base-sub);
}
.category-chip.active .chip-count {
  background: rgba(11,11,12,0.18);
  color: #0B0B0C;
}

/* ====== شريط السلة السفلي الثابت (جوال فقط) ====== */
.mobile-cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40; /* تحت درج السلة والقوائم (z-50) فيغطّيه الدرج عند فتحه */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--base-brand);
  color: #0B0B0C;
  font-weight: 700;
  font-family: inherit;
  border: none;
  cursor: pointer;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.45);
}
.mobile-cart-bar.hidden { display: none; }
@media (min-width: 768px) { .mobile-cart-bar { display: none; } }
.mobile-cart-bar-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.mobile-cart-bar-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(11,11,12,0.14);
}
.mobile-cart-bar-count {
  position: absolute;
  top: -6px;
  inset-inline-start: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 9999px;
  background: #0B0B0C;
  color: #26D07C;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mobile-cart-bar-total { font-size: 17px; font-weight: 800; }
.mobile-cart-bar-cta { font-size: 14px; font-weight: 800; }
/* مساحة أسفل الصفحة كي لا يحجب الشريط الفوتر وآخر المنتجات */
body.has-cart-bar { padding-bottom: 76px; }
@media (min-width: 768px) { body.has-cart-bar { padding-bottom: 0; } }

/* ====== قسم «اطلب لعبتك أو اقترح علينا» ====== */
.suggest-send {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  border-radius: 1.25rem;
  font-weight: 700;
  font-size: 15px;
  transition: filter .2s ease, transform .15s ease;
}
.suggest-send:hover { filter: brightness(1.12); }
.suggest-send:active { transform: scale(0.98); }
.suggest-send-wa {
  background: rgba(37,211,102,0.14);
  border: 1px solid rgba(37,211,102,0.35);
  color: #25D366;
}
.suggest-send-tg {
  background: rgba(0,136,204,0.14);
  border: 1px solid rgba(0,136,204,0.4);
  color: #34AADF;
}
/* على الشاشات الأوسع: الزرّان جنب بعض */
@media (min-width: 640px) {
  .suggest-actions { flex-direction: row; }
  .suggest-actions .suggest-send { flex: 1; }
}
