/* === Final Unified Filter & Sort CSS (cleaned) === */

/* Base container */
#bike-grid-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4em;
  margin: 0.5em auto;
  max-width: 820px;
  padding: 0 4px;
  box-sizing: border-box;
  font-family: 'Inter','Urbanist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* Generic select defaults for all filter dropdowns */
#bike-grid-filters select {
  appearance: menulist;
  -webkit-appearance: menulist;
  -moz-appearance: menulist;
  font-size: 0.85em;
  padding: 2px 6px;
  width: auto;                 /* shrink-to-fit by default */
  min-width: 0;
  max-width: max-content;
  white-space: nowrap;
  background-color: #f9f9f9;
  color: #1c1c1e;
  border: 1px solid #c7c7cc;
  border-radius: 12px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
  transition: border 0.2s ease, box-shadow 0.2s ease;
  background-image: none;                  /* remove native arrow if themed */
  background-position: right 6px center;
  padding-right: 6px;                      /* room for arrow if it appears */
  flex: 0 0 auto;                          /* don’t stretch in flex rows */
}

/* Focus */
#bike-grid-filters select:focus {
  border-color: #007aff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(0,122,255,0.2);
}

/* ---------- Filter row & label ---------- */
.filter-row {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;           /* keep on one line (we’ll wrap on very small screens only) */
  gap: 0.5em;
  margin-top: 0.4em;
  padding: 0 4vw;
}

.filter-label,
.sort-label {
  font-size: 0.85em;           /* readable, compact */
  font-weight: 500;
  margin-right: 0.4em;
  white-space: nowrap;
  font-family: inherit;         /* follow parent font */
}

/* ---------- Sort by price area ---------- */

/* Center the sort label + dropdown together */
#bike-grid-sort {
  display: inline-flex;           /* keep label and dropdown on one line */
  align-items: center;
  justify-content: center;        /* center horizontally inside its parent */
  gap: 0.35em;                     /* spacing between label and select */
  width: 100%;                     /* allow justify-content to work full-width */
  text-align: center;
}

/* Give the sort select a specific class in JS: .bd-sort-select */
#bike-grid-sort .bd-sort-select {
  width: auto !important;       /* kill any legacy fixed widths */
  min-width: 120px;             /* snaps to this when content is short */
  max-width: max-content;
  font-size: 0.8em;             /* compact base size */
  line-height: 1.2;
  padding: 2px 6px;
}

/* ---------- No-match fallback ---------- */
.no-match-message {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 1rem;
  text-align: center;
  padding: 2em 1em;
  color: #333;
  max-width: 90%;
  margin: 2vh auto 0;
  background: #f8f8f8;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  line-height: 1.4;
}

/* ================= Mobile (iPhone 12 width and similar) ================= */
@media screen and (max-width: 430px) {
  .filter-row {
    flex-wrap: wrap;            /* allow wrapping only on very narrow */
    justify-content: center;
    gap: 0.4em;
    padding: 0 2vw;
  }

  .filter-row select {
    font-size: 0.8em;
    padding: 2px 4px;
    width: auto !important;     /* ensure no vw widths survive */
    min-width: 0;
    max-width: max-content;
    margin: 4px;
    flex: 0 0 auto;
  }

  /* Sort: keep compact and inline */
  #bike-grid-sort .bd-sort-select {
    font-size: 0.8em;
    padding: 2px 6px;
    width: auto !important;
    min-width: 120px;
    max-width: max-content;
    margin: 0;                  /* no auto-centering block behavior */
    display: inline-block;
  }
}

/* ================= Desktop (≥768px) ================= */
@media screen and (min-width: 768px) {
  .filter-row {
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 0.4em;
  }

  .filter-label,
  .sort-label {
    font-size: 0.85em;
  }

  .filter-row select {
    width: auto;
    min-width: 0;
    max-width: max-content;
    white-space: nowrap;
    font-size: 0.75em;          /* slightly smaller filters on desktop */
    padding: 2px 4px;
    flex: 0 0 auto;
  }

  /* Sort by price ~20% smaller on desktop, snap to min width */
  #bike-grid-sort .bd-sort-select {
    font-size: 0.75em;          /* ~20% smaller */
    padding: 2px 6px;
    width: auto !important;
    min-width: 130px;           /* slightly wider min is OK for desktop */
    max-width: max-content;
    margin-left: 0.35em;
    display: inline-block;
  }
}
