/* ── SEARCH BAR ── */
.search-bar {
  background: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  padding: var(--space-4) var(--space-8);
}

.search-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.search-input-wrap {
  flex: 1;
  position: relative;
}

.search-input-wrap input {
  width: 100%;
  padding: var(--space-2) var(--space-8) var(--space-2) var(--space-4);
  border: 1.5px solid var(--red);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: #1E1E1E;
  outline: none;
  transition: box-shadow 0.2s;
}

.search-input-wrap input:focus {
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.11);
}

.search-input-wrap .s-icon {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--red);
  pointer-events: none;
}

.btn-search {
  padding: var(--space-2) var(--space-6);
  background: var(--red);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
}

.btn-search:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
}

/* ── PAGE LAYOUT ── */
.page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-8) var(--space-16);
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--space-6);
  align-items: start;
}

/* ── FILTERS SIDEBAR ── */
.filters {
  position: sticky;
  top: calc(var(--nav-height) + var(--space-4));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.filter-card {
  background: #fff;
  border-radius: 12px;
  padding: var(--space-5);
  border: 1px solid rgba(0, 0, 0, 0.07);
}

.filter-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  cursor: pointer;
  user-select: none;
}

.filter-card-header h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1E1E1E;
}

.filter-chevron {
  color: #aaa;
  transition: transform 0.25s;
}

.filter-card.collapsed .filter-chevron {
  transform: rotate(-90deg);
}

.filter-card.collapsed .filter-body {
  display: none;
}

.filter-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.filter-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.filter-field select,
.filter-field input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: #1E1E1E;
  background: #fafafa;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

.filter-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: var(--space-8);
  cursor: pointer;
}

.filter-field select:focus,
.filter-field input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.09);
  background: #fff;
}

.filter-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.filter-checkboxes {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.filter-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}

.filter-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--red);
  cursor: pointer;
  flex-shrink: 0;
}

.filter-check span {
  font-size: 0.82rem;
  color: #555;
}

.filter-check-count {
  margin-left: auto;
  font-size: 0.7rem;
  color: #bbb;
  background: #f0f0f0;
  padding: 1px 6px;
  border-radius: 10px;
}

.btn-apply-filters {
  width: 100%;
  padding: var(--space-3);
  background: var(--red);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.btn-apply-filters:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
}

.btn-clear-filters {
  width: 100%;
  padding: var(--space-2);
  background: transparent;
  color: #999;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
  text-align: center;
}

.btn-clear-filters:hover {
  color: var(--red);
}

/* ── RESULTS COLUMN ── */
.results-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ── RESULTS HEADER ── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.results-count {
  font-size: 0.88rem;
  color: #888;
}

.results-count strong {
  color: #1E1E1E;
  font-weight: 700;
}

.results-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sort-select {
  padding: var(--space-2) var(--space-8) var(--space-2) var(--space-3);
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  color: #1E1E1E;
  background: #fff;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.2s;
}

.sort-select:focus {
  border-color: var(--red);
  outline: none;
}

.view-toggle {
  display: flex;
  gap: var(--space-1);
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: 2px;
}

.view-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: 6px;
  color: #aaa;
  transition: background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
}

.view-btn.active {
  background: var(--red);
  color: #fff;
}

/* ── ACTIVE FILTERS CHIPS ── */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: rgba(200, 16, 46, 0.08);
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid rgba(200, 16, 46, 0.2);
  width: fit-content;
}

.filter-chip:hover {
  background: rgba(200, 16, 46, 0.15);
}

.filter-chip svg {
  flex-shrink: 0;
}

#filterToggle {
  flex-direction: row;
  justify-content: center;
  align-items: center;
  font-family: 'inter';
  color: var(--white);
  text-align: center;
  border: none;
  border-radius: 8px;
  background: var(--red);
  padding: var(--space-2) var(--space-5);
}

/* ── CAR GRID ── */
.car-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.car-grid.list-view {
  grid-template-columns: 1fr;
}

/* CARD — grid view */
.car-card {
  height: fit-content;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.07);
  transition: box-shadow 0.25s, transform 0.25s;
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}

.car-card:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  transform: translateY(-3px);
}

.car-card-img {
  width: 100%;
  height: auto;
}

.car-card-img-wrap {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: #e8e8e8;
}

.car-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s;
}

.car-card:hover .car-card-img-wrap img {
  transform: scale(1.04);
}

.car-card-badge {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  background: var(--red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px var(--space-2);
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.car-card-fav {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  background: rgba(255, 255, 255, 0.85);
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s, color 0.2s;
  color: #aaa;
}

.car-card-fav:hover,
.car-card-fav.active {
  color: var(--red);
  background: #fff;
}

.car-card-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.car-card-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #1E1E1E;
  line-height: 1;
}

.car-card-spec {
  font-size: 0.75rem;
  color: #999;
  line-height: 1;
}

.car-card-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1E1E1E;
  line-height: 1;
  margin-top: var(--space-1);
}

.car-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #bbb;
  border-top: 1px solid #f0f0f0;
  padding-top: var(--space-2);
  margin-top: var(--space-1);
}

.car-card-btn {
  text-decoration: none;
  text-align: center;
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: 1.5px solid var(--red);
  border-radius: 8px;
  color: var(--red);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

/* CARD — list view */
.car-grid.list-view .car-card {
  display: grid;
  grid-template-columns: 220px 1fr;
}

.car-grid.list-view .car-card-img-wrap {
  aspect-ratio: unset;
  height: 100%;
  min-height: 140px;
}

.car-grid.list-view .car-card-body {
  padding: var(--space-5);
  justify-content: center;
}

.car-grid.list-view .car-card-title {
  font-size: 1rem;
}

.car-grid.list-view .car-card-price {
  font-size: 1.25rem;
}

/* ── PAGINATION ── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.page-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.page-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.page-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-weight: 700;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-btn.wide {
  width: auto;
  padding: 0 var(--space-4);
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  display: none;
}

.empty-state.show {
  display: block;
}

.empty-state h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.empty-state p {
  font-size: 0.85rem;
  color: #888;
}

/* ── SKELETON LOADING ── */
@keyframes shimmer {
  0% {
    background-position: -600px 0;
  }

  100% {
    background-position: 600px 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #e8e8e8 25%, #f0f0f0 50%, #e8e8e8 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}

/* ══════════════════════════════════════
       FOOTER
    ══════════════════════════════════════ */

@media (max-width: 960px) {
  .page-wrap {
    grid-template-columns: 1fr;
  }

  .filters {
    position: fixed;
    top: 0;
    left: -100%;
    bottom: 0;
    width: 300px;
    background: #f0f0f0;
    overflow-y: auto;
    padding: var(--space-8) var(--space-5);
    z-index: 200;
    transition: left 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  }

  .filters.open {
    left: 0;
  }

  .filter-toggle-mobile {
    display: flex;
  }

  .filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 199;
  }

  .filter-overlay.show {
    display: block;
  }

  .car-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .car-grid {
    grid-template-columns: 1fr;
  }

  .page-wrap {
    padding: var(--space-4) var(--space-4) var(--space-12);
  }

  .search-bar {
    padding: var(--space-3) var(--space-4);
  }
}