/*
 * هون MOTORX - Global CSS (Reset + Base + Utilities)
 * global.css - الـ CSS الاساسي اللي شغال على كل الـ pages
 */

/* FONTS (الخطوط مرفوعة عنا بـ /fonts/) */

/* هون cairo-300 - arabic_latin */
@font-face {
  font-display: swap;
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 300;
  src: url('../fonts/cairo-v31-arabic_latin-300.woff2') format('woff2');
}
/* هون cairo-regular - arabic_latin */
@font-face {
  font-display: swap;
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/cairo-v31-arabic_latin-regular.woff2') format('woff2');
}
/* هون cairo-500 - arabic_latin */
@font-face {
  font-display: swap;
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 500;
  src: url('../fonts/cairo-v31-arabic_latin-500.woff2') format('woff2');
}
/* هون cairo-600 - arabic_latin */
@font-face {
  font-display: swap;
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 600;
  src: url('../fonts/cairo-v31-arabic_latin-600.woff2') format('woff2');
}
/* هون cairo-700 - arabic_latin */
@font-face {
  font-display: swap;
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/cairo-v31-arabic_latin-700.woff2') format('woff2');
}
/* هون cairo-800 - arabic_latin */
@font-face {
  font-display: swap;
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 800;
  src: url('../fonts/cairo-v31-arabic_latin-800.woff2') format('woff2');
}

/* هون inter-300 - latin */
@font-face {
  font-display: swap;
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  src: url('../fonts/inter-v20-latin-300.woff2') format('woff2');
}
/* هون inter-regular - latin */
@font-face {
  font-display: swap;
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/inter-v20-latin-regular.woff2') format('woff2');
}
/* هون inter-500 - latin */
@font-face {
  font-display: swap;
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  src: url('../fonts/inter-v20-latin-500.woff2') format('woff2');
}
/* هون inter-600 - latin */
@font-face {
  font-display: swap;
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  src: url('../fonts/inter-v20-latin-600.woff2') format('woff2');
}
/* هون inter-700 - latin */
@font-face {
  font-display: swap;
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/inter-v20-latin-700.woff2') format('woff2');
}
/* هون inter-800 - latin */
@font-face {
  font-display: swap;
  font-family: 'Inter';
  font-style: normal;
  font-weight: 800;
  src: url('../fonts/inter-v20-latin-800.woff2') format('woff2');
}

/* RESET - بنصفر كل اشي */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  /* هون Prevent horizontal overflow from triggering browser zoom-out */
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--clr-text-primary);
  background-color: var(--clr-bg-base);
  transition: background-color var(--transition-slow),
              color var(--transition-slow);
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100%;
  min-width: 0;
}

/* Every direct child of body must be constrained */
body > * {
  max-width: 100%;
  min-width: 0;
  /* box-sizing already covered by the universal * reset */
}

/* RTL - Arabic: بنغير الخط لما الاتجاه يصير عربي */
[dir="rtl"] body {
  font-family: var(--font-arabic);
}

/* SCROLLBAR الـ سكرول */
@media (hover: hover) and (pointer: fine) {
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: var(--scrollbar-track); }
  ::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-full);
    /* transition not supported on webkit scrollbar pseudo-elements */
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }
}

@media (max-width: 1024px) {
  *::-webkit-scrollbar,
  ::-webkit-scrollbar,
  .dash-main::-webkit-scrollbar,
  .dash-sidebar::-webkit-scrollbar,
  .admin-main::-webkit-scrollbar,
  .admin-sidebar::-webkit-scrollbar {
    display: none !important; /* width/height/background are dead when display:none */
  }
  * {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
}

/* TYPOGRAPHY الخطوط والعناوين */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--clr-text-primary);
}
h1 { font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl)); }
h2 { font-size: clamp(var(--text-2xl), 3vw, var(--text-4xl)); }
h3 { font-size: clamp(var(--text-xl), 2.5vw, var(--text-3xl)); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p { color: var(--clr-text-secondary); line-height: var(--leading-relaxed); }

a {
  color: var(--clr-brand);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--clr-brand-light); }

img, video { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea {
  font-family: inherit;
  font-size: var(--text-base);
}
ul, ol { list-style: none; }

/* LAYOUT التخطيط */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
  box-sizing: border-box;
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--navbar-height);
}

@supports (min-height: 100svh) {
  .page-wrapper { min-height: 100svh; }
}

.page-content {
  flex: 1;
  padding: var(--space-8) 0;
}

/* SECTION HEADING عناوين الـ sections */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  gap: var(--space-4);
}

.section-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--clr-text-primary);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

.section-title::before {
  content: '';
  display: block;
  width: 4px;
  height: 1.2em;
  background: var(--clr-brand);
  border-radius: var(--radius-full);
  flex-shrink: 0;
  /* gap on .section-title already handles spacing — margin-inline-end removed */
}

.section-view-all {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--clr-brand);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  transition: gap var(--transition-fast);
}
.section-view-all:hover { gap: var(--space-2); }

/* BUTTONS الازرار */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1;
  border: 1.5px solid transparent;
  transition: all var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition-fast);
}
.btn:hover::after { background: rgba(255,255,255,0.06); }

.btn-primary {
  background: var(--clr-brand);
  color: var(--clr-text-on-brand);
  border-color: var(--clr-brand);
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover {
  background: var(--clr-brand-light);
  border-color: var(--clr-brand-light);
  box-shadow: var(--shadow-brand-strong);
  transform: translateY(-1px);
  color: var(--clr-text-on-brand);
}

.btn-outline {
  background: transparent;
  color: var(--clr-brand);
  border-color: var(--clr-brand);
}
.btn-outline:hover {
  background: var(--clr-brand-glow);
  transform: translateY(-1px);
  color: var(--clr-brand-light);
}

.btn-ghost {
  background: transparent;
  color: var(--clr-text-secondary);
  border-color: var(--clr-border);
}
.btn-ghost:hover {
  background: var(--clr-bg-card-hover);
  color: var(--clr-text-primary);
  border-color: var(--clr-border-strong);
}

.btn-danger {
  background: var(--clr-danger);
  color: #fff;
  border-color: var(--clr-danger);
}
.btn-danger:hover {
  background: #c0392b;
  transform: translateY(-1px);
  color: #fff;
}

.btn-success {
  background: var(--clr-success);
  color: #fff;
  border-color: var(--clr-success);
}
.btn-success:hover {
  background: #059669;
  transform: translateY(-1px);
  color: #fff;
}

.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); }
.btn-block { width: 100%; }
.btn-icon { padding: var(--space-2); width: 36px; height: 36px; border-radius: var(--radius-md); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* FORM ELEMENTS inputs وشلتهم */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--clr-text-secondary);
  letter-spacing: 0.02em;
}

.form-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--clr-bg-input);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  color: var(--clr-text-primary);
  font-size: var(--text-sm);
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              background var(--transition-fast);
  outline: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--clr-brand);
  box-shadow: none;
}

.form-control::placeholder { color: var(--clr-text-muted); }

.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238B9CC8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

[dir="rtl"] select.form-control {
  background-position: left 12px center;
  padding-right: var(--space-4);
  padding-left: 36px;
}

/* هون Custom Select Dropdown UI */
.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238B9CC8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  user-select: none;
}

[dir="rtl"] .custom-select-trigger {
  background-position: left 12px center;
  padding-right: var(--space-4);
  padding-left: 36px;
}

.custom-select-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--clr-bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 250px;
  overflow-y: auto;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: all var(--transition-fast) ease;
  padding: 4px;
}

.custom-select-wrapper.open .custom-select-trigger {
  border-color: var(--clr-brand);
  box-shadow: none;
}

.custom-select-wrapper.open .custom-select-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.custom-select-option {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--clr-text-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.custom-select-option:hover {
  background: var(--clr-bg-card-hover);
}

.custom-select-option.selected {
  background: var(--clr-brand-glow);
  color: var(--clr-brand-light);
  font-weight: 500;
}

.custom-select-option.disabled {
  color: var(--clr-text-muted);
  cursor: not-allowed;
  pointer-events: none;
}

/* هون Custom scrollbar لـ options */
.custom-select-options::-webkit-scrollbar {
  width: 6px;
}
.custom-select-options::-webkit-scrollbar-track {
  background: transparent;
}
.custom-select-options::-webkit-scrollbar-thumb {
  background: var(--clr-border);
  border-radius: 4px;
}
.custom-select-options::-webkit-scrollbar-thumb:hover {
  background: var(--clr-text-muted);
}

textarea.form-control { resize: vertical; min-height: 120px; max-height: 250px; }

.form-error {
  font-size: var(--text-xs);
  color: var(--clr-danger);
  display: none;
}
.form-error.visible { display: block; }

.form-hint {
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 768px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* CARDS الكروت */
.card {
  background: var(--clr-bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-base),
              box-shadow var(--transition-base),
              border-color var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--clr-border-strong);
}

.card-body { padding: var(--space-5); }
.card-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--clr-border-subtle);
}

.vehicle-card-badge {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 2;
  pointer-events: none;
}

.badge-ai {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* هون Light Mode Overrides لـ badges on images */
[data-theme="light"] .vehicle-card-badge .badge-ai {
  background-color: rgba(255, 255, 255, 0.85);
  color: #1a1a1a;
  border-color: rgba(0,0,0,0.12);
}

/* هون Dark Mode Overrides لـ badges on images */
[data-theme="dark"] .vehicle-card-badge .badge-ai,
:root .vehicle-card-badge .badge-ai {
  background-color: rgba(0, 0, 0, 0.75);
  color: #f0f0f0;
  border-color: rgba(255,255,255,0.15);
}

.badge-good-deal { color: #10B981; }
.badge-fair-price { color: #3B82F6; }
.badge-overpriced { color: #EF4444; }

/* STATUS BADGES شارات الـ status */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}
.badge-success { background: var(--clr-success-bg); color: var(--clr-success); }
.badge-warning { background: var(--clr-warning-bg); color: var(--clr-warning); }
.badge-danger  { background: var(--clr-danger-bg);  color: var(--clr-danger);  }
.badge-info    { background: var(--clr-info-bg);    color: var(--clr-info);    }

/* MODALS الـ popups */
.modal-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--clr-bg-overlay);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* هون Mobile bottom-sheet modal */
@media (max-width: 480px) {
  .modal-overlay {
    top: 0;
    padding-top: 0;
    align-items: flex-end;
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;
  }

  .modal-box {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: 90vh;           /* fallback */
    max-height: min(90vh, 90dvh);
    width: 100%;
    max-width: 100%;
    margin: 0;
    transform: translateY(20px);
  }

  .modal-overlay.active .modal-box {
    transform: translateY(0);
  }

  /* Critical: must keep flex chain intact on mobile so .modal-body can scroll.
     flex + min-height:0 allow the body to shrink below its content height. */
  .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .modal-footer {
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
  }
}

.modal-box {
  background: var(--clr-bg-card);
  border: 1px solid var(--clr-border-strong);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-spring);
}

.modal-overlay.active .modal-box {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--clr-border);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--clr-text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--clr-bg-input);
  border-radius: var(--radius-md);
  color: var(--clr-text-muted);
  font-size: var(--text-lg);
  transition: all var(--transition-fast);
  cursor: pointer;
}
.modal-close::before {
  content: '×';
  font-size: 1.4rem;
  line-height: 1;
}
.modal-close:hover {
  background: var(--clr-danger-bg);
  color: var(--clr-danger);
}

.modal-body { 
  padding: var(--space-6); 
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--clr-border);
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  flex-shrink: 0;
}

/* هون TOAST NOTIFICATIONS */
#toast-container {
  position: fixed;
  bottom: var(--space-6);
  inset-inline-end: var(--space-6);
  z-index: 99999 !important;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--clr-bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--clr-text-primary);
  min-width: 280px;
  max-width: 380px;
  pointer-events: auto;
  animation: toastIn 0.3s var(--transition-spring) forwards;
}

.toast.removing { animation: toastOut 0.25s ease forwards; }

.toast-success { border-left: 3px solid var(--clr-success); }
.toast-error   { border-left: 3px solid var(--clr-danger);  }
.toast-info    { border-left: 3px solid var(--clr-info);    }
.toast-warning { border-left: 3px solid var(--clr-warning); }

[dir="rtl"] .toast-success { border-left: none; border-right: 3px solid var(--clr-success); }
[dir="rtl"] .toast-error   { border-left: none; border-right: 3px solid var(--clr-danger);  }
[dir="rtl"] .toast-info    { border-left: none; border-right: 3px solid var(--clr-info);    }
[dir="rtl"] .toast-warning { border-left: none; border-right: 3px solid var(--clr-warning); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}
/* [dir="rtl"] & .toastIn removed — .toastIn is not an HTML class;
   animation applied directly on .toast via keyframe name */
@keyframes toastInRtl {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* هون PAGINATION */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-8);
}

.pagination-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--clr-border);
  background: var(--clr-bg-card);
  color: var(--clr-text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.pagination-btn:hover {
  border-color: var(--clr-brand);
  color: var(--clr-brand);
  background: var(--clr-brand-glow);
}

.pagination-btn.active {
  background: var(--clr-brand);
  border-color: var(--clr-brand);
  color: #fff;
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* هون SKELETON LOADER */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--clr-bg-card) 25%,
    var(--clr-bg-card-hover) 50%,
    var(--clr-bg-card) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@keyframes motorx-fade-in {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* هون UTILITIES */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  clip: rect(0,0,0,0);
  overflow: hidden;
}

.text-center  { text-align: center; }
.text-start   { text-align: start; }
.text-end     { text-align: end; }
.text-muted   { color: var(--clr-text-muted); }
.text-brand   { color: var(--clr-brand); }
.text-success { color: var(--clr-success); }
.text-danger  { color: var(--clr-danger); }
.text-warning { color: var(--clr-warning); }

.d-flex         { display: flex; }
.d-grid         { display: grid; }
.d-none         { display: none; }
.d-block        { display: block; }

.align-center   { align-items: center; }
.justify-center { justify-content: center; }
.justify-between{ justify-content: space-between; }
.gap-2          { gap: var(--space-2); }
.gap-3          { gap: var(--space-3); }
.gap-4          { gap: var(--space-4); }

.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.w-full    { width: 100%; }
.h-full    { height: 100%; }
.rounded   { border-radius: var(--radius-md); }
.rounded-lg{ border-radius: var(--radius-lg); }

.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* هون STARS RATING */
.stars {
  display: inline-flex;
  gap: 2px;
  color: var(--clr-warning);
  font-size: var(--text-sm);
}
.star-empty { color: var(--clr-text-muted); }

/* هون DIVIDER */
.divider {
  height: 1px;
  background: var(--clr-border);
  margin: var(--space-6) 0;
}
.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--clr-text-muted);
  font-size: var(--text-sm);
  margin: var(--space-6) 0;
}
.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--clr-border);
}

/* هون EMPTY STATE */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-16) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xl);
  font-size: 2rem;
  color: var(--clr-text-muted);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--clr-text-primary);
}

.empty-state p {
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  max-width: 320px;
}


.pre-footer {
  background-color: var(--clr-bg-base);
  padding: 80px 0;
  border-top: 1px solid var(--clr-border);
}

:root[data-theme="light"] .pre-footer {
  background-color: #F5F7FA;
}

.pre-footer-header {
  text-align: center;
  margin-bottom: 52px;
}

.pre-footer-heading {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0B1B3D;
  margin: 0;
  line-height: 1.3;
}

[data-theme="dark"] .pre-footer-heading {
  color: var(--clr-text-primary);
}

.pre-footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.pre-footer-col {
  background-color: var(--clr-bg-surface);
  padding: 40px 24px;
  border-radius: 16px;
  text-align: center;
  border: 1px solid var(--clr-border-subtle);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

:root[data-theme="light"] .pre-footer-col {
  background-color: #FFFFFF;
  border-color: rgba(11, 27, 61, 0.05); /* Light blue border */
  box-shadow: 0 10px 30px rgba(11, 27, 61, 0.05);
}

.pre-footer-col:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
  border-color: var(--clr-border-strong);
}

:root[data-theme="light"] .pre-footer-col:hover {
  box-shadow: 0 15px 40px rgba(11, 27, 61, 0.1);
  border-color: rgba(6, 182, 212, 0.3); /* Cyan hover border */
}

.pre-footer-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(11, 27, 61, 0.08);
  color: #0B1B3D;
  border-radius: 50%;
  font-size: 28px;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

/* في dark mode بنخلي الأيقونة تظهر باللون الفاتح عشان تبان على الخلفية الداكنة */
[data-theme="dark"] .pre-footer-icon,
:root .pre-footer-icon {
  background-color: rgba(33, 150, 243, 0.1);
  color: #90CAF9; /* Soft Sapphire Blue for dark bg */
}

:root[data-theme="light"] .pre-footer-icon {
  background-color: rgba(11, 27, 61, 0.07);
  color: #0B1B3D; /* Deep Sapphire Blue */
}

.pre-footer-col:hover .pre-footer-icon {
  transform: scale(1.1);
  background-color: rgba(11, 27, 61, 0.12);
}

:root[data-theme="light"] .pre-footer-col:hover .pre-footer-icon {
  background-color: rgba(11, 27, 61, 0.12);
}

.pre-footer-title {
  color: var(--clr-text-primary);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.4;
}

:root[data-theme="light"] .pre-footer-title {
  color: #0B1B3D; /* Deep Sapphire Blue */
}

.pre-footer-body {
  color: var(--clr-text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 0;
  opacity: 0.8;
}

:root[data-theme="light"] .pre-footer-body {
  color: #475569; /* Slate for readability */
  opacity: 0.85;
}

/* Responsive Grid */
@media (max-width: 1200px) {
  .pre-footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .pre-footer {
    padding: 60px 0;
  }
  .pre-footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* هون FOOTER - the footer always has a dark background (--clr-bg-sidebar)
   even in light mode, so we scope dedicated color tokens هون
   عشان الـ text يبان clearly regardless of the theme */
.footer {
  background: var(--clr-bg-sidebar);
  border-top: 1px solid var(--clr-border);
  padding: var(--space-10) 0 var(--space-6);
  margin-top: auto;
  position: relative;
  z-index: 2;
  direction: inherit;
  unicode-bidi: isolate;

  /* // fix the color هون - dedicated footer text tokens عشان ما نعتمد على
     --clr-text-secondary اللي بيختلف بين light/dark theme */
  --footer-clr-heading:  #F0F4FF;   /* section titles and logo */
  --footer-clr-body:     #A8BBDF;   /* description, nav links, contact values */
  --footer-clr-label:    #6B85B5;   /* small uppercase labels (Phone, Email…) */
  --footer-clr-copy:     #5A739E;   /* bottom copyright bar */
  --footer-clr-hover:    #42A5F5;   /* link hover — brand light */
  --footer-clr-icon-bg:  rgba(33, 150, 243, 0.18); /* contact icon chip bg */
  --footer-clr-icon:     #42A5F5;   /* contact icon color */
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-8);
  direction: inherit;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) repeat(3, minmax(160px, 1fr));
  gap: var(--space-8);
  align-items: start;
  direction: inherit;
}

.footer-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  text-align: start;
  min-width: 0;
  direction: inherit;
  unicode-bidi: isolate;
}

.footer-logo {
  font-size: var(--text-2xl);
  font-weight: var(--font-extrabold);
  /* // use the footer-scoped heading token هون عشان يبان on dark bg */
  color: var(--footer-clr-heading);
  line-height: 1;
}

.footer-logo span { color: var(--clr-brand); }

.footer-title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  /* // شيل el قديم --clr-text-primary هون it's fine in dark but breaks in light mode
     use the dedicated footer heading color instead */
  color: var(--footer-clr-heading);
  text-align: start;
  unicode-bidi: plaintext;
}

.footer-description {
  margin: 0;
  max-width: 32rem;
  font-size: var(--text-sm);
  line-height: 1.75;
  /* // fix the color هون — --clr-text-secondary بيصير dark grey في light mode
     يعني ما بيبان on the dark footer background */
  color: var(--footer-clr-body);
  text-align: start;
  unicode-bidi: plaintext;
}

.footer-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  direction: inherit;
}

.footer-links a {
  width: fit-content;
  font-size: var(--text-sm);
  /* // updated to footer-scoped body color لأنه --clr-text-secondary
     ما بيشتغل correctly on the dark footer bg in light mode */
  color: var(--footer-clr-body);
  text-decoration: none;
  transition: color var(--transition-base);
  text-align: start;
  unicode-bidi: plaintext;
}

.footer-links a:hover,
.footer-contact-item:hover {
  /* // hover color يظل brand light هون for consistency */
  color: var(--footer-clr-hover);
}

.footer-contact-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
  direction: inherit;
}

.footer-contact-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: fit-content;
  /* // شيل el --clr-text-secondary القديم — it maps to dark grey in light mode
     replaced with footer-scoped body color عشان يبان on dark bg */
  color: var(--footer-clr-body);
  text-decoration: none;
  transition: color var(--transition-base);
  direction: inherit;
  text-align: start;
  unicode-bidi: isolate;
}

.footer-contact-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  /* // icon chip uses footer-scoped tokens هون عشان يظل consistent
     regardless of theme since the footer bg is always dark */
  background: var(--footer-clr-icon-bg);
  color: var(--footer-clr-icon);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(33, 150, 243, 0.25);
}

.footer-contact-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  min-width: 0;
  text-align: start;
  direction: inherit;
}

.footer-contact-label {
  font-size: var(--text-xs);
  /* // bumped from --clr-text-muted لأنه كان يتلاشى on the dark footer bg
     footer-clr-label is lighter and more readable هون */
  color: var(--footer-clr-label);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: start;
  unicode-bidi: plaintext;
}

.footer-contact-value {
  text-align: start;
  unicode-bidi: plaintext;
}

.footer-contact-value[dir="ltr"] {
  direction: ltr;
  unicode-bidi: isolate;
}

.footer-social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: var(--space-3);
  direction: inherit;
}

.footer-social-links a {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  /* // social chips هون need their own dark bg عشان ما يورثوا the light mode card bg */
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(33, 150, 243, 0.20);
  /* // use footer-scoped body color هون instead of --clr-text-primary */
  color: var(--footer-clr-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: color var(--transition-base), border-color var(--transition-base), background var(--transition-base), transform var(--transition-base);
}

.footer-social-links a:hover {
  /* // hover state for social icons هون — consistent with the footer hover color */
  background: rgba(33, 150, 243, 0.15);
  border-color: rgba(33, 150, 243, 0.45);
  color: var(--footer-clr-hover);
  transform: translateY(-2px);
}

.footer-copy {
  font-size: var(--text-xs);
  /* // copyright bar color هون — use the dedicated muted footer color
     --clr-text-secondary كان يصير unreadable in light mode against the dark footer */
  color: var(--footer-clr-copy);
  text-align: center;
  padding-top: var(--space-6);
  border-top: 1px solid rgba(33, 150, 243, 0.12);
  unicode-bidi: plaintext;
}

html[dir="rtl"] .footer {
  direction: rtl;
}

html[dir="ltr"] .footer {
  direction: ltr;
}

html[dir="rtl"] .footer-contact-label {
  letter-spacing: 0;
  text-transform: none;
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .footer {
    padding-top: var(--space-8);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .footer-column {
    align-items: flex-start;
  }

  .footer-description {
    max-width: none;
  }
}

/* هون RESPONSIVE */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
}

/* @media (max-width: 768px) :root token overrides live in variables.css — duplicate removed */

/* @media (max-width: 480px) modal overrides consolidated in
   the "Mobile bottom-sheet modal" block above — duplicate removed (#2) */

/* هون TOUCH TARGETS */
/* هون All interactive elements must meet 44px minimum touch size */
@media (pointer: coarse) {
  .btn,
  .btn-theme-toggle,
  .btn-lang-toggle,
  .navbar-hamburger,
  .user-avatar-btn,
  .notif-bell-btn,
  .slider-btn,
  .view-toggle-btn,
  .pagination-btn,
  .dropdown-item,
  .sidebar-nav-item,
  .mobile-nav-link {
    min-height: 44px;
  }

  /* بنتأكد mobile-nav-link items are easily tappable */
  .mobile-nav-link {
    padding: var(--space-4) var(--space-4);
  }

  /* هون Filter chips و small buttons need wider tap areas */
  .filter-chip-remove {
    padding: 6px;
    font-size: 0.8rem;
  }

  /* هون Vehicle card fav button needs larger touch target */
  .vehicle-card-fav {
    width: 40px;
    height: 40px;
  }
}



/* هون HYBRID DROPDOWN UI */
/* هون 1. Generic positioning */
.hybrid-dropdown-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.hybrid-dropdown-wrapper.active,
.filter-dropdown.active {
  z-index: 15000 !important;
  position: relative;
}

/* هون 2. Custom Button Trigger inheriting form-control */
.hybrid-dropdown-trigger {
  text-align: left;
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  /* هون Reset some button defaults so it looks exactly like original select */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: var(--input-bg, var(--clr-bg-card));
  color: var(--input-color, var(--clr-text));
}

.hybrid-dropdown-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-dropdown-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: var(--clr-text-secondary);
}

.hybrid-dropdown-wrapper.active .filter-dropdown-chevron {
  transform: rotate(-180deg);
  color: var(--clr-brand);
}

.hybrid-dropdown-wrapper.active .hybrid-dropdown-trigger,
.hybrid-dropdown-trigger:focus {
  border-color: var(--clr-brand);
  box-shadow: none;
  outline: none;
}

/* هون Validation visual feedback */
.hybrid-dropdown-trigger.drop-error-border {
  border-color: var(--clr-danger) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2) !important;
}

/* هون Modern Menu Structure ported from List Vehicle */
.filter-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  min-width: max-content;
  background: var(--clr-bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: all 0.2s ease;
}

.hybrid-dropdown-wrapper.active .filter-dropdown-menu,
.filter-dropdown.active .filter-dropdown-menu,
.filter-dropdown-menu.mobile-sheet {
    display: block !important;
    opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.filter-dropdown-search {
  padding: 12px;
  border-bottom: 1px solid var(--clr-border);
  background: var(--clr-bg-card);
}

.filter-search-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--clr-bg-input);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  color: var(--clr-text-primary);
  font-size: 14px;
}

.filter-search-input:focus {
  outline: none;
  border-color: var(--clr-brand);
  box-shadow: 0 0 0 2px var(--clr-brand-glow);
}

.filter-dropdown-list {
  max-height: 250px;
  overflow-y: auto;
  list-style: none;
  padding: 8px 0;
  margin: 0;
}

.filter-dropdown-item {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--clr-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-dropdown-item:hover, .keyboard-focus {
  background: var(--clr-bg-card-hover);
  color: var(--clr-text-primary);
}

.filter-dropdown-item.active {
  background: var(--clr-brand-glow);
  color: var(--clr-brand-light);
  font-weight: 500;
}

.filter-dropdown-item.active::after {
  content: "✔";
  margin-left: auto;
  font-size: 12px;
  color: var(--clr-brand-light);
}

/* هون RTL SUPPORT (Arabic) */
[dir="rtl"] .hybrid-dropdown-trigger {
  text-align: right;
  /*
 * هون Flexbox `justify-content: space-between` naturally flips items in RTL,
 * هون so الـ chevron moves to الـ far left automatically!
 */
}

[dir="rtl"] .hybrid-dropdown-label {
  text-align: right;
}

[dir="rtl"] .filter-dropdown-item {
  text-align: right;
}

[dir="rtl"] .filter-dropdown-item.active::after {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .filter-search-input {
  text-align: right;
}

/* هون Validation Styles */
.input-error {
  border-color: var(--clr-danger) !important;
  background-color: rgba(220, 53, 69, 0.05) !important;
  color: var(--clr-text-primary) !important;
}
.input-error::placeholder {
  color: rgba(220, 53, 69, 0.8) !important;
}

/* هون NOTIFICATION SYSTEM */
.notif-container {
  position: relative;
  display: flex;
  align-items: center;
}

.notif-bell-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--clr-text-primary);
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  cursor: pointer;
  z-index: 10;
}

.notif-bell-btn:hover {
  background: rgba(120, 120, 150, 0.1); 
  border: 1px solid var(--clr-border);
  transform: translateY(-1px);
}

.notif-bell-btn svg {
  transition: transform var(--transition-spring);
}

.notif-bell-btn:hover svg {
  transform: rotate(15deg) scale(1.1);
}

.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--clr-brand, #ff4c24);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  height: 18px;
  min-width: 18px;
  border-radius: 10px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--clr-bg-base);
  animation: motorx-fade-in 0.3s ease;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: -10px;
  width: 340px;
  max-width: 90vw;
  background: var(--glass-bg, var(--clr-bg-card));
  backdrop-filter: var(--glass-blur, blur(12px));
  -webkit-backdrop-filter: var(--glass-blur, blur(12px));
  border: 1px solid var(--glass-border, var(--clr-border));
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.98);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 9999;
  overflow: hidden;
  transform-origin: top right;
}

.notif-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--clr-border);
  background: rgba(0,0,0,0.05);
}

.notif-title {
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--clr-text-primary);
}

.notif-mark-all {
  background: none;
  border: none;
  color: var(--clr-brand);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

.notif-mark-all:hover {
  color: var(--clr-brand-light);
  text-decoration: underline;
}

.notif-list {
  max-height: 400px;
  overflow-y: auto;
}

.notif-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--clr-border);
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.notif-item:hover {
  background: var(--clr-bg-input, rgba(255,255,255,0.03));
}

.notif-item.unread {
  background: rgba(255, 76, 36, 0.05); /* هون very light brand color overlay */
  border-left: 3px solid var(--clr-brand);
}

.notif-item-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--clr-text-primary);
}

.notif-item-msg {
  font-size: 0.85rem;
  color: var(--clr-text-secondary);
  line-height: 1.5;
}

.notif-item-time {
  font-size: 0.75rem;
  color: var(--clr-text-muted);
  margin-top: 2px;
}

.notif-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--clr-text-muted);
  font-size: 0.9rem;
}

.notif-loading {
  padding: 40px;
  display: flex;
  justify-content: center;
}

/* هون RTL Support */
[dir="rtl"] .notif-dropdown {
  right: auto;
  left: -10px;
  transform-origin: top left;
}
[dir="rtl"] .notif-item.unread {
  border-left: none;
  border-right: 3px solid var(--clr-brand);
}


/*
 * هون MOTORX - MOBILE OPTIMIZATIONS (Smartphone-first pass)
 * هون All rules inside @media blocks - no desktop behavior removed.
 */



/*
 * هون 2. TAP HIGHLIGHT + FOCUS STATES
 * هون Remove iOS blue overlay on tap. Restore visible focus
 * هون لـ keyboard-only users via :focus-visible.
 */
* {
  -webkit-tap-highlight-color: transparent;
}

/* body overflow-x: hidden already in base styles — media-query copy removed (#6) */

/* هون Eliminate 300ms tap delay on interactive elements */
a,
button,
input[type="submit"],
input[type="button"],
.btn,
.nav-link,
.dropdown-item,
.social-btn,
.gallery-thumb,
.filter-chip,
.pagination-btn {
  touch-action: manipulation;
}



.btn:focus-visible,
.form-control:focus-visible,
.hybrid-dropdown-trigger:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible,
.mobile-nav-link:focus-visible {
  outline: 2px solid var(--clr-brand);
  outline-offset: 2px;
}

/*
 * 3. MODAL - MOBILE FIXES — duplicate of the block at line ~659.
 * All overrides consolidated there. Block removed (#1, #3).
 */

/*
 * هون 4. TOAST - FULL WIDTH MOBILE
 * هون Span الـ full screen width on phones, cleared above الـ
 * هون home indicator via env(safe-area-inset-bottom).
 */
@media (max-width: 480px) {
  #toast-container {
    bottom: max(var(--space-6), env(safe-area-inset-bottom, 24px));
    left: var(--space-3);
    right: var(--space-3);
    inset-inline-end: var(--space-3);
    width: auto;
  }

  .toast {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
}

/*
 * هون 5. DROPDOWN BOTTOM SHEET (mobile)
 * هون When JS adds .mobile-sheet to .filter-dropdown-menu,
 * هون it becomes a full-width bottom sheet. الـ ::before is a
 * drag نتعامل مع visual. Direction-agnostic (works RTL/LTR).
 */
.mobile-sheet {
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  width: 100% !important;
  min-width: 0 !important;
  max-height: 60vh !important;   /* fallback for older browsers */
  max-height: 60dvh !important;  /* modern browsers use dvh (excludes browser chrome) */
  overflow-y: auto !important;
    overscroll-behavior-y: none !important;
  -webkit-overflow-scrolling: touch !important;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
  z-index: 15000 !important;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.4) !important;
  transform: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  padding-bottom: env(safe-area-inset-bottom, 16px) !important;
}

/* @supports dvh for .mobile-sheet removed — 60dvh already declared
   first on .mobile-sheet with 60vh as fallback; @supports redundant (#7) */

.mobile-sheet::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--clr-border-strong);
  margin: 12px auto 8px;
  flex-shrink: 0;
}

/* هون Semi-transparent backdrop behind الـ bottom sheet */
.mobile-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7); /* هون Darker, clean background without blur */
  z-index: 14999 !important; /* هون Must be below الـ elevated wrapper/parentFG */
  touch-action: none;
}

/*
 * هون 6. SAFE AREA INSETS
 * هون Footer, sidebar footer, و step nav clear الـ iPhone
 * هون home indicator bar on viewport-fit=cover pages.
 */
@supports (padding: env(safe-area-inset-bottom)) {
  .footer {
    padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
  }

  .sidebar-footer {
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  }

  /* .step-nav safe-area consolidated in the @supports block below with 0px fallback */
}

/*
 * هون 7. SCROLL AFFORDANCE SHADOWS
 * هون Right-fade shadow on horizontal scrollers hints to users
 * هون that more content exists off-screen (iOS hides scrollbars).
 */
.scroll-fade-right {
  position: relative;
}

.scroll-fade-right::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 32px;
  background: linear-gradient(to right, transparent, var(--clr-bg-card));
  pointer-events: none;
  z-index: 1;
}

/*
 * هون 8. FORM-GRID-2 SINGLE COL AT 400px
 * هون Name fields (first/last) get full width on very small phones
 */
@media (max-width: 400px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

/*
 * هون 9. MAP TOUCH-ACTION - ADDITIONAL IDs
 * بنتأكد all Leaflet maps don't hijack page scroll
 */
#em-register-map,
#em-modal-map,
#sd-map,
#edit-serv-map,
#services-map,
#emergency-map,
#provider-mini-map,
.leaflet-container {
  touch-action: pan-x pan-y;
}

/* هون iOS INPUT ZOOM PREVENTION - max-width: 768px */
@media (max-width: 768px) {
  input,
  select,
  textarea,
  .form-control,
  .search-select,
  .filter-search-input,
  .fb-select,
  .fb-more-input,
  .fb-more-select,
  .fb-range-input,
  .sort-select,
  .search-popup-input,
  .hybrid-dropdown-trigger {
    font-size: max(16px, 1em);
  }
}



/* هون SAFE AREAS - fixed bottom elements */
@supports (padding: env(safe-area-inset-bottom)) {
  .step-nav {
    padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  }
  .fixed-bottom-bar,
  .fab,
  .mobile-fab {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* هون MOTORX SPIN KEYFRAME - used by loading spinners site-wide */
@keyframes mx-spin {
  to { transform: rotate(360deg); }
}



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

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

@media (max-width: 768px) {
  select[data-native],
  .fb-select,
  .sort-select,
  .mobile-native-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: var(--clr-bg-card);
    border: 1.5px solid var(--clr-border);
    border-radius: var(--radius-md);
    color: var(--clr-text-primary);
    font-family: inherit;
    font-size: 16px;
    padding: 12px 36px 12px 14px;
    height: 48px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238B9CC8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  }

  select[data-native]:focus,
  .fb-select:focus {
    outline: none;
    border-color: var(--clr-brand);
    box-shadow: none;
  }

  [dir="rtl"] select[data-native],
  [dir="rtl"] .fb-select {
    padding-right: 14px;
    padding-left: 36px;
    background-position: left 12px center;
  }

  .hybrid-dropdown-trigger {
    height: 48px;
    min-height: 48px;
    font-size: 16px;
    padding: 0 36px 0 14px;
    display: flex;
    align-items: center;
  }
  
  .hybrid-dropdown-label {
    font-size: 16px;
    color: var(--clr-text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
  }
  
  [dir="rtl"] .hybrid-dropdown-label {
    text-align: right;
  }
}

/* هون COMPONENT KEYFRAMES */

/* هون From ai.css */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

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

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

/* هون From list-vehicle.css */
@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fb-panel-in {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes chip-in {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes fb-sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes fb-sheet-down {
  from { transform: translateY(0); }
  to   { transform: translateY(100%); }
}

/* هون From home.css */
@keyframes heroPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

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

/* هون From emergency.css */
@keyframes emergencyPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50%       { box-shadow: 0 0 0 6px rgba(239,68,68,0.15); }
}

@keyframes dotBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
