/* ===== Theme ===== */
:root {
  --acura-red: #d10a2c;          /* Acura signature red */
  --acura-red-dark: #a8071f;
  --ink: #14171c;
  --ink-2: #2a2f38;
  --slate: #5b6573;
  --slate-2: #8a93a1;
  --line: #e4e8ee;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --shadow-sm: 0 1px 2px rgba(20,23,28,.06), 0 1px 3px rgba(20,23,28,.08);
  --shadow-md: 0 4px 14px rgba(20,23,28,.08), 0 2px 6px rgba(20,23,28,.05);
  --shadow-lg: 0 18px 48px rgba(20,23,28,.18);
  --radius: 14px;
  --radius-sm: 9px;
  --ok: #16a34a;
  --warn: #d97706;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

.hidden { display: none !important; }

/* ===== Header ===== */
.site-header {
  background: linear-gradient(135deg, #1a1d23 0%, #14171c 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 16px rgba(0,0,0,.25);
}
.header-inner {
  max-width: 1320px; margin: 0 auto; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 11px;
  background: linear-gradient(135deg, var(--acura-red), var(--acura-red-dark));
  display: grid; place-items: center;
  font-weight: 800; font-size: 24px; color: #fff;
  box-shadow: 0 4px 14px rgba(209,10,44,.4);
}
.brand-text h1 { font-size: 1.22rem; font-weight: 700; letter-spacing: -.02em; }
.brand-text p { font-size: .78rem; color: #aab2bf; font-weight: 500; margin-top: 1px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.last-updated { font-size: .76rem; color: #9aa3b1; white-space: nowrap; }
.btn-refresh {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--acura-red); color: #fff; border: none;
  padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: .85rem;
  cursor: pointer; transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
  box-shadow: 0 4px 12px rgba(209,10,44,.35);
}
.btn-refresh:hover { background: var(--acura-red-dark); transform: translateY(-1px); }
.btn-refresh:active { transform: translateY(0); }
.btn-refresh svg { transition: transform .6s ease; }
.btn-refresh.spinning svg { transform: rotate(360deg); }

/* ===== Stats ===== */
.stats {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 16px; margin: 28px 0 24px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-sm); transition: transform .2s ease, box-shadow .2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-value { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; color: var(--ink); }
.stat-label { font-size: .76rem; color: var(--slate); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-card:first-child .stat-value { color: var(--acura-red); }

/* ===== Controls ===== */
.controls {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.search-wrap { position: relative; margin-bottom: 16px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--slate-2); }
#searchInput {
  width: 100%; padding: 13px 14px 13px 44px;
  border: 1.5px solid var(--line); border-radius: 11px;
  font-size: .95rem; font-family: inherit; background: var(--surface-2);
  transition: border-color .2s ease, box-shadow .2s ease;
}
#searchInput:focus { outline: none; border-color: var(--acura-red); box-shadow: 0 0 0 4px rgba(209,10,44,.1); background: #fff; }

.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 130px; }
.filter-group label { font-size: .72rem; font-weight: 700; color: var(--slate); text-transform: uppercase; letter-spacing: .04em; }
.filter-group select {
  padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 9px;
  font-size: .88rem; font-family: inherit; background: var(--surface-2); color: var(--ink);
  cursor: pointer; transition: border-color .2s ease;
}
.filter-group select:focus { outline: none; border-color: var(--acura-red); }
.btn-reset {
  padding: 9px 18px; border: 1.5px solid var(--line); background: var(--surface);
  border-radius: 9px; font-weight: 600; font-size: .85rem; color: var(--slate);
  cursor: pointer; transition: all .2s ease; height: 38px;
}
.btn-reset:hover { border-color: var(--acura-red); color: var(--acura-red); }

.view-toggle { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; border: 1.5px solid var(--line); height: 38px; }
.view-toggle button {
  border: none; background: transparent; padding: 0 10px; border-radius: 7px;
  cursor: pointer; color: var(--slate-2); display: grid; place-items: center; transition: all .2s ease;
}
.view-toggle button.active { background: var(--surface); color: var(--acura-red); box-shadow: var(--shadow-sm); }

/* ===== Grid View ===== */
.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; }
.car-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  display: flex; flex-direction: column;
  animation: fadeUp .4s ease both;
}
.car-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: #d3d9e2; }
.card-img-wrap { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(135deg, #eef1f5, #e2e7ee); overflow: hidden; }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.car-card:hover .card-img-wrap img { transform: scale(1.05); }
.card-img-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--slate-2); font-size: .8rem; gap: 8px; flex-direction: column; }
.badge {
  position: absolute; top: 12px; left: 12px; padding: 5px 11px; border-radius: 20px;
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  backdrop-filter: blur(4px);
}
.badge.new { background: rgba(22,163,74,.92); color: #fff; }
.badge.used { background: rgba(217,119,6,.92); color: #fff; }
.badge-cpo { position: absolute; top: 12px; right: 12px; background: rgba(20,23,28,.85); color: #fff; padding: 5px 10px; border-radius: 20px; font-size: .65rem; font-weight: 700; letter-spacing: .03em; }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.card-title { font-size: 1.05rem; font-weight: 700; letter-spacing: -.02em; }
.card-sub { font-size: .8rem; color: var(--slate); margin-top: 2px; }
.card-specs { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 13px 0; font-size: .8rem; color: var(--ink-2); }
.card-specs span { display: inline-flex; align-items: center; gap: 5px; }
.card-specs .dot { color: var(--slate-2); }
.card-footer { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--line); }
.card-price { font-size: 1.35rem; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.card-msrp { font-size: .74rem; color: var(--slate-2); text-decoration: line-through; }
.card-dealer { font-size: .73rem; color: var(--slate); text-align: right; max-width: 120px; }

/* ===== Table View ===== */
.table-view { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-view table { width: 100%; border-collapse: collapse; }
.table-view thead { background: var(--surface-2); }
.table-view th {
  text-align: left; padding: 14px 16px; font-size: .74rem; font-weight: 700;
  color: var(--slate); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
  border-bottom: 1.5px solid var(--line);
}
.table-view th[data-sort] { cursor: pointer; user-select: none; }
.table-view th[data-sort]:hover { color: var(--acura-red); }
.sort-ind { font-size: .7rem; }
.table-view td { padding: 13px 16px; font-size: .87rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-view tbody tr { cursor: pointer; transition: background .15s ease; }
.table-view tbody tr:hover { background: var(--surface-2); }
.table-view tbody tr:last-child td { border-bottom: none; }
.tbl-thumb { width: 64px; height: 42px; border-radius: 7px; object-fit: cover; background: #eef1f5; }
.tbl-vehicle { display: flex; align-items: center; gap: 11px; }
.tbl-vehicle .v-name { font-weight: 600; }
.tbl-vehicle .v-sub { font-size: .76rem; color: var(--slate); }
.tbl-price { font-weight: 800; }
.tag { display: inline-block; padding: 3px 9px; border-radius: 14px; font-size: .7rem; font-weight: 700; }
.tag.new { background: rgba(22,163,74,.12); color: var(--ok); }
.tag.used { background: rgba(217,119,6,.12); color: var(--warn); }
.tbl-link { color: var(--acura-red); font-weight: 600; font-size: .8rem; white-space: nowrap; }

/* ===== Empty state ===== */
.empty-state { text-align: center; padding: 80px 20px; color: var(--slate); }
.empty-state svg { color: var(--slate-2); margin-bottom: 14px; }
.empty-state h3 { font-size: 1.15rem; color: var(--ink-2); margin-bottom: 6px; }
.empty-state p { font-size: .9rem; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,23,28,.6); backdrop-filter: blur(4px); z-index: 60; display: grid; place-items: center; padding: 20px; animation: fadeIn .2s ease; }
.modal { background: var(--surface); border-radius: 18px; max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; box-shadow: var(--shadow-lg); animation: modalIn .28s cubic-bezier(.2,.8,.2,1); }
.modal-close { position: absolute; top: 14px; right: 16px; z-index: 5; width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(255,255,255,.9); color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: background .2s ease; }
.modal-close:hover { background: #fff; color: var(--acura-red); }
.modal-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #eef1f5; border-radius: 18px 18px 0 0; }
.modal-img-placeholder { width: 100%; aspect-ratio: 16/9; display: grid; place-items: center; background: linear-gradient(135deg, #eef1f5, #e2e7ee); color: var(--slate-2); border-radius: 18px 18px 0 0; }
.modal-body { padding: 24px 28px 28px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.modal-head h2 { font-size: 1.5rem; letter-spacing: -.02em; }
.modal-head .m-price { font-size: 1.7rem; font-weight: 800; color: var(--acura-red); }
.modal-sub { color: var(--slate); font-size: .9rem; margin-top: 2px; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin: 22px 0; }
.spec-item { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; }
.spec-item .s-label { font-size: .7rem; color: var(--slate); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.spec-item .s-value { font-size: .92rem; font-weight: 600; margin-top: 3px; }
.modal-dealer { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 18px; }
.modal-dealer h4 { font-size: .9rem; margin-bottom: 6px; }
.modal-dealer p { font-size: .85rem; color: var(--slate); margin: 2px 0; }
.btn-listing { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px; background: var(--acura-red); color: #fff; border-radius: 11px; font-weight: 700; text-decoration: none; transition: background .2s ease, transform .15s ease; }
.btn-listing:hover { background: var(--acura-red-dark); transform: translateY(-1px); }
.btn-listing.disabled { background: var(--slate-2); pointer-events: none; }

/* ===== Toast ===== */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 11px; font-size: .88rem; font-weight: 500; box-shadow: var(--shadow-lg); z-index: 80; opacity: 0; transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .3s ease; max-width: 90vw; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ===== Footer ===== */
.site-footer { text-align: center; padding: 40px 24px; color: var(--slate); font-size: .82rem; margin-top: 40px; border-top: 1px solid var(--line); }
.site-footer .disclaimer { font-size: .76rem; color: var(--slate-2); margin-top: 6px; }

/* ===== Animations ===== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .header-inner { padding: 14px 18px; }
  .brand-text h1 { font-size: 1.05rem; }
  .last-updated { display: none; }
  .container { padding: 0 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 20px 0; }
  .stat-value { font-size: 1.4rem; }
  .filter-group { min-width: calc(50% - 7px); flex: none; }
  .btn-reset, .view-toggle { flex: 1; }
  .grid-view { grid-template-columns: 1fr; }
  /* table -> horizontal scroll */
  .table-view { overflow-x: auto; }
  .table-view table { min-width: 720px; }
  .btn-refresh span { display: none; }
  .btn-refresh { padding: 10px; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .modal-head h2 { font-size: 1.25rem; }
}
