/* ============================================
   INVENTORY PAGE — Search, filters, listings
   ============================================ */

/* ── Search box ── */
.search-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 18px 20px;
}
.search-box-label {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 3px;
  color: #fff;
  margin-bottom: 12px;
}
.search-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }

.s-select,
.s-input {
  flex: 1;
  min-width: 110px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: .83rem;
  appearance: none;
  font-family: var(--font-body);
}
.s-select:focus,
.s-input:focus  { outline: none; border-color: var(--blue); }
.s-input::placeholder { color: var(--muted); }

/* ── Filter bar ── */
.filter-bar {
  background: var(--inset-bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-pill {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: .76rem;
  color: var(--muted);
  background: var(--card-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .2s;
  white-space: nowrap;
  font-family: var(--font-body);
}
.filter-pill:hover,
.filter-pill.active { border-color: var(--blue); color: var(--blue); }

.reset-btn {
  margin-left: auto;
  border: 1px solid var(--error);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: .76rem;
  color: var(--error);
  background: transparent;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
  font-family: var(--font-body);
}
.reset-btn:hover { background: var(--error); color: #fff; }

/* ── Results bar ── */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 0 10px;
}
.results-count       { font-size: .84rem; color: #fff; font-weight: 600; }
.results-count span  { font-weight: 400; color: var(--muted); }
.results-right       { display: flex; align-items: center; gap: 14px; font-size: .8rem; color: var(--muted); }
.results-right select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: .78rem;
  color: var(--text);
  background: var(--card-bg);
}

/* ── Pagination ── */
.pager { display: flex; align-items: center; gap: 4px; }
.pager-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--muted);
  font-size: .78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.pager-btn:hover,
.pager-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ── Listing card ── */
.listing-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 14px;
  transition: border-color .2s, box-shadow .2s;
  /* Fixed height so every card is identical */
  min-height: 180px;
}
.listing-card:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-card);
}
.listing-inner {
  display: flex;
  height: 100%;
  min-height: 180px;
}

/* Image col — fixed width, full card height */
.listing-img-wrap {
  width: 260px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  /* Force 4:3 aspect ratio on the image column */
  aspect-ratio: 4/3;
}
.listing-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0; left: 0;
}
.listing-compare {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: .7rem;
  color: #fff;
  background: rgba(0,0,0,.6);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  z-index: 2;
}
.listing-compare input { accent-color: var(--blue); cursor: pointer; }

/* Body col — flex column so actions always sit at bottom */
.listing-body {
  flex: 1;
  padding: 14px 16px 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.listing-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  /* Single line — ellipsis on overflow */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .2s;
  text-decoration: none;
  display: block;
}
.listing-title:hover { color: var(--blue); }

.specs-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 8px;
}
.spec-item  { display: flex; align-items: center; gap: 5px; font-size: .76rem; color: var(--muted); }
.spec-item i { color: var(--blue); font-size: .8rem; width: 14px; text-align: center; }

.listing-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: .71rem;
  color: #55657a;
  margin-bottom: 0;
  /* Push actions to bottom */
  flex: 1;
  align-content: flex-start;
}
.listing-meta span { display: flex; align-items: center; gap: 4px; }

/* Payment bar */
.payment-bar {
  background: #0d1828;
  border-top: 1px solid #1a2d47;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}
.payment-label { font-size: .78rem; font-weight: 700; color: var(--blue); }
.payment-sub   { font-size: .68rem; color: var(--muted); }
.payment-logo  {
  width: 28px; height: 28px;
  background: var(--blue);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .75rem;
  font-weight: 900;
}

/* Action buttons */
.listing-actions {
  padding: 12px 16px 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  border-top: 1px solid var(--border);
}
.action-btn {
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: opacity .2s;
  white-space: nowrap;
  font-family: var(--font-body);
}
.action-btn:hover { opacity: .82; }
.btn-avail   { background: var(--blue); color: #fff; }
.btn-quote   { background: #2d3748; color: var(--text); }
.btn-apply-g { background: #276749; color: #fff; }
.btn-details { background: #374151; color: var(--text); }

/* Right col */
.listing-right {
  width: 160px;
  flex-shrink: 0;
  padding: 14px 14px 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  border-left: 1px solid var(--border);
}
.listing-price { font-size: 1.35rem; font-weight: 800; color: #fff; text-align: center; width: 100%; }

.mpg-box {
  background: var(--inset-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  text-align: center;
  width: 100%;
}
.mpg-label { font-size: .6rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.mpg-value { font-size: 1rem; font-weight: 700; color: var(--text); }
.mpg-unit  { font-size: .63rem; color: var(--muted); }

/* Badges */
.badge-wrap    { display: flex; flex-direction: column; gap: 5px; width: 100%; }
.carfax-badge  { background: #1a365d; color: #90cdf4; border-radius: var(--radius-sm); padding: 4px 6px; font-size: .6rem; font-weight: 700; text-align: center; border: 1px solid #2a4a7f; }

/* Carfax / AutoCheck button in listing-right */
.carfax-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #0c2340;
  color: #5bb8f5;
  border: 1px solid #1e4a7a;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: .72rem;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  transition: background .2s;
  cursor: pointer;
  width: 100%;
  line-height: 1.3;
}
.carfax-btn:hover { background: #1a3a5c; color: #90cdf4; }
.carfax-na { opacity: .6; cursor: default; }
.carfax-na:hover { background: #0c2340; }

/* Clean title badge */
.clean-title-badge {
  font-size: .7rem;
  color: var(--success);
  font-weight: 700;
  text-align: center;
  padding: 4px 8px;
  background: rgba(34,197,94,.1);
  border: 1px solid rgba(34,197,94,.3);
  border-radius: 20px;
  width: 100%;
}
.value-badge   { background: var(--success-bg); color: var(--success); border-radius: var(--radius-sm); padding: 4px 6px; font-size: .6rem; font-weight: 700; text-align: center; border: 1px solid #276749; }

/* ── Responsive ── */
@media (max-width: 767px) {
  .listing-inner      { flex-direction: column; min-height: auto; }
  .listing-img-wrap   { width: 100%; aspect-ratio: 4/3; position: relative; }
  .listing-img-wrap img { position: absolute; height: 100%; }
  .listing-right      { width: 100%; flex-direction: row; flex-wrap: wrap;
                         padding: 10px 14px; align-items: center;
                         border-left: none; border-top: 1px solid var(--border); }
  .listing-price      { font-size: 1.2rem; }
  .listing-title      { white-space: normal; }
}