:root {
  --ink: #0e1218;
  --ink-soft: #1a2230;
  --paper: #f4f6f8;
  --muted: #6b7380;
  --line: rgba(255, 255, 255, 0.12);
  --amber: #e8a838;
  --amber-deep: #c4841f;
  --steel: #8fa3b8;
  --ok: #3d9a6a;
  --danger: #c44b4b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --font-display: "Syne", "Noto Sans Arabic", sans-serif;
  --font-body: "Manrope", "Noto Sans Arabic", sans-serif;
  --radius: 14px;
  --max: 1180px;
}

html[dir="rtl"] body { font-family: "Noto Sans Arabic", "Manrope", sans-serif; }
html[dir="rtl"] .brand,
html[dir="rtl"] .hero-copy .brand-mark,
html[dir="rtl"] .section h2,
html[dir="rtl"] .dash-header h2 { font-family: "Noto Sans Arabic", "Syne", sans-serif; }
.lang-switch { display: inline-flex; gap: 0.35rem; }
.lang-switch button { min-width: 2.4rem; }
.wa-btn { background: #1f6b45; color: #eafff3; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--paper);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(232, 168, 56, 0.18), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(143, 163, 184, 0.14), transparent 50%),
    linear-gradient(180deg, #0b0f14 0%, #121821 40%, #0e1218 100%);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font: inherit;
  color: inherit;
}
img { max-width: 100%; display: block; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topnav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.25rem;
  backdrop-filter: blur(14px);
  background: rgba(14, 18, 24, 0.72);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 1.35rem;
}
.brand span { color: var(--amber); }
.nav-links { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.nav-links a { color: var(--steel); font-weight: 600; font-size: 0.95rem; }
.nav-links a:hover, .nav-links a.active { color: var(--paper); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem; border: 0; cursor: pointer;
  border-radius: 999px; padding: 0.75rem 1.2rem;
  font-weight: 700; transition: transform .2s ease, background .2s ease, opacity .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--amber), var(--amber-deep)); color: #16120a; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--paper); }
.btn-danger { background: rgba(196, 75, 75, 0.18); color: #ffb4b4; border: 1px solid rgba(196,75,75,.35); }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.88rem; }

main { flex: 1; }

.hero {
  position: relative;
  min-height: 92vh;
  display: grid;
  align-items: end;
  overflow: hidden;
}
.hero-media {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(8,10,14,0.15) 0%, rgba(8,10,14,0.82) 70%, #0e1218 100%),
    url("https://images.unsplash.com/photo-1492144534655-ae79c964c9d7?auto=format&fit=crop&w=2000&q=80") center/cover no-repeat;
  transform: scale(1.04);
  animation: heroDrift 18s ease-in-out infinite alternate;
}
@keyframes heroDrift {
  from { transform: scale(1.04) translateY(0); }
  to { transform: scale(1.08) translateY(-1.5%); }
}
.hero-copy {
  position: relative; z-index: 1;
  width: min(var(--max), calc(100% - 2.5rem));
  margin: 0 auto 4.5rem;
  animation: rise 900ms cubic-bezier(.2,.7,.2,1) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-copy .brand-mark {
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 9vw, 6.5rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.hero-copy .brand-mark em {
  font-style: normal;
  color: var(--amber);
}
.hero-copy p {
  max-width: 34rem;
  color: #d5dde8;
  font-size: 1.1rem;
  line-height: 1.55;
  margin: 0 0 1.6rem;
}
.cta-row { display: flex; gap: 0.8rem; flex-wrap: wrap; }

.section {
  width: min(var(--max), calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 4rem 0;
}
.section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 0.5rem;
}
.section .lede { color: var(--steel); margin: 0 0 2rem; max-width: 40rem; }

.filters {
  display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.filters input, .filters select, .field input, .field select, .field textarea {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  min-width: 0;
}
.filters input { flex: 1; min-width: 180px; }

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.vehicle-tile {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  transition: transform .25s ease, border-color .25s ease;
  animation: rise 700ms ease both;
}
.vehicle-tile:hover { transform: translateY(-4px); border-color: rgba(232,168,56,.45); }
.vehicle-tile .thumb {
  aspect-ratio: 16/10;
  background: #1a2230 center/cover no-repeat;
}
.vehicle-tile .meta { padding: 1rem 1.05rem 1.15rem; }
.vehicle-tile h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
}
.price { color: var(--amber); font-weight: 700; }
.meta-row { display: flex; justify-content: space-between; gap: 0.5rem; color: var(--steel); font-size: 0.9rem; }

.detail {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 2rem;
  align-items: start;
}
.detail-media {
  border-radius: 18px;
  min-height: 360px;
  background: #1a2230 center/cover no-repeat;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.chip-row { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 1rem 0; }
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  color: var(--steel);
  font-size: 0.85rem;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem;
  background: rgba(255,255,255,0.03);
}
.field { display: grid; gap: 0.35rem; margin-bottom: 0.85rem; }
.field label { color: var(--steel); font-size: 0.85rem; font-weight: 600; }
.field textarea { min-height: 110px; resize: vertical; }

.footer {
  border-top: 1px solid var(--line);
  padding: 2rem 1.25rem 2.5rem;
  color: var(--steel);
  text-align: center;
}

/* Dashboard */
.dash {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.dash-side {
  border-right: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
  padding: 1.25rem 1rem;
}
.dash-side .brand { margin-bottom: 1.5rem; display: block; }
.dash-side nav { display: grid; gap: 0.35rem; }
.dash-side a {
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  color: var(--steel);
  font-weight: 600;
}
.dash-side a.active, .dash-side a:hover {
  background: rgba(232,168,56,0.12);
  color: var(--paper);
}
.dash-main { padding: 1.5rem; }
.dash-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}
.stat {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: rgba(255,255,255,0.03);
}
.stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin-top: 0.2rem;
}
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); }
th { color: var(--steel); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: rgba(255,255,255,0.02); }
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(143,163,184,0.18);
  color: var(--steel);
}
.badge.available { background: rgba(61,154,106,0.18); color: #8fd6b0; }
.badge.reserved { background: rgba(232,168,56,0.18); color: #f0c778; }
.badge.sold, .badge.lost, .badge.cancelled { background: rgba(196,75,75,0.18); color: #ffb4b4; }
.badge.new, .badge.requested { background: rgba(143,163,184,0.22); color: #c9d6e4; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}
.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.75rem;
  background: rgba(18,24,33,0.9);
  box-shadow: var(--shadow);
  animation: rise 600ms ease both;
}
.toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 80;
  background: #1b2431; border: 1px solid var(--line);
  padding: 0.85rem 1rem; border-radius: 12px;
  box-shadow: var(--shadow);
  animation: rise 300ms ease both;
}
.toast.error { border-color: rgba(196,75,75,.5); }
.empty { color: var(--steel); padding: 2rem 0; }
.muted { color: var(--steel); }
.form-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.5rem; }

@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
  .dash { grid-template-columns: 1fr; }
  .dash-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .dash-side nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
}
