/* ==================================================
   AUTOLANE — DESIGN SYSTEM
   ================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --navy: #0f2138;
  --navy-deep: #091626;
  --amber: #d4a017;
  --amber-dark: #b88c14;
  --ink: #14181f;
  --slate: #4b5563;
  --slate-light: #8a93a1;
  --line: #e3e6eb;
  --mist: #f4f5f7;
  --page-bg: #f7f7f8;
  --bad: #c0392b;
  --good: #1c8a4c;
  --radius: 8px;
  --shadow-pop: 0 12px 32px rgba(9, 22, 38, 0.14);
}

html, body { height: 100%; }

body {
  font-family: "Inter", Arial, sans-serif;
  background: var(--page-bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: "Space Grotesk", "Inter", Arial, sans-serif;
  color: var(--navy);
  line-height: 1.2;
}

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

.text-slate { color: var(--slate); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }

/* ==================================================
   BUTTONS
   ================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .1s ease, color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }
.btn-block { display: flex; width: 100%; }

.btn-primary { background: var(--amber); color: var(--navy-deep); border-color: var(--amber); }
.btn-primary:hover { background: var(--amber-dark); border-color: var(--amber-dark); }

.btn-dark { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-dark:hover { background: var(--navy-deep); }

.btn-outline { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-outline:hover { border-color: var(--navy); }

.btn-ghost { background: transparent; color: #fff; border-color: transparent; }
.btn-ghost:hover { background: rgba(255,255,255,0.1); }

.btn-danger { background: #fff; color: var(--bad); border-color: #f0c4bd; }
.btn-danger:hover { background: #fdf0ee; }

/* ==================================================
   HEADER
   ================================================== */
#site-header {
  background: var(--navy);
  border-bottom: 3px solid var(--amber);
  position: sticky;
  top: 0;
  z-index: 45;
}

#site-header .wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 78px;
}

.brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 4px 0;
  opacity: 1;
  transition: opacity .15s ease;
}
.brand:hover { opacity: 0.85; }
.brand img { height: 38px; width: auto; display: block; }

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.main-nav a {
  color: rgba(255,255,255,0.75);
  font-weight: 600;
  font-size: 15px;
  padding: 10px 16px;
  border-radius: 6px;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.main-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.main-nav a.is-active { color: #fff; background: rgba(255,255,255,0.14); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hamburger { display: none; }

.user-menu button#user-menu-btn {
  color: #fff;
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
}
.user-menu button#user-menu-btn:hover { background: rgba(255,255,255,0.14); }

#user-menu-dropdown a:hover,
#user-menu-dropdown button:hover { background: var(--mist); }

/* ==================================================
   FOOTER
   ================================================== */
#site-footer {
  margin-top: 60px;
  background: var(--navy);
  color: rgba(255,255,255,0.75);
  border-top: 3px solid var(--amber);
}
#site-footer .wrap { padding-top: 44px; padding-bottom: 28px; }

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.footer-col h4 { color: #fff; font-size: 14px; margin-bottom: 14px; }
.footer-col a { display: block; padding: 6px 0; font-size: 14px; color: rgba(255,255,255,0.7); }
.footer-col a:hover { color: #fff; }

.footer-bottom {
  padding-top: 24px;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}

/* ==================================================
   HERO / HOME SEARCH
   ================================================== */
.hero {
  background: var(--navy);
  padding: 56px 0 64px;
  position: relative;
}
.hero .wrap { position: relative; z-index: 1; }
.hero h1 { color: #fff; font-size: 40px; margin-bottom: 14px; max-width: 640px; }
.hero .lead { color: rgba(255,255,255,0.75); font-size: 17px; margin-bottom: 32px; max-width: 640px; }
.road-divider { display: block; width: 100%; height: 40px; margin-top: -2px; }

.search-panel { background: transparent; }
.search-row {
  display: flex;
  gap: 12px;
  background: #fff;
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  flex-wrap: wrap;
}
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 160px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--slate); }
.field input, .field select {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14.5px;
  font-family: inherit;
}

/* ==================================================
   PAGE SECTIONS
   ================================================== */
.section { padding: 48px 0; }
.section-alt { background: #fff; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  gap: 16px;
}
.section-head p { color: var(--slate); margin-top: 4px; }

.make-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.make-pill {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  font-weight: 600;
  transition: transform .12s ease, border-color .15s ease;
}
.make-pill:hover { transform: translateY(-2px); border-color: var(--amber); }

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.how-step .num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--navy-deep);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; margin-bottom: 14px;
}
.how-step h3 { margin-bottom: 8px; font-size: 18px; }
.how-step p { color: var(--slate); font-size: 14.5px; }

/* ==================================================
   CARDS / RESULTS GRID
   ================================================== */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.car-card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .15s ease, transform .12s ease;
}
.car-card:hover { box-shadow: var(--shadow-pop); transform: translateY(-2px); }

.car-card .thumb { position: relative; aspect-ratio: 4/3; background: var(--mist); }
.car-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.car-card .no-photo { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--slate-light); font-size: 13px; }

.save-btn {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  border: none;
  color: var(--slate-light);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.save-btn.is-saved { color: var(--bad); }

.car-card .body { padding: 14px 16px 16px; }
.car-card .price { font-size: 19px; font-weight: 700; color: var(--navy); font-family: "Space Grotesk", sans-serif; }
.car-card .title { font-weight: 600; margin: 4px 0 8px; font-size: 15px; }
.car-card .specs { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--slate); margin-bottom: 6px; }
.car-card .specs span:not(:last-child)::after { content: '·'; margin-left: 10px; color: var(--line); }
.car-card .location { font-size: 12.5px; color: var(--slate-light); }

.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--mist);
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
}
.badge-sold { background: var(--navy-deep); color: #fff; }

/* ==================================================
   BROWSE / FILTERS
   ================================================== */
.browse-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  padding: 28px 0 60px;
  align-items: start;
}
.filters {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  position: sticky;
  top: 94px;
}
.filters h3 { font-size: 16px; }
.filter-group { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.filter-group:first-of-type { margin-top: 16px; padding-top: 0; border-top: none; }
.filter-group h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate); margin-bottom: 10px; }
.filter-group select, .filter-group input[type=text], .filter-group input[type=number] {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; font-family: inherit;
}
.filter-range { display: flex; gap: 8px; }
.filter-range input { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; }
#f-fuel label, #f-transmission label, #f-bodytype label { display: block; font-size: 14px; padding: 4px 0; }
.chip-clear { background: none; border: none; color: var(--amber-dark); font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-block#apply-filters, #apply-filters { margin-top: 18px; }

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}
.results-count { font-size: 15px; color: var(--slate); }
.sort-select select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; font-family: inherit;
}

/* ==================================================
   AUTH (LOGIN / SIGNUP)
   ================================================== */
.auth-shell {
  min-height: calc(100vh - 260px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}
.auth-shell .card { width: 100%; max-width: 420px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14.5px;
  font-family: inherit;
}
.form-group textarea { min-height: 110px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.hint { font-size: 12.5px; color: var(--slate-light); margin-top: 5px; }

.alert { padding: 12px 14px; border-radius: 6px; font-size: 14px; margin-bottom: 18px; }
.alert-error { background: #fdf0ee; color: var(--bad); border: 1px solid #f4cfc7; }
.alert-success { background: #eef8f1; color: var(--good); border: 1px solid #c9ebd4; }

/* ==================================================
   ACCOUNT / ADMIN DASHBOARD
   ================================================== */
.dashboard-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  padding: 32px 0 64px;
  align-items: start;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { padding: 11px 14px; border-radius: 6px; font-weight: 600; color: var(--slate); font-size: 14.5px; }
.side-nav a:hover { background: var(--mist); }
.side-nav a.is-active { background: var(--navy); color: #fff; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat-box .num { font-size: 26px; font-weight: 700; color: var(--navy); font-family: "Space Grotesk", sans-serif; }
.stat-box .lbl { font-size: 13px; color: var(--slate); margin-top: 2px; }

.data-table { width: 100%; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); border-collapse: collapse; overflow: hidden; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--line); }
.data-table th { background: var(--mist); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--slate); }
.data-table tr:last-child td { border-bottom: none; }
.row-thumb { width: 56px; height: 40px; object-fit: cover; border-radius: 4px; background: var(--mist); display: block; }

.pill-status { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; text-transform: capitalize; }
.pill-active { background: #eef8f1; color: var(--good); }
.pill-sold { background: var(--mist); color: var(--slate); }
.pill-removed { background: #fdf0ee; color: var(--bad); }

/* ==================================================
   LISTING PAGE
   ================================================== */
.listing-layout { display: grid; grid-template-columns: 1fr 340px; gap: 36px; padding: 28px 0 64px; align-items: start; }
.gallery-main { position: relative; aspect-ratio: 4/3; background: var(--mist); border-radius: var(--radius); overflow: hidden; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: none; background: rgba(15,33,56,0.65); color: #fff; font-size: 20px; cursor: pointer; }
.gallery-nav.prev { left: 12px; } .gallery-nav.next { right: 12px; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.gallery-thumbs img { width: 76px; height: 56px; object-fit: cover; border-radius: 6px; cursor: pointer; opacity: .6; flex-shrink: 0; }
.gallery-thumbs img.is-active { opacity: 1; outline: 2px solid var(--amber); }

.listing-title-row { display: flex; justify-content: space-between; align-items: flex-start; margin-top: 20px; gap: 12px; }
.listing-title-row .save-btn { position: static; }

.spec-table { width: 100%; margin-top: 20px; border-collapse: collapse; }
.spec-table td { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.spec-table td:first-child { color: var(--slate); width: 45%; }
.spec-table td:last-child { font-weight: 600; }

.listing-price { font-size: 30px; font-weight: 700; color: var(--navy); font-family: "Space Grotesk", sans-serif; }
.seller-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-align: center; }
.seller-card .avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--amber); color: var(--navy-deep); font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; }
.seller-card .name { font-weight: 700; font-size: 16px; }
.seller-card .since { font-size: 12.5px; color: var(--slate-light); margin-bottom: 16px; }
.contact-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 14px; font-size: 14px; }
.contact-row .num { font-weight: 700; color: var(--navy); }
.map-box { margin-top: 16px; height: 200px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }

/* ==================================================
   SELL FORM
   ================================================== */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 10px; }
.photo-slot { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--mist); border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--slate-light); font-weight: 600; }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot .remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(15,33,56,0.7); color: #fff; cursor: pointer; font-size: 12px; }
.quota-bar { height: 6px; background: var(--mist); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.quota-bar div { height: 100%; background: var(--amber); }
#sell-form h3 { margin-top: 28px; margin-bottom: 4px; }
#sell-form h3:first-child { margin-top: 0; }

/* ==================================================
   MISC
   ================================================== */
.loading-dots, .empty-state { text-align: center; padding: 48px 20px; color: var(--slate); }
.empty-state h3 { margin-bottom: 8px; }
.empty-state a { color: var(--amber-dark); font-weight: 600; }

/* ==================================================
   RESPONSIVE
   ================================================== */
@media (max-width: 860px) {
  #site-header .wrap { padding: 0 20px; }
  .hamburger { display: block !important; }
  .header-actions { gap: 8px; }
  .browse-layout, .dashboard-layout, .listing-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .how-grid, .footer-cols { grid-template-columns: 1fr; gap: 20px; }
  .search-row { flex-direction: column; }
  .hero h1 { font-size: 30px; }
}
