:root {
  --navy: #0f1b33;
  --navy-2: #16233f;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --red: #dc2626;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-mute: #64748b;
  --text-faint: #94a3b8;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: inherit; }
img { max-width: 100%; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px;
}

/* Header */
.site-header {
  background: var(--navy);
  color: #fff;
}
.site-header .topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 18px;
  max-width: 1180px;
  margin: 0 auto;
  flex-wrap: wrap;
}
.logo {
  font-size: 21px;
  font-weight: 900;
  text-decoration: none;
  color: #fff;
  white-space: nowrap;
}
.logo span { color: #60a5fa; }

.nav-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.nav-tabs a {
  text-decoration: none;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 20px;
  background: rgba(255,255,255,.06);
}
.nav-tabs a.on, .nav-tabs a:hover {
  background: var(--blue);
  color: #fff;
}

.search-box {
  margin-left: auto;
  display: flex;
  min-width: 220px;
}
.search-box input {
  flex: 1;
  padding: 9px 12px;
  border-radius: 20px 0 0 20px;
  border: none;
  font-size: 14px;
  outline: none;
}
.search-box button {
  border: none;
  background: var(--blue);
  color: #fff;
  padding: 0 16px;
  border-radius: 0 20px 20px 0;
  cursor: pointer;
  font-weight: 700;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 60%, #1e3a6e 100%);
  color: #fff;
  padding: 46px 18px 56px;
  text-align: center;
}
.hero h1 { font-size: 30px; margin: 0 0 10px; }
.hero p { color: #cbd5e1; margin: 0 0 22px; font-size: 15px; }
.hero .search-box { max-width: 520px; margin: 0 auto; }
.hero .search-box input { padding: 13px 16px; font-size: 15px; }
.hero .stat { margin-top: 18px; font-size: 13px; color: #93c5fd; }

.cat-quick {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.cat-quick a {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  padding: 8px 18px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}
.cat-quick a:hover { background: var(--blue); border-color: var(--blue); }

/* Section titles */
.section {
  padding: 34px 0;
}
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title h2 { font-size: 19px; margin: 0; }
.section-title a { font-size: 13px; color: var(--blue); text-decoration: none; font-weight: 700; }

/* Car grid & cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.car-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform .12s, box-shadow .12s;
  border: 1px solid var(--border);
}
.car-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.12); }
.car-card .thumb-wrap { position: relative; background: #e2e8f0; }
.car-card img { width: 100%; height: 160px; object-fit: cover; display: block; }
.car-card .badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(15,27,51,.82); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px;
}
.car-card .body { padding: 12px 13px; }
.car-card .model { font-weight: 800; font-size: 15px; margin-bottom: 3px; }
.car-card .sub { color: var(--text-faint); font-size: 12px; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.car-card .price { color: var(--red); font-weight: 900; font-size: 18px; }
.car-card .meta { font-size: 12px; color: var(--text-mute); margin-top: 5px; }

/* Filters */
.filter-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-row label { font-size: 12px; color: var(--text-mute); font-weight: 700; width: 62px; flex-shrink: 0; }
.filter-panel select, .filter-panel input[type=text], .filter-panel input[type=number] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
}
.filter-panel .to { color: var(--text-faint); font-size: 12px; }
.brand-chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.brand-chip {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12.5px;
  text-decoration: none;
  color: var(--text-mute);
  font-weight: 600;
}
.brand-chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn {
  border: none;
  background: var(--blue);
  color: #fff;
  padding: 9px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: var(--blue-dark); }
.btn.ghost { background: #fff; color: var(--text-mute); border: 1px solid var(--border); }

.result-count { font-size: 14px; color: var(--text-mute); margin-bottom: 14px; }
.result-count b { color: var(--text); }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 28px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--border); background: #fff; text-decoration: none;
  font-size: 13px; color: var(--text-mute); font-weight: 600;
}
.pagination a:hover { background: #eef2ff; }
.pagination .cur { background: var(--blue); border-color: var(--blue); color: #fff; }
.pagination .disabled { opacity: .4; pointer-events: none; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-mute); }
.empty-state .emoji { font-size: 40px; margin-bottom: 10px; }

/* Detail page */
.detail-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 26px;
  align-items: start;
}
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }

.gallery {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.gallery .main-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #e2e8f0 center/cover no-repeat;
}
.gallery .thumbs {
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
}
.gallery .thumbs img {
  width: 74px; height: 56px; object-fit: cover; border-radius: 6px; cursor: pointer;
  border: 2px solid transparent; flex-shrink: 0;
}
.gallery .thumbs img.on { border-color: var(--blue); }

.detail-info {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px;
}
.detail-info h1 { font-size: 22px; margin: 0 0 4px; }
.detail-info .series { color: var(--text-mute); font-size: 14px; margin-bottom: 14px; }
.detail-info .price { font-size: 28px; font-weight: 900; color: var(--red); margin-bottom: 18px; }
.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 20px; }
.spec-table th, .spec-table td { text-align: left; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.spec-table th { width: 90px; color: var(--text-mute); font-weight: 700; }

.inquiry-box { border-top: 2px solid var(--navy); padding-top: 16px; }
.inquiry-box h3 { font-size: 15px; margin: 0 0 12px; }
.inquiry-form { display: flex; flex-direction: column; gap: 10px; }
.inquiry-form input, .inquiry-form textarea {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit;
}
.inquiry-form textarea { resize: vertical; min-height: 70px; }
.flash {
  padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; font-weight: 600;
}
.flash.ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.flash.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

.breadcrumb { font-size: 12px; color: var(--text-faint); margin-bottom: 14px; }
.breadcrumb a { text-decoration: none; color: var(--text-mute); }

/* Footer */
.site-footer {
  background: var(--navy);
  color: #94a3b8;
  padding: 30px 18px;
  margin-top: 40px;
  font-size: 12.5px;
  text-align: center;
}
.site-footer .fname { color: #fff; font-weight: 800; margin-bottom: 6px; font-size: 14px; }
.site-footer .fmeta { line-height: 1.8; }

@media (max-width: 640px) {
  .hero h1 { font-size: 24px; }
  .site-header .topbar { gap: 10px; }
  .search-box { min-width: 100%; order: 3; }
}
