/* ================= ROOT VARIABLES ================= */
:root {
  --primary: #0ABAB5;
  --primary-dark: #089691;
  --primary-light: #7ADED9;
  --brand-title: #067D79;
  --secondary: #1B4D4B;
  --accent: #e74c3c;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --light: #F0F0F0; /* رمادي فاتح موحّد للكمبيوتر والجوال */
  --dark: #2c3e50;
  --gray: #95a5a6;
  --light-gray: #f8f9fa;
  --surface: #ffffff;
  --surface-card: #ffffff;
  --border: #ddd;
  --shadow: rgba(0,0,0,0.1);
  --radius: 10px;
  --transition: all 0.3s ease;
}

/* ================= ضبط نهائي لموضع وحجم أيقونة حذف صورة البروفايل على الجوال (أولوية قصوى) ================ */
@media (max-width: 480px) {
  /* parent containers: مرجع التموضع والسماح بخروج الأيقونة خارج الدائرة */
  .account-avatar-wrapper,
  .account-avatar-inner,
  .account-avatar {
    position: relative !important;
    display: block !important;
    overflow: visible !important;
  }

  /* الأيقونة: خارج حدود الدائرة (أسفل يسار) بحجم صغير ثابت */
  .avatar-delete-btn {
    position: absolute !important;
    top: auto !important;
    right: auto !important;
    left: -15px !important;
    bottom: -8px !important;
    transform: none !important;
    margin: 0 !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    border-radius: 50% !important;
    background: #fff !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    z-index: 10 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .avatar-delete-btn i {
    width: 10px !important;
    height: 10px !important;
    font-size: 10px !important;
  }
}

/* ================= RESET & BASE ================= */
/* كود التمريض: منع تجاوز عرض الشاشة (يُطبَّق على صفحة إضافة الإعلان في الجوال عبر media query) */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw; /* PWA: منع انجراف الواجهة يميناً أو يساراً على الجوال */
  overflow-x: hidden;
  box-sizing: border-box;
  background: var(--light); /* توحيد لون الخلفية */
  min-height: 100vh;
  min-height: 100dvh; /* دعم الواجهات الديناميكية (الجوال) */
  font-size: 22px; /* خط أكبر للموقع بالكامل */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Cairo', 'Tajawal', sans-serif;
  background: var(--light);
  color: var(--dark);
  font-size: 1rem;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  padding-right: 118px; /* مساحة لشريط التنقل الجانبي */
  width: 100%;
  max-width: 100vw; /* PWA: واجهة ثابتة كالتطبيقات الأصلية دون انجراف */
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-overflow-scrolling: touch;
  display: flex; /* جعل الجسم حاوية Flex رأسية لكل الصفحات */
  flex-direction: column;
  font-weight: 500; /* جعل الخط أوضح قليلاً */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.page {
  display: none;
  animation: fadeIn 0.3s ease;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  background: var(--light); /* توحيد لون الخلفية مع body */
  min-height: 100vh; /* ضمان تغطية كامل الارتفاع */
}

/* مبدأ المرونة: حاويات متجاوبة — منع خروج أي عنصر عن حدود الشاشة */
.content-area,
.add-ad-container,
.add-ad-card,
.ads-container,
.details-card,
.site-footer,
.footer-container {
  max-width: 100%;
  box-sizing: border-box;
}
.content-area { width: 100%; }
.add-ad-container { width: 100%; }
.add-ad-card { width: 100%; }
.ads-container { width: 100%; }

.page.active {
  display: block;
}

/* إخفاء صفحة حسابي بشكل صارم عند عدم النشاط */
#account-page:not(.active) {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  top: -9999px !important;
  width: 0 !important;
  flex-grow: 0 !important;
  flex-shrink: 0 !important;
}

/* استثناء صفحة حسابي - لا تستخدم flexbox مثل صفحة المحادثة */
#account-page.active {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: 100vh !important; /* توحيد سلوك صفحة حسابي مع بقية الصفحات */
  overflow: visible !important;
  position: relative !important;
  top: 0 !important;
  width: 100% !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ================= HEADER ================= */
.header {
  background: var(--light);
  padding: 15px 20px;
  padding-top: calc(15px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  box-shadow: 0 2px 10px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-left {
  flex: 1;
  display: flex;
  align-items: center;
  /* في RTL: flex-start = يمين الشاشة (حافة البداية) — زر الرجوع في حسابي يبقى على اليمين */
  justify-content: flex-start;
  min-width: 0;
}

/* إخفاء الشريط العلوي من جميع الصفحات ما عدا الصفحة الرئيسية */
.header.hidden {
  display: none !important;
}

.header-back-btn {
  background: none;
  border: none;
  color: var(--primary, #0ABAB5);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px 12px;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.header-back-btn:hover {
  color: var(--primary-dark, #089691);
}

.header h1 {
  flex: 1;
  font-size: 1.5rem;
  color: var(--primary, #0ABAB5);
  margin: 0;
  font-weight: 700;
  text-align: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* شعار الموقع: مبايعة (لون موحّد أزرق غامق) */
.site-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1em;
  line-height: 1.12;
  font-weight: 700;
  color: var(--brand-title, #067D79);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.site-brand__ar {
  display: block;
  font-family: "El Messiri", "Segoe UI", Tahoma, sans-serif;
  font-weight: 700;
  font-size: clamp(0.92rem, 0.9vw + 0.72rem, 1.22rem);
  letter-spacing: 0.03em;
  white-space: nowrap;
  text-align: center;
  color: inherit;
}

.site-brand--sub .site-brand__ar {
  font-size: clamp(0.82rem, 0.5vw + 0.7rem, 1rem);
}

.header h1.site-brand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-title, #067D79);
}

.header-actions {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 15px;
  min-width: 0;
}

/* صفحات الفوتر (أسئلة، خصوصية، اتفاقية...): زر الرجوع على يمين الشاشة في RTL */
body.standalone-page .header-actions {
  justify-content: flex-start;
  flex-direction: row;
}

/* مكان زر تثبيت PWA داخل الهيدر — يظهر فقط عند توفر التثبيت */
.pwa-install-slot {
  display: inline-flex;
  align-items: center;
}
.pwa-install-slot:empty {
  display: none;
}
.header-pwa-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary, #0ABAB5);
  background: white;
  border: 1px solid var(--primary, #0ABAB5);
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.header-pwa-install-btn:hover {
  background: var(--primary, #0ABAB5);
  color: white;
  box-shadow: 0 2px 6px rgba(10, 186, 181, 0.3);
}
.header-pwa-install-btn i {
  font-size: 11px;
}

/* تلميح تعليمات التثبيت (iOS فقط) — أسفل الشاشة، ألوان الموقع */
.pwa-ios-tooltip {
  padding-bottom: max(14px, env(safe-area-inset-bottom)) !important;
}

/* غلاف الأيقونة في الهيدر — يفك ارتباطها عن flex ويسمح بالتحريك بـ position */
.header-actions .btn-icon {
  position: absolute !important;
  top: 50% !important;
  right: 10px !important;
  transform: translateY(-50%) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  pointer-events: none;
}
.header-actions .btn-text {
  display: inline-block;
  margin: 0;
}

/* زر تسجيل الدخول - أزرق فاتح */
.auth-status-btn,
.auth-register-btn,
.admin-btn,
.auth-logout-btn {
  position: relative !important;
  padding-right: 36px !important; /* مساحة للأيقونة من اليمين (بدون تداخل مع النص) */
  padding-left: 20px !important;
}
.auth-status-btn {
  background-color: #0ABAB5 !important; /* أزرق فاتح */
  color: black !important;
  border: none !important;
  padding: 10px 20px;
  padding-right: 36px !important;
  border-radius: 25px;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 5px rgba(10, 186, 181, 0.2);
  min-width: 120px;
  justify-content: center !important;
}

.auth-status-btn:hover {
  background-color: #089691 !important; /* أزرق داكن عند التمرير */
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(10, 186, 181, 0.3);
}

/* زر تسجيل الخروج - أحمر فاتح */
.auth-status-btn.logged-in {
  background-color: #e74c3c !important; /* أحمر فاتح */
  box-shadow: 0 2px 5px rgba(231, 76, 60, 0.2);
}

.auth-status-btn.logged-in:hover {
  background-color: #c0392b !important; /* أحمر داكن عند التمرير */
  box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

/* زر إنشاء حساب - أخضر */
.auth-register-btn {
  background-color: #27ae60 !important; /* أخضر */
  color: black !important;
  border: none !important;
  padding: 10px 20px;
  padding-right: 36px !important;
  border-radius: 25px;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 5px rgba(39, 174, 96, 0.2);
  min-width: 120px;
  justify-content: center !important;
}

.auth-register-btn:hover {
  background-color: #229954 !important; /* أخضر داكن عند التمرير */
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

/* زر تسجيل الخروج - أحمر */
.auth-logout-btn {
  background-color: #e74c3c !important; /* أحمر فاتح */
  color: white !important;
  border: none !important;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 5px rgba(231, 76, 60, 0.2);
  min-width: 120px;
  justify-content: center;
}

.auth-logout-btn:hover {
  background-color: #c0392b !important; /* أحمر داكن عند التمرير */
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

/* منع تمطط أيقونة تسجيل الخروج — أبعاد ثابتة ووضع contain */
.auth-logout-btn .btn-icon {
  width: 24px;
  height: 24px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
}
.auth-logout-btn .btn-icon i {
  font-size: 1rem;
  object-fit: contain;
  display: inline-block;
}

/* إخفاء أزرار المصادقة حسب الحالة (تجاوز display: flex !important) */
.auth-status-btn.auth-hidden,
.auth-register-btn.auth-hidden,
.auth-logout-btn.auth-hidden {
  display: none !important;
}

.admin-btn {
  background: var(--warning);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  transition: var(--transition);
}

.admin-btn:hover {
  background: #e67e22;
  transform: translateY(-2px);
}

/* ================= AUTH PAGE SWITCHER ================= */
.auth-switcher {
  display: flex;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px var(--shadow);
}

.auth-switch-btn {
  flex: 1;
  padding: 15px;
  background: var(--light-gray);
  border: none;
  font-size: 1rem;
  font-weight: 600;
  color: black;
  cursor: pointer;
  transition: var(--transition);
}

.auth-switch-btn.active {
  background: var(--primary);
  color: black;
}

.auth-switch-btn:hover:not(.active) {
  background: var(--light-gray);
}

/* ================= HOME PAGE ================= */
.filters {
  background: var(--light);
  padding: 15px;
  overflow-x: auto;
  display: flex;
  gap: 10px;
  white-space: nowrap;
  box-shadow: 0 2px 5px var(--shadow);
}

.filter-btn {
  padding: 10px 15px;
  background: var(--light-gray);
  border: 2px solid var(--border);
  border-radius: 25px;
  cursor: pointer;
  font-family: 'Almarai', 'Cairo', 'Tajawal', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: #1a1a1a;
  letter-spacing: 0.3px;
  -webkit-font-smoothing: antialiased;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.filter-btn:hover {
  border-color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}


#filters-panel {
  background: white;
  padding: 20px;
  margin: 15px;
  border-radius: var(--radius);
  box-shadow: 0 2px 10px var(--shadow);
  display: none; /* مخفي افتراضياً، يظهر فقط عند اختيار شركة معينة */
}

.sub-top-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 15px;
}

.brand-dd-wrap,
.sort-dd-wrap,
.sort-options-wrap,
.mc-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  min-width: 240px;
}

.brand-dd-label,
.sort-dd-label,
.sort-options-label,
.mc-label {
  font-weight: 700;
  color: #1a1a1a;
  font-size: 1.05rem;
  -webkit-font-smoothing: antialiased;
}

.brand-dd-select,
.sort-dd-select,
.mc-select {
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 1.08rem;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  min-width: 240px;
  -webkit-font-smoothing: antialiased;
}

.brand-dd-select option,
.mc-select option {
  font-size: 1rem;
  font-weight: 600;
  padding: 10px;
}

/* سنة الصنع: حقلين من ـ الى — نفس مقاس القوائم المنسدلة */
.year-range-wrap .year-range-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: nowrap;
  width: 100%;
  min-width: 240px;
  min-height: 48px;
  height: 48px;
  box-sizing: border-box;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}
.year-range-wrap .mc-select.year-from,
.year-range-wrap .mc-select.year-to {
  flex: 1 1 50%;
  min-width: 0;
  width: auto;
  min-height: 48px;
  height: 48px;
  margin: 0;
  padding: 12px 10px;
  border: none;
  border-radius: 0;
  box-sizing: border-box;
}
.year-range-wrap .mc-select.year-to {
  border-inline-start: 1px solid var(--border);
}
.year-range-sep {
  display: none;
}

/* قطع غيار: محاذاة سنة الصنع والمدينة مع «اسم القطعة» — نفس الصف ونفس المستوى */
#filters-panel.filters-panel--scrap .sub-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 15px;
}

#filters-panel.filters-panel--scrap .brand-dd-wrap,
#filters-panel.filters-panel--scrap #scrapBrandWrap,
#filters-panel.filters-panel--scrap #scrapCarTypeWrap,
#filters-panel.filters-panel--scrap #scrapPartWrap,
#filters-panel.filters-panel--scrap .year-range-wrap,
#filters-panel.filters-panel--scrap .mc-box:has(#citySelect) {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 0;
  position: relative;
  top: 0;
  flex: 1 1 240px;
  width: auto;
  min-width: 240px;
  max-width: none;
  box-sizing: border-box;
}

/* حقل من–إلى = نفس عرض/ارتفاع قائمة «اسم القطعة» */
#filters-panel.filters-panel--scrap .year-range-wrap .year-range-row,
#filters-panel.filters-panel--scrap #scrapPartDropdown {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  height: 48px;
  margin: 0;
  box-sizing: border-box;
}

#filters-panel.filters-panel--scrap .year-range-wrap .year-range-row {
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: white;
}

#filters-panel.filters-panel--scrap .year-range-wrap .mc-select.year-from,
#filters-panel.filters-panel--scrap .year-range-wrap .mc-select.year-to,
#filters-panel.filters-panel--scrap #scrapPartDropdown,
#filters-panel.filters-panel--scrap .brand-dd-select,
#filters-panel.filters-panel--scrap .mc-select {
  min-height: 48px;
  height: 48px;
  margin: 0;
  box-sizing: border-box;
}

#filters-panel.filters-panel--scrap #scrapPartDropdown,
#filters-panel.filters-panel--scrap .brand-dd-select,
#filters-panel.filters-panel--scrap .mc-select {
  padding: 12px 14px;
}

#filters-panel.filters-panel--scrap .year-range-wrap .mc-select.year-from,
#filters-panel.filters-panel--scrap .year-range-wrap .mc-select.year-to {
  flex: 1 1 50%;
  min-width: 0;
  padding: 12px 10px;
  border: none;
  border-radius: 0;
}

/* سطح المكتب: محاذاة صف الفلاتر + إنزال «فلتر» قليلاً ليطابق أسفل «اختر المدينة» */
@media (min-width: 769px) {
  #filters-panel .sub-top-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 15px;
  }

  #filters-panel .brand-dd-wrap,
  #filters-panel .sort-options-wrap,
  #filters-panel .mc-box,
  #filters-panel .year-range-wrap {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
    margin: 0;
    padding: 0;
    flex: 1 1 240px;
    min-width: 240px;
    max-width: none;
    box-sizing: border-box;
  }

  #filters-panel .brand-dd-label,
  #filters-panel .sort-options-label,
  #filters-panel .mc-label {
    min-height: 1.35em;
    line-height: 1.35;
    margin: 0;
  }

  #filters-panel .brand-dd-select,
  #filters-panel .mc-select,
  #filters-panel .sort-dropdown-toggle {
    min-height: 48px;
    height: 48px;
    margin: 0;
    box-sizing: border-box;
  }

  #filters-panel .year-range-wrap .year-range-row {
    min-height: 48px;
    height: 48px;
    margin: 0;
    box-sizing: border-box;
  }

  #filters-panel .sort-options-wrap {
    margin-top: 5px;
  }
}

/* تحسين قائمة اسم القطعة لتكون بنفس الحجم */
#scrapPartWrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  min-width: 240px;
}

#scrapPartDropdown {
  width: 100%;
  min-width: 240px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 1.08rem;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  transition: var(--transition);
  -webkit-font-smoothing: antialiased;
}

.brand-dd-select:hover,
.sort-dd-select:hover,
.mc-select:hover {
  border-color: var(--primary);
}

.sort-dropdown-toggle {
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 1.08rem;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 240px;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

.sort-dropdown-toggle:hover {
  border-color: var(--primary);
}

.sort-dropdown-toggle i {
  font-size: 0.8rem;
  transition: var(--transition);
}

.sort-options-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  margin-top: 5px;
  padding: 15px;
  display: none;
  max-height: 400px;
  overflow-y: auto;
}

.sort-options-dropdown.show {
  display: block;
}

.sort-options-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sort-options-row {
  display: flex;
  gap: 8px;
}

.sort-option-btn {
  flex: 1;
  padding: 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: var(--light-gray);
  color: #1a1a1a;
  font-size: 1.02rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  -webkit-font-smoothing: antialiased;
}

.sort-option-btn:hover {
  border-color: var(--primary);
  background: var(--light-gray);
}

.sort-option-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
}

.search-wrap {
  padding: 15px;
}

.search-container {
  display: flex;
  background: white;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: 0 4px 15px var(--shadow);
}

.search-input {
  flex: 1;
  padding: 15px 20px;
  border: none;
  outline: none;
  font-size: 1.08rem;
  font-weight: 600;
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
}

.search-input::placeholder {
  color: #555;
  font-weight: 500;
}

.search-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0 25px;
  cursor: pointer;
  transition: var(--transition);
}

.search-btn:hover {
  background: #089691;
}

/* ================= HOME PAGE ================= */
#home-page {
  background: var(--light); /* توحيد لون الخلفية */
  min-height: 100vh; /* ملء كامل الشاشة */
}

/* ================= ADS CONTAINER ================= */
.ads-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px;
  background: var(--light); /* توحيد لون الخلفية */
}

@media (max-width: 768px) {
  .ads-container {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
    padding: 14px;
  }
  
  .ad-img {
    aspect-ratio: 4 / 3;
    min-height: 140px;
  }
  
  .ad-title {
    font-size: 0.95rem;
  }
  
  .ad-price {
    font-size: 1.3rem;
  }
}

.ad-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  font-family: 'Almarai', 'Cairo', 'Tajawal', sans-serif;
  min-height: 0;
}

.ad-card .ad-compare-checkbox {
  overflow: visible !important;
}

.ad-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  border-color: rgba(10, 186, 181, 0.2);
}

/* منطقة الصورة: ارتفاع ثابت (4/3) — لا تتقلص لتبقى البطاقات متوازية */
.ad-img {
  aspect-ratio: 4 / 3;
  width: 100%;
  min-height: 160px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.ad-img::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.1) 100%);
  z-index: 1;
  pointer-events: none; /* الأندرويد: عدم حجب النقر عن الأسهم */
}

.ad-img i {
  font-size: 3.5rem;
  color: white;
  opacity: 0.6;
  z-index: 2;
}

.ad-img img,
.ad-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  z-index: 0;
  aspect-ratio: 4 / 3;
}

.ad-card:hover .ad-img img {
  transform: scale(1.1);
}

.ad-card:hover .ad-card-slider img {
  transform: none;
}

/* سلايدر صور البطاقة — منع التحديد والـ highlight عند النقر/اللمس */
.ad-card-slider,
.ad-card-slider-track,
.ad-card-slider-arrow {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  tap-highlight-color: transparent;
}
.ad-card-slider-arrow:focus {
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.ad-card-slider {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  min-height: 160px;
  flex-shrink: 0;
  overflow: hidden;
}

.ad-card-slider-track {
  position: relative;
  width: 100%;
  height: 100%;
}

.ad-card-slider-track img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.ad-card-slider-track img.active {
  opacity: 1;
  z-index: 1;
  pointer-events: auto;
}

/* أسهم السلايدر — تظهر فقط عند وجود أكثر من صورة (ad-card-slider-single يخفيها) */
.ad-card-slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a1a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  pointer-events: auto;
  touch-action: manipulation;
}

.ad-card-slider-arrow:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.3);
}

.ad-card-slider-arrow:active {
  transform: translateY(-50%) scale(1.02);
}

.ad-card-slider-prev {
  right: 10px;
}

.ad-card-slider-next {
  left: 10px;
}

.ad-card-slider-arrow i {
  font-size: 1.1rem;
  color: #1a1a1a;
  display: block;
  line-height: 1;
}

/* إخفاء الأسهم عند صورة واحدة فقط */
.ad-card-slider-single .ad-card-slider-arrow {
  display: none;
}

/* على الجوال: منطقة لمس كافية ومحددة (44px) — على الجانبين فقط دون تداخل مع وسط البطاقة */
@media (max-width: 768px), (hover: none) {
  .ad-card-slider-arrow {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    z-index: 15;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
  }
  .ad-card-slider-prev {
    right: 10px;
    left: auto;
  }
  .ad-card-slider-next {
    left: 10px;
    right: auto;
  }
}

/* ========== خاص بالأندرويد وكروم: تعطيل الهالة والتظليل على البطاقة والأسهم ========== */
.ad-card,
.ad-card *,
.ad-card .ad-img,
.ad-card .ad-card-slider,
.ad-card .ad-card-slider-track,
.ad-card .ad-card-slider-arrow {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
}
.ad-card .ad-img:active,
.ad-card .ad-card-slider:active,
.ad-card .ad-card-slider-track:active,
.ad-card button.ad-card-slider-arrow:active {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
}
.ad-card .ad-img,
.ad-card .ad-card-slider,
.ad-card .ad-card-slider-track {
  pointer-events: auto;
}
.ad-card .ad-card-slider-arrow {
  pointer-events: auto !important;
}
.ad-card .ad-img::before,
.ad-card .ad-card-slider-track img:not(.active) {
  pointer-events: none !important;
}
/* إزالة تظليل الـ active الذي يظهر على أندرويد عند النقر (الحاويات فقط) */
.ad-card .ad-img:active,
.ad-card .ad-card-slider:active,
.ad-card .ad-card-slider-track:active {
  background-color: transparent !important;
}

/* مساحة محجوزة عند عدم وجود صورة — نفس أبعاد الصورة (4/3) */
.ad-card-placeholder {
  flex-shrink: 0;
}

.ad-card-placeholder i {
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.5);
}

.ad-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: white;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-family: 'Almarai', 'Cairo', 'Tajawal', sans-serif;
  font-weight: 800;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ad-badge.used {
  background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
}

/* حاوية المعلومات: تبدأ دائماً أسفل منطقة الصورة (نفس الارتفاع) لظهور الأسعار على خط أفقي واحد */
.ad-body {
  padding: 16px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

.ad-price {
  color: var(--primary);
  font-size: 1.4rem;
  font-family: 'Almarai', 'Cairo', 'Tajawal', sans-serif;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.ad-price i {
  font-size: 1rem;
  opacity: 0.8;
}

.ad-title {
  font-size: 1rem;
  font-family: 'Almarai', 'Cairo', 'Tajawal', sans-serif;
  font-weight: 800;
  letter-spacing: 0.3px;
  margin-bottom: 12px;
  color: var(--dark);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.ad-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* لون خط بيانات البطاقة: اسم المعلن، نوع السيارة، المدينة، تاريخ الإعلان */
.ad-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #374151;
  font-size: 0.85rem;
  font-family: 'Almarai', 'Cairo', 'Tajawal', sans-serif;
  font-weight: 700;
  letter-spacing: 0.3px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.ad-meta span i {
  color: var(--primary);
  font-size: 0.8rem;
  width: 16px;
  text-align: center;
}

.ad-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
}

.ad-favorite {
  color: var(--gray);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 5px;
  border-radius: 50%;
}

.ad-favorite:hover {
  background-color: rgba(231, 76, 60, 0.1);
  transform: scale(1.1);
}

.ad-favorite i {
  color: var(--accent);
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.ad-favorite:hover i {
  color: var(--danger);
}

.ad-favorite .fas.fa-heart {
  color: var(--danger);
  animation: heartBeat 0.3s ease;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.ad-views {
  color: var(--gray);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

.ad-views i {
  color: var(--primary);
  font-size: 0.9rem;
}

.ad-date {
  color: var(--gray);
  font-size: 0.8rem;
  font-weight: 400;
}

.ad-comments-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 15px;
  padding: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, #7ADED9 100%);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(10, 186, 181, 0.3);
}

.ad-comments-icon:hover {
  background: linear-gradient(135deg, #7ADED9 0%, var(--primary) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(10, 186, 181, 0.4);
}

.ad-comments-icon i {
  font-size: 1rem;
}

/* ================= AUTH PAGE ================= */
.details-header {
  background: #ffffff;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 2px 10px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 999;
}

.back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
}

/* تغيير لون زر الرجوع إلى الأسود في صفحات المفضلة والرسائل والملف الشخصي */
#favorites-page .back-btn,
#account-page .back-btn {
  color: #000;
}

.details-header h2 {
  flex: 1;
  margin: 0;
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* نقل عنوان المفضلة إلى المنتصف */
#favorites-page .details-header {
  justify-content: center;
  position: relative;
}

#favorites-page .details-header .back-btn {
  position: absolute;
  right: 20px;
}

#favorites-page .details-header h2 {
  text-align: center;
  flex: none;
}

/* صفحة أضف إعلان: مبايعة في المنتصف مع زر الرجوع على الجانب */
#add-ad-page .details-header {
  justify-content: center;
  position: relative;
}
#add-ad-page .details-header .back-btn {
  position: absolute;
  right: 20px;
}
#add-ad-page .details-header h2 {
  text-align: center;
  flex: none;
  color: var(--primary);
  font-size: 1.25rem;
}

#add-ad-page .details-header h2.site-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08em;
  font-size: 1rem;
  line-height: 1.1;
  color: var(--brand-title, #067D79);
}

/* ================= ACCOUNT PAGE - فصل كامل عن منطق المحادثة ================= */
/* إجبار صفحة حسابي على التصرف كصفحة مقالات عادية - تبدأ من الأعلى */
#account-page {
  padding: 0 !important;
  margin: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  position: relative !important;
  top: 0 !important;
  min-height: auto !important;
  max-height: none !important;
  height: auto !important;
  background: var(--light) !important;
  display: block !important;
  overflow: visible !important;
  /* إلغاء أي تنسيقات flexbox من الصفحات الأخرى */
  align-items: flex-start !important;
  justify-content: flex-start !important;
  align-content: flex-start !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  flex-grow: 0 !important;
  flex-shrink: 0 !important;
  flex-basis: auto !important;
}

/* إخفاء السطر العلوي (details-header) بالكامل في صفحة الملف الشخصي - بدون أي مساحة */
#account-page .details-header {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  margin-top: 0 !important;
  padding: 0 !important;
  padding-top: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
  position: absolute !important;
  top: -9999px !important;
  width: 0 !important;
  flex-grow: 0 !important;
  flex-shrink: 0 !important;
}

/* إخفاء صفحة الرسائل بشكل صارم عند فتح صفحة حسابي */
#account-page.active ~ #messages-page,
#account-page.active ~ #chat-page {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  top: -9999px !important;
  width: 0 !important;
  flex-grow: 0 !important;
  flex-shrink: 0 !important;
}

.auth-container {
  padding: 20px;
}

.auth-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 5px 20px var(--shadow);
  max-width: 500px;
  margin: 0 auto;
}

.auth-header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 25px;
  text-align: center;
}

.auth-body {
  padding: 25px;
}

/* تنبيه الحساب غير المفعل في صفحة تسجيل الدخول (متوافق Chrome/Safari) */
.login-unverified-alert {
  background: #fff8e6;
  border: 1px solid #f0c674;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 18px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.login-unverified-alert .login-unverified-message {
  margin: 0 0 12px 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #5a4a2a;
}
.login-unverified-alert .auth-btn-resend {
  margin: 0;
  padding: 12px 16px;
  font-size: 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.login-unverified-alert .auth-btn-resend:disabled {
  opacity: 0.85;
  cursor: not-allowed;
  -webkit-tap-highlight-color: transparent;
}
/* زر إعادة الإرسال: حجم لمس مناسب للجوال (iOS/Android) وعداد تنازلي */
.login-unverified-alert .auth-btn-resend {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.login-unverified-alert .auth-btn-resend .fa-clock {
  margin-left: 6px;
}

.forgot-password-wrap {
  text-align: right;
  margin-top: 12px;
  margin-bottom: 4px;
  position: relative;
  z-index: 2;
}

.forgot-password-link {
  display: inline-block;
  font-size: 15px;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(10, 186, 181, 0.2);
  touch-action: manipulation;
  padding: 8px 0;
  min-height: 44px;
  line-height: 28px;
  box-sizing: border-box;
  border: none;
  background: transparent;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  box-shadow: none;
}
.forgot-password-link:hover {
  color: var(--secondary);
  text-decoration: underline;
}
.forgot-password-link:active {
  color: var(--secondary);
}

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

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.condition-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.condition-option {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 15px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--light-gray);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.condition-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.condition-option span {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--dark);
}

.condition-option span i {
  font-size: 1rem;
  color: var(--gray);
}

.condition-option:hover {
  border-color: var(--primary);
  background: var(--light-gray);
}

.condition-option input[type="radio"]:checked + span {
  color: var(--primary);
  font-weight: 600;
}

.condition-option input[type="radio"]:checked + span i {
  color: var(--primary);
}

.condition-option:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: rgba(10, 186, 181, 0.1);
}

.form-input {
  width: 100%;
  padding: 15px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: var(--transition);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Ensure select options are always visible */
select.form-input {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
  min-height: 50px;
  -webkit-appearance: menulist !important;
  -moz-appearance: menulist !important;
  appearance: menulist !important;
}

select.form-input option {
  display: block !important;
  padding: 10px;
  background: white;
  color: var(--dark);
}

/* حقل حالة السيارة — نفس مقاس وعرض الحقول المجاورة */
#add-ad-page #ad-condition {
  min-height: 60px !important;
  height: 60px !important;
  padding: 14px 16px !important;
  padding-inline-start: 36px !important;
  padding-inline-end: 16px !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  line-height: 1.5 !important;
  vertical-align: middle !important;
}

/* رقم الجوال — إطار موحّد مثل السعر: حقل + «إظهار رقم الجوال» */
#add-ad-page .phone-group {
  display: block;
  width: 100%;
  min-width: 0;
}

#add-ad-page .phone-unified {
  display: -webkit-box;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
  flex-direction: row;
  -webkit-flex-wrap: nowrap;
  flex-wrap: nowrap;
  -webkit-box-align: stretch;
  -webkit-align-items: stretch;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 48px;
  box-sizing: border-box;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: visible;
}

#add-ad-page .phone-unified__input {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 0%;
  flex: 1 1 0%;
  min-width: 0;
  width: 0;
  min-height: 48px;
  box-sizing: border-box;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 12px 10px;
  text-align: right !important;
  direction: rtl !important;
  font-size: 1rem;
  font-weight: 500;
  background: #fff;
}

#add-ad-page .phone-unified__show.toggle-switch {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  flex: 0 0 auto;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  display: -webkit-box;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
  flex-direction: row;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  gap: 6px;
  min-width: 200px;
  max-width: none;
  padding: 0 12px;
  padding-inline-start: 14px;
  padding-inline-end: 12px;
  box-sizing: border-box;
  cursor: pointer;
  background: #f0f2f5;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

#add-ad-page .phone-unified__show .toggle-label {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: #1a1a1a;
  text-align: right;
  white-space: nowrap;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  overflow: visible;
  min-width: min-content;
}

#add-ad-page .phone-unified__show .toggle-slider {
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

/* إيقاف «إظهار رقم الجوال» — نفس مظهر حقل السعر مع «على السوم» (الحقل معطّل) */
#add-ad-page .phone-unified--show-off {
  background: #e8ecef;
  border-color: #cfd8dc;
}

#add-ad-page .phone-unified--show-off .phone-unified__input {
  background: #e8ecef !important;
  color: #455a64;
  -webkit-text-fill-color: #455a64;
  cursor: not-allowed;
}

#add-ad-page .phone-unified--show-off .phone-unified__input:disabled {
  opacity: 1;
  -webkit-text-fill-color: #455a64;
  background: #e8ecef !important;
  cursor: not-allowed;
}

#add-ad-page .phone-unified--show-off .phone-unified__show.toggle-switch {
  background: #dde3e6;
}

#add-ad-page .phone-unified--show-off .phone-unified__show .toggle-label {
  color: #455a64;
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: relative;
  width: 50px;
  height: 26px;
  background-color: #ccc;
  border-radius: 26px;
  transition: background-color 0.3s ease;
  flex-shrink: 0;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider::before {
  transform: translateX(24px);
}

.toggle-label {
  font-size: 0.9rem;
  color: var(--dark);
  font-weight: 500;
}

/* غلاف حقل كلمة المرور + أيقونة العين على اليسار فقط */
.password-input-wrap {
  position: relative;
  width: 100%;
}
.password-input-wrap .form-input {
  padding-left: 48px;
  padding-right: 15px;
}
.password-toggle {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 8px;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.2s ease;
}
.password-toggle:hover {
  color: var(--primary);
}
.password-toggle:focus {
  outline: none;
  color: var(--primary);
}

/* إخفاء أيقونة إظهار/إخفاء كلمة المرور الافتراضية للمتصفح (مثل Edge) */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
  display: none;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 186, 181, 0.1);
}

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

.form-input.error,
.form-input.required-error {
  border-color: var(--danger) !important;
  background-color: #fff5f5;
}

.field-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.field-error::before {
  content: "⚠";
  font-size: 0.9rem;
}

.auth-btn {
  width: 100%;
  padding: 15px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.auth-btn:hover {
  background: #089691;
  transform: translateY(-2px);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.auth-btn:disabled:hover {
  background: var(--primary);
  transform: none;
}

/* مربع الموافقة على الشروط في صفحة إنشاء الحساب */
.register-terms-row {
  margin-bottom: 18px;
}
.register-terms-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--dark, #1a1a1a);
  -webkit-tap-highlight-color: transparent;
}
.register-terms-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
}
.register-terms-text {
  flex: 1;
  min-width: 0;
}
.register-terms-link {
  color: var(--primary, #0ABAB5);
  text-decoration: underline;
  font-weight: 600;
}
.register-terms-link:hover,
.register-terms-link:focus {
  text-decoration: underline;
  opacity: 0.9;
}

@media (max-width: 768px) {
  .register-terms-label {
    font-size: 0.9rem;
    gap: 8px;
  }
  .register-terms-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-top: 0;
  }
}

/* ================= ADD AD PAGE ================= */
#add-ad-page,
#add-ad-page * {
  box-sizing: border-box !important;
}

#add-ad-page {
  color: #1a1a1a !important;
  font-size: 1.22rem !important;
  font-weight: 500 !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  height: auto !important;
  min-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* إخفاء عناوين الحقول (Labels) في صفحة إضافة إعلان والاكتفاء بما داخل الحقول
   مع الإبقاء على عنوان حقل "عنوان الإعلان" في الأعلى فقط */
#add-ad-page .form-label,
#add-ad-page .form-group > label.form-label {
  display: none !important;
}
#add-ad-page .price-label-row .form-label {
  display: none !important;
}

/* إظهار عنوان حقل "عنوان الإعلان" فوق الحقل بتنسيق واضح */
#add-ad-page .form-label.form-label-title {
  display: block !important;
  font-size: 1.28rem !important;
  font-weight: 700 !important;
  color: #1a1a1a !important;
  margin-bottom: 6px !important;
  margin-top: 0 !important;
}
#add-ad-page .form-group label.checkbox-label,
#add-ad-page .form-group .toggle-label {
  display: inline-flex !important;
}

#add-ad-page .form-input,
#add-ad-page select.form-input,
#add-ad-page .form-input::placeholder {
  color: #1a1a1a !important;
  font-size: 1.38rem !important;
  font-weight: 600 !important;
  line-height: 1.5 !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#add-ad-page .form-input.textarea {
  font-size: 1.38rem !important;
  font-weight: 500 !important;
  color: #1a1a1a !important;
  line-height: 1.5 !important;
}

#add-ad-page .toggle-label,
#add-ad-page .upload-area p,
#add-ad-page .checkbox-label {
  color: #1a1a1a !important;
  font-size: 1.28rem !important;
  font-weight: 600 !important;
  -webkit-font-smoothing: antialiased;
}

#add-ad-page .add-ad-header h3 {
  font-size: 1.65rem !important;
  font-weight: 700 !important;
  color: white !important;
}

#add-ad-page .submit-btn {
  font-size: 1.3rem !important;
  font-weight: 600 !important;
  color: white !important;
}

#add-ad-page #ad-submit-note {
  font-size: 1.06rem !important;
  color: #333 !important;
  margin-top: 4px !important;
}

/* شريط علوي لتنبيه تفعيل البريد — لا يؤثر على مكان الحقول.
   افتراضياً مخفي (display: none)، ويُظهَر فقط عند الحاجة من الـ JS. */
.add-ad-verify-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: #fff8e6;
  border-bottom: 1px solid #f0c674;
  color: #856404;
  font-size: 1.05rem;
  font-weight: 600;
  flex-shrink: 0;
}
.add-ad-verify-banner[hidden],
#add-ad-email-verify-alert[hidden] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
}
.add-ad-verify-banner i {
  font-size: 1.25rem;
  flex-shrink: 0;
}
.add-ad-verify-banner-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.add-ad-verify-resend-btn {
  padding: 10px 20px;
  min-height: 44px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1a5c34;
  background: rgba(39, 174, 96, 0.1);
  border: 1px solid rgba(39, 174, 96, 0.35);
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}
.add-ad-verify-resend-btn:hover,
.add-ad-verify-resend-btn:focus {
  background: rgba(39, 174, 96, 0.18);
  border-color: rgba(39, 174, 96, 0.5);
  outline: none;
}
.add-ad-verify-resend-btn:active {
  opacity: 0.85;
}
.add-ad-verify-resend-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
@media (max-width: 480px) {
  .add-ad-verify-resend-btn {
    min-height: 44px;
    padding: 10px 18px;
    font-size: 0.78rem;
  }
}

/* تعطيل حقول النموذج عند عدم تفعيل البريد (الحقول تبقى بعرض كامل) */
#add-ad-page .add-ad-body.add-ad-email-not-verified input,
#add-ad-page .add-ad-body.add-ad-email-not-verified select,
#add-ad-page .add-ad-body.add-ad-email-not-verified textarea,
#add-ad-page .add-ad-body.add-ad-email-not-verified .form-input,
#add-ad-page .add-ad-body.add-ad-email-not-verified .upload-area,
#add-ad-page .add-ad-body.add-ad-email-not-verified .submit-btn {
  pointer-events: none !important;
  opacity: 0.6;
}
#add-ad-page .add-ad-body.add-ad-email-not-verified .submit-btn {
  cursor: not-allowed;
}

#add-ad-page .price-label-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
#add-ad-page .price-label-row .form-label {
  margin-bottom: 0;
}
#add-ad-page .price-option-inline {
  font-weight: 500;
  font-size: 1.06rem;
}
#add-ad-page .price-option {
  margin-top: 4px !important;
}

/* حقل السعر + «على السوم» — صف Flex، إطار واحد (صف واحد على الجوال) */
#add-ad-page .price-group {
  display: block;
  width: 100%;
  min-width: 0;
}

#add-ad-page .price-unified {
  display: -webkit-box;
  display: flex;
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
  flex-direction: row;
  -webkit-flex-wrap: nowrap;
  flex-wrap: nowrap;
  -webkit-box-align: stretch;
  -webkit-align-items: stretch;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 48px;
  box-sizing: border-box;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: visible;
}

#add-ad-page .price-unified--som-active {
  background: #e8ecef;
  border-color: #cfd8dc;
}

#add-ad-page .price-unified__input {
  -webkit-box-flex: 1;
  -webkit-flex: 1 1 0%;
  flex: 1 1 0%;
  min-width: 0;
  width: 0;
  min-height: 48px;
  box-sizing: border-box;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 12px 10px;
  text-align: right;
  font-size: 1rem;
  font-weight: 500;
  background: #fff;
}

/* إخفاء أسهم العداد (Chrome / Edge / Safari) — الإدخال يبقى يدوياً */
#add-ad-page .price-unified__input::-webkit-outer-spin-button,
#add-ad-page .price-unified__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

/* Firefox */
#add-ad-page .price-unified__input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

#add-ad-page .price-unified--som-active .price-unified__input {
  background: #e8ecef !important;
  color: #455a64;
  cursor: not-allowed;
}

#add-ad-page .price-unified__input:disabled {
  opacity: 1;
  -webkit-text-fill-color: #455a64;
  background: #e8ecef !important;
}

#add-ad-page .price-unified__som {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 auto;
  flex: 0 0 auto;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  display: -webkit-box;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  min-width: 128px;
  max-width: none;
  padding: 0 12px;
  padding-inline-start: 14px;
  padding-inline-end: 12px;
  box-sizing: border-box;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.35;
  color: #1a1a1a;
  white-space: nowrap;
  background: #f0f2f5;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

#add-ad-page .price-unified--som-active .price-unified__som {
  background: #dde3e6;
}

#add-ad-page .price-unified__som input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0 0 0 6px;
  padding: 0;
  cursor: pointer;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  accent-color: var(--primary, #0ABAB5);
}

#add-ad-page .price-unified__som-text {
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  min-width: min-content;
  overflow: visible;
}

/* الحاوية الرئيسية لصفحة الإعلان — إلغاء أي طول محدد وتمديد الصفحة لآخر الشاشة */
#add-ad-page .add-ad-container {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 12px 16px !important;
  height: auto !important;
  min-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
}

#add-ad-page .add-ad-card {
  background: white !important;
  border-radius: var(--radius) !important;
  overflow: hidden !important;
  box-shadow: 0 5px 20px var(--shadow) !important;
  max-width: none !important;
  width: 100% !important;
  height: auto !important;
  min-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
}

.add-ad-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 5px 20px var(--shadow);
  max-width: none;
}

.add-ad-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 10px 14px;
}

#add-ad-page .add-ad-header {
  flex-shrink: 0;
}

/* تبويبات إعلان سيارة / قطع غيار — عرض كامل، مساحة لمس مناسبة للجوال */
#add-ad-page .add-ad-tabs {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  gap: 8px;
  margin-bottom: 6px;
}

#add-ad-page .add-ad-tab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 48px;
  padding: 14px 12px;
  margin: 0;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  background: #f4f5f7;
  color: var(--text, #333);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

#add-ad-page .add-ad-tab:hover {
  background: #e8eaed;
}

#add-ad-page .add-ad-tab.add-ad-tab--active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

#add-ad-page .add-ad-tab:focus-visible {
  outline: 3px solid rgba(46, 204, 113, 0.45);
  outline-offset: 2px;
}

/* الحاوية الرئيسية: Grid احترافي عمودين متساويين */
#add-ad-page .add-ad-body,
body #add-ad-page .add-ad-body {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 20px !important;
  padding: 16px 20px !important;
  margin: 0 !important;
  height: auto !important;
  min-height: 100vh !important;
  align-items: start !important;
  overflow-y: auto !important;
}

/* كل صف عادي = حقلين (عمودين متساويين) */
#add-ad-page .add-ad-body > .form-row:not(.form-row-full):not(.form-row-title-desc),
body #add-ad-page .add-ad-body > .form-row:not(.form-row-full):not(.form-row-title-desc),
#add-ad-page .add-ad-parts-fields > .form-row,
body #add-ad-page .add-ad-parts-fields > .form-row {
  grid-column: 1 / -1 !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 20px !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  align-items: start !important;
}

/* قطع غيار — تجميع الحقول بترتيب متناسق */
#add-ad-page .add-ad-parts-fields,
body #add-ad-page .add-ad-parts-fields {
  grid-column: 1 / -1 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
  width: 100% !important;
  min-width: 0 !important;
}

/* الحقول الطويلة (عنوان الإعلان، وصف السيارة، صور) — السطر بالكامل */
#add-ad-page .add-ad-body > .form-row.form-row-full,
#add-ad-page .add-ad-body > .form-row.form-row-title-desc,
#add-ad-page .add-ad-body > .form-row:has(.form-group-full),
body #add-ad-page .add-ad-body > .form-row.form-row-full,
body #add-ad-page .add-ad-body > .form-row.form-row-title-desc,
body #add-ad-page .add-ad-body > .form-row:has(.form-group-full) {
  grid-column: span 2 !important;
  display: block !important;
  width: 100% !important;
}

/* كل حقل إدخال يملأ مكانه في الشبكة */
#add-ad-page .add-ad-body .form-group {
  min-width: 0 !important;
  width: 100% !important;
}

#add-ad-page .add-ad-body .form-input,
#add-ad-page .add-ad-body select.form-input,
#add-ad-page .add-ad-body input.form-input,
body #add-ad-page .add-ad-body .form-input,
body #add-ad-page .add-ad-body select.form-input,
body #add-ad-page .add-ad-body input.form-input {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* حقل بعرض كامل — العنوان فوق الحقل */
#add-ad-page .add-ad-body > .form-row > .form-group.form-group-full,
body #add-ad-page .add-ad-body > .form-row > .form-group.form-group-full {
  grid-column: 1 / -1 !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
}

#add-ad-page .add-ad-body > .form-row > .form-group.form-group-full > .form-label {
  display: block !important;
  margin-bottom: 6px !important;
}

/* خانة فارغة للمحاذاة (نوع الوقود + عمود فارغ) */
#add-ad-page .form-group-spacer {
  min-height: 0;
  visibility: hidden;
  pointer-events: none;
}

/* مسافة خفيفة فوق عنوان الإعلان ووصف السيارة */
#add-ad-page .form-row-title-desc:first-of-type {
  margin-top: 0.5rem;
}

/* إلغاء القاعدة العامة form-group (margin-bottom) داخل صفحة إضافة الإعلان */
#add-ad-page .add-ad-body .form-group {
  margin: 0 !important;
  padding: 0 !important;
  align-self: start !important;
}

#add-ad-page .form-row .form-group,
#add-ad-page .form-row-half .form-group {
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  width: 100% !important;
}

/* حقول العرض الكامل: display block و width 100% */
#add-ad-page .add-ad-body > .form-row > .form-group.form-group-full .form-input,
#add-ad-page .add-ad-body > .form-row > .form-group.form-group-full textarea,
#add-ad-page .add-ad-body > .form-row > .form-group.form-group-full .upload-area {
  display: block !important;
  width: 100% !important;
}

#add-ad-page .form-group {
  margin: 0 !important;
}

#add-ad-page .add-ad-body > .submit-btn {
  grid-column: 1 / -1 !important;
  justify-self: center !important;
  margin: 0 !important;
  margin-top: 24px !important;
  align-self: start !important;
}

#add-ad-page .add-ad-body > #ad-submit-note {
  grid-column: 1 / -1 !important;
  margin: 0 !important;
  padding: 0 !important;
}

#add-ad-page .form-row > .form-group.form-group-full {
  display: block !important;
  width: 100% !important;
}

#add-ad-page .add-ad-body > .form-row,
#add-ad-page .add-ad-body > .form-row-half {
  margin: 0 !important;
  margin-bottom: 0 !important;
}

/* إلغاء القواعد العامة للـ form-row خارج صفحة الإعلان — لا تؤثر على add-ad */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

/* داخل صفحة الإعلان: إجبار Grid عمودين وتباعد 20px (تجاوز أي قاعدة عامة) */
#add-ad-page .form-row,
#add-ad-page .form-row-half,
body #add-ad-page .form-row,
body #add-ad-page .form-row-half {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 20px !important;
  width: 100% !important;
  margin-bottom: 0 !important;
}

.form-row-half {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}
@media (min-width: 768px) {
  .form-row-half {
    flex-direction: row;
  }
  .form-row-half .form-group {
    flex: 1;
  }
}

@media (min-width: 769px) {
  /* قطع غيار — صف السعر: نفس شبكة ومقاس عمود السعر في صف «السعر | الجوال» (تبويب سيارة) */
  #add-ad-page .add-ad-body > #add-ad-parts-row-price.form-row,
  body #add-ad-page .add-ad-body > #add-ad-parts-row-price.form-row,
  #add-ad-page .add-ad-parts-fields > #add-ad-parts-row-price.form-row,
  body #add-ad-page .add-ad-parts-fields > #add-ad-parts-row-price.form-row {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
    width: 100% !important;
    min-width: 0 !important;
    align-items: start !important;
  }
  #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group {
    min-width: 0 !important;
  }
}
/* حقول صفحة إضافة إعلان: line-height و padding كافٍ لعدم قص النص العربي */
#add-ad-page .form-input,
#add-ad-page select.form-input {
  background: #f2f2f2 !important;
  border: 1px solid #e5ddd0 !important;
  border-radius: 8px !important;
  min-height: 60px !important;
  height: 60px !important;
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 150px !important;
  font-size: 1.38rem !important;
  font-weight: 600 !important;
  line-height: 1.5 !important;
  padding-top: 14px !important;
  padding-bottom: 14px !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
}

#add-ad-page select.form-input {
  padding-inline-start: 36px !important;
  padding-inline-end: 16px !important;
  padding-top: 14px !important;
  padding-bottom: 14px !important;
  appearance: menulist !important;
  -webkit-appearance: menulist !important;
  -moz-appearance: menulist !important;
  font-size: 1.38rem !important;
  font-weight: 600 !important;
  line-height: 1.5 !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#add-ad-page select.form-input option {
  font-size: 1.28rem !important;
  font-weight: 600 !important;
  padding: 10px 12px !important;
  background: #fff !important;
  color: #1a1a1a !important;
}

#add-ad-page .form-input.textarea,
#add-ad-page #ad-description {
  min-height: 150px !important;
  height: auto !important;
  max-height: none !important;
  padding: 12px !important;
  line-height: 1.5 !important;
  resize: none !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  background: #ffffff !important;
  border: 1px solid #e5ddd0 !important;
  font-size: 16px !important;
  text-align: right !important;
}

#add-ad-page #ad-description::placeholder,
#add-ad-page .form-input.textarea::placeholder {
  color: #999 !important;
  font-size: 14px !important;
  opacity: 1;
}

/* إخفاء الـ input الافتراضي لرفع الملفات — Android و iPhone */
.file-input-hidden,
#add-ad-page input[type="file"],
input[type="file"].file-input-hidden {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

#add-ad-page .upload-area {
  padding: 14px 12px;
  margin-left: auto;
  margin-right: auto;
  max-width: 420px;
  text-align: center;
}

#add-ad-page .upload-area p,
#add-ad-page .upload-area-video p {
  display: none !important;
}

#add-ad-page .upload-area .upload-btn {
  display: inline-block;
}

.upload-area:hover {
  border-color: var(--primary);
  background: var(--light-gray);
}

.upload-area i {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 10px;
}

.upload-btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 8px 20px;
  border-radius: 5px;
  margin-top: 10px;
  font-weight: 600;
}

.upload-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}
.upload-actions-row .upload-area {
  margin-left: 0;
  margin-right: 0;
}
.upload-area-video {
  flex: 0 0 auto;
  min-width: 140px;
}
.upload-area-video .upload-btn {
  margin-top: 10px;
}
.upload-area-video i {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 10px;
}
.upload-area-video p {
  margin: 0;
  font-size: 0.9rem;
  color: #555;
}

.video-preview-wrap {
  margin-top: 14px;
  padding: 10px 0;
}
.video-preview-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}
.video-preview-inner {
  position: relative;
  display: inline-block;
  max-width: 320px;
}
.video-preview-inner.video-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 100%;
}
.video-preview-item {
  position: relative;
  display: inline-block;
  max-width: 320px;
}
.video-preview-item .video-preview-player {
  display: block;
  max-width: 100%;
}
.video-preview-item .remove-video-btn {
  position: absolute;
  top: 6px;
  left: 6px;
}
.video-preview-player {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  max-height: 200px;
  border-radius: var(--radius);
  background: #000;
}
.remove-video-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.2s;
}
.remove-video-btn:hover {
  background: rgba(0,0,0,0.85);
}
/* صفحة التفاصيل: قائمة الفيديوهات */
.details-videos-section {
  margin-top: 20px;
  padding: 16px 0;
}
.details-videos-label {
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
}
.details-videos-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.details-video-item {
  width: 100%;
  max-width: 560px;
}
.details-video-player {
  width: 100%;
  max-height: 320px;
  border-radius: var(--radius);
  background: #000;
}
@media (max-width: 768px) {
  .upload-actions-row {
    flex-direction: column;
    align-items: stretch;
  }
  .upload-area-video {
    min-width: 0;
  }
  .video-preview-inner {
    max-width: 100%;
  }
  .video-preview-item {
    max-width: 100%;
  }
  .video-preview-player {
    max-width: 100%;
  }
  .details-video-item {
    max-width: 100%;
  }
  .details-video-player {
    max-height: 240px;
  }
}

.images-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

/* معاينة الصور المرفوعة — صف عرضي (أفقي) في صفحة إضافة الإعلان */
#add-ad-page .images-preview {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin-top: 10px !important;
  justify-content: flex-start !important;
}

.image-preview-item {
  position: relative;
  border-radius: 8px;
  overflow: visible;
  height: 100px;
}

#add-ad-page .images-preview .image-preview-item {
  flex: 0 0 160px !important;
  width: 160px !important;
  min-width: 160px !important;
  height: 160px !important;
  overflow: visible !important;
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  pointer-events: none;
}

.remove-image {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 5;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  pointer-events: auto !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.remove-image i {
  pointer-events: none;
  font-size: 14px;
  line-height: 1;
}
@media (max-width: 768px) {
  #add-ad-page .images-preview .image-preview-item {
    flex: 0 0 120px !important;
    width: 120px !important;
    min-width: 120px !important;
    height: 120px !important;
  }
  .remove-image {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    top: 2px;
    left: 2px;
  }
  .remove-image i {
    font-size: 16px;
  }
}

.submit-btn {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, var(--success), #27ae60);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  margin-top: 20px;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}

/* ================= DETAILS PAGE (Like Haraj) ================= */
.details-card {
  background: white;
  margin: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 10px var(--shadow);
}

.details-body {
  padding: 25px;
}

/* Header Section */
/* Title Section */
.details-title-section {
  margin-bottom: 15px;
}

.details-main-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.4;
  margin: 0;
}

/* Location and Time */
.details-location-time {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--light-gray);
  color: var(--gray);
  font-size: 0.95rem;
}

.details-location-text {
  display: flex;
  align-items: center;
  gap: 5px;
}

.details-time-text {
  color: var(--gray);
}

/* Seller Section */
.details-seller-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--light-gray);
}

.seller-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.seller-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.seller-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.seller-details {
  flex: 1;
}

.seller-name {
  font-weight: 600;
  color: var(--dark);
  font-size: 1rem;
  margin-bottom: 3px;
}

.seller-id {
  font-size: 0.85rem;
  color: var(--gray);
}

.follow-btn {
  padding: 8px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.follow-btn:hover {
  background: var(--secondary);
  transform: translateY(-2px);
}

.follow-btn.following {
  background: var(--light-gray);
  color: var(--dark);
}

/* Car Specifications */
.details-specs-section .spec-item {
  margin-bottom: 12px;
}

.details-specs-section .spec-item:last-child {
  margin-bottom: 0;
}

/* Price Section */
.details-price-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--light-gray);
}

.details-price {
  color: var(--primary);
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0;
}

.details-header-section {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--light-gray);
}

.details-meta-top {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: center;
  margin-top: 15px;
}

.details-meta-top .ad-badge {
  background: var(--success);
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.details-location,
.details-views {
  color: var(--gray);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.details-location i,
.details-views i {
  color: var(--primary);
}

/* Description Section */
.details-description-section {
  margin-bottom: 30px;
  padding-bottom: 25px;
  border-bottom: 2px solid var(--light-gray);
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
}

.section-title i {
  color: var(--primary);
}

.details-description {
  color: var(--dark);
  line-height: 1.8;
  font-size: 1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* زر فحص موجز - بنفس حجم أزرار تواصل/مفضلة/مشاركة */
/* رابط فحص موجز — مظهر الزر دون تنسيق الرابط (تفادي تفعيل عند التمرير على الجوال) */
a.action-btn.details-mojaz-btn,
.action-btn.details-mojaz-btn {
  text-decoration: none;
  color: inherit;
}
.action-btn.details-mojaz-btn {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: var(--dark, #1a1a1a);
  text-decoration: none;
}
.action-btn.details-mojaz-btn:hover,
.action-btn.details-mojaz-btn:focus {
  background: var(--surface);
  border-color: rgba(0, 0, 0, 0.18);
}

/* معرض الصور الكامل تحت الوصف - حتى 15 صورة، جودة عالية ومتجاوب */
.details-images-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
}

.images-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
  width: 100%;
}

@media (min-width: 768px) {
  .images-gallery {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
  }
}

@media (min-width: 1024px) {
  .images-gallery {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
  }
}

.gallery-image-item {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--light-gray);
  transition: var(--transition);
  border: 2px solid var(--border);
}

.gallery-image-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  border-color: var(--primary);
}

.gallery-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  aspect-ratio: 4 / 3;
}

.gallery-image-item .gallery-fallback-img,
.gallery-fallback-img {
  object-fit: contain;
  background: var(--light-gray);
}

.gallery-image-item .image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.gallery-image-item:hover .image-overlay {
  opacity: 1;
}

.image-overlay i {
  color: white;
  font-size: 2rem;
}

.gallery-image-item i {
  font-size: 3rem;
  color: var(--gray);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* ========== Image Lightbox Modal ========== */
.image-lightbox {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  z-index: 999999 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: imageLightboxFadeIn 0.2s ease;
}

@keyframes imageLightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.image-lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  cursor: pointer;
}

.image-lightbox-content {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  z-index: 1;
}

.image-lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.image-lightbox-close {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000000;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.image-lightbox-close:hover {
  background: #fff;
  transform: scale(1.05);
}

.image-lightbox-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.image-lightbox-arrow:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.08);
}

.image-lightbox-prev {
  right: 20px;
}

.image-lightbox-next {
  left: 20px;
}

.image-lightbox-counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 20px;
  font-size: 0.9rem;
  z-index: 2;
}

/* Lightbox على الجوال: فوق الكيبورد والقائمة السفلية */
@media (max-width: 768px) {
  .image-lightbox {
    z-index: 999999 !important;
  }
  .image-lightbox-backdrop {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .image-lightbox-content {
    max-width: 100vw;
    max-height: 100vh;
    padding: 12px;
    box-sizing: border-box;
  }
  .image-lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
  }
  .image-lightbox-close {
    top: 12px;
    left: 12px;
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    font-size: 1.8rem;
    font-weight: bold;
    background: #fff !important;
    color: #222 !important;
    z-index: 1000000 !important;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 0, 0, 0.1);
  }
}

/* منع التمرير خلف الـ Lightbox (يُطبّق من JS على body) */
body.body-lightbox-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
}

/* Specifications Section */
.details-specs-section {
  margin-bottom: 30px;
  padding-bottom: 25px;
  border-bottom: 2px solid var(--light-gray);
}

.details-specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

/* Owner Info Section */
.details-owner-section {
  margin-bottom: 30px;
  padding-bottom: 25px;
  border-bottom: 2px solid var(--light-gray);
}

.owner-info {
  margin-top: 15px;
}

.spec-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: var(--light-gray);
  border-radius: 8px;
}

.spec-item i {
  font-size: 1.5rem;
  color: var(--primary);
}

.spec-label {
  font-size: 0.9rem;
  color: var(--gray);
  margin-bottom: 5px;
}

.spec-value {
  font-weight: 600;
  color: var(--dark);
}

/* ================= COMMENTS SYSTEM (Like Haraj) ================= */
.comments-section {
  margin-top: 30px;
  padding-top: 25px;
  border-top: 2px solid var(--light-gray);
}

.comments-header {
  margin-bottom: 20px;
}

.comments-title {
  font-size: 1.3rem;
  color: var(--dark);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.comments-count {
  color: var(--primary);
  font-weight: 600;
}

.add-comment-form {
  margin-bottom: 25px;
  padding: 20px;
  background: var(--light-gray);
  border-radius: var(--radius);
}

.comment-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment-input {
  width: 100%;
  padding: 15px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  transition: var(--transition);
}

.comment-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 186, 181, 0.1);
}

.comment-submit-btn {
  align-self: flex-end;
  padding: 12px 25px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.comment-submit-btn:hover {
  background: #089691;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(10, 186, 181, 0.3);
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.comment-item {
  background: white;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--shadow);
  border-right: 3px solid var(--primary);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.comment-author {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.comment-avatar {
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.comment-author-info {
  flex: 1;
}

.comment-author-name {
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-badge {
  background: var(--warning);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.comment-time {
  font-size: 0.85rem;
  color: var(--gray);
}

.comment-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.reply-btn,
.delete-comment-btn {
  background: none;
  border: none;
  color: var(--gray);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.9rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
}

.reply-btn:hover {
  background: var(--light-gray);
  color: var(--primary);
}

.delete-comment-btn:hover {
  background: var(--light-gray);
  color: var(--danger);
}

.comment-content {
  color: var(--dark);
  line-height: 1.6;
  padding: 10px 0;
  word-wrap: break-word;
}

.comment-replies {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--light-gray);
  padding-right: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.reply-item {
  background: var(--light-gray);
  padding: 15px;
  border-radius: 8px;
  border-right: 2px solid var(--primary);
}

.reply-form-container {
  margin-top: 15px;
  padding: 15px;
  background: var(--light-gray);
  border-radius: 8px;
}

.reply-input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  margin-bottom: 10px;
  transition: var(--transition);
}

.reply-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 186, 181, 0.1);
}

.reply-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.reply-submit-btn,
.reply-cancel-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.reply-submit-btn {
  background: var(--primary);
  color: white;
}

.reply-submit-btn:hover {
  background: #089691;
}

.reply-cancel-btn {
  background: var(--light-gray);
  color: var(--dark);
}

.reply-cancel-btn:hover {
  background: var(--border);
}

.loading-comments,
.no-comments,
.comments-error {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray);
}

.loading-comments {
  color: var(--primary);
}

.comments-error {
  color: var(--danger);
}

.comments-error i {
  font-size: 2rem;
  margin-bottom: 10px;
  opacity: 0.7;
}

.no-comments i {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.3;
}

.no-comments p {
  color: var(--gray);
  font-size: 1rem;
}

/* ================= CHAT SYSTEM ================= */
.chat-section {
  margin-top: 30px;
  padding-top: 25px;
  padding-bottom: 20px; /* مسافة إضافية من الأسفل */
  border-top: 2px solid var(--light-gray);
  position: relative;
  display: flex;
  flex-direction: column;
}

.chat-title {
  font-size: 1.2rem;
  color: var(--dark);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-container {
  height: 300px;
  overflow-y: scroll !important; /* إظهار scrollbar دائماً */
  overflow-x: hidden !important;
  padding: 15px;
  padding-bottom: 20px; /* مسافة إضافية من الأسفل */
  background: var(--light-gray);
  border-radius: var(--radius);
  margin-bottom: 20px; /* زيادة المسافة من الأسفل */
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* تحسين الـ scroll */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  /* إظهار scrollbar واضح ومرئي دائماً */
  scrollbar-width: auto !important;
  scrollbar-color: #888 #f1f1f1 !important;
  /* التأكد من أن المحتوى يظهر بشكل صحيح */
  position: relative;
  scrollbar-gutter: stable;
  /* منع التداخل مع زر الإرسال */
  box-sizing: border-box;
}

/* تخصيص scrollbar للـ Webkit browsers (Chrome, Safari, Edge) - مثل موقع حراج */
.chat-container::-webkit-scrollbar {
  width: 16px !important; /* عرض واضح ومرئي */
  display: block !important;
  -webkit-appearance: none;
}

.chat-container::-webkit-scrollbar-track {
  background: #f1f1f1 !important;
  border-radius: 8px;
  border: 1px solid #ddd;
  -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.1);
}

.chat-container::-webkit-scrollbar-thumb {
  background: #888 !important;
  border-radius: 8px;
  border: 2px solid #f1f1f1;
  -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}

.chat-container::-webkit-scrollbar-thumb:hover {
  background: #555 !important;
}

.chat-container::-webkit-scrollbar-thumb:active {
  background: #333 !important;
}

.loading-chat,
.chat-error,
.no-messages {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  text-align: center;
  color: var(--gray);
  min-height: 200px;
}

.loading-chat {
  color: var(--primary);
}

.chat-error {
  color: var(--danger);
}

.chat-error i {
  font-size: 2rem;
  margin-bottom: 10px;
  opacity: 0.7;
}

.no-messages i {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.3;
}

.no-messages p {
  color: var(--gray);
  font-size: 1rem;
}

.message {
  padding: 12px 15px;
  border-radius: 15px;
  max-width: 80%;
  position: relative;
  animation: slideIn 0.3s ease;
  margin-bottom: 5px; /* مسافة إضافية بين الرسائل */
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.sent {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 5px;
}

.message.received {
  background: white;
  color: var(--dark);
  align-self: flex-start;
  border-bottom-left-radius: 5px;
  box-shadow: 0 2px 5px var(--shadow);
}

.message.sender {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 5px;
  opacity: 0.8;
}

.message-content {
  word-wrap: break-word;
}

.message-time {
  font-size: 0.7rem;
  opacity: 0.7;
  text-align: left;
  margin-top: 5px;
}

.message-image {
  max-width: 200px;
  max-height: 200px;
  border-radius: 10px;
  margin-top: 5px;
  cursor: pointer;
  transition: var(--transition);
}

.message-image:hover {
  transform: scale(1.05);
}

.chat-input-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  padding: 12px 15px;
  border-radius: 30px;
  border: 2px solid var(--border);
  box-shadow: 0 2px 10px var(--shadow);
  position: relative;
  z-index: 10;
  margin-top: 0;
}

.chat-attachments {
  display: flex;
}

.chat-attach-btn {
  background: var(--light-gray);
  border: none;
  color: var(--primary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 10px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-attach-btn:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.05);
}

.chat-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 15px;
  font-size: 1rem;
  background: transparent;
  color: var(--dark);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.chat-input::placeholder {
  color: #999;
  opacity: 0.8;
  font-weight: 400;
}

.chat-input:focus {
  outline: none;
}

.chat-input:focus::placeholder {
  opacity: 0.5;
}

.chat-send-btn {
  background: var(--primary);
  color: white;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(10, 186, 181, 0.3);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: #089691;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(10, 186, 181, 0.4);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-send-btn i {
  font-size: 1.1rem;
}

.details-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 25px;
  padding-left: 12px;
  padding-right: 12px;
  box-sizing: border-box;
}

.action-btn {
  padding: 15px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
}

.action-btn.whatsapp {
  background: #25D366;
  color: white;
}

.action-btn.call {
  background: var(--primary);
  color: white;
}

.action-btn.favorite {
  background: var(--light-gray);
  color: var(--dark);
}

.action-btn.share {
  background: #6c757d;
  color: white;
}

.action-btn.edit-btn {
  background: #4CAF50;
  color: white;
}

.action-btn.delete-btn {
  background: #f44336;
  color: white;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px var(--shadow);
}

.owner-actions {
  display: none;
  gap: 15px;
  width: 100%;
  grid-column: 1 / -1;
}

.details-actions.is-owner .owner-actions {
  display: flex !important;
}

.details-actions:not(.is-owner) .owner-actions {
  display: none !important;
}

.details-actions.is-owner .action-btn.contact,
.details-actions.is-owner .action-btn.report-btn {
  display: none !important;
}

.regular-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: stretch;
  gap: 12px;
  width: 100%;
  min-width: 0;
  align-items: stretch;
  overflow: visible;
  grid-column: 1 / -1;
}

.regular-actions .action-btn {
  flex: 1 1 150px;
  min-width: 140px;
  justify-content: center;
  align-items: center;
  padding: 14px 16px;
  font-size: 1rem;
  min-height: 48px;
  box-sizing: border-box;
  display: flex;
}

.regular-actions .action-btn.contact,
.regular-actions .action-btn.favorite,
.regular-actions .action-btn.share,
.regular-actions .action-btn.details-mojaz-btn,
.regular-actions .action-btn.report-btn {
  flex: 1;
  height: auto;
  min-height: 44px;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.regular-actions .action-btn.report-btn {
  background: var(--light-gray);
  color: #6c757d;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.regular-actions .action-btn.report-btn:hover,
.regular-actions .action-btn.report-btn:focus {
  background: #e9ecef;
  color: #495057;
  border-color: rgba(0, 0, 0, 0.15);
}

.regular-actions .action-btn i {
  flex-shrink: 0;
  font-size: 0.95em;
}

.regular-actions .action-btn.details-mojaz-btn {
  font-size: 0.85rem;
}

.regular-actions .action-btn.details-mojaz-btn i {
  font-size: 0.85em;
}

.regular-actions .action-btn span,
.regular-actions .action-btn .menu-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

@media (min-width: 769px) {
  .details-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .regular-actions .action-btn span,
  .regular-actions .action-btn .menu-text {
    overflow: visible;
    text-overflow: unset;
    white-space: nowrap;
  }

  /* إعلان المالك على الكمبيوتر: المفضلة / مشاركة / موجز بنفس شكل تعديل وحذف */
  .details-actions.is-owner .owner-actions {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 12px;
    width: 100%;
  }
  .details-actions.is-owner .owner-actions .action-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    padding: 15px 16px;
    font-size: 1rem;
    border-radius: 8px;
    box-sizing: border-box;
  }
  .details-actions.is-owner .regular-actions {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 12px;
    width: 100%;
    align-items: stretch;
  }
  .details-actions.is-owner .regular-actions .action-btn.favorite,
  .details-actions.is-owner .regular-actions .action-btn.share,
  .details-actions.is-owner .regular-actions .action-btn.details-mojaz-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    width: auto !important;
    min-height: 48px !important;
    height: auto !important;
    padding: 15px 16px !important;
    font-size: 1rem !important;
    border-radius: 8px;
    box-sizing: border-box;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .details-actions.is-owner .regular-actions .action-btn.details-mojaz-btn i,
  .details-actions.is-owner .regular-actions .action-btn.favorite i,
  .details-actions.is-owner .regular-actions .action-btn.share i {
    font-size: 1em !important;
  }
}
@media (max-width: 768px) {
  .regular-actions {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
    width: 100%;
    min-width: 0;
  }

  /* الزر الرابع والخامس في الصف الثاني */
  .regular-actions .action-btn:nth-child(4),
  .regular-actions .action-btn:nth-child(5) {
    grid-row: 2 !important;
  }

  .regular-actions .action-btn:nth-child(4) {
    grid-column: 1 / 2 !important;
  }

  .regular-actions .action-btn:nth-child(5) {
    grid-column: 2 / 3 !important;
  }

  .regular-actions .action-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px 4px;
    font-size: 11px !important;
    min-width: 0;
  }

  .regular-actions .action-btn:nth-child(n+4) {
    background-color: var(--light-gray) !important;
    border: 1px solid #ddd !important;
  }

  .regular-actions .action-btn i {
    font-size: 0.85em !important;
  }
}

/* ================= MESSAGES SECTION ================= */
/* المحادثة تملأ الشاشة بين الهيدر وصندوق الكتابة، والتمرير يكون داخل قائمة الرسائل فقط */
#messages-section {
  position: fixed;
  top: 0;
  left: 0;
  right: 118px;
  bottom: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  width: auto;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  padding-top: env(safe-area-inset-top, 0px);
  background: #fff;
  overflow: hidden;
  box-sizing: border-box;
}

body.messages-open {
  overflow: hidden !important;
}

/* هيدر قسم الرسائل: عنوان في المنتصف + زر رجوع في الزاوية */
.messages-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px;
  border-bottom: 1px solid #eee;
  background: white;
  min-height: 56px;
  flex-shrink: 0;
}

.messages-sidebar-title {
  flex: 1;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.3px;
}

.messages-back-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--primary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.messages-back-btn:hover {
  background: rgba(10, 186, 181, 0.1);
  color: #089691;
}

.messages-sidebar-spacer {
  width: 44px;
  min-width: 44px;
  height: 44px;
}

#messages-section .chat-layout {
  flex: 1 1 0%;
  min-height: 0;
  height: auto;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

#messages-section .chat-sidebar {
  min-height: 0;
  overflow: hidden;
}

#messages-section .users-list {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

#messages-section .chat-main-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* هيدر منطقة المحادثة: عنوان «الرسائل الواردة» في المنتصف */
#messages-section .chat-area-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  border-bottom: 1px solid #ddd;
  background: #fff;
  min-height: 48px;
  flex-shrink: 0;
}
.chat-back-arrow {
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
}
.chat-back-arrow:hover {
  background: rgba(10, 186, 181, 0.1);
}
#messages-section .chat-area-title,
#messages-section #chat-title {
  flex: 1;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  color: #1a1a1a;
}
#messages-section .chat-area-status {
  font-size: 0.75rem;
  color: #666;
  flex-shrink: 0;
}

/* زر حظر / إلغاء الحظر داخل هيدر المحادثة */
#messages-section .chat-block-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  min-height: 36px;
  min-width: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(231, 76, 60, 0.35);
  background: #fff;
  color: #c0392b;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#messages-section .chat-block-btn[hidden] {
  display: none !important;
}
#messages-section .chat-block-btn:hover,
#messages-section .chat-block-btn:focus {
  background: rgba(231, 76, 60, 0.08);
  outline: none;
}
#messages-section .chat-block-btn.is-blocked {
  border-color: rgba(10, 186, 181, 0.4);
  color: var(--primary-dark, #089691);
}
#messages-section .chat-block-btn.is-blocked:hover,
#messages-section .chat-block-btn.is-blocked:focus {
  background: rgba(10, 186, 181, 0.1);
}
#messages-section .chat-block-btn i {
  font-size: 0.85rem;
}
#messages-section .chat-block-banner {
  display: none;
  flex-shrink: 0;
  padding: 10px 14px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.45;
  color: #7a3e00;
  background: #fff6e8;
  border-bottom: 1px solid rgba(230, 162, 60, 0.35);
}
#messages-section .chat-block-banner[hidden] {
  display: none !important;
}
#messages-section .chat-block-banner:not([hidden]) {
  display: block;
}
@media (max-width: 768px) {
  #messages-section .chat-block-btn {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.75rem;
    gap: 4px;
  }
  #messages-section .chat-block-btn span {
    max-width: 4.5em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #messages-section .chat-area-header {
    gap: 8px;
    padding: 10px 12px;
  }
  #messages-section .chat-block-banner {
    font-size: 0.8rem;
    padding: 10px 12px;
  }
}

#messages-section #chat-box,
#messages-section .chat-box-inner {
  flex: 1 1 0%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  overflow-anchor: none;
  direction: ltr;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  padding: 12px 14px 16px;
  background: #efeae2;
}

/* الرسائل القصيرة تلتصق بأسفل الشاشة، والقديمة تطلع فوق وتُسحب بالإصبع */
#messages-section #chat-box .chat-thread {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  margin-top: auto;
  min-height: min-content;
}

#messages-section .chat-jump-latest {
  position: absolute;
  left: 16px;
  bottom: 78px;
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  padding: 0 !important;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #54656f;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#messages-section .chat-jump-latest.is-visible {
  display: flex;
}
#messages-section .chat-jump-latest i {
  font-size: 1rem;
  pointer-events: none;
}

/* صندوق الإرسال داخل عمود المحادثة، فوقه قائمة الرسائل القابلة للسحب */
#messages-section #chat-input-area,
#messages-section .chat-input-area-fixed {
  position: relative !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: #f0f2f5 !important;
  border-top: 1px solid #ddd;
  box-sizing: border-box;
  z-index: 3;
  box-shadow: 0 -1px 4px rgba(0,0,0,0.06);
}
#messages-section #chat-input-area #msg-input,
#messages-section .chat-input-area-fixed #msg-input {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 24px;
  outline: none;
  box-sizing: border-box;
  font-size: 1rem;
}
#messages-section #chat-input-area .chat-send-btn,
#messages-section .chat-send-btn {
  flex-shrink: 0;
  min-width: 64px;
  padding: 12px 20px;
  background: #0ABAB5 !important;
  color: #fff;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
}
#messages-section #chat-input-area .chat-send-btn:hover,
#messages-section .chat-send-btn:hover {
  background: #0056b3 !important;
}

/* أيقونة إرفاق صورة في الدردشة */
#messages-section .chat-attach-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
  border: 1px solid #ddd;
  border-radius: 50%;
  color: #555;
  cursor: pointer;
  margin: 0;
  padding: 0;
  transition: background 0.2s, color 0.2s;
}
#messages-section .chat-attach-btn:hover {
  background: #e4e6eb;
  color: var(--primary, #0ABAB5);
}
#messages-section .chat-attach-btn i {
  font-size: 1.2rem;
}

/* زر إرسال موقع المعاينة (دبوس خريطة) — حجم لا يقل عن 44x44 للجوال */
#messages-section .chat-location-btn {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f0f2f5;
  border: 1px solid #ddd;
  border-radius: 50%;
  color: #555;
  cursor: pointer;
  margin: 0;
  padding: 0;
  transition: background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#messages-section .chat-location-btn:hover {
  background: #e4e6eb;
  color: var(--primary, #0ABAB5);
}
#messages-section .chat-location-btn i {
  font-size: 1.2rem;
}

/* بطاقة رسالة موقع المعاينة في الدردشة */
#messages-section .chat-location-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin-top: 4px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 1px solid #ddd;
  border-radius: 12px;
  color: var(--brand-title, #067D79);
  text-decoration: none;
  font-weight: 500;
  min-height: 44px;
  box-sizing: border-box;
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#messages-section .chat-location-card:hover,
#messages-section .chat-location-card:active {
  background: linear-gradient(135deg, #d4ebf7 0%, #b8daff 100%);
  transform: scale(1.02);
}
#messages-section .chat-location-card i {
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* صورة في فقاعة الدردشة */
#messages-section #chat-box .chat-msg-image-wrap {
  position: relative;
  margin-top: 4px;
  border-radius: 12px;
  overflow: hidden;
  max-width: 280px;
  cursor: pointer;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
#messages-section #chat-box .chat-msg-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: cover;
  vertical-align: middle;
  cursor: pointer;
  pointer-events: auto;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
/* طبقة شفافة فوق الصورة لاستقبال اللمس على الجوال */
#messages-section #chat-box .chat-msg-image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  cursor: pointer;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
#messages-section #chat-box .chat-bubble--me .chat-msg-image-wrap {
  border-radius: 14px 14px 4px 14px;
}
#messages-section #chat-box .chat-bubble--other .chat-msg-image-wrap {
  border-radius: 14px 14px 14px 4px;
}

/* علامة تحميل رفع الصورة */
#messages-section #chat-box .chat-loading-bubble .chat-msg-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
}
#messages-section #chat-box .chat-loading-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: chat-spin 0.8s linear infinite;
}
#messages-section #chat-box .chat-loading-text {
  font-size: 0.9rem;
  opacity: 0.95;
}
@keyframes chat-spin {
  to { transform: rotate(360deg); }
}

/* تمييز رسائل المستخدم الحالي (يمين) ورسائل الطرف الآخر (يسار) */
#messages-section #chat-box .chat-bubble-wrap {
  max-width: 75%;
  display: flex;
}
#messages-section #chat-box .chat-bubble-wrap--me {
  align-self: flex-end;
  flex-direction: row;
  justify-content: flex-end;
}
#messages-section #chat-box .chat-bubble-wrap--other {
  align-self: flex-start;
  flex-direction: row;
  justify-content: flex-start;
}
#messages-section #chat-box .chat-bubble {
  padding: 10px 15px;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
#messages-section #chat-box .chat-bubble--me {
  background: linear-gradient(135deg, #0ABAB5 0%, #089691 100%);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 1px 3px rgba(10, 186, 181, 0.3);
}
#messages-section #chat-box .chat-bubble--me .chat-msg-text {
  color: #fff !important;
}
#messages-section #chat-box .chat-bubble--other {
  background: #f0f0f0;
  color: #1a1a1a;
  border: 1px solid #e0e0e0;
  border-radius: 14px 14px 14px 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
#messages-section #chat-box .chat-bubble--other .chat-msg-text {
  color: #1a1a1a !important;
}

/* خط المحادثة: أكبر وأوضح */
#messages-section #chat-box .chat-msg-text,
#messages-section #chat-box [class*="chat-msg-text"] {
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  line-height: 1.55 !important;
  color: #1a1a1a !important;
  letter-spacing: 0.2px;
  font-family: 'Almarai', 'Cairo', 'Tajawal', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#messages-section #chat-box .chat-msg-sender-name {
  font-size: 0.9rem !important;
  font-weight: 700 !important;
}

/* بطاقة الإعلان داخل فقاعة الدردشة */
#messages-section #chat-box .chat-ad-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  max-width: 260px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#messages-section #chat-box .chat-ad-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
#messages-section #chat-box .chat-ad-card-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  background: #eee;
}
#messages-section #chat-box .chat-ad-card-body {
  padding: 10px 12px;
}
#messages-section #chat-box .chat-ad-card-title {
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  color: #1a1a1a !important;
  margin-bottom: 4px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#messages-section #chat-box .chat-ad-card-price {
  font-size: 1rem !important;
  font-weight: 700 !important;
  color: var(--primary, #0ABAB5) !important;
}
#messages-section #chat-box .chat-bubble--me .chat-ad-card {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.35);
}
#messages-section #chat-box .chat-bubble--me .chat-ad-card-title,
#messages-section #chat-box .chat-bubble--me .chat-ad-card-price {
  color: #fff !important;
}

.chat-delete-btn {
  color: var(--danger, #e74c3c) !important;
}
.chat-delete-btn:hover {
  color: #c0392b !important;
  background: rgba(231, 76, 60, 0.15) !important;
}

/* زر العودة للقائمة في هيدر المحادثة */
/* ================= رسائل - متجاوب للجوال ================= */
@media (max-width: 768px) {
  #messages-section {
    right: 0;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
  }
  #messages-section .chat-layout {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
  }
  #messages-section .chat-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
  }
  #messages-section .chat-layout.chat-view-active .chat-sidebar {
    display: none !important;
  }
  #messages-section .chat-main-area {
    display: none !important;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
  }
  #messages-section .chat-layout.chat-view-active .chat-main-area {
    display: flex !important;
  }
  #messages-section #chat-box {
    padding-bottom: 12px !important;
  }
  #messages-section .chat-jump-latest {
    bottom: 74px;
  }
  #messages-section #chat-input-area[style*="display: none"] {
    display: none !important;
  }
  /* صورة الدردشة على الجوال: عرض كامل الفقاعة مع border-radius موحّد */
  #messages-section #chat-box .chat-msg-image-wrap {
    max-width: 100% !important;
    border-radius: 12px !important;
  }
  #messages-section #chat-box .chat-msg-image {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    border-radius: 12px !important;
    display: block !important;
  }
  #messages-section #chat-box .chat-bubble--me .chat-msg-image-wrap,
  #messages-section #chat-box .chat-bubble--other .chat-msg-image-wrap {
    border-radius: 12px !important;
  }
  /* أيقونة الكاميرا تظهر في الجوال بجانب حقل النص */
  #messages-section .chat-attach-btn,
  #messages-section .chat-location-btn {
    display: inline-flex !important;
    flex-shrink: 0 !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
  }
}

/* ================= رسائل - ديسكتوب فقط: توزيع المساحات (لا يمس الجوال) ================= */
@media (min-width: 768px) {
  /* تكبير القائمة الجانبية: 350px (أو 30% على الشاشات الواسعة) */
  #messages-section .chat-sidebar {
    width: 30% !important;
    min-width: 350px !important;
    max-width: 420px !important;
    flex-shrink: 0 !important;
  }
  /* منطقة الدردشة تأخذ المساحة المتبقية تلقائياً */
  #messages-section .chat-main-area {
    flex: 1 !important;
    min-width: 0 !important;
  }
  /* صندوق الإرسال يتمدد مع منطقة الدردشة */
  #messages-section #chat-input-area,
  #messages-section .chat-input-area-fixed {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 12px 20px;
    box-sizing: border-box !important;
    flex-shrink: 0;
  }
  #messages-section .chat-jump-latest {
    bottom: 84px;
  }
}

/* ================= FAVORITES PAGE ================= */
#favorites-page {
  background: var(--light); /* توحيد لون الخلفية */
  min-height: 100vh; /* ملء كامل الشاشة */
}

.favorites-container {
  padding: 20px;
  min-height: auto;
  background: var(--light); /* توحيد لون الخلفية */
}

/* حاوية الملف الشخصي - فصل كامل عن منطق المحادثة - تبدأ من الأعلى مباشرة */
#account-page .account-container {
  padding: 20px !important;
  padding-top: 20px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  position: relative !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  background: var(--light) !important;
  min-height: auto !important;
  max-height: none !important;
  height: auto !important;
  /* إجبار flexbox على البدء من الأعلى - المفتاح الرئيسي */
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
  align-items: stretch !important;
  align-self: flex-start !important;
  justify-content: flex-start !important; /* هذا هو المفتاح - يبدأ من الأعلى */
  align-content: flex-start !important;
  flex-wrap: nowrap !important;
  flex-grow: 0 !important;
  flex-shrink: 0 !important;
  flex-basis: auto !important;
  /* منع أي تمدد أو توسع */
  overflow: visible !important;
}

.account-header {
  background: white;
  padding: 20px;
  padding-top: 20px !important;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-shadow: 0 2px 8px var(--shadow);
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  width: 100%;
  box-sizing: border-box;
  align-self: flex-start !important;
  position: relative !important;
  top: 0 !important;
}

.account-avatar-wrapper {
  position: relative;
  display: inline-block;
}

.account-avatar-inner {
  position: relative;
  display: inline-block;
  overflow: visible;
}

.account-avatar {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: white;
  font-weight: 700;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.account-avatar span {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* الكاميرا: تحت الصورة يمين — خارج الدائرة بدون تغطية */
.avatar-change-btn {
  position: absolute;
  bottom: -40px;
  right: -40px;
  left: auto;
  top: auto;
  width: 34px;
  height: 34px;
  background: var(--primary);
  border: 2px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 0.95rem;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}
.avatar-change-btn:hover {
  background: var(--secondary);
  transform: scale(1.08);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}
.avatar-change-btn:active {
  transform: scale(0.98);
}

/* الحذف: فوق الصورة يمين — حجم مناسب لسطح المكتب */
.avatar-delete-btn {
  position: absolute;
  top: -24px;
  right: -18px;
  left: auto;
  bottom: auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  color: #c0392b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}
.avatar-delete-btn i {
  font-size: 0.7rem;
}
.avatar-delete-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}
.avatar-delete-btn:active {
  transform: scale(0.98);
}

.account-info h2 {
  margin-bottom: 5px;
  color: var(--dark);
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.account-info p {
  color: var(--gray);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-menu {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow);
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  margin: 0 !important;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--light-gray);
  cursor: pointer;
  transition: var(--transition);
}

.menu-item:hover {
  background: var(--light-gray);
}

.menu-item:last-child {
  border-bottom: none;
}

/* زر/عنصر خطير داخل قائمة الحساب (مثلاً حذف الحساب) */
.menu-item.danger i,
.menu-item.danger .menu-text {
  color: var(--danger);
}

.menu-item.danger .menu-arrow {
  color: var(--danger);
}

.menu-item.danger:hover {
  background: #ffecec;
}

.ads-count-badge {
  color: var(--primary);
  font-weight: 600;
  margin-right: 5px;
}

.menu-item i {
  font-size: 1.5rem;
  color: var(--primary);
  width: 40px;
}

.menu-text {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.menu-arrow {
  color: var(--gray);
}

/* تنسيقات أقسام صفحة الحساب */
.account-section {
  background: white;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--shadow);
  margin: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  animation: slideIn 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

#changePasswordSection,
#updatePhoneSection,
#myAdsSection {
  background: white;
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px var(--shadow);
  margin: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  animation: slideIn 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

.account-section-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--light-gray);
}

.account-section-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 10px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.account-section-header h3 i {
  color: var(--primary);
  font-size: 1.2rem;
}

/* ================= Delete Account Confirmation Modal ================= */
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.confirm-modal-content {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 24px 20px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  text-align: center;
}

.confirm-modal-title {
  margin: 0 0 12px 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--danger);
}

.confirm-modal-text {
  margin: 0 0 20px 0;
  font-size: 1rem;
  line-height: 1.7;
  color: #444;
}

.confirm-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-modal-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.confirm-modal-btn.cancel {
  background: #f1f2f6;
  color: #333;
}

.confirm-modal-btn.danger {
  background: var(--danger);
  color: #fff;
}

.confirm-modal-btn.danger:hover {
  background: #c0392b;
}

/* ================= Forgot Password Modal ================= */
.forgot-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 999999 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
}

.forgot-modal-backdrop {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  z-index: 1;
}

.forgot-modal-content {
  position: relative;
  z-index: 2;
  background: #fff;
  border-radius: 12px;
  padding: 24px 20px;
  width: 90%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  text-align: right;
  border-top: 4px solid var(--primary);
  margin: auto;
}

.forgot-modal-title {
  margin: 0 0 8px 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.forgot-modal-title i {
  color: var(--primary);
}

.forgot-modal-text {
  margin: 0 0 16px 0;
  font-size: 1rem;
  line-height: 1.6;
  color: #444;
}

.forgot-modal-content .form-group {
  margin-bottom: 16px;
}

.forgot-modal-content .form-group:last-of-type {
  margin-bottom: 12px;
}

.forgot-modal-message {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.forgot-modal-message.success {
  background: rgba(39, 174, 96, 0.15);
  color: var(--success);
  border: 1px solid rgba(39, 174, 96, 0.3);
}

.forgot-modal-message.error {
  background: rgba(231, 76, 60, 0.1);
  color: var(--danger);
  border: 1px solid rgba(231, 76, 60, 0.25);
}

.forgot-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}

.forgot-modal-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.forgot-modal-btn.cancel {
  background: #f1f2f6;
  color: #333;
}

.forgot-modal-btn.cancel:hover {
  background: #e4e6eb;
}

.forgot-modal-btn.submit {
  background: var(--primary);
  color: #fff;
}

.forgot-modal-btn.submit:hover {
  background: var(--secondary);
  transform: translateY(-1px);
}

.forgot-modal-btn.submit:disabled {
  opacity: 0.8;
  cursor: not-allowed;
  transform: none;
}

/* Forgot Password Modal - متجاوب للجوال */
@media (max-width: 480px) {
  .forgot-modal {
    padding: 16px;
    align-items: center;
    justify-content: center;
  }
  .forgot-modal-content {
    width: 100%;
    max-width: 100%;
    padding: 20px 16px;
    max-height: 85vh;
  }
}

@media (max-width: 360px) {
  .forgot-modal-content {
    padding: 18px 14px;
  }
  .forgot-modal-title {
    font-size: 1.2rem;
  }
}

/* تحسين عرض إعلاناتي */
#myAdsSection .ads-container {
  padding: 0;
  margin-top: 20px;
}

.following-container {
  margin-top: 20px;
}

.following-user-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.following-user-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ================= ADMIN PAGE ================= */
.admin-container {
  padding: 20px;
}

.admin-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 5px 25px var(--shadow);
}

.admin-header {
  background: linear-gradient(135deg, var(--warning), #e67e22);
  color: white;
  padding: 25px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  padding: 20px;
}

.stat-card {
  background: var(--light-gray);
  padding: 20px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px var(--shadow);
}

.stat-icon {
  width: 60px;
  height: 60px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark);
}

.stat-label {
  color: var(--gray);
  font-size: 0.9rem;
}

.admin-tabs {
  padding: 20px;
}

.tab-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--light-gray);
  padding-bottom: 10px;
}

.tab-btn {
  padding: 10px 25px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.admin-table-container {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 10px var(--shadow);
}

.admin-table th {
  background: var(--light-gray);
  padding: 15px;
  text-align: right;
  font-weight: 600;
  color: var(--dark);
  border-bottom: 2px solid var(--border);
}

.admin-table td {
  padding: 15px;
  border-bottom: 1px solid var(--light-gray);
}

.admin-table tr:hover {
  background: var(--light-gray);
}

.status-active {
  color: var(--success);
  font-weight: 600;
}

.admin-actions {
  display: flex;
  gap: 10px;
}

.admin-btn-small {
  padding: 8px 15px;
  border: none;
  border-radius: 5px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.admin-btn-small:hover {
  transform: translateY(-2px);
}

.admin-btn-view {
  background: var(--primary);
  color: white;
}

.admin-btn-edit {
  background: var(--warning);
  color: white;
}

.admin-btn-delete {
  background: var(--danger);
  color: white;
}

.reports-container {
  background: var(--light-gray);
  padding: 25px;
  border-radius: var(--radius);
}

.report-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}

.report-item:last-child {
  border-bottom: none;
}

.report-label {
  font-weight: 600;
  color: var(--dark);
}

.report-value {
  color: var(--primary);
  font-weight: 600;
}

/* ================= NOTIFICATION SYSTEM ================= */
/* Notification bell and panel removed */

/* ================= SIDE NAVIGATION ================= */
/* ================= SIDE NAVIGATION (Desktop) ================= */
.bottom-nav {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 118px; /* عرض يكفي لظهور «الرئيسية» و«المفضلة» كاملتين دون قص */
  background: var(--light);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 20px 6px;
  padding-top: calc(70px + env(safe-area-inset-top));
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  gap: 18px;
  overflow-y: auto;
  overflow-x: hidden;
}

.bottom-nav .nav-item {
  margin: 0 4px; /* مسافة أفقية بين الأيقونات داخل الشريط */
  min-height: 78px; /* مساحة كافية للأيقونة + سطرين من النص حتى لا يُقطع الوصف */
  overflow: visible !important;
}

.nav-item {
  display: block !important;
  text-decoration: none;
  color: #2c3e50;
  padding: 14px 5px;
  padding-top: 10px !important;
  border-radius: var(--radius);
  transition: var(--transition);
  position: relative !important;
  width: 100%;
  min-width: auto;
  text-align: center;
  word-wrap: break-word;
  line-height: 1.35;
  overflow: visible !important;
  /* عدم استخدام flex للأيقونة/النص — الأيقونة تُوضَع بـ position مطلق */
}

/* غلاف الأيقونة في الشريط الجانبي — محاذاة أفقية ثابتة ومرتبة */
.nav-item .nav-icon {
  position: absolute !important;
  top: 10px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  pointer-events: none;
  width: 42px;
  box-sizing: border-box;
}
.nav-item .nav-icon i {
  font-size: 2.1rem;
  margin: 0 !important;
  display: inline-block !important;
  position: relative !important;
  text-align: center;
  width: 1em;
}

/* ألوان مخصصة للأيقونات */
.nav-item:nth-child(1) .nav-icon i {
  color: #0ABAB5; /* أزرق للرئيسية */
}

.nav-item:nth-child(2) .nav-icon i {
  color: #e74c3c; /* أحمر للمفضلة */
}

.nav-item:nth-child(3) .nav-icon i {
  color: #27ae60; /* أخضر لإضافة إعلان */
}
/* منع تداخل كلمة "إضافة" مع أيقونة + */
.nav-item:nth-child(3) .nav-text {
  margin-top: 72px !important; /* أيقونة + حوالي 1 سم تحتها */
}

.nav-item:nth-child(4) .nav-icon i {
  color: #f39c12; /* برتقالي للرسائل */
}

.nav-item:nth-child(5) .nav-icon i {
  color: #9b59b6; /* بنفسجي للملف الشخصي */
}

/* أيقونة حسابي: خط أوضح وأكبر */
.bottom-nav .nav-item:nth-child(5) .nav-text {
  font-size: 1.28rem !important;
  font-weight: 800;
  color: #1a1a1a !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0.5px;
  margin-top: 74px !important; /* أيقونة + حوالي 1 سم تحتها */
}
.bottom-nav .nav-item:nth-child(5) .nav-icon i {
  font-size: 2.2rem !important;
}
.bottom-nav .nav-item:nth-child(5).active .nav-text {
  color: var(--primary) !important;
}

.nav-item .nav-text {
  display: block !important;
  font-size: 1.18rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.35;
  word-break: break-word;
  white-space: normal;
  max-width: 100%;
  letter-spacing: 0.5px;
  margin-top: 66px !important; /* مسافة تحت الأيقونة (أيقونة + حوالي 1 سم) */
  padding: 0 4px;
  overflow: visible !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
}

.nav-item.active {
  background: rgba(10, 186, 181, 0.22);
  border-right: 3px solid var(--primary);
}

.nav-item.active .nav-icon i {
  transform: scale(1.1);
  color: var(--primary) !important;
}

.nav-item.active .nav-text {
  color: var(--primary);
  font-weight: 800;
}

.nav-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.nav-item:hover .nav-icon i {
  transform: scale(1.05);
  transition: transform 0.2s ease;
}

/* عداد الرسائل غير المقروءة: دائرة حمراء صغيرة + رقم أبيض، يختفي عند 0، متوافق iOS/Android */
.nav-badge {
  position: absolute;
  top: 2px;
  right: 50%;
  transform: translateX(50%);
  min-width: 20px;
  min-height: 20px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 999px;
  background: #e74c3c;
  background: var(--danger, #e74c3c);
  color: #fff !important;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  border: 2px solid #fff;
  z-index: 10;
  visibility: hidden;
}
.nav-badge.nav-badge-show {
  display: flex !important;
  visibility: visible !important;
}
.nav-badge:empty {
  min-width: 0;
  min-height: 0;
  padding: 0;
}

/* ================= ALERT ================= */
.alert {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 15px 25px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
  z-index: 9999;
  animation: slideDown 0.3s ease;
  max-width: 90%;
  width: auto;
}

.alert i {
  font-size: 1.2rem;
}

.alert.success {
  background: var(--success);
}

.alert.error {
  background: var(--danger);
}

.alert.warning {
  background: var(--warning);
}

@media (max-width: 768px) {
  .alert {
    top: max(12px, env(safe-area-inset-top));
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    transform: none;
    padding: 16px 20px;
    font-size: 1rem;
    line-height: 1.5;
    min-height: 48px;
    box-sizing: border-box;
  }
  .alert i {
    font-size: 1.35rem;
    flex-shrink: 0;
  }
  #alertText {
    flex: 1;
    word-break: break-word;
  }
}

@keyframes slideDown {
  from {
    transform: translate(-50%, -100%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  @keyframes slideDown {
    from {
      transform: translateY(-100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
}

/* ================= LOADING SPINNER ================= */
.loading-spinner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-spinner[style*="display: none"],
.loading-spinner[style*="display:none"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--light-gray);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

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

.loading-text {
  color: var(--dark);
  font-size: 1.1rem;
  font-weight: 500;
}

/* ================= Contact Modal ================= */
.contact-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  font-family: inherit;
}

.contact-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.contact-modal-content {
  position: relative;
  background: #fff;
  width: 90%;
  max-width: 400px;
  border-radius: 16px;
  padding: 20px 24px 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  direction: rtl;
  border: 1px solid rgba(10, 186, 181, 0.15);
}

.contact-modal-title {
  margin: 0 0 4px 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  text-align: right;
}

.contact-modal-close {
  position: absolute;
  top: 14px;
  left: 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: #333;
  padding: 4px;
  line-height: 1;
}

.contact-modal-close:hover {
  color: #000;
}

.contact-modal-divider {
  height: 1px;
  background: #eee;
  margin: 14px 0;
}

.contact-modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
  text-align: right;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.contact-modal-row:hover {
  background: #f5f9ff;
  border-color: var(--primary);
  color: var(--primary);
}

.contact-modal-row-text {
  flex: 1;
}

.contact-modal-row-icon {
  font-size: 1.25rem;
  color: var(--primary);
  margin-right: 12px;
  flex-shrink: 0;
}

.contact-modal-row:hover .contact-modal-row-icon {
  color: var(--primary);
}

.contact-modal-row-phone .contact-modal-row-icon {
  color: #25D366;
}

.contact-modal-row-phone:hover .contact-modal-row-icon {
  color: #20bd5a;
}

.contact-modal-phone-row {
  margin-top: 0;
}

/* ================= Report Modal (بلاغ) ================= */
.report-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  font-family: inherit;
  padding: 16px;
  box-sizing: border-box;
}

.report-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.report-modal-content {
  position: relative;
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  padding: 20px 24px 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  direction: rtl;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.report-modal-close {
  position: absolute;
  top: 12px;
  left: 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: #666;
  padding: 6px;
  line-height: 1;
}

.report-modal-close:hover {
  color: #000;
}

.report-modal-title {
  margin: 0 0 6px 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a1a1a;
  text-align: right;
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-modal-title i {
  color: #6c757d;
}

.report-modal-desc {
  margin: 0 0 14px 0;
  font-size: 0.9rem;
  color: #666;
  text-align: right;
  line-height: 1.5;
}

.report-modal-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  direction: rtl;
  text-align: right;
  box-sizing: border-box;
  margin-bottom: 16px;
}

.report-modal-textarea:focus {
  outline: none;
  border-color: var(--primary, #0ABAB5);
  box-shadow: 0 0 0 2px rgba(10, 186, 181, 0.15);
}

.report-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.report-modal-btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, color 0.2s;
}

.report-modal-btn.cancel {
  background: #f0f0f0;
  color: #333;
}

.report-modal-btn.cancel:hover {
  background: #e0e0e0;
}

.report-modal-btn.submit {
  background: var(--primary, #0ABAB5);
  color: #fff;
}

.report-modal-btn.submit:hover {
  background: #089691;
  color: #fff;
}

.report-modal-btn.submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ================= EMPTY STATES ================= */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--gray);
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.3;
}

.empty-state h3 {
  color: var(--dark);
  margin-bottom: 10px;
}

/* ================= RESPONSIVE DESIGN ================= */
@media (max-width: 768px) {
  .header h1:not(.site-brand) {
    font-size: 1.2rem;
  }
  
  /* صفحات بدون شريط تنقل سفلي: تقليل المسافة السفلية */
  body.standalone-page {
    padding-bottom: 25px;
    padding-bottom: calc(25px + env(safe-area-inset-bottom));
  }
  
  /* صفحات النصوص (نظام العمولة، اتفاقية الاستخدام، إلخ) */
  .terms-page,
  .legal-page,
  .privacy-page {
    padding: 20px 15px 40px;
  }
  .terms-page h1,
  .legal-page h1,
  .privacy-page h1 {
    font-size: 1.5rem;
  }
  .terms-article h2,
  .legal-section h2,
  .privacy-section h2 {
    font-size: 1.1rem;
  }
  .terms-article img,
  .legal-section img,
  .privacy-section img {
    max-width: 100%;
    height: auto;
  }
  
  /* أزرار الهيدر مناسبة للمس (44px كحد أدنى) */
  .back-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .header-home-btn {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    flex-shrink: 0;
  }
  .header-actions {
    flex-wrap: nowrap;
    gap: 10px;
  }
  
  .auth-status-btn,
  .admin-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
  }
  
  /* في الجوال يُطبّق أيقونات فقط من الـ media block اللاحق (768px) */
  .auth-status-btn .btn-icon i {
    margin: 0;
  }
  
  .filters {
    padding: 10px;
  }
  
  .filter-btn {
    padding: 8px 12px;
    font-size: 1rem;
    font-weight: 700;
  }
  
  #filters-panel {
    padding: 12px;
    margin: 10px;
  }

  .sub-top-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .brand-dd-wrap,
  .sort-options-wrap,
  .mc-box,
  .year-range-wrap {
    min-width: 0;
    width: 100%;
    gap: 6px;
  }

  .brand-dd-select,
  .sort-dd-select,
  .mc-select,
  .sort-dropdown-toggle,
  .year-range-wrap .year-range-row {
    min-width: 0;
  }

  #filters-panel .sort-options-wrap {
    margin-top: 0;
  }

  /* قطع غيار — الجوال: بدون تمدد عمودي بين الحقول */
  #filters-panel.filters-panel--scrap .sub-top-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  #filters-panel.filters-panel--scrap .brand-dd-wrap,
  #filters-panel.filters-panel--scrap #scrapBrandWrap,
  #filters-panel.filters-panel--scrap #scrapCarTypeWrap,
  #filters-panel.filters-panel--scrap #scrapPartWrap,
  #filters-panel.filters-panel--scrap .year-range-wrap,
  #filters-panel.filters-panel--scrap .mc-box:has(#citySelect) {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    gap: 6px;
  }

  #filters-panel.filters-panel--scrap .year-range-wrap .year-range-row {
    flex-wrap: nowrap;
    height: 48px;
    min-height: 48px;
  }
  
  .ads-container {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    padding: 15px;
    gap: 15px;
  }
  
  .details-specs {
    grid-template-columns: 1fr;
  }
  
  .details-header-section {
    padding-bottom: 15px;
  }
  
  .details-price {
    font-size: 1.6rem;
  }
  
  .details-title {
    font-size: 1.2rem;
  }
  
  .details-meta-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .images-gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }
  
  .section-title {
    font-size: 1.1rem;
  }
  
  .details-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-left: 16px;
    padding-right: 16px;
    overflow: visible;
  }
  .details-actions .owner-actions {
    flex-direction: column;
    gap: 10px;
  }
  .details-actions .owner-actions .action-btn {
    width: 100%;
    margin-bottom: 0;
  }
  .details-actions .regular-actions {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    gap: 0;
    overflow: visible;
  }
  .details-actions .regular-actions .action-btn {
    width: 100% !important;
    margin-bottom: 10px;
    min-height: 48px;
    justify-content: center !important;
    align-items: center !important;
    padding: 14px 12px;
    font-size: 1rem;
  }
  .details-actions .regular-actions .action-btn:last-child {
    margin-bottom: 0;
  }
  .details-actions .regular-actions .action-btn i,
  .details-actions .regular-actions .action-btn span {
    flex-shrink: 0;
  }
  
  .admin-stats {
    grid-template-columns: 1fr;
  }
  
  
  /* إرجاع شريط التنقل للأسفل في الشاشات الصغيرة - تصميم مثل تطبيقات الجوال */
  .bottom-nav {
    position: fixed;
    bottom: 0;
    top: auto;
    right: 0;
    left: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 12px 8px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom)); /* دعم للشاشات مع notch */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    gap: 12px; /* مسافة بين الأيقونات في الشريط السفلي */
  }
  
  /* إضافة مساحة فارغة في أسفل الصفحة لتجنب تغطية المحتوى */
  body {
    padding-right: 0;
    padding-bottom: 70px;
    padding-bottom: calc(70px + env(safe-area-inset-bottom)); /* دعم للشاشات مع notch */
  }
  
  /* إخفاء النصوص في الشاشات الصغيرة */
  .bottom-nav .nav-text {
    display: none !important;
  }
  
  /* تحسين تصميم العناصر في الشاشات الصغيرة */
  .nav-item {
    min-width: 50px;
    width: auto;
    padding: 8px 12px;
    flex: 1;
    max-width: none;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* على الجوال: توسيط الأيقونة في العنصر (النص مخفي) */
  .nav-item .nav-icon {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
  }
  
  .nav-item .nav-icon i {
    font-size: 1.65rem;
    margin: 0 !important;
  }
  
  .nav-item .nav-text {
    margin-top: 0 !important;
  }
  
  /* تحسين موضع الـ badge في الشاشات الصغيرة (متوافق مع safe-area) */
  .nav-badge {
    top: 2px;
    right: 50%;
    transform: translateX(50%);
    min-width: 16px;
    height: 16px;
    font-size: 0.65rem;
    padding: 0 4px;
  }
  .nav-badge:empty {
    min-width: 16px;
  }
  
  /* تحسين تصميم العنصر النشط في الشاشات الصغيرة */
  .nav-item.active {
    background: rgba(10, 186, 181, 0.25);
    border-radius: 12px;
    border-right: 3px solid var(--primary);
  }
  .nav-item.active .nav-icon i {
    color: var(--primary) !important;
  }
}

/* ================= FOOTER ================= */
.site-footer {
  background: var(--secondary);
  color: #ecf0f1;
  padding: 50px 20px 20px;
  margin-top: auto; /* دفع الفوتر لأسفل الشاشة عند قلة المحتوى عبر Flexbox */
  margin-right: calc(-118px);
  width: calc(100% + 118px);
  direction: rtl;
  box-sizing: border-box;
  position: relative;
  left: 0;
  right: 0;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding-right: 118px; /* مساحة لشريط التنقل الجانبي */
  box-sizing: border-box;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.footer-column {
  flex: 1;
  min-width: 200px;
}

.footer-logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 15px 0;
  text-align: right;
}

.footer-description {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #bdc3c7;
  margin: 0 0 20px 0;
  text-align: right;
}

.social-links {
  display: flex;
  gap: 15px;
  justify-content: flex-start;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: #ecf0f1;
  text-decoration: none;
  transition: all 0.3s ease;
  font-size: 1.2rem;
}

.social-link:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-3px);
}

.footer-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 20px 0;
  text-align: right;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 12px;
}

.footer-link {
  color: #bdc3c7;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
  display: block;
  text-align: right;
}

.footer-link:hover {
  color: var(--primary);
  padding-right: 5px;
}

/* إخفاء أيقونة العمولة — لإظهارها لاحقاً: احذف صنف hide-commission من الـ <li> في index.html */
.hide-commission {
  display: none !important;
}

/* رابط/أيقونة العمولة في الفوتر — لا تتأثر بقيود Flexbox */
.footer-commission-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex: none !important;
  cursor: pointer;
}
.footer-commission-link i {
  flex-shrink: 0;
  font-size: 1rem;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
  text-align: center;
  margin-top: 30px;
}

/* ================= نافذة منبثقة نظام العمولة ================= */
.commission-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.commission-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.commission-modal-box {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 28px 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(39, 174, 96, 0.2);
  box-sizing: border-box;
}

.commission-modal-title {
  margin: 0 0 16px 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #27ae60;
  text-align: center;
  font-family: inherit;
}

.commission-modal-text {
  margin: 0 0 24px 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: #2c3e50;
  text-align: center;
}

/* نسبة العمولة 0.5% — أكبر وأوضح */
.commission-rate {
  font-size: 1.65rem;
  font-weight: 800;
  color: #27ae60;
  letter-spacing: 0.02em;
}

.commission-modal-close {
  display: block;
  width: 100%;
  padding: 12px 20px;
  background: #27ae60;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  font-family: inherit;
}

.commission-modal-close:hover {
  background: #229954;
  transform: translateY(-1px);
}

.commission-modal-close:active {
  transform: translateY(0);
}

.copyright {
  color: #95a5a6;
  font-size: 0.85rem;
  margin: 0;
}

/* ================= COMPARE FEATURE ================= */
/* Checkbox في بطاقة السيارة */
.ad-compare-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 100;
  overflow: visible !important;
}

.compare-checkbox {
  display: none;
}

.compare-checkbox-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  background: white;
  border: 2px solid var(--primary);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: visible;
  color: #000;
}

.compare-checkbox-label:hover {
  background: white;
  color: #000;
  transform: scale(1.1);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.compare-checkbox:checked + .compare-checkbox-label {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.compare-checkbox-label i {
  font-size: 1rem;
  color: #000;
  font-weight: 900;
}

.compare-checkbox:checked + .compare-checkbox-label i {
  color: white;
}

.compare-tooltip {
  position: absolute;
  top: 50%;
  left: calc(100% + 10px);
  transform: translateY(-50%) translateX(0);
  background: white;
  color: #000;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: 'Almarai', 'Cairo', 'Tajawal', sans-serif;
  font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  z-index: 10001;
  text-align: center;
  border: 2px solid #e0e0e0;
  word-break: keep-all;
  display: block;
  width: max-content;
}

.compare-tooltip::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: white;
}

.compare-checkbox-label:hover .compare-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(3px);
}

/* الشريط العائم للمقارنة */
.compare-bar {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  direction: rtl;
  margin-right: 118px; /* مساحة لشريط التنقل الجانبي */
}

.compare-bar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1200px;
  gap: 20px;
}

.compare-bar-text {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.1rem;
  font-weight: 600;
}

.compare-bar-text i {
  font-size: 1.3rem;
}

#compareCount {
  font-weight: 700;
  color: #ffd700;
  font-size: 1.2rem;
}

.compare-bar-actions {
  display: flex;
  gap: 10px;
}

.compare-bar-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.compare-bar-btn.cancel {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.compare-bar-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.3);
}

.compare-bar-btn.compare {
  background: #ffd700;
  color: #333;
  font-weight: 700;
}

.compare-bar-btn.compare:hover {
  background: #ffed4e;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

/* Modal المقارنة */
.compare-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  font-family: inherit;
}

.compare-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.compare-modal-content {
  position: relative;
  background: white;
  width: 95%;
  max-width: 1000px;
  max-height: 90vh;
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  direction: rtl;
  overflow-y: auto;
}

.compare-modal-close {
  position: absolute;
  top: 15px;
  left: 15px;
  background: #f0f0f0;
  border: none;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  cursor: pointer;
  font-size: 1.1rem;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1;
}

.compare-modal-close:hover {
  background: #e0e0e0;
  color: #333;
}

.compare-modal-title {
  margin: 0 0 25px 0;
  font-size: 1.5rem;
  color: var(--primary);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* جدول المقارنة */
.compare-table-container {
  overflow-x: auto;
  margin-bottom: 20px;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.compare-table thead {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.compare-table th {
  padding: 15px;
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
}

.compare-table th:first-child {
  background: rgba(255, 255, 255, 0.1);
  text-align: right;
}

.compare-car-col {
  width: 40%;
}

.compare-car-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.compare-car-title {
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
}

.compare-table tbody tr {
  border-bottom: 1px solid #eee;
  transition: background 0.2s ease;
}

.compare-table tbody tr:hover {
  background: var(--light-gray);
}

.compare-table tbody tr:last-child {
  border-bottom: none;
}

.compare-label {
  padding: 15px;
  background: var(--light-gray);
  font-weight: 600;
  color: var(--dark);
  text-align: right;
  width: 20%;
  vertical-align: middle;
}

.compare-label i {
  margin-left: 8px;
  color: var(--primary);
}

.compare-value {
  padding: 15px;
  text-align: center;
  vertical-align: middle;
}

.compare-image-cell {
  text-align: center;
  padding: 20px;
}

.compare-image {
  max-width: 150px;
  max-height: 100px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.compare-icon {
  font-size: 3rem;
  color: #ccc;
}

.price-negotiable {
  color: #f39c12;
  font-weight: 600;
  font-size: 1.1rem;
}

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

.compare-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #eee;
}

.compare-action-btn {
  padding: 12px 30px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.compare-action-btn:hover {
  background: #089691;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(10, 186, 181, 0.3);
}

/* Responsive Design للمقارنة */
@media (max-width: 768px) {
  .compare-bar {
    margin-right: 0;
    padding: 12px 15px;
    padding-bottom: calc(80px + 12px + env(safe-area-inset-bottom)); /* مساحة لشريط التنقل السفلي */
  }

  .compare-bar-content {
    flex-direction: column;
    gap: 12px;
  }

  .compare-bar-text {
    font-size: 1rem;
  }

  .compare-bar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .compare-bar-btn {
    flex: 1;
    justify-content: center;
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  .compare-modal-content {
    width: 98%;
    padding: 20px 15px;
    max-height: 95vh;
  }

  .compare-table {
    font-size: 0.85rem;
  }

  .compare-table th,
  .compare-table td {
    padding: 10px 8px;
  }

  .compare-image {
    max-width: 100px;
    max-height: 70px;
  }

  .compare-car-title {
    font-size: 0.8rem;
  }
}

/* Footer Responsive Design */
@media (max-width: 768px) {
  body {
    padding-right: 0; /* إزالة padding في الشاشات الصغيرة */
  }

  .site-footer {
    padding: 40px 15px 20px;
    margin: 40px 0 0 0;
    margin-right: 0; /* إزالة التعويض في الشاشات الصغيرة */
    width: 100%; /* عرض كامل في الشاشات الصغيرة */
    padding-bottom: 90px; /* مساحة لشريط التنقل السفلي */
  }
  body.standalone-page .site-footer {
    padding-bottom: 25px;
    padding-bottom: calc(25px + env(safe-area-inset-bottom));
  }

  .footer-container {
    padding-right: 0; /* إزالة المساحة الجانبية في الشاشات الصغيرة */
    padding-left: 0;
  }

  .footer-content {
    flex-direction: column;
    gap: 30px;
    text-align: center;
  }

  .footer-column {
    min-width: 100%;
  }

  .footer-logo,
  .footer-description,
  .footer-title {
    text-align: center;
  }

  .footer-links {
    text-align: center;
  }

  .footer-link {
    text-align: center;
  }

  .social-links {
    justify-content: center;
  }
}

/* تصغير عام للجوال — نسبة بصرية أفضل (مقياس، هوامش، هيدر، كروت) */
@media (max-width: 768px) {
  /* المقياس العام: خط أساس 14px لتقليل الإحساس بالضخامة */
  html {
    font-size: 14px;
  }

  /* الحاوية الرئيسية: عرض 92% مع توسيط لفراغ حقيقي يميناً ويساراً */
  .content-area,
  body .content-area {
    width: 92% !important;
    max-width: 92% !important;
    margin: 0 auto !important;
    padding: 12px 0 !important;
    box-sizing: border-box !important;
  }

  /* الهيدر: مساحة أوضح لشعار سطرين (عربي + KSA) */
  .header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 6px 10px !important;
    padding-top: calc(6px + env(safe-area-inset-top)) !important;
    min-height: 46px !important;
    max-height: none !important;
    flex-wrap: nowrap !important;
  }
  .header-left {
    flex: 0 0 auto !important;
    min-width: 0 !important;
  }
  /* عنوان هيدر عادي (صفحات فرعية إن وُجدت) */
  .header h1:not(.site-brand) {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: 160px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 1rem !important;
    color: var(--primary, #0ABAB5) !important;
  }
  /* شعار الموقع: عربي فوق و KSA تحته */
  .header h1.site-brand {
    flex: 1 1 auto !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 0 !important;
    max-width: min(56vw, 220px) !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    font-size: inherit !important;
    color: var(--brand-title, #067D79) !important;
    line-height: 1.08 !important;
    padding: 2px 2px !important;
    box-sizing: border-box !important;
    gap: 0.08em !important;
  }
  .header h1.site-brand .site-brand__ar {
    font-size: clamp(0.72rem, 4vw, 0.95rem) !important;
    line-height: 1.15 !important;
    text-align: center !important;
    white-space: nowrap !important;
    max-width: 100%;
  }
  .header-actions {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    gap: 6px !important;
  }
  .header-pwa-install-btn {
    padding: 5px 8px !important;
    font-size: 11px !important;
    min-height: 32px !important;
  }
  .header-pwa-install-btn i {
    font-size: 10px !important;
  }

  /* أزرار الدخول/الحساب/الخروج: أيقونات ثابتة لمنع التمطط */
  .auth-status-btn,
  .auth-register-btn,
  .auth-logout-btn {
    padding: 6px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    font-size: 13px !important;
    border-radius: 50% !important;
    justify-content: center !important;
    align-items: center !important;
  }
  .auth-status-btn .btn-text,
  .auth-register-btn .btn-text,
  .auth-logout-btn .btn-text {
    display: none !important;
  }
  /* أيقونات الدخول/الخروج: aspect-ratio 1/1 و min-width ثابت لمنع التشوه */
  .auth-status-btn .btn-icon,
  .auth-register-btn .btn-icon,
  .auth-logout-btn .btn-icon {
    position: static !important;
    right: auto !important;
    transform: none !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    aspect-ratio: 1 / 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
  }
  .auth-status-btn .btn-icon i,
  .auth-register-btn .btn-icon i,
  .auth-logout-btn .btn-icon i {
    font-size: 0.95rem !important;
    display: inline-block !important;
  }
  .auth-logout-btn .btn-icon {
    margin: 0 !important;
  }


  .auth-status-btn,
  .auth-register-btn,
  .auth-logout-btn {
    aspect-ratio: 1 / 1 !important;
    min-width: 40px !important;
    min-height: 40px !important;
  }

  /* كروت الإعلانات: max-width 100%، padding 8px، عنوان وسعر أصغر */
  .ads-container {
    gap: 6px;
    padding: 6px 0 !important;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    max-width: 100%;
    box-sizing: border-box !important;
  }

  .ad-card {
    border-radius: 10px;
    padding: 0;
    margin: 0;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .ad-body {
    padding: 8px !important;
  }

  /* صورة الكرت: ارتفاع 180px لرؤية التفاصيل دون سحب كثير */
  .ad-img,
  .ad-card-slider {
    min-height: 140px;
    max-height: 180px;
    height: 180px;
    aspect-ratio: auto;
  }
  .ad-img img,
  .ad-card-slider-track img {
    object-fit: cover;
  }

  /* منع التحديد والـ highlight الرمادي على البطاقة والسلايدر في الجوال */
  .ad-card,
  .ad-card .ad-img,
  .ad-card .ad-card-slider,
  .ad-card .ad-card-slider-track,
  .ad-card .ad-card-slider-arrow {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    tap-highlight-color: transparent;
  }

  .ad-title {
    font-size: 0.82rem !important;
    line-height: 1.3;
  }

  .ad-price {
    font-size: 1rem !important;
  }

  .ad-meta {
    gap: 6px;
    margin-bottom: 6px;
    padding-bottom: 6px;
  }

  .ad-meta span {
    font-size: 0.7rem;
  }

  .ad-footer {
    padding-top: 8px;
  }

  .ad-comments-icon {
    margin-top: 12px;
    padding: 10px;
    font-size: 0.85rem;
  }

  .add-ad-card,
  .details-card {
    margin: 8px;
    padding: 14px;
  }

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

  .form-label,
  .form-input {
    font-size: 0.9rem;
  }

  .form-input,
  .textarea {
    padding: 10px 12px;
  }

  .submit-btn {
    padding: 12px 18px;
    font-size: 0.95rem;
  }

  .details-body {
    padding: 20px;
  }

  .details-main-title,
  .details-title-section h1 {
    font-size: 1.62rem;
  }

  .details-price {
    font-size: 1.26rem;
  }

  .content-area {
    width: 92% !important;
    max-width: 92% !important;
    margin: 0 auto !important;
    padding: 12px 0 !important;
  }

  .page {
    padding: 0;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 6px 8px !important;
    padding-top: calc(6px + env(safe-area-inset-top)) !important;
    max-height: none !important;
    min-height: 46px !important;
  }

  .content-area {
    width: 92% !important;
    max-width: 92% !important;
    margin: 0 auto !important;
    padding: 12px 0 !important;
  }

  .header-actions {
    gap: 6px;
  }
  
  .auth-switch-btn {
    padding: 12px;
    font-size: 0.9rem;
  }
  
  .ads-container {
    grid-template-columns: 1fr;
  }
  
  .account-header {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  /* حاوية صورة البروفايل للجوال: مرجع التموضع، وبلا Flex داخل الدائرة */
  .account-avatar-wrapper,
  .account-avatar-inner,
  .account-avatar {
    position: relative !important;
    display: block !important;
    overflow: visible !important;
  }

  .account-avatar {
    width: 100px !important;
    height: 100px !important;
    font-size: 2rem !important;
  }
  
  /* أيقونة حذف صورة البروفايل على الجوال (≤ 480px):
     - خارج إطار الدائرة (أسفل يسار)
     - حجم صغير ثابت
     - بلا أي تمركز للمنتصف أو تحريك إضافي */
  .avatar-delete-btn {
    position: absolute !important;
    top: auto !important;
    left: -10px !important;
    bottom: -5px !important;
    right: auto !important;
    transform: none !important;
    margin: 0 !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    border-radius: 50% !important;
    background: #fff !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    z-index: 10 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .avatar-delete-btn i {
    width: 12px !important;
    height: 12px !important;
    font-size: 12px !important;
  }

  .avatar-change-btn {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.8rem !important;
    bottom: -36px;
    right: -36px;
  }

  .account-info h2 {
    font-size: 18px !important;
  }
  .account-info p {
    font-size: 14px !important;
  }

  .menu-text {
    font-size: 1rem;
  }
  
  .chat-section {
    margin-top: 20px;
    padding-top: 20px;
  }
  
  .chat-container {
    height: 250px;
  }
  
  .details-card {
    margin: 10px;
  }
  
  .details-body {
    padding: 15px;
  }
  
  .images-gallery {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  
  .details-price {
    font-size: 1.4rem;
  }
  
  .details-title {
    font-size: 1.1rem;
  }
  
  /* صفحات النصوص على الشاشات الصغيرة جداً */
  .terms-page,
  .legal-page,
  .privacy-page {
    padding: 16px 12px 30px;
  }
  .terms-page h1,
  .legal-page h1,
  .privacy-page h1 {
    font-size: 1.35rem;
  }
  .footer-bottom .copyright {
    font-size: 0.8rem;
    padding: 0 10px;
    word-break: break-word;
  }
}

/* ================= LAYOUT OVERRIDE (Higher Specificity) ================= */
/* توزيع العناصر: قوة اختيار أعلى + !important لضمان تفوق التنسيق على أي CSS خارجي (Font Awesome, Google Fonts) */
body .page {
  display: none !important;
  position: relative !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

body .page.active {
  display: block !important;
  position: relative !important;
  margin: 0 !important;
}

body #account-page:not(.active) {
  display: none !important;
  position: absolute !important;
  margin: 0 !important;
  visibility: hidden !important;
  overflow: hidden !important;
}

body #account-page.active {
  display: block !important;
  position: relative !important;
  margin: 0 !important;
}

body .header {
  display: flex !important;
  position: sticky !important;
  margin: 0 !important;
  top: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

body #home-page,
body #auth-page,
body #add-ad-page,
body #details-page {
  display: none !important;
  position: relative !important;
  margin: 0 !important;
}

body #home-page.active,
body #auth-page.active,
body #add-ad-page.active,
body #details-page.active {
  display: block !important;
  position: relative !important;
  margin: 0 !important;
}

/* صفحة تسجيل الدخول فوق الشريط السفلي حتى لا يغطي الـ overlay الرابط/الزر */
body #auth-page.active {
  z-index: 1001 !important;
}

body .ads-container {
  display: grid !important;
  position: relative !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

body .content-area {
  display: block !important;
  position: relative !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

@media (max-width: 768px) {
  body .content-area {
    width: 92% !important;
    max-width: 92% !important;
    margin: 0 auto !important;
  }
}

body .bottom-nav {
  display: flex !important;
  position: fixed !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

body .ad-card {
  display: flex !important;
  position: relative !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

/* أيقونات Font Awesome داخل التخطيط: منع تغيير display من قوى خارجية من التأثير على التوزيع */
body .header i.fas,
body .header i.far,
body .header i.fab,
body .bottom-nav i.fas,
body .bottom-nav i.far,
body .bottom-nav i.fab {
  display: inline-block !important;
  position: relative !important;
  margin: 0 !important;
}

/* ================= توافق الجوال (iOS & Android) — 768px ================= */
@media (max-width: 768px) {
  /* خلفية بيضاء موحّدة على الجوال */
  html,
  body,
  .page,
  .page.active,
  #home-page,
  #home-page.active,
  #favorites-page,
  #account-page,
  #add-ad-page,
  #details-page,
  #auth-page {
    background: #ffffff !important;
    background-color: #ffffff !important;
  }
  .filters,
  .header,
  .details-header {
    background: #ffffff !important;
    background-color: #ffffff !important;
  }
  /* منع أي حركة عرضية (اهتزاز) على الجوال */
  body {
    overflow-x: hidden !important;
    align-items: stretch !important;
  }
  #add-ad-page.active {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100vw !important;
    align-self: stretch !important;
  }
  /* كود التمريض: تصفير القيود في صفحة إضافة الإعلان فقط */
  #add-ad-page,
  #add-ad-page * {
    max-width: 100vw !important;
  }

  /* ===== استهداف مباشر للعناصر (بدون الاعتماد على الكلاسات فقط) — Android & iPhone ===== */
  #add-ad-page div[class*="container"],
  #add-ad-page div[class*="Container"],
  #add-ad-page div[class*="wrapper"],
  #add-ad-page div[class*="Wrapper"],
  #add-ad-page .add-ad-body,
  #add-ad-page .form-row,
  #add-ad-page .form-row-half {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  /* السعر ورقم الجوال — أو حالة القطعة ورقم الجوال (قطع غيار): كل حقل في سطر كامل على الجوال */
  #add-ad-page #add-ad-row-price-phone,
  body #add-ad-page #add-ad-row-price-phone,
  #add-ad-page #add-ad-parts-row-price,
  body #add-ad-page #add-ad-parts-row-price,
  #add-ad-page #add-ad-block-parts-row.add-ad-parts-row--with-phone,
  body #add-ad-page #add-ad-block-parts-row.add-ad-parts-row--with-phone {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 0 !important;
  }
  #add-ad-page #add-ad-row-price-phone .form-group,
  body #add-ad-page #add-ad-row-price-phone .form-group,
  #add-ad-page #add-ad-parts-row-price .form-group,
  body #add-ad-page #add-ad-parts-row-price .form-group,
  #add-ad-page #add-ad-block-parts-row.add-ad-parts-row--with-phone .form-group,
  body #add-ad-page #add-ad-block-parts-row.add-ad-parts-row--with-phone .form-group {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-bottom: 15px !important;
  }
  #add-ad-page #add-ad-row-price-phone .form-group:last-child,
  body #add-ad-page #add-ad-row-price-phone .form-group:last-child,
  #add-ad-page #add-ad-parts-row-price .form-group:last-child,
  body #add-ad-page #add-ad-parts-row-price .form-group:last-child,
  #add-ad-page #add-ad-block-parts-row.add-ad-parts-row--with-phone .form-group:last-child,
  body #add-ad-page #add-ad-block-parts-row.add-ad-parts-row--with-phone .form-group:last-child {
    margin-bottom: 0 !important;
  }
  /* صف سعر قطع الغيار: إخفاء العمود الوهمي على الجوال ليبقى السعر بعرض كامل */
  #add-ad-page #add-ad-parts-price-spacer {
    display: none !important;
  }

  /* نوع الوقود + ناقل الحركة: عمود بعرض كامل (يتفوق على grid سطح المكتب لصف الحقلين) */
  body #add-ad-page .add-ad-body > #add-ad-row-fuel-transmission.form-row,
  #add-ad-page .add-ad-body > #add-ad-row-fuel-transmission.form-row,
  body #add-ad-page .add-ad-body > #add-ad-row-fuel-transmission,
  #add-ad-page .add-ad-body > #add-ad-row-fuel-transmission {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    gap: 0 !important;
    align-items: stretch !important;
  }
  body #add-ad-page #add-ad-row-fuel-transmission > .form-group,
  #add-ad-page #add-ad-row-fuel-transmission > .form-group {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  body #add-ad-page #add-ad-row-fuel-transmission #ad-fuel,
  body #add-ad-page #add-ad-row-fuel-transmission #ad-transmission,
  #add-ad-page #add-ad-row-fuel-transmission #ad-fuel,
  #add-ad-page #add-ad-row-fuel-transmission #ad-transmission {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  #add-ad-page input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  #add-ad-page select,
  #add-ad-page textarea,
  #add-ad-page .form-input,
  #add-ad-page .add-ad-body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  #add-ad-page .add-ad-body select,
  #add-ad-page .add-ad-body textarea {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    font-size: 16px !important;
    padding: 8px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  #add-ad-page .add-ad-body select,
  #add-ad-page .add-ad-body select.form-input {
    padding-left: 8px !important;
    padding-right: 8px !important;
    padding-inline-start: 36px !important;
    padding-inline-end: 8px !important;
  }
  #add-ad-page .add-ad-body textarea {
    overflow: auto !important;
    text-overflow: clip !important;
    white-space: pre-wrap !important;
  }
  /* حقل السعر الموحّد على الجوال: عمود مثل الجوال — حقل السعر ثم «على السوم» ملاصق تحته */
  #add-ad-page .add-ad-body .price-unified {
    display: -webkit-box !important;
    display: flex !important;
    -webkit-box-orient: vertical !important;
    -webkit-flex-direction: column !important;
    flex-direction: column !important;
    -webkit-flex-wrap: nowrap !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    -webkit-box-align: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  #add-ad-page .add-ad-body .price-unified__input {
    -webkit-box-flex: 0 !important;
    -webkit-flex: 0 0 auto !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 44px !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
  }
  #add-ad-page .add-ad-body .price-unified__som {
    -webkit-box-flex: 0 !important;
    -webkit-flex: 0 0 auto !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-inline-start: none !important;
    border-right: none !important;
    border-inline-end: none !important;
    -webkit-box-pack: start !important;
    -webkit-justify-content: flex-start !important;
    justify-content: flex-start !important;
    padding: 10px 12px !important;
    font-size: 0.8125rem !important;
    box-sizing: border-box !important;
  }
  /* حقل الجوال الموحّد — مثل السعر */
  #add-ad-page .add-ad-body .phone-unified {
    display: -webkit-box !important;
    display: flex !important;
    -webkit-flex-wrap: nowrap !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  #add-ad-page .add-ad-body .phone-unified__input {
    -webkit-box-flex: 1 !important;
    -webkit-flex: 1 1 0% !important;
    flex: 1 1 0% !important;
    min-width: 0 !important;
    width: 0 !important;
    max-width: none !important;
    min-height: 44px !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
  }
  #add-ad-page .add-ad-body .phone-unified__show.toggle-switch {
    -webkit-box-orient: horizontal !important;
    -webkit-flex-direction: row !important;
    flex-direction: row !important;
    -webkit-flex-shrink: 0 !important;
    flex-shrink: 0 !important;
    min-width: 198px !important;
    max-width: none !important;
    padding: 0 12px !important;
    padding-inline-start: 14px !important;
    padding-inline-end: 12px !important;
    gap: 6px !important;
    overflow: visible !important;
  }
  #add-ad-page .add-ad-body .phone-unified__show .toggle-label {
    font-size: 0.8125rem !important;
    white-space: nowrap !important;
    max-width: none !important;
  }
  #add-ad-page .add-ad-body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  #add-ad-page .add-ad-body select {
    white-space: nowrap !important;
  }
  /* محاذاة النصوص من اليمين + مسافة داخلية بسيطة */
  #add-ad-page .add-ad-body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  #add-ad-page .add-ad-body select,
  #add-ad-page .add-ad-body textarea {
    text-align: right !important;
    padding-inline-end: 15px !important;
  }
  /* توحيد العرض: الكيلومترات وحاوية السعر 100% */
  #add-ad-page #ad-km,
  #add-ad-page #add-ad-block-km,
  #add-ad-page #add-ad-price-form-group .price-unified,
  #add-ad-page #add-ad-phone-form-group .phone-unified {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  /* زر إضافة الإعلان: عرض كامل + مسافة كافية فوقه لتفادي النقر بالخطأ */
  #add-ad-page .add-ad-body > .submit-btn {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 16px !important;
    min-height: 52px !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    background: linear-gradient(135deg, var(--success), #27ae60) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 10px !important;
    margin-top: 28px !important;
    box-shadow: 0 4px 14px rgba(39, 174, 96, 0.35) !important;
  }

  /* الجوال: عمود النموذج بعرض 92% من الشاشة، متمركز — الحقول والوصف والرفع تملأ العمود (100% داخله) */
  #add-ad-page .add-ad-container {
    display: flex !important;
    flex-direction: column !important;
    width: 92% !important;
    max-width: 92vw !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    /* مساحة كافية فوق الشريط السفلي + أجهزة ذات home indicator */
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  #add-ad-page .add-ad-card {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  /* إلغاء شبكة سطح المكتب (body + id تفوق على القاعدة العامة) — عمود واحد يمنع قصّ الحقول وانزياحها */
  body #add-ad-page .add-ad-body,
  #add-ad-page .add-ad-body {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 12px 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  /* إلغاء max-width ثابت لمنطقة رفع الصور/الفيديو (كان 420px) */
  #add-ad-page .upload-area,
  #add-ad-page .upload-area-video {
    max-width: 100% !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  #add-ad-page input[type="file"],
  #add-ad-page .file-input-hidden {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
  }
  /* تعطيل Flexbox العرضي داخل الصفوف المساعدة */
  #add-ad-page .price-label-row,
  #add-ad-page .upload-actions-row {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
  }
  #add-ad-page .price-group {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  /* حقل السعر على الجوال: عمود — حقل ثم «على السوم» (متسق مع الكتلة التالية) */
  #add-ad-page .price-unified {
    display: -webkit-box !important;
    display: flex !important;
    -webkit-box-orient: vertical !important;
    -webkit-flex-direction: column !important;
    flex-direction: column !important;
    -webkit-flex-wrap: nowrap !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    -webkit-box-align: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  #add-ad-page .price-unified__input {
    -webkit-box-flex: 0 !important;
    -webkit-flex: 0 0 auto !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 44px !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
  }
  #add-ad-page .price-unified__som {
    -webkit-box-flex: 0 !important;
    -webkit-flex: 0 0 auto !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-inline-start: none !important;
    border-right: none !important;
    border-inline-end: none !important;
    -webkit-box-pack: start !important;
    -webkit-justify-content: flex-start !important;
    justify-content: flex-start !important;
    padding: 10px 12px !important;
    font-size: 0.8125rem !important;
    gap: 8px !important;
    box-sizing: border-box !important;
  }
  #add-ad-page .phone-unified {
    display: -webkit-box !important;
    display: flex !important;
    -webkit-flex-wrap: nowrap !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  #add-ad-page .phone-unified__input {
    -webkit-box-flex: 1 !important;
    -webkit-flex: 1 1 0% !important;
    flex: 1 1 0% !important;
    min-width: 0 !important;
    width: 0 !important;
    min-height: 44px !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
  }
  #add-ad-page .phone-unified__show.toggle-switch {
    -webkit-box-orient: horizontal !important;
    -webkit-flex-direction: row !important;
    flex-direction: row !important;
    -webkit-flex-shrink: 0 !important;
    flex-shrink: 0 !important;
    min-width: 198px !important;
    max-width: none !important;
    padding: 0 12px !important;
    padding-inline-start: 14px !important;
    padding-inline-end: 12px !important;
    gap: 6px !important;
    overflow: visible !important;
  }
  #add-ad-page .phone-unified__show .toggle-label {
    font-size: 0.8125rem !important;
    white-space: nowrap !important;
    max-width: none !important;
  }

  /* الجوال: حقل الجوال — عمود (الحقل ثم شريط المفتاح) */
  #add-ad-page .add-ad-body .phone-unified,
  #add-ad-page .phone-unified {
    flex-direction: column !important;
    -webkit-box-orient: vertical !important;
    align-items: stretch !important;
    -webkit-box-align: stretch !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
  }
  /* الجوال: السعر — عمود داخل الإطار: حقل السعر ثم شريط «على السوم» ملاصق (نفس فكرة الجوال) */
  #add-ad-page .add-ad-body .price-unified,
  #add-ad-page .price-unified {
    flex-direction: column !important;
    -webkit-box-orient: vertical !important;
    align-items: stretch !important;
    -webkit-box-align: stretch !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
  }
  #add-ad-page .add-ad-body .price-unified__input,
  #add-ad-page .price-unified__input {
    -webkit-box-flex: 0 !important;
    -webkit-flex: 0 0 auto !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 44px !important;
    border-radius: 0 !important;
  }
  #add-ad-page .add-ad-body .price-unified__som,
  #add-ad-page .price-unified__som {
    -webkit-box-flex: 0 !important;
    -webkit-flex: 0 0 auto !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-right: none !important;
    border-inline-end: none !important;
    border-inline-start: none !important;
    -webkit-box-pack: start !important;
    -webkit-justify-content: flex-start !important;
    justify-content: flex-start !important;
    padding: 10px 12px !important;
    font-size: 0.8125rem !important;
    gap: 8px !important;
  }
  /* جوال: تطابق إطار السعر — سيارة وقطع غيار */
  #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified,
  body #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified,
  #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified,
  body #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
  }
  #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified__input,
  body #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified__input,
  #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified__input,
  body #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified__input {
    min-height: 44px !important;
    font-size: 16px !important;
  }
  #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified__som,
  body #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified__som,
  #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified__som,
  body #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified__som {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 10px 12px !important;
    font-size: 0.8125rem !important;
  }
  #add-ad-page .add-ad-body .phone-unified__input,
  #add-ad-page .phone-unified__input {
    -webkit-box-flex: 0 !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-radius: 0 !important;
  }
  #add-ad-page .add-ad-body .phone-unified__show.toggle-switch,
  #add-ad-page .phone-unified__show.toggle-switch {
    -webkit-box-flex: 0 !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    border-right: none !important;
    border-inline-end: none !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    /* RTL: تجميع المفتاح و«إخفاء» عند بداية السطر (اليمين) بدل space-between الذي يبعد النص عن المفتاح */
    -webkit-box-pack: start !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    padding: 10px 12px !important;
    gap: 6px !important;
    overflow: visible !important;
  }
  #add-ad-page .add-ad-body .phone-unified__show .toggle-label,
  #add-ad-page .phone-unified__show .toggle-label {
    white-space: normal !important;
    text-align: right !important;
    -webkit-box-flex: 1 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  /* الجوال فقط: استبدال نص «إظهار رقم الجوال» بـ «إخفاء» بجانب المفتاح (نص واحد في HTML) */
  #add-ad-page .phone-unified__show .toggle-label--ad-show-phone,
  #add-ad-page .add-ad-body .phone-unified__show .toggle-label--ad-show-phone {
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
    white-space: nowrap !important;
    -webkit-box-flex: 0 !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    position: relative !important;
    overflow: visible !important;
    width: auto !important;
    min-height: 1.35em !important;
  }
  #add-ad-page .phone-unified__show .toggle-label--ad-show-phone::after,
  #add-ad-page .add-ad-body .phone-unified__show .toggle-label--ad-show-phone::after {
    content: "إخفاء" !important;
    font-size: 0.8125rem !important;
    line-height: 1.35 !important;
    font-weight: 600 !important;
    color: #1a1a1a !important;
    position: absolute !important;
    right: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    white-space: nowrap !important;
  }
  #add-ad-page .phone-unified--show-off .phone-unified__show .toggle-label--ad-show-phone::after {
    color: #455a64 !important;
  }

  /* السعر والجوال: عرض كامل + border-box داخل الشاشة (يتفوق على شبكة اللابتوب) */
  body #add-ad-page #add-ad-row-price-phone,
  #add-ad-page #add-ad-row-price-phone,
  body #add-ad-page #add-ad-parts-row-price,
  #add-ad-page #add-ad-parts-row-price,
  body #add-ad-page #add-ad-price-form-group,
  #add-ad-page #add-ad-price-form-group,
  body #add-ad-page #add-ad-phone-form-group,
  #add-ad-page #add-ad-phone-form-group,
  body #add-ad-page #add-ad-row-price-phone .price-group,
  #add-ad-page #add-ad-row-price-phone .price-group,
  body #add-ad-page #add-ad-parts-row-price .price-group,
  #add-ad-page #add-ad-parts-row-price .price-group,
  body #add-ad-page #add-ad-row-price-phone .phone-group,
  #add-ad-page #add-ad-row-price-phone .phone-group {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  body #add-ad-page .price-unified,
  body #add-ad-page .phone-unified,
  #add-ad-page .add-ad-body .price-unified,
  #add-ad-page .price-unified,
  #add-ad-page .add-ad-body .phone-unified,
  #add-ad-page .phone-unified,
  body #add-ad-page .price-unified__input,
  body #add-ad-page .phone-unified__input,
  body #add-ad-page .price-unified__som,
  body #add-ad-page .phone-unified__show.toggle-switch {
    box-sizing: border-box !important;
    max-width: 100% !important;
  }

  /* نوع السيارة / حالة السيارة + الكيلومترات: عمود كامل على الجوال */
  #add-ad-page #add-ad-row-brand-model,
  #add-ad-page #add-ad-row-condition-km {
    display: flex !important;
    flex-direction: column !important;
  }
  #add-ad-page #add-ad-row-brand-model > .form-group,
  #add-ad-page #add-ad-row-condition-km > .form-group {
    width: 100% !important;
    max-width: 100% !important;
  }
  #add-ad-page .add-ad-body > .form-row,
  #add-ad-page .add-ad-body > .form-row-half {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 15px !important;
    padding: 0 !important;
    gap: 0 !important;
  }
  #add-ad-page .add-ad-body > .form-row:last-child,
  #add-ad-page .add-ad-body > .form-row-half:last-child {
    margin-bottom: 0 !important;
  }
  #add-ad-page .add-ad-body > .form-row > .form-group,
  #add-ad-page .add-ad-body > .form-row-half > .form-group {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 15px !important;
    padding: 0 !important;
  }
  #add-ad-page .add-ad-body > .form-row > .form-group:last-child,
  #add-ad-page .add-ad-body > .form-row-half > .form-group:last-child {
    margin-bottom: 15px !important;
  }
  #add-ad-page .add-ad-body > .form-row.form-row-full,
  #add-ad-page .add-ad-body > .form-row.form-row-title-desc,
  #add-ad-page .add-ad-body > .form-row:has(.form-group-full) {
    display: flex !important;
    flex-direction: column !important;
  }
  /* قاعدة 100vw: منع أي margin/padding من تجاوز عرض الشاشة — ثبات الصفحة على Android و iPhone */
  body #add-ad-page.active,
  #add-ad-page.active {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  #add-ad-page .add-ad-body .form-group,
  #add-ad-page .add-ad-body .form-row,
  #add-ad-page .add-ad-body .form-row-half {
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* تنسيق المدخلات: 16px على الأقل — منع زوم Safari التلقائي في الآيفون */
  input,
  select,
  textarea,
  .form-input,
  #add-ad-page .form-input,
  #add-ad-page select.form-input {
    font-size: 16px !important;
    min-height: 50px;
    line-height: 1.5 !important;
  }
  input:not([type="checkbox"]):not([type="radio"]),
  textarea {
    -webkit-appearance: none;
    appearance: none;
  }
  #add-ad-page .form-input.textarea,
  #add-ad-page #ad-description {
    min-height: 150px !important;
    padding: 12px !important;
    font-size: 16px !important;
    text-align: right !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* ===== صفحة إضافة إعلان — حقول بعرض كامل (الوالد تم تعطيل flex/grid أعلاه) ===== */
  #add-ad-page .form-group,
  #add-ad-page .input-container {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }
  /* حقول الإدخال: padding 8px (يمين/يسار) لظهور النص كاملاً + ellipsis إن طال */
  /* استثناء حقول السعر/الجوال الموحّدة: selectors أدقّ من .price-unified__input تكسر صفّ الفليكس وتُقصّ الحقل من الجانب على iOS/Android */
  #add-ad-page input:not(.phone-unified__input):not(.price-unified__input),
  #add-ad-page select,
  #add-ad-page textarea,
  #add-ad-page .form-control,
  #add-ad-page .form-input:not(.phone-unified__input):not(.price-unified__input),
  #add-ad-page .add-ad-body .form-input:not(.phone-unified__input):not(.price-unified__input),
  #add-ad-page .add-ad-body input.form-input:not(.phone-unified__input):not(.price-unified__input),
  #add-ad-page .add-ad-body textarea.form-input,
  #add-ad-page .add-ad-body input[type="text"]:not(.phone-unified__input):not(.price-unified__input),
  #add-ad-page .add-ad-body input[type="number"]:not(.price-unified__input),
  #add-ad-page .add-ad-body input[type="tel"]:not(.phone-unified__input) {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    display: block !important;
    box-sizing: border-box !important;
    padding: 8px !important;
    font-size: 16px !important;
    min-height: 44px !important;
    line-height: 1.5 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  #add-ad-page .add-ad-body textarea.form-input {
    overflow: auto !important;
    text-overflow: clip !important;
    white-space: pre-wrap !important;
  }
  #add-ad-page .add-ad-body input.form-input:not(.phone-unified__input):not(.price-unified__input),
  #add-ad-page .add-ad-body select.form-input {
    white-space: nowrap !important;
  }
  #add-ad-page .add-ad-body select.form-input,
  #add-ad-page .add-ad-body select {
    padding-inline-start: 36px !important;
    padding-inline-end: 8px !important;
  }
  #add-ad-page .add-ad-body > .form-row .form-input,
  #add-ad-page .add-ad-body > .form-row-half .form-input,
  #add-ad-page .add-ad-body > .form-row input.form-input,
  #add-ad-page .add-ad-body > .form-row select.form-input,
  #add-ad-page .add-ad-body > .form-row-half input.form-input,
  #add-ad-page .add-ad-body > .form-row-half select.form-input {
    font-size: 15px !important;
  }
  #add-ad-page #ad-condition {
    padding: 8px !important;
    padding-inline-start: 36px !important;
    padding-inline-end: 8px !important;
  }
  #add-ad-page .add-ad-body > .form-row,
  #add-ad-page .add-ad-body > .form-row-half {
    margin-bottom: 15px !important;
  }
  #add-ad-page .add-ad-body > .form-row:last-child,
  #add-ad-page .add-ad-body > .form-row-half:last-child {
    margin-bottom: 0 !important;
  }
  /* «على السوم» — وضوح النص على الجوال */
  #add-ad-page .price-unified__som {
    font-size: 0.8125rem !important;
    line-height: 1.35 !important;
  }
  #add-ad-page .phone-unified__show .toggle-label {
    font-size: 0.8125rem !important;
    line-height: 1.35 !important;
    white-space: normal !important;
  }
  #add-ad-page .price-unified__som input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    margin: 0 0 0 4px !important;
    -webkit-flex-shrink: 0 !important;
    flex-shrink: 0 !important;
  }
  #add-ad-page #ad-condition {
    min-height: 44px !important;
    height: auto !important;
  }
  #add-ad-page .form-input.textarea,
  #add-ad-page #ad-description {
    padding: 12px !important;
    min-height: 150px !important;
    font-size: 16px !important;
    text-align: right !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  #add-ad-page .form-label.form-label-title {
    font-size: 16px !important;
    margin-bottom: 8px !important;
  }

  /* تحسين اللمس: مساحة داخلية للأزرار لا تقل عن 12px */
  button,
  .submit-btn,
  .auth-switch-btn,
  .btn,
  .nav-item,
  .ad-card,
  .condition-option {
    padding: 12px 16px !important;
    min-height: 44px;
    min-width: 44px;
  }
  .bottom-nav .nav-item {
    padding: 12px 16px !important;
    min-height: 48px;
  }

  /* شريط الأزرار السفلي (App-like): ثابت في الأسفل — التأكيد على العرض الكامل */
  .bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    flex-direction: row !important;
    justify-content: space-around !important;
    padding: 12px 0 !important;
    padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
    border-top: 1px solid rgba(0,0,0,0.08);
    z-index: 1000;
  }

  /* دعم الشاشات العالية (Retina): أوضح للأيقونات والخطوط */
  html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }
  .bottom-nav .nav-icon i,
  .nav-item .nav-icon i,
  .header i.fas,
  .header i.far {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  img,
  .ad-img img,
  .details-images-section img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* ================= شاشات الجوال الصغيرة (≤600px): صف كامل للحقول الطويلة + padding 6px + ellipsis ================= */
@media (max-width: 600px) {
  body {
    overflow-x: hidden !important;
  }
  #add-ad-page .add-ad-container {
    display: flex !important;
    flex-direction: column !important;
    width: 92% !important;
    max-width: 92vw !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 0 !important;
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }
  #add-ad-page .add-ad-card {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
  }
  #add-ad-page .add-ad-body {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 12px 0 !important;
    gap: 0 !important;
    box-sizing: border-box !important;
  }
  #add-ad-page .add-ad-body > .form-row,
  #add-ad-page .add-ad-body > .form-row-half {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 15px !important;
    padding: 0 !important;
    gap: 0 !important;
  }
  #add-ad-page .add-ad-body > .form-row:last-child,
  #add-ad-page .add-ad-body > .form-row-half:last-child {
    margin-bottom: 0 !important;
  }
  #add-ad-page .add-ad-body > .form-row > .form-group,
  #add-ad-page .add-ad-body > .form-row-half > .form-group,
  #add-ad-page .add-ad-body .form-group,
  #add-ad-page .form-row .form-group,
  #add-ad-page .form-row-half .form-group {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-bottom: 15px !important;
    padding: 0 !important;
    display: block !important;
    box-sizing: border-box !important;
  }
  #add-ad-page .add-ad-body > .form-row > .form-group:last-child,
  #add-ad-page .add-ad-body > .form-row-half > .form-group:last-child {
    margin-bottom: 15px !important;
  }
  /* السعر ورقم الجوال — أو حالة القطعة ورقم الجوال (قطع غيار): كل حقل في سطر كامل */
  #add-ad-page #add-ad-row-price-phone,
  body #add-ad-page #add-ad-row-price-phone,
  #add-ad-page #add-ad-parts-row-price,
  body #add-ad-page #add-ad-parts-row-price,
  #add-ad-page #add-ad-block-parts-row.add-ad-parts-row--with-phone,
  body #add-ad-page #add-ad-block-parts-row.add-ad-parts-row--with-phone {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 0 !important;
  }
  #add-ad-page #add-ad-row-price-phone .form-group,
  body #add-ad-page #add-ad-row-price-phone .form-group,
  #add-ad-page #add-ad-parts-row-price .form-group,
  body #add-ad-page #add-ad-parts-row-price .form-group,
  #add-ad-page #add-ad-block-parts-row.add-ad-parts-row--with-phone .form-group,
  body #add-ad-page #add-ad-block-parts-row.add-ad-parts-row--with-phone .form-group {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-bottom: 15px !important;
  }
  #add-ad-page #add-ad-row-price-phone .form-group:last-child,
  body #add-ad-page #add-ad-row-price-phone .form-group:last-child,
  #add-ad-page #add-ad-parts-row-price .form-group:last-child,
  body #add-ad-page #add-ad-parts-row-price .form-group:last-child,
  #add-ad-page #add-ad-block-parts-row.add-ad-parts-row--with-phone .form-group:last-child,
  body #add-ad-page #add-ad-block-parts-row.add-ad-parts-row--with-phone .form-group:last-child {
    margin-bottom: 0 !important;
  }
  #add-ad-page #add-ad-parts-price-spacer {
    display: none !important;
  }

  /* الحقول الطويلة (الشركة المصنعة، حالة الاستمارة، حالة الفحص) — صف كامل 100% لكل حقل */
  #add-ad-page .form-row:has(#ad-manufacturer),
  #add-ad-page .form-row:has(#ad-registration-status),
  #add-ad-page .form-row:has(#ad-inspection-status) {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  #add-ad-page .form-group:has(#ad-manufacturer),
  #add-ad-page .form-group:has(#ad-registration-status),
  #add-ad-page .form-group:has(#ad-inspection-status) {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  #add-ad-page #ad-manufacturer,
  #add-ad-page #ad-registration-status,
  #add-ad-page #ad-inspection-status {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  #add-ad-page .add-ad-body > .form-row.form-row-full,
  #add-ad-page .add-ad-body > .form-row.form-row-title-desc,
  #add-ad-page .add-ad-body > .form-row:has(.form-group-full) {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  /* padding 6px (و 15px لجهة النص) — ظهور أكبر قدر من النص + محاذاة يمين */
  #add-ad-page .add-ad-body .form-input:not(.phone-unified__input):not(.price-unified__input),
  #add-ad-page .add-ad-body input.form-input:not(.phone-unified__input):not(.price-unified__input),
  #add-ad-page .add-ad-body select.form-input,
  #add-ad-page .add-ad-body textarea.form-input,
  #add-ad-page .add-ad-body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(.phone-unified__input):not(.price-unified__input) {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding: 6px !important;
    padding-left: 6px !important;
    padding-right: 15px !important;
    padding-inline-start: 32px !important;
    padding-inline-end: 15px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    text-align: right !important;
  }
  #add-ad-page .add-ad-body textarea.form-input {
    white-space: pre-wrap !important;
    overflow: auto !important;
    text-overflow: clip !important;
    padding: 6px !important;
  }
  #add-ad-page .add-ad-body select.form-input,
  #add-ad-page .add-ad-body select {
    padding-inline-start: 32px !important;
    padding-inline-end: 15px !important;
  }
  #add-ad-page #ad-condition,
  #add-ad-page #ad-manufacturer,
  #add-ad-page #ad-registration-status,
  #add-ad-page #ad-inspection-status {
    padding: 6px !important;
    padding-inline-start: 32px !important;
    padding-inline-end: 15px !important;
  }
  /* محاذاة النصوص من اليمين + مسافة داخلية بسيطة */
  #add-ad-page .add-ad-body input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  #add-ad-page .add-ad-body select,
  #add-ad-page .add-ad-body textarea.form-input {
    text-align: right !important;
    padding-inline-end: 15px !important;
  }
  /* حقل السعر والجوال (≤600px): السعر عمود مثل الجوال — حقل ثم شريط «على السوم» */
  #add-ad-page .price-group {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  #add-ad-page .price-unified {
    display: -webkit-box !important;
    display: flex !important;
    flex-direction: column !important;
    -webkit-box-orient: vertical !important;
    -webkit-flex-wrap: nowrap !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    -webkit-box-align: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  #add-ad-page .phone-unified {
    display: -webkit-box !important;
    display: flex !important;
    flex-direction: column !important;
    -webkit-box-orient: vertical !important;
    -webkit-flex-wrap: nowrap !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    -webkit-box-align: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  #add-ad-page .price-unified__input {
    -webkit-box-flex: 0 !important;
    -webkit-flex: 0 0 auto !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 44px !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
  }
  #add-ad-page .phone-unified__input {
    -webkit-box-flex: 0 !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
    padding: 10px 12px !important;
    padding-inline-start: 12px !important;
    padding-inline-end: 15px !important;
  }
  #add-ad-page .price-unified__som {
    -webkit-box-flex: 0 !important;
    -webkit-flex: 0 0 auto !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-right: none !important;
    border-inline-end: none !important;
    border-inline-start: none !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    font-size: 0.76rem !important;
    padding: 10px 12px !important;
    gap: 8px !important;
    -webkit-box-pack: start !important;
    -webkit-justify-content: flex-start !important;
    justify-content: flex-start !important;
  }
  /* ≤600px: تطابق شريط السعر سيارة / قطع غيار */
  #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified,
  body #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified,
  #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified,
  body #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
  }
  #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified__input,
  body #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified__input,
  #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified__input,
  body #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified__input {
    min-height: 44px !important;
    font-size: 16px !important;
  }
  #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified__som,
  body #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified__som,
  #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified__som,
  body #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified__som {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 10px 12px !important;
    font-size: 0.76rem !important;
  }
  #add-ad-page .phone-group {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  #add-ad-page .phone-unified__show.toggle-switch {
    -webkit-box-flex: 0 !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    -webkit-box-orient: horizontal !important;
    -webkit-flex-direction: row !important;
    flex-direction: row !important;
    border-right: none !important;
    border-inline-end: none !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    -webkit-box-pack: start !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    padding: 10px 12px !important;
    gap: 6px !important;
    overflow: visible !important;
  }
  #add-ad-page .phone-unified__show .toggle-label {
    font-size: 0.75rem !important;
    white-space: normal !important;
    text-align: right !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  #add-ad-page .phone-unified__show .toggle-label--ad-show-phone::after,
  #add-ad-page .add-ad-body .phone-unified__show .toggle-label--ad-show-phone::after {
    font-size: 0.75rem !important;
  }
  #add-ad-page #ad-km {
    width: 100% !important;
    max-width: 100% !important;
  }
  /* نوع السيارة وحالة السيارة — سطر كامل لكل واحد */
  #add-ad-page #add-ad-row-brand-model > .form-group,
  #add-ad-page #add-ad-row-condition-km > .form-group {
    width: 100% !important;
    max-width: 100% !important;
  }
  /* المسافات: 15px بين كل سطر وسطر */
  #add-ad-page .add-ad-body > .form-row,
  #add-ad-page .add-ad-body > .form-row-half {
    margin-bottom: 15px !important;
  }
  #add-ad-page .add-ad-body > .form-row > .form-group,
  #add-ad-page .add-ad-body > .form-row-half > .form-group {
    margin-bottom: 15px !important;
  }
  #add-ad-page .add-ad-body > .form-row > .form-group:last-child,
  #add-ad-page .add-ad-body > .form-row-half > .form-group:last-child {
    margin-bottom: 15px !important;
  }
  #add-ad-page .form-input.textarea,
  #add-ad-page #ad-description {
    padding: 12px !important;
    min-height: 150px !important;
    font-size: 16px !important;
    text-align: right !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  /* زر إضافة الإعلان: عرض الشاشة كامل + مسافة كافية فوقه */
  #add-ad-page .add-ad-body > .submit-btn {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 16px !important;
    min-height: 52px !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    background: linear-gradient(135deg, var(--success), #27ae60) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 10px !important;
    margin-top: 28px !important;
    box-shadow: 0 4px 14px rgba(39, 174, 96, 0.35) !important;
  }
  #add-ad-page .form-label,
  #add-ad-page .form-label.form-label-title {
    display: block !important;
    width: 100% !important;
    margin-bottom: 6px !important;
  }
}

/* ================= الجوال الضيق (≤480px، only screen): عرض 92vw/92% — لا يؤثر على سطح المكتب ================= */
@media only screen and (max-width: 480px) {
  html {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
  }
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    background-color: #ffffff !important;
    padding-inline: 0 !important;
    /* يعوض إلغاء padding من استعلامات أوسع: مساحة فوق الشريط السفلي الثابت */
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .page,
  .page.active {
    margin: 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  /* الحاوية الرئيسية للمحتوى: بدون min-width كبير، عرض 92% من الشاشة وتوسيط */
  .content-area,
  body .content-area {
    display: block !important;
    margin: 0 auto !important;
    padding: 0 !important;
    width: 92% !important;
    max-width: 92vw !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  #add-ad-page.active,
  body #add-ad-page.active {
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
  }
  #add-ad-page .add-ad-container {
    width: 92% !important;
    max-width: 92vw !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 0 !important;
    padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important;
    box-sizing: border-box !important;
  }
  #add-ad-page .add-ad-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }
  body #add-ad-page .add-ad-body,
  #add-ad-page .add-ad-body {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 10px 0 !important;
    box-sizing: border-box !important;
  }
  #add-ad-page .phone-unified {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-inline: 0 !important;
    box-sizing: border-box !important;
  }
  /* نفس تخطيط السعر عمودياً (حقل + «على السوم») على الشاشات الضيقة */
  #add-ad-page .price-unified,
  #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified,
  body #add-ad-page #add-ad-row-price-phone #add-ad-price-form-group .price-unified,
  #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified,
  body #add-ad-page #add-ad-parts-row-price #add-ad-price-form-group .price-unified {
    display: flex !important;
    flex-direction: column !important;
    -webkit-box-orient: vertical !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin-inline: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  #add-ad-page .price-unified__input,
  #add-ad-page .phone-unified__input {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }
  /* صفحات content-area: 92% من الشاشة وتوسيط (بدون صف إضافة الإعلان — عمودها من .add-ad-container) */
  .content-area input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
  .content-area select,
  .content-area textarea,
  .content-area .form-input {
    width: 92% !important;
    max-width: 92vw !important;
    min-width: 0 !important;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
  }
  /* إضافة إعلان: الحقول بعرض عمود البطاقة (100% داخل الحاوية 92%) */
  #add-ad-page input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
  #add-ad-page select,
  #add-ad-page textarea,
  #add-ad-page .form-input:not(.price-unified__input):not(.phone-unified__input) {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  #add-ad-page .upload-area,
  #add-ad-page .upload-area-video {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }
  #add-ad-page .add-ad-body > .submit-btn {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }
}

/* ================= وضع الليل / النهار ================= */
.theme-toggle-btn {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  left: calc(8px + env(safe-area-inset-left));
  z-index: 1200;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border, #ddd);
  background: #ffffff;
  color: #067D79;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle-btn i {
  font-size: 15px;
  line-height: 1;
}
.header,
.details-header {
  padding-left: 54px !important;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --light: #10181a;
  --dark: #e8f2f1;
  --gray: #a9bdbb;
  --light-gray: #243436;
  --surface: #172224;
  --surface-card: #1d2c2f;
  --border: #314448;
  --shadow: rgba(0, 0, 0, 0.45);
  --brand-title: #7ADED9;
  --secondary: #0c1416;
}
html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] .page {
  background-color: #10181a !important;
  color: #e8f2f1;
}
html[data-theme="dark"] .theme-toggle-btn {
  background: #1d2c2f;
  color: #f6e27a;
  border-color: #314448;
}
html[data-theme="dark"] .header,
html[data-theme="dark"] .details-header,
html[data-theme="dark"] .filters,
html[data-theme="dark"] #filters-panel,
html[data-theme="dark"] .ad-card,
html[data-theme="dark"] .details-card,
html[data-theme="dark"] .add-ad-card,
html[data-theme="dark"] #add-ad-page .add-ad-card,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .bottom-nav,
html[data-theme="dark"] .spec-item,
html[data-theme="dark"] .comments-section,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .commission-modal,
html[data-theme="dark"] .report-modal,
html[data-theme="dark"] .compare-modal {
  background-color: #172224 !important;
  color: #e8f2f1;
  border-color: #314448 !important;
}
html[data-theme="dark"] .filter-btn {
  background: #243436 !important;
  color: #e8f2f1 !important;
  border-color: #314448 !important;
}
html[data-theme="dark"] .filter-btn.active {
  background: var(--primary) !important;
  color: #042826 !important;
  border-color: var(--primary) !important;
}
html[data-theme="dark"] .ad-title,
html[data-theme="dark"] .ad-meta span,
html[data-theme="dark"] .ad-views,
html[data-theme="dark"] .ad-date,
html[data-theme="dark"] .details-main-title,
html[data-theme="dark"] .spec-value,
html[data-theme="dark"] .spec-label,
html[data-theme="dark"] .seller-name,
html[data-theme="dark"] .form-label,
html[data-theme="dark"] .mc-label,
html[data-theme="dark"] .nav-item,
html[data-theme="dark"] .details-location-text,
html[data-theme="dark"] .details-time-text,
html[data-theme="dark"] .details-description {
  color: #e8f2f1;
}
html[data-theme="dark"] .ad-meta {
  border-bottom-color: rgba(232, 242, 241, 0.15);
}
html[data-theme="dark"] .nav-item.active {
  color: var(--primary-light);
}
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .form-input {
  background-color: #10181a !important;
  color: #e8f2f1 !important;
  border-color: #314448 !important;
}
html[data-theme="dark"] ::placeholder {
  color: #8aa3a1;
}
html[data-theme="dark"] .site-footer {
  background: #0c1416 !important;
  color: #d5e4e2;
}
html[data-theme="dark"] .site-brand,
html[data-theme="dark"] .header h1.site-brand {
  color: #7ADED9 !important;
}
html[data-theme="dark"] .search-container,
html[data-theme="dark"] .search-input,
html[data-theme="dark"] .ads-container,
html[data-theme="dark"] .search-wrap {
  background-color: #172224 !important;
  color: #e8f2f1;
}
@media (max-width: 768px) {
  html[data-theme="dark"],
  html[data-theme="dark"] body,
  html[data-theme="dark"] .page,
  html[data-theme="dark"] .page.active,
  html[data-theme="dark"] #home-page,
  html[data-theme="dark"] #home-page.active,
  html[data-theme="dark"] #favorites-page,
  html[data-theme="dark"] #account-page,
  html[data-theme="dark"] #add-ad-page,
  html[data-theme="dark"] #details-page,
  html[data-theme="dark"] #auth-page,
  html[data-theme="dark"] .ads-container,
  html[data-theme="dark"] .filters,
  html[data-theme="dark"] .header,
  html[data-theme="dark"] .details-header {
    background: #10181a !important;
    background-color: #10181a !important;
  }
  html[data-theme="dark"] .header,
  html[data-theme="dark"] .details-header,
  html[data-theme="dark"] .filters,
  html[data-theme="dark"] .ad-card,
  html[data-theme="dark"] .search-container,
  html[data-theme="dark"] #add-ad-page .add-ad-card,
  html[data-theme="dark"] .details-card {
    background: #172224 !important;
    background-color: #172224 !important;
  }
  html[data-theme="dark"] .search-input {
    background: transparent !important;
    background-color: transparent !important;
    color: #e8f2f1 !important;
  }
}

/* ثبات تباين النصوص في الوضع الليلي: لا يتبدل اللون مع التمرير أو اللمس على iOS وAndroid */
html[data-theme="dark"] {
  -webkit-tap-highlight-color: transparent;
}
html[data-theme="dark"] .nav-item,
html[data-theme="dark"] .nav-item:hover,
html[data-theme="dark"] .nav-item:active,
html[data-theme="dark"] .nav-item:focus,
html[data-theme="dark"] .nav-text,
html[data-theme="dark"] .bottom-nav .nav-item:nth-child(5) .nav-text,
html[data-theme="dark"] .bottom-nav .nav-item:nth-child(5) .nav-text:hover,
html[data-theme="dark"] .bottom-nav .nav-item:nth-child(5):hover .nav-text,
html[data-theme="dark"] .bottom-nav .nav-item:nth-child(5):active .nav-text {
  color: #e8f2f1 !important;
}
html[data-theme="dark"] .nav-item.active,
html[data-theme="dark"] .nav-item.active:hover,
html[data-theme="dark"] .nav-item.active:active,
html[data-theme="dark"] .nav-item.active .nav-text,
html[data-theme="dark"] .nav-item.active:hover .nav-text,
html[data-theme="dark"] .nav-item.active:active .nav-text {
  color: #7ADED9 !important;
}
html[data-theme="dark"] #add-ad-page,
html[data-theme="dark"] #add-ad-page .form-label.form-label-title,
html[data-theme="dark"] #add-ad-page .toggle-label,
html[data-theme="dark"] #add-ad-page .upload-area p,
html[data-theme="dark"] #add-ad-page .checkbox-label,
html[data-theme="dark"] #add-ad-page #ad-submit-note,
html[data-theme="dark"] #add-ad-page .add-ad-tab,
html[data-theme="dark"] #add-ad-page .add-ad-tab:hover,
html[data-theme="dark"] #add-ad-page .add-ad-tab:active,
html[data-theme="dark"] #add-ad-page .add-ad-tab:focus,
html[data-theme="dark"] #add-ad-page .phone-unified__show .toggle-label--ad-show-phone::after,
html[data-theme="dark"] #add-ad-page .add-ad-body .phone-unified__show .toggle-label--ad-show-phone::after {
  color: #e8f2f1 !important;
}
html[data-theme="dark"] #add-ad-page .add-ad-tab:not(.add-ad-tab--active),
html[data-theme="dark"] #add-ad-page .add-ad-tab:not(.add-ad-tab--active):hover,
html[data-theme="dark"] #add-ad-page .add-ad-tab:not(.add-ad-tab--active):active,
html[data-theme="dark"] #add-ad-page .add-ad-tab:not(.add-ad-tab--active):focus {
  background: #243436 !important;
  color: #e8f2f1 !important;
  -webkit-text-fill-color: #e8f2f1 !important;
  border-color: #314448 !important;
}
html[data-theme="dark"] #add-ad-page .add-ad-tab.add-ad-tab--active,
html[data-theme="dark"] #add-ad-page .add-ad-tab.add-ad-tab--active:hover,
html[data-theme="dark"] #add-ad-page .add-ad-tab.add-ad-tab--active:active,
html[data-theme="dark"] #add-ad-page .add-ad-tab.add-ad-tab--active:focus {
  background: var(--primary) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28) !important;
}
html[data-theme="dark"] #add-ad-page .submit-btn,
html[data-theme="dark"] #add-ad-page .submit-btn:hover,
html[data-theme="dark"] #add-ad-page .submit-btn:active,
html[data-theme="dark"] #add-ad-page .add-ad-header h3 {
  color: #ffffff !important;
}
html[data-theme="dark"] #add-ad-page .form-input,
html[data-theme="dark"] #add-ad-page select.form-input,
html[data-theme="dark"] #add-ad-page .form-input.textarea,
html[data-theme="dark"] #add-ad-page .form-input:hover,
html[data-theme="dark"] #add-ad-page .form-input:focus,
html[data-theme="dark"] #add-ad-page .form-input:active,
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):hover,
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
html[data-theme="dark"] textarea:hover,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:hover,
html[data-theme="dark"] select:focus {
  color: #e8f2f1 !important;
  -webkit-text-fill-color: #e8f2f1 !important;
  caret-color: #e8f2f1;
  background: #10181a !important;
  background-color: #10181a !important;
  border-color: #314448 !important;
}
html[data-theme="dark"] #add-ad-page .form-input::placeholder,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #8aa3a1 !important;
  -webkit-text-fill-color: #8aa3a1 !important;
}
html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] textarea:-webkit-autofill,
html[data-theme="dark"] select:-webkit-autofill,
html[data-theme="dark"] #add-ad-page .form-input:-webkit-autofill {
  -webkit-text-fill-color: #e8f2f1 !important;
  caret-color: #e8f2f1;
  box-shadow: 0 0 0 1000px #10181a inset !important;
}
html[data-theme="dark"] #add-ad-page select.form-input option,
html[data-theme="dark"] select option {
  background: #172224 !important;
  color: #e8f2f1 !important;
}
html[data-theme="dark"] .forgot-password-link,
html[data-theme="dark"] .forgot-password-link:hover,
html[data-theme="dark"] .forgot-password-link:active,
html[data-theme="dark"] .forgot-password-link:focus {
  color: #7ADED9 !important;
}
html[data-theme="dark"] .sort-option-btn,
html[data-theme="dark"] .sort-option-btn:hover,
html[data-theme="dark"] .sort-option-btn:active,
html[data-theme="dark"] .sort-option-btn:focus,
html[data-theme="dark"] .contact-modal-row,
html[data-theme="dark"] .contact-modal-row:hover,
html[data-theme="dark"] .contact-modal-row:active,
html[data-theme="dark"] .commission-modal-text,
html[data-theme="dark"] .filter-btn,
html[data-theme="dark"] .filter-btn:hover,
html[data-theme="dark"] .filter-btn:active,
html[data-theme="dark"] .filter-btn:focus {
  color: #e8f2f1 !important;
  background: #243436 !important;
}
html[data-theme="dark"] .sort-option-btn.active,
html[data-theme="dark"] .sort-option-btn.active:hover,
html[data-theme="dark"] .sort-option-btn.active:active,
html[data-theme="dark"] .filter-btn.active,
html[data-theme="dark"] .filter-btn.active:hover,
html[data-theme="dark"] .filter-btn.active:active {
  background: var(--primary) !important;
  color: #042826 !important;
}
html[data-theme="dark"] #messages-section #chat-box .chat-bubble--other,
html[data-theme="dark"] #messages-section #chat-box .chat-bubble--other .chat-msg-text,
html[data-theme="dark"] #messages-section #chat-box .chat-msg-text,
html[data-theme="dark"] #messages-section #chat-box [class*="chat-msg-text"] {
  color: #e8f2f1 !important;
}
html[data-theme="dark"] #messages-section #chat-box .chat-bubble--other {
  background: #243436 !important;
  border-color: #314448 !important;
}
html[data-theme="dark"] #messages-section #chat-box .chat-bubble--me .chat-msg-text,
html[data-theme="dark"] #messages-section #chat-box .chat-bubble--me:hover .chat-msg-text,
html[data-theme="dark"] #messages-section #chat-box .chat-bubble--me:active .chat-msg-text {
  color: #ffffff !important;
}
html[data-theme="dark"] #messages-section .chat-block-btn {
  background: #1d2c2f;
  border-color: rgba(231, 76, 60, 0.45);
  color: #f5a9a0;
}
html[data-theme="dark"] #messages-section .chat-block-btn.is-blocked {
  border-color: rgba(122, 222, 217, 0.45);
  color: #7ADED9;
}
html[data-theme="dark"] #messages-section .chat-block-banner {
  background: #2a2418;
  color: #f0d9a8;
  border-bottom-color: rgba(230, 162, 60, 0.35);
}

/* حسابي والتعليقات: بطاقات داكنة ونص فاتح ثابت مع اللمس */
html[data-theme="dark"] .account-menu,
html[data-theme="dark"] .account-section,
html[data-theme="dark"] .menu-item,
html[data-theme="dark"] .menu-item:hover,
html[data-theme="dark"] .menu-item:active,
html[data-theme="dark"] .menu-item:focus,
html[data-theme="dark"] .comment-item,
html[data-theme="dark"] .comment-item:hover,
html[data-theme="dark"] .comment-item:active,
html[data-theme="dark"] .reply-item,
html[data-theme="dark"] .reply-item:hover,
html[data-theme="dark"] .add-comment-form,
html[data-theme="dark"] .reply-form-container {
  background: #172224 !important;
  color: #e8f2f1 !important;
}
html[data-theme="dark"] .menu-item.danger:hover,
html[data-theme="dark"] .menu-item.danger:active {
  background: #3a2428 !important;
}
html[data-theme="dark"] .menu-text,
html[data-theme="dark"] .menu-item:hover .menu-text,
html[data-theme="dark"] .menu-item:active .menu-text,
html[data-theme="dark"] .menu-arrow,
html[data-theme="dark"] .account-info h2,
html[data-theme="dark"] .account-info p,
html[data-theme="dark"] .comments-title,
html[data-theme="dark"] .comment-content,
html[data-theme="dark"] .comment-author-name,
html[data-theme="dark"] .comment-time,
html[data-theme="dark"] .reply-btn,
html[data-theme="dark"] .reply-btn:hover,
html[data-theme="dark"] .reply-btn:active,
html[data-theme="dark"] .comment-item:hover .comment-content,
html[data-theme="dark"] .comment-item:active .comment-content {
  color: #e8f2f1 !important;
}
html[data-theme="dark"] .menu-item i,
html[data-theme="dark"] .menu-item:hover i,
html[data-theme="dark"] .menu-item:active i,
html[data-theme="dark"] .menu-item:focus i {
  color: #7ADED9 !important;
}
html[data-theme="dark"] .menu-item.danger i,
html[data-theme="dark"] .menu-item.danger .menu-text,
html[data-theme="dark"] .menu-item.danger .menu-arrow,
html[data-theme="dark"] .menu-item.danger:hover i,
html[data-theme="dark"] .menu-item.danger:hover .menu-text,
html[data-theme="dark"] .menu-item.danger:active i,
html[data-theme="dark"] .menu-item.danger:active .menu-text,
html[data-theme="dark"] .delete-comment-btn,
html[data-theme="dark"] .delete-comment-btn:hover,
html[data-theme="dark"] .delete-comment-btn:active {
  color: #ff8b80 !important;
}

/* شريط بيانات الحساب: الاسم والجوال والبريد */
html[data-theme="dark"] .account-header,
html[data-theme="dark"] #account-page .account-header,
html[data-theme="dark"] .account-info,
html[data-theme="dark"] .account-info h2,
html[data-theme="dark"] .account-info p,
html[data-theme="dark"] .account-info p:hover,
html[data-theme="dark"] .account-info a,
html[data-theme="dark"] .account-info a:hover,
html[data-theme="dark"] .account-info a:active {
  background: #172224 !important;
  color: #e8f2f1 !important;
  -webkit-text-fill-color: #e8f2f1 !important;
}

/* زر على السوم وحقل الوصف في إضافة الإعلان */
html[data-theme="dark"] #add-ad-page .price-unified,
html[data-theme="dark"] #add-ad-page .price-unified--som-active,
html[data-theme="dark"] #add-ad-page .price-unified__som,
html[data-theme="dark"] #add-ad-page .price-unified__som:hover,
html[data-theme="dark"] #add-ad-page .price-unified__som:active,
html[data-theme="dark"] #add-ad-page .price-unified__som:focus,
html[data-theme="dark"] #add-ad-page .price-unified--som-active .price-unified__som {
  background: #243436 !important;
  color: #e8f2f1 !important;
  -webkit-text-fill-color: #e8f2f1 !important;
  border-color: #314448 !important;
}
html[data-theme="dark"] #add-ad-page .price-unified__som-text,
html[data-theme="dark"] #add-ad-page .price-unified__som:hover .price-unified__som-text,
html[data-theme="dark"] #add-ad-page .price-unified__som:active .price-unified__som-text {
  color: #e8f2f1 !important;
  -webkit-text-fill-color: #e8f2f1 !important;
}
html[data-theme="dark"] #add-ad-page .price-unified__input,
html[data-theme="dark"] #add-ad-page .price-unified__input:hover,
html[data-theme="dark"] #add-ad-page .price-unified__input:focus,
html[data-theme="dark"] #add-ad-page .price-unified__input:disabled,
html[data-theme="dark"] #add-ad-page .price-unified--som-active .price-unified__input {
  background: #10181a !important;
  color: #e8f2f1 !important;
  -webkit-text-fill-color: #e8f2f1 !important;
}
html[data-theme="dark"] #add-ad-page #ad-description,
html[data-theme="dark"] #add-ad-page .form-input.textarea,
html[data-theme="dark"] #add-ad-page #ad-description:hover,
html[data-theme="dark"] #add-ad-page #ad-description:focus,
html[data-theme="dark"] #add-ad-page #ad-description:active,
html[data-theme="dark"] #add-ad-page .form-input.textarea:hover,
html[data-theme="dark"] #add-ad-page .form-input.textarea:focus {
  background: #10181a !important;
  background-color: #10181a !important;
  color: #e8f2f1 !important;
  -webkit-text-fill-color: #e8f2f1 !important;
  caret-color: #e8f2f1;
  border-color: #314448 !important;
}
html[data-theme="dark"] #add-ad-page #ad-description::placeholder,
html[data-theme="dark"] #add-ad-page .form-input.textarea::placeholder {
  color: #8aa3a1 !important;
  -webkit-text-fill-color: #8aa3a1 !important;
}

/* زر إظهار رقم الجوال */
html[data-theme="dark"] #add-ad-page .phone-unified,
html[data-theme="dark"] #add-ad-page .phone-unified--show-off,
html[data-theme="dark"] #add-ad-page .phone-unified__show,
html[data-theme="dark"] #add-ad-page .phone-unified__show.toggle-switch,
html[data-theme="dark"] #add-ad-page .phone-unified__show:hover,
html[data-theme="dark"] #add-ad-page .phone-unified__show:active,
html[data-theme="dark"] #add-ad-page .phone-unified--show-off .phone-unified__show.toggle-switch {
  background: #243436 !important;
  color: #e8f2f1 !important;
  border-color: #314448 !important;
}
html[data-theme="dark"] #add-ad-page .phone-unified__show .toggle-label,
html[data-theme="dark"] #add-ad-page .phone-unified__show:hover .toggle-label,
html[data-theme="dark"] #add-ad-page .phone-unified__show:active .toggle-label,
html[data-theme="dark"] #add-ad-page .phone-unified--show-off .phone-unified__show .toggle-label,
html[data-theme="dark"] #add-ad-page .phone-unified__show .toggle-label--ad-show-phone::after,
html[data-theme="dark"] #add-ad-page .add-ad-body .phone-unified__show .toggle-label--ad-show-phone::after,
html[data-theme="dark"] #add-ad-page .phone-unified--show-off .phone-unified__show .toggle-label--ad-show-phone::after {
  color: #e8f2f1 !important;
  -webkit-text-fill-color: #e8f2f1 !important;
}
html[data-theme="dark"] #add-ad-page .phone-unified__input,
html[data-theme="dark"] #add-ad-page .phone-unified__input:hover,
html[data-theme="dark"] #add-ad-page .phone-unified__input:focus,
html[data-theme="dark"] #add-ad-page .phone-unified__input:disabled,
html[data-theme="dark"] #add-ad-page .phone-unified--show-off .phone-unified__input,
html[data-theme="dark"] #add-ad-page .phone-unified--show-off .phone-unified__input:disabled {
  background: #10181a !important;
  color: #e8f2f1 !important;
  -webkit-text-fill-color: #e8f2f1 !important;
}