/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0a0c10;
  color: #e2e8f0;
  line-height: 1.5;
  min-height: 100vh;
}

/* ===== Variables ===== */
:root {
  --cyan: #00d4ff;
  --cyan-dim: rgba(0, 212, 255, 0.12);
  --cyan-glow: rgba(0, 212, 255, 0.25);
  --bg-1: #0a0c10;
  --bg-2: #0f1117;
  --bg-3: #151820;
  --bg-4: #1a1e2a;
  --border: rgba(255,255,255,0.07);
  --text-1: #f0f4ff;
  --text-2: #94a3b8;
  --text-3: #5a6478;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

/* ===== Typography ===== */
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,12,16,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s;
}
.site-header.scrolled { box-shadow: 0 4px 32px rgba(0,0,0,0.6); }

.header-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
}
.logo-icon { color: var(--cyan); font-size: 1.4rem; }
.logo span { color: var(--cyan); }

.search-bar {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.search-bar input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 16px 9px 40px;
  color: var(--text-1);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}
.search-bar input::placeholder { color: var(--text-3); }
.search-bar input:focus { border-color: var(--cyan); }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 0.95rem;
  pointer-events: none;
}

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.btn-post {
  background: var(--cyan);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-post:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.85rem;
  transition: border-color 0.2s, color 0.2s;
}
.btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }

/* ===== Nav Tabs ===== */
.nav-tabs {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.nav-tabs-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
}
.nav-tab {
  background: none;
  border: none;
  color: var(--text-2);
  padding: 12px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-tab:hover { color: var(--text-1); }
.nav-tab.active { color: var(--cyan); border-bottom-color: var(--cyan); }
.tab-count {
  background: var(--bg-4);
  color: var(--text-3);
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 0.75rem;
}

/* ===== Brands Block ===== */
.brands-section {
  width: 100%;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.brands-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 20px;
}
.brands-title {
  font-size: 0.78rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.brands-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.brand-chip {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.82rem;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.brand-chip:hover { background: var(--cyan-dim); border-color: var(--cyan); color: var(--cyan); }
.chip-count { color: var(--text-3); margin-left: 4px; font-size: 0.75rem; }

/* ===== Container ===== */
.container { max-width: 1300px; margin: 0 auto; padding: 0 20px; }

/* ===== Listing Section ===== */
.listing-section { padding: 28px 0 48px; }

.listing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}
.listing-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-1);
}
.results-count {
  color: var(--text-3);
  font-size: 0.85rem;
  margin-left: 8px;
}

.listing-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== Filters ===== */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  align-items: center;
}
.filter-select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-1);
  padding: 8px 12px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  min-width: 140px;
}
.filter-select:focus { border-color: var(--cyan); }
.filter-select option { background: var(--bg-3); }

.btn-reset {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-3);
  padding: 8px 14px;
  font-size: 0.82rem;
  transition: all 0.2s;
}
.btn-reset:hover { border-color: #f87171; color: #f87171; }

/* ===== View Toggle ===== */
.view-toggle { display: flex; gap: 4px; }
.view-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-3);
  padding: 7px 10px;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.view-btn:hover { color: var(--text-1); }
.view-btn.active { background: var(--cyan-dim); border-color: var(--cyan); color: var(--cyan); }

/* ===== TABLE VIEW ===== */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.cars-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.cars-table thead tr {
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}

.cars-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  user-select: none;
}
.cars-table th.sortable { cursor: pointer; }
.cars-table th.sortable:hover { color: var(--text-1); }
.cars-table th.sort-asc::after { content: ' ↑'; color: var(--cyan); }
.cars-table th.sort-desc::after { content: ' ↓'; color: var(--cyan); }

/* th widths */
.th-photo { width: 68px; }
.th-name { min-width: 180px; }
.th-year { width: 60px; }
.th-mileage { width: 110px; }
.th-city { width: 150px; }
.th-price { width: 140px; text-align: right !important; }
.th-fav { width: 44px; }

.cars-table tbody tr.car-row {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.cars-table tbody tr.car-row:last-child { border-bottom: none; }
.cars-table tbody tr.car-row:hover { background: var(--bg-3); }
.cars-table tbody tr.car-row:hover .car-title { color: var(--cyan); }

.cars-table td {
  padding: 7px 12px;
  vertical-align: middle;
}

/* Photo cell */
.td-photo { padding: 6px 8px 6px 12px; }
.car-thumb {
  width: 68px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  background: var(--bg-4);
}

/* Name cell */
.td-name { padding-left: 4px; }
.car-title {
  font-weight: 600;
  color: var(--text-1);
  font-size: 0.88rem;
  display: block;
  transition: color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.car-sub {
  display: block;
  color: var(--text-3);
  font-size: 0.75rem;
  margin-top: 2px;
  white-space: nowrap;
}

/* Year cell */
.td-year { color: var(--text-2); font-size: 0.85rem; }

/* Mileage cell */
.td-mileage { color: var(--text-2); font-size: 0.85rem; white-space: nowrap; }

/* City cell */
.td-city { }
.city-tag { font-size: 0.8rem; color: var(--text-3); white-space: nowrap; }

/* Price cell — LARGE, RIGHT-ALIGNED */
.td-price {
  text-align: right;
  white-space: nowrap;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: -0.01em;
}

/* Fav cell */
.td-fav { text-align: center; }
.fav-btn {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 1rem;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s, transform 0.15s;
  line-height: 1;
}
.fav-btn:hover { color: #f87171; transform: scale(1.2); }
.fav-btn.active { color: #f87171; }

/* ===== GRID VIEW ===== */
.cars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.car-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.car-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px var(--cyan-glow);
  border-color: var(--cyan);
}
.card-img-wrap { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--bg-4); }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.card-fav { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.5); border-radius: 50%; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; }
.card-body { padding: 12px 14px; }
.card-title { font-weight: 600; font-size: 0.9rem; color: var(--text-1); margin-bottom: 4px; }
.card-meta { font-size: 0.78rem; color: var(--text-3); margin-bottom: 10px; }
.card-footer { display: flex; align-items: center; justify-content: space-between; }
.card-price { font-size: 1rem; font-weight: 700; color: var(--cyan); }
.card-city { font-size: 0.78rem; color: var(--text-3); }

/* ===== Empty ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ===== How it works ===== */
.how-section { background: var(--bg-2); padding: 60px 0; border-top: 1px solid var(--border); }
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 8px;
}
.section-sub { color: var(--text-3); margin-bottom: 40px; font-size: 0.95rem; }

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
}
.step-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.2s;
}
.step-card:hover { border-color: var(--cyan); }
.step-num {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--cyan-dim);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-weight: 700;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.step-title { font-weight: 600; color: var(--text-1); margin-bottom: 6px; font-size: 0.95rem; }
.step-desc { color: var(--text-3); font-size: 0.85rem; line-height: 1.6; }

/* ===== CTA ===== */
.cta-section {
  padding: 60px 0;
  text-align: center;
  background: linear-gradient(135deg, rgba(0,212,255,0.04) 0%, transparent 50%, rgba(0,212,255,0.04) 100%);
  border-top: 1px solid var(--border);
}
.cta-title { font-size: 1.8rem; font-weight: 700; color: var(--text-1); margin-bottom: 10px; }
.cta-sub { color: var(--text-3); margin-bottom: 28px; font-size: 0.95rem; }
.btn-cta {
  background: var(--cyan);
  color: #000;
  border: none;
  border-radius: 10px;
  padding: 14px 36px;
  font-size: 1rem;
  font-weight: 700;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-cta:hover { opacity: 0.9; transform: translateY(-2px); }

/* ===== Stats ===== */
.stats-section { padding: 48px 0; border-top: 1px solid var(--border); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 24px;
  text-align: center;
}
.stat-card { }
.counter-num { font-size: 2.2rem; font-weight: 800; color: var(--cyan); display: block; }
.stat-label { color: var(--text-3); font-size: 0.85rem; margin-top: 4px; }

/* ===== FAQ ===== */
.faq-section { padding: 60px 0; border-top: 1px solid var(--border); }
.faq-list { max-width: 760px; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-q {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  cursor: pointer;
  color: var(--text-1);
  font-size: 0.95rem;
  font-weight: 500;
  gap: 16px;
}
.faq-q:hover { color: var(--cyan); }
.faq-icon { color: var(--text-3); font-size: 1.2rem; transition: transform 0.25s; flex-shrink: 0; }
.faq-item.open .faq-icon { transform: rotate(45deg); color: var(--cyan); }
.faq-a { color: var(--text-3); font-size: 0.88rem; line-height: 1.7; padding-bottom: 16px; display: none; }
.faq-item.open .faq-a { display: block; }

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 680px;
  width: 100%;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: rgba(255,255,255,0.07);
  border: none;
  color: var(--text-2);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: rgba(255,255,255,0.15); }
.modal-top { position: relative; }
.modal-img { width: 100%; height: 260px; object-fit: cover; display: block; background: var(--bg-4); }
.modal-content { padding: 24px; }
.modal-title { font-size: 1.3rem; font-weight: 700; color: var(--text-1); margin-bottom: 4px; }
.modal-price { font-size: 1.6rem; font-weight: 800; color: var(--cyan); margin-bottom: 20px; display: block; }
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row span { color: var(--text-3); }
.detail-row strong { color: var(--text-1); }
.modal-actions { margin-top: 20px; display: flex; gap: 10px; }
.btn-contact {
  flex: 1;
  background: var(--cyan);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-weight: 700;
  font-size: 0.95rem;
}
.btn-contact:hover { opacity: 0.9; }

/* ===== Footer ===== */
.site-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 36px;
}
.footer-brand .logo { margin-bottom: 10px; }
.footer-desc { color: var(--text-3); font-size: 0.85rem; line-height: 1.6; }
.footer-col h4 { color: var(--text-1); font-size: 0.85rem; font-weight: 600; margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.06em; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { color: var(--text-3); font-size: 0.85rem; transition: color 0.2s; }
.footer-col ul li a:hover { color: var(--cyan); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-copy { color: var(--text-3); font-size: 0.8rem; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .header-inner { gap: 10px; }
  .search-bar { max-width: none; }
  .btn-ghost { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
  .cta-title { font-size: 1.4rem; }
  .th-city, .td-city { display: none; }
  .th-mileage, .td-mileage { display: none; }
}
