/* ── Dari / Persian Font ── */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

/* ══════════════════════════════════════════════════════
   SVG ICON SYSTEM
══════════════════════════════════════════════════════ */
.ico {
  display: inline-block;
  width:  1em;
  height: 1em;
  vertical-align: -.125em;
  flex-shrink: 0;
  transition: transform .2s ease, opacity .2s ease;
}
/* Size variants */
.ico-xs  { width: 12px; height: 12px; }
.ico-sm  { width: 15px; height: 15px; }
.ico-md  { width: 20px; height: 20px; }
.ico-lg  { width: 28px; height: 28px; }
.ico-xl  { width: 40px; height: 40px; }
.ico-2xl { width: 56px; height: 56px; }
.ico-3xl { width: 72px; height: 72px; }

/* ── Animations ── */

/* Slow continuous spin – for gear/settings */
.ico-spin {
  animation: ico-spin 4s linear infinite;
  transform-origin: center;
}
@keyframes ico-spin {
  to { transform: rotate(360deg); }
}

/* Gentle pulse – for "new" star badge, status dots */
.ico-pulse {
  animation: ico-pulse 2.4s ease-in-out infinite;
}
@keyframes ico-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: .65; transform: scale(.88); }
}

/* Floating up-down – for empty-state car placeholders */
.ico-float {
  animation: ico-float 3s ease-in-out infinite;
}
@keyframes ico-float {
  0%, 100% { transform: translateY(0);    }
  50%       { transform: translateY(-7px); }
}

/* Draw-in stroke for success checkmarks */
.ico-draw path {
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
  animation: ico-draw .5s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes ico-draw {
  to { stroke-dashoffset: 0; }
}

/* Shake – for errors/warnings */
.ico-shake {
  animation: ico-shake .4s ease;
}
@keyframes ico-shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* Soft bounce on page load – for CTA icons */
.ico-bounce {
  animation: ico-bounce .7s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes ico-bounce {
  0%,100% { transform: translateY(0); }
  40%      { transform: translateY(-8px); }
  60%      { transform: translateY(-4px); }
}

/* ── Interactive hover ── */
a .ico, button .ico { transition: transform .18s ease, color .18s ease; }
a:hover .ico, button:hover .ico { transform: scale(1.18); }

/* ── Why-card big icons ── */
.why-icon-svg {
  width: 52px; height: 52px;
  padding: 12px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
  transition: transform .25s ease;
}
.why-card:hover .why-icon-svg { transform: scale(1.1) rotate(-4deg); }
.why-icon-svg svg { width: 28px; height: 28px; display: block; }

/* ── How-step big icons ── */
.how-icon-svg {
  width: 60px; height: 60px;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  transition: transform .3s ease;
}
.how-step:hover .how-icon-svg { transform: translateY(-5px) scale(1.05); }
.how-icon-svg svg { width: 30px; height: 30px; display: block; }

/* ── Hero pill icons ── */
.hero-pill .ico { width: 14px; height: 14px; margin-right: 5px; vertical-align: middle; }

/* ── Dashboard sidebar icons ── */
.dash-nav-item .ico { width: 17px; height: 17px; margin-right: 10px; opacity: .75; }
.dash-nav-item.active .ico,
.dash-nav-item:hover .ico { opacity: 1; }

/* ══════════════════════════════════════════════════════
   LANGUAGE TOGGLE BUTTON
══════════════════════════════════════════════════════ */
.lang-toggle {
  padding: 6px 14px;
  border: 1.5px solid rgba(255,255,255,.4);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
  transition: .15s;
  font-family: 'Vazirmatn', 'Segoe UI', sans-serif;
  letter-spacing: .3px;
}
.lang-toggle:hover { background: rgba(255,255,255,.12); border-color: #fff; }

/* ══════════════════════════════════════════════════════
   DARI MODE — Font override for all elements
══════════════════════════════════════════════════════ */
html.dari-mode,
html.dari-mode body,
html.dari-mode * {
  font-family: 'Vazirmatn', 'Segoe UI', system-ui, sans-serif !important;
}

/* ══════════════════════════════════════════════════════
   RTL LAYOUT FIXES  — targeted physical-property flips only
   NOTE: When dir="rtl" is on <html>, the browser already:
     • reverses flex-direction: row (items flow right→left)
     • right-aligns block text via text-align:start
   We only need to fix ABSOLUTE positions and explicit
   CSS physical values that don't auto-flip.
══════════════════════════════════════════════════════ */

/* ── Absolute-positioned badges: flip left↔right ── */
html[dir="rtl"] .car-badge,
html[dir="rtl"] .cc2-badge,
html[dir="rtl"] .qv-gallery-badge { left: auto !important; right: 10px; }
html[dir="rtl"] .cc2-photos       { right: auto !important; left: 8px; }
html[dir="rtl"] .preview-primary-badge { left: auto; right: 4px; }
html[dir="rtl"] .preview-remove        { right: auto; left: 4px; }

/* ── Filter sidebar: move to right, flip its border ── */
html[dir="rtl"] .filter-panel {
  border-right: none;
  border-left: 1px solid #e9ecef;
  order: 1;
}
html[dir="rtl"] .browse-main2 { order: 0; }

/* ── Table headers: CSS sets text-align:left explicitly, override ── */
html[dir="rtl"] th { text-align: right; }

/* ── Dashboard sidebar: active bar is border-left, flip to right ── */
html[dir="rtl"] .dash-nav-item {
  border-left: none;
  border-right: 3px solid transparent;
  padding: 10px 17px 10px 20px;
}
html[dir="rtl"] .dash-nav-item.active { border-right-color: #dc2626; }

/* ── Input direction — Dari text is RTL ── */
html[dir="rtl"] input:not([type="number"]):not([type="email"]):not([type="tel"]),
html[dir="rtl"] textarea { direction: rtl; text-align: right; }
html[dir="rtl"] select   { direction: rtl; }

/* ═════════════════════════════════════════════════════════════════════════
   Custom translated file picker
   ─────────────────────────────────────────────────────────────────────────
   The native <input type="file"> shows "Choose File / No file chosen"
   from the BROWSER locale, not the page locale — it can't be styled or
   translated. So we hide it and use a label+span pair that the i18n
   engine can translate.
   ───────────────────────────────────────────────────────────────────────── */
.file-picker-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px; font-weight: 600;
  color: #0f172a;
  transition: .15s;
  user-select: none;
  flex-shrink: 0;
}
.file-picker-btn:hover { background: #e2e8f0; border-color: #cbd5e1; }
.file-picker-btn svg { flex-shrink: 0; color: #dc2626; }
.file-picker-name {
  font-size: 13px; color: #64748b;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.file-picker-name.has-file { color: #0f172a; font-weight: 600; }

/* ═════════════════════════════════════════════════════════════════════════
   Bidi-safe phone numbers + emails (+ URLs)
   ─────────────────────────────────────────────────────────────────────────
   In RTL context, characters like '+' / '@' / '/' are "neutral" — the
   browser places them based on surrounding direction. A phone number like
   "+8619070760467" inside Dari text renders as "8619070760467+" because
   the '+' adopts RTL direction.
   Fix: isolate these in their own LTR bidi context. unicode-bidi:isolate
   creates a self-contained run so the '+' stays at the start.
   ───────────────────────────────────────────────────────────────────────── */
a[href^="tel:"],
a[href^="mailto:"],
.ltr-num,
.ltr-text {
  direction: ltr;
  unicode-bidi: isolate;
}

/* tel: links typically have content like "+93 700 000 000 📞" — keep
   the digits LTR but allow the icon/label flex layout to follow document dir. */
html[dir="rtl"] a[href^="tel:"],
html[dir="rtl"] a[href^="mailto:"] {
  unicode-bidi: isolate;
}

/* ──────────── */
:root {
  --primary: #dc2626;
  --primary-dark: #b91c1c;
  --primary-light: #fee2e2;
  --dark: #111827;
  --gray: #6b7280;
  --light: #f9fafb;
  --border: #e5e7eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; color: #1f2937; background: #f9fafb; }

/* NAV */
.nav { background: #111827; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 64px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.nav-brand { display: flex; align-items: center; gap: 0; text-decoration: none; }
.nav-brand .site-logo { height: 46px; width: auto; display: block; background: #fff; padding: 5px 12px; border-radius: 8px; }
.nav-brand span { display: none; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a { color: #d1d5db; text-decoration: none; padding: 8px 14px; border-radius: 6px; font-size: 14px; font-weight: 500; transition: all .2s; }
.nav-links a:hover, .nav-links a.active { color: #fff; background: rgba(255,255,255,.1); }
.nav-cta { background: #dc2626; color: #fff !important; padding: 8px 16px !important; border-radius: 6px !important; }
.nav-cta:hover { background: #b91c1c !important; }
.nav-user { display: flex; align-items: center; gap: 8px; color: #d1d5db; font-size: 14px; }
.nav-user .btn-logout { background: none; border: 1px solid #4b5563; color: #d1d5db; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; transition: all .2s; }
.nav-user .btn-logout:hover { border-color: #dc2626; color: #dc2626; }

/* HERO */
.hero { background: linear-gradient(135deg, #111827 0%, #1f2937 50%, #111827 100%); padding: 80px 24px; text-align: center; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="40" fill="rgba(220,38,38,0.05)"/><circle cx="80" cy="80" r="60" fill="rgba(220,38,38,0.03)"/></svg>'); }
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; color: #fff; margin-bottom: 16px; position: relative; }
.hero h1 span { color: #dc2626; }
.hero p { color: #9ca3af; font-size: 1.1rem; margin-bottom: 40px; position: relative; }
.hero-search { background: #fff; border-radius: 12px; padding: 8px; display: flex; gap: 8px; max-width: 700px; margin: 0 auto; box-shadow: 0 20px 40px rgba(0,0,0,.3); position: relative; }
.hero-search input { flex: 1; border: none; outline: none; padding: 12px 16px; font-size: 15px; border-radius: 8px; }
.hero-search button { background: #dc2626; color: #fff; border: none; padding: 12px 28px; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .2s; }
.hero-search button:hover { background: #b91c1c; }
.hero-stats { display: flex; gap: 40px; justify-content: center; margin-top: 48px; position: relative; }
.hero-stat { text-align: center; }
.hero-stat .num { font-size: 2rem; font-weight: 800; color: #dc2626; }
.hero-stat .label { color: #9ca3af; font-size: 13px; margin-top: 4px; }

/* SECTION */
.section { padding: 60px 24px; max-width: 1200px; margin: 0 auto; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.section-title { font-size: 1.75rem; font-weight: 700; color: #111827; }
.section-title span { color: #dc2626; }
.view-all { color: #dc2626; text-decoration: none; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 4px; }
.view-all:hover { text-decoration: underline; }

/* CARDS */
.cars-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.car-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); transition: transform .2s, box-shadow .2s; cursor: pointer; text-decoration: none; color: inherit; display: block; }
.car-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,.12); }
.car-card-img { position: relative; height: 200px; background: #f3f4f6; overflow: hidden; }
.car-card-img img { width: 100%; height: 100%; object-fit: cover; }
.car-card-img .no-img { display: flex; align-items: center; justify-content: center; height: 100%; color: #9ca3af; font-size: 48px; }
.car-badge { position: absolute; top: 10px; left: 10px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.badge-new { background: #dcfce7; color: #16a34a; }
.badge-used { background: #f3f4f6; color: #6b7280; }
.badge-sold { background: #fee2e2; color: #dc2626; }
.badge-pending { background: #fef9c3; color: #ca8a04; }
.badge-approved { background: #dcfce7; color: #16a34a; }
.badge-rejected { background: #fee2e2; color: #dc2626; }
.badge-blocked { background: #f3f4f6; color: #6b7280; }
.car-card-body { padding: 16px; }
.car-card-title { font-size: 1rem; font-weight: 700; color: #111827; margin-bottom: 4px; }
.car-card-sub { color: #6b7280; font-size: 13px; margin-bottom: 12px; }
.car-card-price { font-size: 1.3rem; font-weight: 800; color: #dc2626; margin-bottom: 12px; }
.car-card-meta { display: flex; gap: 12px; flex-wrap: wrap; }
.car-meta-item { display: flex; align-items: center; gap: 4px; color: #6b7280; font-size: 12px; }

/* DEALERSHIP CARDS */
.dealerships-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.dealership-card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,.08); transition: transform .2s, box-shadow .2s; text-decoration: none; color: inherit; display: block; }
.dealership-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,.12); }
.dealer-logo { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 2px solid #e5e7eb; }
.dealer-logo-placeholder { width: 60px; height: 60px; border-radius: 50%; background: #dc2626; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; font-weight: 700; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; border: none; text-decoration: none; }
.btn-primary { background: #dc2626; color: #fff; }
.btn-primary:hover { background: #b91c1c; }
.btn-secondary { background: #f3f4f6; color: #374151; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-outline { background: transparent; border: 2px solid #dc2626; color: #dc2626; }
.btn-outline:hover { background: #dc2626; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }

/* FORMS */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-input { width: 100%; padding: 10px 14px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; outline: none; transition: border-color .2s; background: #fff; }
.form-input:focus { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.form-select { width: 100%; padding: 10px 14px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; outline: none; background: #fff; cursor: pointer; }
.form-select:focus { border-color: #dc2626; }
.form-textarea { width: 100%; padding: 10px 14px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; outline: none; resize: vertical; min-height: 100px; font-family: inherit; }
.form-textarea:focus { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-error { color: #dc2626; font-size: 13px; margin-top: 4px; }
.form-hint { color: #6b7280; font-size: 12px; margin-top: 4px; }

/* AUTH PAGES */
.auth-page { min-height: 100vh; background: #111827; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .site-logo { height: 90px; width: auto; max-width: 280px; margin-bottom: 12px; display: block; margin-left: auto; margin-right: auto; }
.auth-logo h2 { font-size: 1.4rem; font-weight: 700; color: #111827; }
.auth-logo p { color: #6b7280; font-size: 14px; margin-top: 4px; }

/* DASHBOARD */
.dash-layout { display: flex; min-height: calc(100vh - 64px); }
.dash-sidebar { width: 240px; background: #111827; flex-shrink: 0; padding: 24px 0; position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; }
.dash-sidebar-title { color: #4b5563; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 0 20px; margin-bottom: 8px; margin-top: 16px; }
.dash-nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: #9ca3af; font-size: 14px; font-weight: 500; cursor: pointer; transition: all .2s; text-decoration: none; border-left: 3px solid transparent; }
.dash-nav-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.dash-nav-item.active { color: #fff; background: rgba(220,38,38,.15); border-left-color: #dc2626; }
.dash-nav-item .icon { width: 18px; text-align: center; }
.dash-content { flex: 1; padding: 32px; overflow-y: auto; }
.dash-section { display: none; }
.dash-section.active { display: block; }
.dash-header { margin-bottom: 28px; }
.dash-header h1 { font-size: 1.5rem; font-weight: 700; color: #111827; }
.dash-header p { color: #6b7280; font-size: 14px; margin-top: 4px; }

/* STAT CARDS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.stat-card .stat-label { font-size: 13px; color: #6b7280; font-weight: 500; }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: #111827; margin: 4px 0; }
.stat-card .stat-icon { font-size: 24px; margin-bottom: 8px; }
.stat-red .stat-value { color: #dc2626; }
.stat-green .stat-value { color: #16a34a; }
.stat-blue .stat-value { color: #2563eb; }
.stat-orange .stat-value { color: #d97706; }

/* TABLES */
.table-wrap { background: #fff; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.06); overflow: hidden; }
.table-header { padding: 16px 20px; border-bottom: 1px solid #f3f4f6; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.table-header h3 { font-size: 1rem; font-weight: 600; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .05em; background: #f9fafb; border-bottom: 1px solid #f3f4f6; }
td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid #f9fafb; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }
.table-img { width: 48px; height: 36px; object-fit: cover; border-radius: 4px; background: #f3f4f6; }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.alert-warning { background: #fefce8; color: #ca8a04; border: 1px solid #fde68a; }

/* IMAGE UPLOAD */
.upload-zone { border: 2px dashed #d1d5db; border-radius: 12px; padding: 40px; text-align: center; cursor: pointer; transition: all .2s; background: #fafafa; }
.upload-zone:hover, .upload-zone.dragover { border-color: #dc2626; background: #fff5f5; }
.upload-zone p { color: #6b7280; font-size: 14px; margin-top: 8px; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 16px; }
.preview-item { position: relative; border-radius: 8px; overflow: hidden; aspect-ratio: 4/3; }
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-remove { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 12px; }
.preview-primary-badge { position: absolute; bottom: 4px; left: 4px; background: #dc2626; color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }

/* FILTER SIDEBAR */
.browse-layout { display: flex; gap: 24px; max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
.filter-sidebar { width: 260px; flex-shrink: 0; }
.filter-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06); position: sticky; top: 80px; }
.filter-title { font-size: 1rem; font-weight: 700; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; }
.filter-section { margin-bottom: 20px; border-bottom: 1px solid #f3f4f6; padding-bottom: 20px; }
.filter-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.filter-label { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 8px; }
.browse-main { flex: 1; min-width: 0; }
.browse-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.results-count { font-size: 14px; color: #6b7280; }
.sort-select { padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; outline: none; }

/* CAR DETAIL PAGE */
.car-detail { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }
.car-detail-grid { display: grid; grid-template-columns: 1fr 380px; gap: 32px; }
.gallery { border-radius: 12px; overflow: hidden; background: #0a0f1a; }

/* ═════════════════════════════════════════════════════════════════════════
   .car-stage — reusable stable photo stage for car images
   - Locked 16:9 aspect ratio so the page never jumps as photos load
   - Original photo NEVER cropped (object-fit: contain)
   - Blurred copy of the same photo fills any letterboxing → premium look
   - Used by: full car-details page, browse-cars modal, homepage modal
═════════════════════════════════════════════════════════════════════════ */
.car-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0a0f1a;
  overflow: hidden;
}
.car-stage-bg {
  position: absolute; inset: -10%;
  width: 120%; height: 120%;
  object-fit: cover;
  filter: blur(36px) brightness(.45) saturate(1.2);
  transform: scale(1.1);   /* hides blur-edge artifacts */
  z-index: 0;
  pointer-events: none;
  user-select: none;
}
.car-stage-main {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  z-index: 1;
  cursor: zoom-in;
  transition: transform .25s;
}
.car-stage-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #334155; font-size: 80px;
  z-index: 1;
}

/* Legacy gallery — kept for backwards compat but now uses stage pattern */
.gallery-main { position: relative; aspect-ratio: 16 / 9; height: auto; background: #0a0f1a; overflow: hidden; }
.gallery-main img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: transparent; z-index: 1; }
.gallery-main .gallery-bg { position: absolute; inset: -10%; width: 120%; height: 120%; object-fit: cover; filter: blur(36px) brightness(.45) saturate(1.2); transform: scale(1.1); z-index: 0; pointer-events: none; }

.gallery-thumbs { display: flex; gap: 8px; padding: 12px; background: #1f2937; overflow-x: auto; }
.gallery-thumb { width: 80px; height: 60px; object-fit: cover; border-radius: 6px; cursor: pointer; opacity: .6; transition: opacity .2s; flex-shrink: 0; }
.gallery-thumb.active, .gallery-thumb:hover { opacity: 1; outline: 2px solid #dc2626; }
.car-info-card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 20px; }
.car-price { font-size: 2.2rem; font-weight: 800; color: #dc2626; }
.car-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.spec-item { display: flex; flex-direction: column; gap: 2px; }
.spec-label { font-size: 11px; color: #6b7280; font-weight: 600; text-transform: uppercase; }
.spec-value { font-size: 14px; font-weight: 600; color: #111827; }

/* PAGINATION */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; }
.page-btn { padding: 8px 14px; border-radius: 8px; border: 1px solid #e5e7eb; background: #fff; cursor: pointer; font-size: 14px; transition: all .2s; }
.page-btn:hover { border-color: #dc2626; color: #dc2626; }
.page-btn.active { background: #dc2626; color: #fff; border-color: #dc2626; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* FOOTER */
.footer { background: #111827; color: #9ca3af; padding: 48px 24px 24px; margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; max-width: 1200px; margin: 0 auto 32px; }
.footer-brand { color: #fff; font-size: 20px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.footer-brand .site-logo { height: 44px; width: auto; display: block; background: #fff; padding: 4px 10px; border-radius: 6px; }
.footer-desc { font-size: 14px; line-height: 1.6; }
.footer-col h4 { color: #fff; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.footer-col a { display: block; color: #9ca3af; text-decoration: none; font-size: 13px; margin-bottom: 8px; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #1f2937; padding-top: 24px; text-align: center; font-size: 13px; max-width: 1200px; margin: 0 auto; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 24px; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid #f3f4f6; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #6b7280; padding: 4px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid #f3f4f6; display: flex; gap: 8px; justify-content: flex-end; }

/* MISC */
.empty-state { text-align: center; padding: 60px 20px; color: #6b7280; }
.empty-state .icon { font-size: 64px; margin-bottom: 16px; opacity: .3; }
.empty-state p { font-size: 1rem; font-weight: 500; }
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid #e5e7eb; border-top-color: #dc2626; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.8); z-index: 200; display: flex; align-items: center; justify-content: center; }
.tag { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; }
.divider { height: 1px; background: #f3f4f6; margin: 20px 0; }
.text-muted { color: #6b7280; }
.text-red { color: #dc2626; }
.text-green { color: #16a34a; }
.fw-bold { font-weight: 700; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* ══════════════════════════════════════════════════════
   HAMBURGER NAV (shared pages)
══════════════════════════════════════════════════════ */
.nav-hamburger {
  display: none; background: none; border: none; color: #fff;
  cursor: pointer; padding: 6px 8px; line-height: 1;
  border-radius: 6px; transition: background .2s;
  align-items: center; justify-content: center;
}
.nav-hamburger:hover { background: rgba(255,255,255,.1); }

/* ══════════════════════════════════════════════════════
   RESPONSIVE — 1200px (large tablet)
══════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; gap: 28px; }
  .car-detail-grid { gap: 24px; }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — 1024px
══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .car-detail-grid { grid-template-columns: 1fr 320px; gap: 20px; }
  .dash-content { padding: 20px; }
  .section { padding: 50px 20px; }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — 768px (tablet / large phone)
══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* NAV */
  .nav { padding: 0 14px; height: 60px; }
  .nav-brand .site-logo { height: 36px; }
  .nav-hamburger { display: flex; }
  .lang-toggle { padding: 5px 10px; font-size: 12px; }
  .nav-links {
    display: none; flex-direction: column; gap: 4px;
    position: fixed; top: 60px; left: 0; right: 0;
    background: #111827; padding: 12px 16px 24px;
    z-index: 500; border-top: 1px solid #374151;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 13px 14px; font-size: 15px; border-radius: 8px; }
  .nav-user span { display: none; }
  /* Touch-friendly buttons */
  .btn, .btn-sm { min-height: 40px; }
  .form-input, .form-select, .form-textarea { font-size: 16px; } /* prevent iOS zoom */

  /* HERO */
  .hero { padding: 56px 16px 40px; }
  .hero h1 { font-size: clamp(1.6rem, 6vw, 2.6rem); }
  .hero p { font-size: .95rem; margin-bottom: 28px; }
  .hero-search { padding: 6px; gap: 6px; }
  .hero-search input { padding: 10px 14px; font-size: 14px; }
  .hero-search button { padding: 10px 18px; font-size: 14px; }
  .hero-stats { gap: 20px; margin-top: 32px; flex-wrap: wrap; justify-content: center; }
  .hero-stat .num { font-size: 1.6rem; }

  /* SECTION */
  .section { padding: 40px 16px; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 20px; }
  .section-title { font-size: 1.4rem; }

  /* CARDS */
  .cars-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
  .dealerships-grid { grid-template-columns: 1fr; gap: 16px; }

  /* FORMS */
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; gap: 12px; }

  /* DASHBOARD */
  .dash-layout { flex-direction: column; }
  .dash-sidebar {
    width: 100%; height: auto; position: static;
    display: flex; flex-wrap: nowrap; overflow-x: auto; padding: 8px 12px; gap: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .dash-sidebar::-webkit-scrollbar { height: 0; }
  .dash-sidebar-title { display: none; }
  .dash-nav-item {
    flex-shrink: 0; min-width: 90px; justify-content: center; text-align: center;
    flex-direction: column; gap: 4px; padding: 8px 10px;
    border-left: none !important; border-right: none !important;
    border-bottom: 3px solid transparent; font-size: 11px;
  }
  .dash-nav-item.active { border-bottom-color: #dc2626 !important; }
  .dash-nav-item .ico { width: 18px !important; height: 18px !important; }
  .dash-content { padding: 16px; }

  /* TABLES */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 520px; }

  /* BROWSE */
  .browse-layout { flex-direction: column; padding: 16px; gap: 16px; }
  .filter-sidebar { width: 100%; }
  .filter-card { position: static; }
  .browse-toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* CAR DETAIL */
  .car-detail { padding: 16px; }
  .car-detail-grid { grid-template-columns: 1fr; gap: 16px; }
  .gallery-main { aspect-ratio: 16/9; height: auto; }
  .car-price { font-size: 1.8rem; }
  .car-specs { grid-template-columns: 1fr 1fr; }

  /* FOOTER */
  .footer { padding: 32px 16px 20px; margin-top: 40px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }

  /* MODAL */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; max-height: 94vh; border-radius: 20px 20px 0 0; }
  .modal-body { padding: 20px 16px; }
  .modal-footer { padding: 12px 16px; }

  /* AUTH */
  .auth-card { padding: 28px 20px; }
  .auth-logo .site-logo { height: 70px; }

  /* STAT CARDS */
  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* HERO STATS */
  .hero-stats { gap: 20px; }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — 600px
══════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .cars-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .car-card-img { height: 160px; }
  .gallery-main { aspect-ratio: 4/3; height: auto; }  /* slightly taller on tablets */
  .gallery-thumbs { padding: 8px; gap: 6px; }
  .gallery-thumb { width: 60px; height: 48px; }
  .car-specs { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — 480px (phone)
══════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  /* NAV */
  .nav { height: 56px; padding: 0 12px; }
  .nav-brand .site-logo { height: 32px; }
  .nav-links { top: 56px; }
  .lang-toggle { padding: 4px 8px; font-size: 11px; }
  .btn-sm { padding: 5px 10px; font-size: 12px; }

  /* STATS */
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hero-stats { flex-direction: column; gap: 8px; }

  /* FOOTER */
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .footer { padding: 28px 16px 16px; }

  /* BUTTONS */
  .btn-lg { padding: 12px 18px; font-size: 15px; }

  /* AUTH */
  .auth-card { padding: 20px 16px; border-radius: 12px; }

  /* CAR DETAIL */
  .car-price { font-size: 1.5rem; }
  .gallery-main { aspect-ratio: 4/3; height: auto; }  /* phone: maintain ratio */
  .car-info-card { padding: 16px; }
  .cars-grid { grid-template-columns: 1fr; gap: 12px; }

  /* PAGINATION */
  .pagination { gap: 4px; flex-wrap: wrap; }
  .page-btn { padding: 7px 11px; font-size: 13px; }

  /* MODAL */
  .modal { border-radius: 16px 16px 0 0; }
  .modal-header { padding: 16px; }
  .modal-header h3 { font-size: 1rem; }
}
