/* cars.css — styles only the cars page needs: filter column, search/sort toolbar, results line.
   Used by: pages/cars.html */


/* [TOPIC: grid]  fixed-width filter column + flexible results column */
.catalog {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  align-items: start;
  gap: 3rem;
}

/* The filter column stays in view while the results scroll */
.filters {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  display: flex;
  flex-direction: column;
}

.filters > * {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--color-border);
}

.filters > :first-child {
  padding-top: 0;
}

.filters-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 2px solid var(--color-ink) !important;
}

.filters-header h2 {
  margin: 0;
  font-size: 1.375rem;
}

.filter-dates {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.price-label {
  display: flex;
  justify-content: space-between;
}

.price-label output {
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}

.range-scale {
  display: flex;
  justify-content: space-between;
  color: var(--color-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

/* Only shown on small screens (see media query) */
.filters-toggle {
  display: none;
}

/* [TOPIC: flexbox]  search box grows, sort box keeps its size */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.search-input-wrap {
  position: relative;
  flex: 1 1 18rem;
}

.search-input-wrap .icon {
  position: absolute;
  top: 50%;
  left: 0.9rem;
  color: var(--color-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search-input-wrap .form-control {
  padding-left: 2.6rem;
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sort-wrap label {
  color: var(--color-muted);
  font-size: 0.95rem;
  white-space: nowrap;
}

.sort-wrap .form-control {
  width: auto;
}

.results-meta {
  margin-bottom: 1rem;
}


/* [TOPIC: media queries]  filters become a collapsible panel above the results */
@media (max-width: 1024px) {
  .catalog {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

  .filters-toggle {
    display: inline-flex;
    justify-self: start;
  }

  .filters {
    position: static;
    display: none;
  }

  .filters.is-open {
    display: flex;
  }
}

@media (max-width: 480px) {
  .toolbar .sort-wrap {
    width: 100%;
  }

  .toolbar .sort-wrap .form-control {
    flex: 1;
  }
}
