/* Public cars-for-trade list (/cars-for-trade/): SellAnyCarFast design system v1.6, marketplace context
   (white cards on a soft surface, 10px action buttons, 6px inputs). Scoped under .cfs. */

.cfs,
.cfs *,
.cfs *::before,
.cfs *::after { box-sizing: border-box; }

.cfs {
  --cfs-text: #0d131c;
  --cfs-text-2: #475569;
  --cfs-text-muted: #64748b;
  --cfs-primary: #40c7b1;
  --cfs-primary-text: #0f8f7e;
  --cfs-border: #e2e8f0;
  --cfs-border-strong: #cbd5e1;
  --cfs-soft: #f5f7f9;
  --cfs-yellow: #ffcc00;
  min-width: 0;
  padding: 32px 0 56px;
  background: var(--cfs-soft);
  color: var(--cfs-text);
  font-family: "Poppins", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
}
.cfs :where(h1, h2, h3, p, ul, ol, dl, dd, fieldset) { margin: 0; padding: 0; }
.cfs :where(ul, ol) { list-style: none; }
.cfs :where(a, button, input, select):focus-visible { outline: 2px solid var(--cfs-primary); outline-offset: 2px; }
.cfs a { color: inherit; text-decoration: none; }

.cfs-wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.cfs-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Intro ---------- */
.cfs-intro { margin-bottom: 24px; }
.cfs-title { font-size: clamp(2.5rem, 2rem + 2vw, 3.5rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.cfs-title-accent { background-image: url(/img/underline-warning.png); background-repeat: no-repeat; background-position: 0 100%; background-size: 100% 0.32em; padding-bottom: 0.14em; }
.cfs-lead { margin-top: 8px; font-size: 16px; color: var(--cfs-text-2); }

/* ---------- Layout ---------- */
.cfs-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }

.cfs-card { background: #fff; border: 1px solid var(--cfs-border); border-radius: 10px; }

/* ---------- Filters ---------- */
.cfs-filters { background: #fff; border: 1px solid var(--cfs-border); border-radius: 10px; }
.cfs-filters-toggle { display: none; }
.cfs-filters-head { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 20px; min-height: 60px; border-bottom: 1px solid var(--cfs-border); }
.cfs-filters-title { font-size: 16px; font-weight: 600; }
.cfs-filters-close { display: none; align-items: center; justify-content: center; width: 44px; height: 44px; background: transparent; border: 0; border-radius: 10px; color: var(--cfs-text); font-size: 24px; cursor: pointer; }
.cfs-filters-close:hover { background: var(--cfs-soft); }
.cfs-group { border: 1px solid var(--cfs-border); border-radius: 10px; margin: 12px 16px 0; padding: 14px 16px 16px; min-width: 0; }
.cfs-group legend { float: left; width: 100%; margin: 0 0 12px; padding: 0; font-size: 14px; font-weight: 600; }
.cfs-group legend + * { clear: both; }
.cfs-label { display: block; margin: 12px 0 4px; font-size: 14px; font-weight: 500; line-height: 1.5; }
.cfs-group legend + .cfs-label { margin-top: 0; }
.cfs-note { margin-top: 8px; font-size: 13px; font-weight: 500; color: var(--cfs-text-muted); }
.cfs-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cfs-pair .cfs-label { margin-top: 0; }

.cfs-input { display: block; width: 100%; min-height: 48px; padding: 0 14px; background: #fff; color: var(--cfs-text); border: 1px solid var(--cfs-border-strong); border-radius: 6px; font: 400 16px/1.4 "Poppins", sans-serif; }
.cfs-input::placeholder { color: var(--cfs-text-muted); opacity: 1; }
.cfs-input:focus { border-color: var(--cfs-primary-text); }
select.cfs-input { appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

.cfs-radios { display: grid; gap: 2px; }
.cfs-radio, .cfs-check { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; font-size: 15px; }
.cfs-check { margin-top: 14px; min-height: 48px; padding: 10px 12px; border: 1px solid var(--cfs-primary); border-radius: 6px; background: #fff; }
.cfs-radio input, .cfs-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--cfs-primary); flex: none; cursor: pointer; }

.cfs-filters-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; padding: 18px 20px 20px; }
.cfs-clear-link { text-align: center; font-size: 14px; font-weight: 600; color: var(--cfs-primary-text); padding: 6px; }
.cfs-clear-link:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.cfs-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border: 1px solid transparent; border-radius: 10px; font: 600 14px/1.4 "Poppins", sans-serif; cursor: pointer; transition: background-color .2s, border-color .2s, color .2s; white-space: nowrap; }
.cfs-btn--primary { background: var(--cfs-primary); color: var(--cfs-text); }
.cfs-btn--primary:hover { background: #35b6a1; }
.cfs-btn--dark { background: var(--cfs-text); color: #fff; }
.cfs-btn--dark:hover { background: #1f2a3a; }
.cfs-btn--outline { background: transparent; color: var(--cfs-primary-text); border-color: var(--cfs-primary); }
.cfs-btn--outline:hover { background: rgba(64, 199, 177, .12); }
.cfs-btn--small { min-height: 36px; padding: 0 14px; }

/* ---------- Results ---------- */
.cfs-results { min-width: 0; display: grid; gap: 16px; }

.cfs-searchbar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; padding: 16px; }
.cfs-input--search { flex: 1; min-width: 200px; }
.cfs-btn--search { min-height: 48px; padding: 0 24px; border-radius: 10px; }

.cfs-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 20px 24px; }
.cfs-summary-top { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.cfs-count { flex: 0 1 auto; font-size: 22px; font-weight: 700; line-height: 1.3; }
.cfs-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cfs-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px; background: var(--cfs-soft); border: 1px solid var(--cfs-border-strong); border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--cfs-text); transition: border-color .2s; }
.cfs-chip:hover { border-color: var(--cfs-text-muted); }

.cfs-sortfield { flex: none; display: flex; align-items: flex-start; gap: 12px; }
.cfs-input--sort { width: 230px; }

.cfs-list { display: grid; gap: 12px; }
.cfs-car { display: flex; align-items: stretch; justify-content: space-between; gap: 24px; background: #fff; border: 1px solid var(--cfs-border); border-radius: 10px; padding: 22px 24px; transition: border-color .2s, box-shadow .2s; }
.cfs-car:hover { border-color: var(--cfs-primary); box-shadow: 0 2px 12px rgba(13, 19, 28, .07); }
.cfs-car-main { min-width: 0; flex: 1; }
.cfs-car-title { font-size: 18px; font-weight: 600; line-height: 1.4; }
.cfs-car-meta { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 2px; font-size: 13px; font-weight: 500; color: var(--cfs-text-muted); }
.cfs-car-meta span { display: inline-flex; align-items: center; gap: 4px; }
.cfs-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cfs-badges:empty { display: none; }
.cfs-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.cfs-badge--drop { background: #fff9c9; color: #7a5b00; }


.cfs-car-side { display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 16px; flex: none; text-align: center; padding-left: 24px; border-left: 1px solid var(--cfs-border); min-width: 210px; }
.cfs-price { display: grid; gap: 0; }
.cfs-price-label { font-size: 13px; font-weight: 500; color: var(--cfs-text-muted); }
.cfs-price strong { font-size: 20px; font-weight: 700; line-height: 1.3; }
.cfs-car-cta { margin-top: auto; }
.cfs-car:hover .cfs-car-cta { background: #35b6a1; }

.cfs-empty { display: grid; justify-items: center; gap: 8px; padding: 56px 24px; text-align: center; }
.cfs-empty i { font-size: 40px; color: var(--cfs-text-muted); }
.cfs-empty h3 { font-size: 20px; font-weight: 600; }
.cfs-empty p { color: var(--cfs-text-2); margin-bottom: 8px; }

/* ---------- Pagination ---------- */
.cfs-pagination { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 8px; }
.cfs-page { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 12px; background: #fff; border: 1px solid var(--cfs-border-strong); border-radius: 10px; font-size: 14px; font-weight: 600; transition: border-color .2s, background-color .2s; }
.cfs-page:hover { border-color: var(--cfs-primary); }
.cfs-page.is-current { background: var(--cfs-text); border-color: var(--cfs-text); color: #fff; }
.cfs-page-gap { color: var(--cfs-text-muted); padding: 0 2px; }
.cfs-page--arrow i { font-size: 20px; }

/* ---------- Register band ---------- */
.cfs-cta { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 16px; padding: 28px 32px; background: #d9ffea; border-radius: 10px; }
.cfs-cta h2 { font-size: 22px; font-weight: 700; line-height: 1.3; }
.cfs-cta p { margin-top: 4px; font-size: 15px; color: var(--cfs-text-2); max-width: 560px; }
.cfs-cta .cfs-btn { min-height: 52px; padding: 0 28px; font-size: 16px; }

/* ---------- Tablet / mobile ---------- */
@media (max-width: 1023px) {
  .cfs-layout { grid-template-columns: 1fr; gap: 16px; }
  .cfs-filters-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 0 20px; background: transparent; border: 0; font: 600 16px/1.4 "Poppins", sans-serif; color: var(--cfs-text); cursor: pointer; text-align: left; }
  .cfs-filters-toggle i:first-child { font-size: 20px; color: var(--cfs-primary-text); }
  .cfs-filters-toggle span { flex: 1; }
  .cfs-filters-toggle-caret { font-size: 22px; transition: transform .2s; }
  .cfs-filters-toggle[aria-expanded="true"] .cfs-filters-toggle-caret { transform: rotate(180deg); }
  /* on a narrow screen the filters sit above the search */
}

@media (max-width: 767px) {
  .cfs { padding: 24px 0 40px; }
  .cfs-count { font-size: 20px; }
  .cfs-summary { padding: 16px; }
  .cfs-car { flex-direction: column; gap: 16px; padding: 18px 16px; }
  .cfs-car-title { font-size: 16px; }
    .cfs-car-side { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; text-align: left; min-width: 0; padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--cfs-border); }
  .cfs-price strong { font-size: 18px; }
  .cfs-car-cta { margin-top: 0; }
  .cfs-btn--search span { display: none; }
  .cfs-btn--search { padding: 0 16px; }
  .cfs-cta { flex-direction: column; align-items: stretch; text-align: left; padding: 24px 20px; }
  .cfs-cta .cfs-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .cfs * { transition: none !important; }
}

/* ---------- counts beside the filter options (loaded with AJAX) ---------- */
.cfs-num { margin-left: auto; flex: none; min-width: 32px; padding: 0 10px; border-radius: 999px; background: #d9ffea; color: #087f70; font-style: normal; font-size: 13px; font-weight: 600; line-height: 24px; text-align: center; }
.cfs-num:empty { display: none; }
.cfs-radio.is-empty, .cfs-check.is-empty { color: var(--cfs-text-muted); }
.is-empty > .cfs-num { background: var(--cfs-soft); color: var(--cfs-text-muted); }
.cfs-layout.is-loading .cfs-results { opacity: .6; transition: opacity .15s; pointer-events: none; }

/* ---------- make logo ---------- */
.cfs-car-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 0 16px; padding-bottom: 16px; border-bottom: 1px solid var(--cfs-border); }
.cfs-car-head .cfs-logo { grid-row: 1; }
.cfs-car-head .cfs-badges { grid-column: 1 / -1; }
.cfs-car-head .cfs-dropoff { width: 100%; }
.cfs-car-head-text { min-width: 0; align-self: center; } /* centred beside the logo; a long title that is taller than the logo just fills the row */
.cfs-logo { flex: none; display: flex; align-items: center; justify-content: center; width: 72px; height: 72px; padding: 10px; background: #fff; border: 1px solid var(--cfs-border); border-radius: 10px; }
.cfs-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.cfs-logo i { font-size: 28px; color: var(--cfs-text-muted); }
@media (max-width: 767px) {
  .cfs-car-head { gap: 0 12px; }
  /* the "seller happy to bring the car" box runs the full width of the card, under the logo too */
  .cfs-car-head .cfs-badges { grid-column: 1 / -1; }
  .cfs-car-head .cfs-logo { grid-row: 1; }
  .cfs-car-head .cfs-dropoff { width: 100%; }
  .cfs-logo { width: 56px; height: 56px; padding: 8px; }
}

/* ---------- drop-down with coloured counts (built by script.js from the real <select>) ---------- */
.cfs-select { position: relative; }
.cfs-select-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cfs-select-btn { display: flex; align-items: center; justify-content: space-between; text-align: left; cursor: pointer; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.cfs-filters .cfs-select-btn { border-color: var(--cfs-primary); }
.cfs-select.is-open { z-index: 31; }
.cfs-select.is-open .cfs-select-btn { border: 2px solid var(--cfs-primary-text); border-bottom-color: transparent; border-radius: 12px 12px 0 0; outline: none; box-shadow: none; }
.cfs-select-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfs-select-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; max-height: 320px; overflow-y: auto; background: #fff; border: 2px solid var(--cfs-primary-text); border-top: 0; border-radius: 0 0 12px 12px; box-shadow: none; padding: 4px 0 8px; }
.cfs-select-list[hidden] { display: none; }
.cfs-select-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 10px 12px; border-radius: 0; font-size: 15px; cursor: pointer; }
.cfs-select-list li:hover, .cfs-select-list li:focus { background: var(--cfs-soft); outline: 0; }
.cfs-select-list li:focus-visible { outline: 2px solid var(--cfs-primary-text); outline-offset: -2px; }
.cfs-select-list li[aria-selected="true"] { background: #f3f4f6; }
.cfs-select-list li[aria-disabled="true"] { color: var(--cfs-text-muted); cursor: not-allowed; }
.cfs-select-list li[aria-disabled="true"]:hover { background: transparent; }

/* ---------- price range slider ---------- */
.cfs-range { --lo: 0; --hi: 1; --thumb: 24px; }
.cfs-range-label { margin-bottom: 8px; font-size: 15px; font-weight: 600; }
.cfs-hist { display: flex; align-items: flex-end; gap: 2px; height: 56px; padding: 0 calc(var(--thumb) / 2); }
.cfs-hist i { flex: 1; min-width: 0; background: #d9ffea; border-radius: 2px 2px 0 0; transition: background-color .15s; }
.cfs-hist i.is-in { background: #8fe3d3; }
.cfs-range-track { position: relative; height: var(--thumb); margin-top: 4px; }
.cfs-range-track::before { content: ""; position: absolute; left: calc(var(--thumb) / 2); right: calc(var(--thumb) / 2); top: 50%; height: 4px; margin-top: -2px; background: var(--cfs-border-strong); border-radius: 2px; }
.cfs-range-fill { position: absolute; top: 50%; height: 4px; margin-top: -2px; background: var(--cfs-primary-text); border-radius: 2px;
  left: calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--lo)); right: calc(var(--thumb) / 2 + (100% - var(--thumb)) * (1 - var(--hi))); }
.cfs-range-input { position: absolute; left: 0; top: 0; width: 100%; height: var(--thumb); margin: 0; padding: 0; background: transparent; pointer-events: none; -webkit-appearance: none; appearance: none; z-index: 2; }
.cfs-range-input:focus { outline: 0; }
.cfs-range-input::-webkit-slider-runnable-track { height: var(--thumb); background: transparent; border: 0; }
.cfs-range-input::-moz-range-track { height: var(--thumb); background: transparent; border: 0; }
.cfs-range-input::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: var(--thumb); height: var(--thumb); margin: 0; border-radius: 50%; background: var(--cfs-primary); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--cfs-primary-text), 0 2px 6px rgba(13, 19, 28, .25); cursor: grab; pointer-events: auto; }
.cfs-range-input::-moz-range-thumb { width: calc(var(--thumb) - 6px); height: calc(var(--thumb) - 6px); border-radius: 50%; background: var(--cfs-primary); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--cfs-primary-text), 0 2px 6px rgba(13, 19, 28, .25); cursor: grab; pointer-events: auto; }
.cfs-range-input:active::-webkit-slider-thumb { cursor: grabbing; }
.cfs-range-input:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--cfs-primary); outline-offset: 2px; }
.cfs-range-input:focus-visible::-moz-range-thumb { outline: 2px solid var(--cfs-primary); outline-offset: 2px; }

@media (max-width: 767px) {
  .cfs-sortfield { width: 100%; order: 3; flex-direction: column; align-items: stretch; }
  .cfs-input--sort { width: 100%; }
}

/* ---------- phone / tablet order: count, search + sort, then Filters, then the list ---------- */
@media (max-width: 1023px) {
  .cfs-results { display: contents; }
  .cfs-results > * { order: 4; }
  .cfs-results > .cfs-summary { order: 1; }
  .cfs-results > .cfs-searchbar { order: 2; }
  .cfs-layout > .cfs-filters { order: 3; }
  .cfs-results > .cfs-cta { margin-top: 0; }
}

/* a group whose fields already have their own labels: the heading stays for screen readers only */
.cfs-group legend.cfs-sr-only { float: none; width: 1px; margin: -1px; }

/* ---------- filters pop-up sheet (phone / tablet) ---------- */
html.cfs-lock { overflow: hidden; }
@media (max-width: 1023px) {
  .cfs-filters-toggle-caret { transform: none !important; }
  .cfs-filters.is-open { position: fixed; z-index: 1000; inset: 0; background: rgba(13, 19, 28, .55); border: 0; border-radius: 0; }
  .cfs-filters.is-open .cfs-filters-toggle { display: none; }
  .cfs-filters-body { display: none; }
  .cfs-filters.is-open .cfs-filters-body { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -8px 32px rgba(13, 19, 28, .25); }
  .cfs-filters-head { position: sticky; top: 0; z-index: 2; background: #fff; flex: none; }
  .cfs-filters-close { display: inline-flex; }
  .cfs-filters.is-open .cfs-filters-actions { position: sticky; bottom: 0; z-index: 2; background: #fff; border-top: 1px solid var(--cfs-border); padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); }
  .cfs-filters.is-open .cfs-filters-actions .cfs-btn { min-height: 52px; font-size: 16px; }
}

.cfs-tag { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 12px; background: #d9ffea; color: #087f70; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.3; }
.cfs-tag i { font-size: 15px; }
.cfs-tag--hurry { background: #fff9c9; color: #7a5b00; }
.cfs-near { min-height: 48px; white-space: nowrap; }

/* the two tags take turns in the same place: each shows for about 4 seconds, fading in and out */
.cfs-tags { display: inline-grid; }
.cfs-tags > .cfs-tag { grid-area: 1 / 1; justify-self: start; animation: cfs-tag-turn 8s linear infinite; }
.cfs-tags > .cfs-tag:nth-child(2) { animation-delay: -4s; }
@keyframes cfs-tag-turn {
  0%, 44% { opacity: 1; visibility: visible; }
  50%, 94% { opacity: 0; visibility: hidden; }
  100% { opacity: 1; visibility: visible; }
}
@media (prefers-reduced-motion: reduce) {
  /* no movement: both tags are shown together */
  .cfs-tags { display: inline-flex; flex-wrap: wrap; gap: 8px; }
  .cfs-tags > .cfs-tag { animation: none; opacity: 1; visibility: visible; }
}

/* "Seller happy to bring the car to you": a small callout with the distance on its own line */
.cfs-badges { margin-top: 12px; }
.cfs-dropoff { display: flex; align-items: center; gap: 12px; width: fit-content; max-width: 100%; padding: 10px 16px 10px 10px; background: #fcf8e3; border: 1px solid #ebdfa6; border-radius: 12px; }
.cfs-dropoff-icon { flex: none; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; background: #f1dc86; border-radius: 50%; color: #3f3a1f; font-size: 16px; line-height: 1; }
.cfs-dropoff-text { display: grid; gap: 0; min-width: 0; line-height: 1.35; }
.cfs-dropoff-text strong { font-size: 14px; font-weight: 600; color: var(--cfs-text); }
.cfs-dropoff-text span { font-size: 13px; font-weight: 500; color: var(--cfs-text-2); }
/* a car with no details to list: no divider line under the heading */
.cfs-car-head:last-child { border-bottom: 0; padding-bottom: 0; }

/* link-buttons keep their own text colour (the page-wide `.cfs a { color: inherit }` would otherwise win) */
.cfs a.cfs-btn--dark, .cfs a.cfs-btn--dark:hover { color: #fff; }
.cfs a.cfs-btn--outline { color: var(--cfs-primary-text); }
.cfs a.cfs-btn--primary { color: var(--cfs-text); }
.cfs-cta-count { color: var(--cfs-text); font-weight: 600; }

/* each filter group is a box of its own (no group titles) */
.cfs-group > .cfs-label:first-of-type { margin-top: 0; }
.cfs-filters-actions { padding-top: 16px; }

/* the car's details as small chips: icon + value (fuel, miles, gearbox, colour, service history) */
.cfs-specs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.cfs-spec { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; background: var(--cfs-soft); border-radius: 10px; font-size: 14px; font-weight: 500; line-height: 1.4; color: var(--cfs-text); }
.cfs-spec i { flex: none; font-size: 18px; color: var(--cfs-primary-text); }
/* a fault (no valid MOT, MOT failed, corrosion, warning lights, mileage went down, recall, on finance) is drawn in red */
.cfs-spec--fault { background: #fee2e2; color: #991b1b; font-weight: 600; }
.cfs-spec--fault i { color: #dc2626; }

/* banner in the middle of the list: two messages that take turns, and a register button */
.cfs-promo-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 28px; background: #d9ffea; border-radius: 10px; }
.cfs-promo-msgs { display: grid; min-width: 0; }
.cfs-promo-msg { grid-area: 1 / 1; display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; line-height: 1.3; color: var(--cfs-text); animation: cfs-tag-turn 8s linear infinite; }
.cfs-promo-msg:nth-child(2) { animation-delay: -4s; }
.cfs-promo-msg i { flex: none; font-size: 26px; color: #087f70; }
.cfs-promo-btn { flex: none; min-height: 52px; padding: 0 28px; font-size: 16px; }
@media (max-width: 767px) {
  .cfs-promo-inner { flex-direction: column; align-items: stretch; gap: 16px; padding: 20px 16px; }
  .cfs-promo-msg { font-size: 18px; }
  .cfs-promo-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cfs-promo-msgs { gap: 6px; }
  .cfs-promo-msg { grid-area: auto; animation: none; opacity: 1; visibility: visible; }
}

/* phone: the boxes run edge to edge (no side gutter); only the heading text keeps its margin */
@media (max-width: 767px) {
  .cfs-wrap { padding: 0; }
  .cfs-intro, .cfs-pagination { padding-left: 16px; padding-right: 16px; }
  .cfs-card, .cfs-filters, .cfs-car { border-left: 0; border-right: 0; border-radius: 0; }
  .cfs-promo-inner, .cfs-cta { border-radius: 0; }
  .cfs-list { gap: 8px; }
}

/* desktop: the "seller happy to bring the car" box is one line (message, then the distance after a dot) */
@media (min-width: 768px) {
  .cfs-dropoff { padding: 8px 16px 8px 8px; }
  .cfs-dropoff-icon { width: 28px; height: 28px; font-size: 15px; }
  .cfs-dropoff-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
  .cfs-dropoff-text strong + span::before { content: "\00b7"; margin-right: 8px; color: var(--cfs-text-muted); font-weight: 700; }
}

/* phone / tablet: the Filters button is inside the search card, under "Show cars near me", the same size; the box that held the old toggle goes */
.cfs-filters-open { display: none; }
@media (max-width: 1023px) {
  .cfs-filters:not(.is-open) { display: none; }
  .cfs-searchbar > .cfs-filters-open { display: inline-flex; flex: 1 1 100%; width: 100%; order: 4; min-height: 48px; background: #fff; }
  .cfs-searchbar > .cfs-filters-open:hover { background: #effbf9; }
}

/* "Show cars near me": a white button (not see-through) */
.cfs a.cfs-near { background: #fff; }
.cfs a.cfs-near:hover { background: #effbf9; }

/* the search box, the sort drop-down and the two buttons in the search card all have the same green border */
.cfs-searchbar :is(.cfs-input--search, .cfs-input--sort, .cfs-select-btn) { border-color: var(--cfs-primary); }
.cfs-searchbar :is(.cfs-input--search, .cfs-input--sort, .cfs-select-btn):focus,
.cfs-searchbar .cfs-select.is-open .cfs-select-btn { border-color: var(--cfs-primary-text); }

/* Join the sort trigger and native picker inside one matching border. */
@supports (appearance: base-select) {
  .cfs #cfs-sort,
  .cfs #cfs-sort::picker(select) { appearance: base-select; }
  .cfs #cfs-sort {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background-image: none;
    text-align: left;
  }
  .cfs #cfs-sort::picker-icon { color: var(--cfs-text-2); font-size: 12px; flex: none; }
  .cfs #cfs-sort:open {
    border: 2px solid var(--cfs-primary-text);
    border-bottom-color: transparent;
    border-radius: 12px 12px 0 0;
    outline: none;
    box-shadow: none;
  }
  .cfs #cfs-sort::picker(select) {
    top: anchor(bottom);
    right: auto;
    bottom: 16px;
    left: anchor(left);
    position-try-fallbacks: none;
    margin: 0;
    width: anchor-size(width);
    height: max-content;
    padding: 4px 0 8px;
    border: 2px solid var(--cfs-primary-text);
    border-top: 0;
    border-radius: 0 0 12px 12px;
    background: #fff;
    color: var(--cfs-text);
    box-shadow: none;
    font: inherit;
    max-width: calc(100vw - 32px);
    max-height: min(420px, 70dvh);
    max-height: stretch;
    overflow-y: auto;
  }
  .cfs #cfs-sort option {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 0;
    background: #fff;
    color: var(--cfs-text);
    white-space: normal;
    cursor: pointer;
  }
  .cfs #cfs-sort option:is(:hover, :focus-visible) { background: var(--cfs-soft); }
  .cfs #cfs-sort option:focus-visible { outline: 2px solid var(--cfs-primary-text); outline-offset: -2px; }
  .cfs #cfs-sort option:checked { background: #f3f4f6; }
  .cfs #cfs-sort option::checkmark { display: none; }
}
.cfs-check span { white-space: nowrap; }

/* Vehicle Condition Score: wider screens show the ring in the right-hand column (between the price and the button); phones get one line of text under the car details */
.cfs-cond { display: none; }
.cfs-cond-text { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--cfs-border); border-radius: 10px; background: var(--cfs-soft); font-size: 14px; font-weight: 500; line-height: 1.5; color: var(--cfs-text); }
.cfs-cond-text i { flex: none; font-size: 18px; }
.cfs-cond-text span { min-width: 0; }
.cfs-cond-text--very_good { background: #dcfce7; border-color: #86efac; color: #14532d; }
.cfs-cond-text--good { background: #fdf6dc; border-color: #ecc95c; color: #5f4300; }
.cfs-cond-text--attention { background: #ffedd5; border-color: #fdba74; color: #7c2d12; }
.cfs-cond-text--significant { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
@media (min-width: 768px) {
  .cfs-cond-text { display: none; }
  .cfs-cond { display: block; align-self: center; }
  .cfs-cond .cs-tile { flex-direction: column; align-items: center; gap: 6px; width: 142px; margin: 0; padding: 10px 8px 12px; text-align: center; background: #f8fafc; border: 1px solid var(--cfs-border); border-radius: 12px; }
  .cfs-cond .cs-tile-cap { display: block; }
  .cfs-cond .cs-ring--sm { width: 96px; height: 96px; }
  .cfs-cond .cs-ring--sm .cs-ring-text strong { font-size: 1.625rem; }
  .cfs-cond .cs-ring--sm .cs-ring-text span { font-size: .625rem; }
  .cfs-cond .cs-tile-info { align-items: center; }
  .cfs-cond .cs-tile-label { text-align: center; font-size: .75rem; }
  .cfs-cond .cs-tile-label i { font-size: 14px; }
  .cfs-cond .cs-tile-label { align-items: center; justify-content: center; max-width: 100%; }
  .cfs-cond .cs-tile-label-text { display: block; width: min-content; line-height: 1.25; text-align: center; }
  .cfs-cond .cs-tile--none .cs-tile-label { font-size: .6875rem; }
  .cfs-cond .cs-tile--none .cs-tile-label i { font-size: 12px; }
}
/* the ring draws when its card scrolls into view (script.js adds .cfs-in), not all at once when the page loads: until then only the grey track shows.
   Reduced motion: no animation, the ring is simply there. */
@media (prefers-reduced-motion: no-preference) {
  .cfs-ringwait .cfs-cond .cs-ring-fill:not(.cfs-in) { opacity: 0; animation: none; }
}
