/* The F1 "Smarter sidebar" (templates/listing-sidebar.html), its results toolbar and the applied-filter
   chips. Values come from the F1 board on the Vehicle Card Redesign canvas. Everything is scoped
   to .lf-*, so the page around it is untouched. */

.lf, .lf-toolbar, .lf-chipbar, .lf-wrap {
    --lf-navy: #19284A;
    --lf-body: #4A5468;
    --lf-muted: #5B6478;
    --lf-line: #E3E6EC;
    --lf-rule: #EEF0F4;
    --lf-purple: #5B2FC9;
    --lf-purple-soft: #D9CCF5;
    --lf-purple-wash: #F4F1FC;
    --lf-good-bg: #E7F6EE; --lf-good: #0F6B3E;
    --lf-caution-bg: #FFF1D1; --lf-caution: #7A4D00;
    --lf-problem-bg: #FDE7EA; --lf-problem: #A3122A;
    --lf-unknown-bg: #EEF1F6; --lf-unknown: #33415C;
    font-family: var(--ff-primary, 'Poppins', sans-serif);
    color: var(--lf-navy);
}

.lf-icon { flex-shrink: 0; display: block; }

/* ---------------------------------------------------------------- the card */
.lf {
    box-sizing: border-box;
    border: 1px solid var(--lf-line);
    border-radius: 16px;
    background: #FFFFFF;
    padding: 8px 18px 18px;
    display: flex;
    flex-direction: column;
}
.lf-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    border-bottom: 1px solid var(--lf-rule);
}
.lf-head__title { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; }
.lf-link {
    border: none;
    background: transparent;
    padding: 0;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--lf-muted);
    cursor: pointer;
}
.lf-link:hover, .lf-link:focus-visible { color: var(--lf-navy); text-decoration: underline; }

/* ---------------------------------------------------------------- groups */
.lf-group { border-bottom: 1px solid var(--lf-rule); padding: 4px 0 16px; }
.lf-group.is-collapsed { padding-bottom: 4px; }
.lf-group__title { margin: 0; font: inherit; }
.lf-group__head {
    width: 100%;
    min-height: 48px;
    padding: 0;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    font: inherit;
    color: var(--lf-navy);
    cursor: pointer;
    text-align: left;
}
.lf-group__name { font-size: 15px; font-weight: 600; white-space: nowrap; }
.lf-group__summary {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    color: var(--lf-muted);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lf-group:not(.is-collapsed) .lf-group__summary { visibility: hidden; }
.lf-group__head .lf-icon { transition: transform 0.15s ease; }
.lf-group__head[aria-expanded="true"] .lf-icon { transform: rotate(180deg); }
.lf-group__body { display: flex; flex-direction: column; gap: 12px; }
.lf-group__body[hidden] { display: none; }
.lf-new {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #1A62C9;
    color: #FFFFFF;
    font-size: 10px;
    line-height: 16px;
    font-weight: 700;
    letter-spacing: 0.06em;
    vertical-align: middle;
}
.lf-count { font-weight: 500; opacity: 0.75; }
.lf [hidden] { display: none !important; }

/* ---------------------------------------------------------------- quick switches */
.lf-switches { display: flex; flex-direction: column; }
.lf-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    font: inherit;
    color: var(--lf-navy);
    cursor: pointer;
    text-align: left;
}
.lf-switch__label { font-size: 14px; }
.lf-switch__input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.lf-switch__track {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 24px;
    border-radius: 999px;
    background: #C9CED8;
    transition: background 0.15s ease;
}
.lf-switch__track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.25);
    transition: transform 0.15s ease;
}
.lf-switch[aria-checked="true"] .lf-switch__track,
.lf-switch__input:checked + .lf-switch__track { background: var(--lf-purple); }
.lf-switch[aria-checked="true"] .lf-switch__track::after,
.lf-switch__input:checked + .lf-switch__track::after { transform: translateX(16px); }
.lf-switch:focus-visible .lf-switch__track,
.lf-switch__input:focus-visible + .lf-switch__track { outline: 2px solid var(--lf-purple); outline-offset: 2px; }

/* ---------------------------------------------------------------- tone, chip and segmented toggles */
.lf-tones, .lf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lf-chip, .lf-tone { position: relative; margin: 0; cursor: pointer; }
.lf-chip__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lf-chip__face, .lf-tone__face {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 13px;
    border-radius: 999px;
    border: 1.5px solid var(--lf-line);
    background: #FFFFFF;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.lf-chip__input:checked + .lf-chip__face { background: var(--lf-navy); border-color: var(--lf-navy); color: #FFFFFF; }
.lf-chip__input:focus-visible + .lf-chip__face,
.lf-chip__input:focus-visible + .lf-tone__face { outline: 2px solid var(--lf-purple); outline-offset: 2px; }
.lf-tone--good .lf-tone__face { background: var(--lf-good-bg); border-color: var(--lf-good-bg); color: var(--lf-good); }
.lf-tone--caution .lf-tone__face { background: var(--lf-caution-bg); border-color: var(--lf-caution-bg); color: var(--lf-caution); }
.lf-tone--problem .lf-tone__face { background: var(--lf-problem-bg); border-color: var(--lf-problem-bg); color: var(--lf-problem); }
.lf-tone--unknown .lf-tone__face { background: var(--lf-unknown-bg); border-color: var(--lf-unknown-bg); color: var(--lf-unknown); }
.lf-tone .lf-chip__input:checked + .lf-tone__face { border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }

.lf-segmented {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: #EEF1F6;
}
.lf-seg {
    height: 40px;
    padding: 0 6px;
    border: none;
    border-radius: 9px;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--lf-navy);
    white-space: nowrap;
    cursor: pointer;
}
.lf-seg[aria-pressed="true"] { background: #FFFFFF; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12); }

/* ---------------------------------------------------------------- checkbox lists */
.lf-list { display: flex; flex-direction: column; }
.lf-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    margin: 0;
    font-weight: 400;
    cursor: pointer;
}
.lf-check__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lf-check__box {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    box-sizing: border-box;
    border-radius: 5px;
    border: 1.5px solid #9AA1AD;
    background: #FFFFFF;
    position: relative;
}
.lf-check__input:checked + .lf-check__box { background: var(--lf-navy); border-color: var(--lf-navy); }
.lf-check__input:checked + .lf-check__box::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 11px;
    border: solid #FFFFFF;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}
.lf-check__input:focus-visible + .lf-check__box { outline: 2px solid var(--lf-purple); outline-offset: 2px; }
.lf-check__label { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 20px; font-weight: 400; color: var(--lf-navy); }
.lf-check .lf-count { font-size: 13px; color: var(--lf-muted); opacity: 1; }
.lf-check.is-extra, .lf-check.is-filtered-out { display: none; }
.lf-check.is-extra.is-searching:not(.is-filtered-out) { display: flex; }

.lf-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    margin: 0;
    padding: 0 12px;
    border: 1.5px solid var(--lf-line);
    border-radius: 10px;
    color: var(--lf-muted);
}
.lf-search__input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 14px;
    color: var(--lf-navy);
}
.lf-search:focus-within { border-color: var(--lf-purple); }
.lf-more {
    align-self: flex-start;
    border: none;
    background: transparent;
    padding: 0;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--lf-purple);
    cursor: pointer;
}
.lf-more:hover { text-decoration: underline; }
.lf-locked {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin: 0;
    padding: 0 12px;
    border-radius: 10px;
    background: #F6F7F9;
    color: var(--lf-muted);
    font-size: 14px;
}

/* ---------------------------------------------------------------- price and mileage */
/* The bars, their labels and the slider's fill all span the thumb centres (an 11px inset each
   side, half the 22px thumb), so a bar sits exactly over the stretch of track that is its range
   (listing-filters.js rangeSegments). */
.lf-range { --lf-thumb-half: 11px; display: flex; flex-direction: column; gap: 12px; }
.lf-bars { display: flex; gap: 4px; height: 56px; align-items: flex-end; padding: 0 var(--lf-thumb-half); }
.lf .lf-bar-hit {
    flex: 1;
    min-width: 0;
    height: 56px;
    display: flex;
    align-items: flex-end;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    cursor: pointer;
}
.lf .lf-bar-hit:disabled { cursor: default; }
.lf-bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--lf-purple); transition: background 0.15s ease-in-out; }
.lf-bar.is-out { background: var(--lf-purple-soft); }
.lf-bar-hit:not(:disabled):hover .lf-bar { background: #4A23A8; }
.lf-bar-hit:not(:disabled):hover .lf-bar.is-out { background: #B9A4EC; }
.lf-ticks { display: flex; gap: 4px; margin-top: 6px; padding: 0 var(--lf-thumb-half); }
.lf-tick { flex: 1; min-width: 0; text-align: center; font-size: 11px; color: var(--lf-muted); }
.lf-slider {
    --lf-from: 0;
    --lf-to: 1;
    position: relative;
    height: 24px;
}
.lf-slider::before, .lf-slider::after {
    content: "";
    position: absolute;
    top: 50%;
    height: 4px;
    margin-top: -2px;
    border-radius: 2px;
}
.lf-slider::before { left: 0; right: 0; background: var(--lf-line); }
.lf-slider::after {
    left: calc(var(--lf-thumb-half) + (100% - 2 * var(--lf-thumb-half)) * var(--lf-from));
    right: calc(var(--lf-thumb-half) + (100% - 2 * var(--lf-thumb-half)) * (1 - var(--lf-to)));
    background: var(--lf-purple);
}
.lf .lf-slider .lf-slider__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 24px;
    margin: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    outline: none;
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    z-index: 1;
}
.lf .lf-slider .lf-slider__input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 2px solid var(--lf-purple);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    margin-top: 1px;
    pointer-events: auto;
    cursor: pointer;
}
.lf .lf-slider .lf-slider__input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 2px solid var(--lf-purple);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    cursor: pointer;
}
.lf .lf-slider .lf-slider__input::-webkit-slider-runnable-track { height: 24px; background: transparent; border: none; box-shadow: none; }
.lf .lf-slider .lf-slider__input::-moz-range-track { background: transparent; border: none; }
.lf-slider__input:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--lf-purple); outline-offset: 2px; }
.lf-minmax, .lf-years { display: flex; align-items: flex-end; gap: 10px; }
.lf-years { align-items: center; }
.lf-minmax__box { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; margin: 0; }
.lf-minmax__label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--lf-muted); }
.lf-minmax__input, .lf-select {
    width: 100%;
    min-width: 0;
    height: 44px;
    box-sizing: border-box;
    padding: 0 12px;
    border: 1.5px solid var(--lf-line);
    border-radius: 10px;
    background: #FFFFFF;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--lf-navy);
}
.lf-select { flex: 1 1 0; }
.lf-minmax__input:focus, .lf-select:focus { outline: none; border-color: var(--lf-purple); }
.lf-minmax__to { padding-bottom: 12px; color: var(--lf-muted); font-size: 14px; }
.lf-years .lf-minmax__to { padding-bottom: 0; }

/* ---------------------------------------------------------------- toolbar, menus and chips */
.lf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.lf-toolbar__count { margin: 0; font-size: 15px; font-weight: 600; color: var(--lf-navy); }
.lf-toolbar__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.lf-menu-wrap { position: relative; }
.lf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}
.lf-btn--ghost { border: 1.5px solid var(--lf-line); background: #FFFFFF; color: var(--lf-navy); }
.lf-btn--ghost:hover, .lf-btn--ghost[aria-expanded="true"] { border-color: var(--lf-navy); }
.lf-btn--primary { width: 100%; height: 52px; border: none; background: var(--lf-purple); color: #FFFFFF; font-size: 16px; }
.lf-sortbtn__key { color: var(--lf-muted); font-weight: 500; }
.lf-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    width: 250px;
    max-height: 70vh;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 6px;
    border: 1px solid var(--lf-line);
    border-radius: 14px;
    background: #FFFFFF;
    box-shadow: 0 16px 40px rgba(16, 24, 40, 0.18);
}
.lf-menu--save { width: 300px; }
.lf-menu__option, .lf-menu__action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 40px;
    padding: 0 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--lf-navy);
    text-align: left;
    cursor: pointer;
}
.lf-menu__option:hover, .lf-menu__action:hover { background: #F6F7F9; }
.lf-menu__option[aria-selected="true"] { background: var(--lf-purple-wash); font-weight: 600; }
.lf-menu__option[aria-selected="true"]::after { content: "✓"; color: var(--lf-purple); font-weight: 700; }
.lf-menu__action { font-weight: 600; }
.lf-menu__action--quiet { color: var(--lf-purple); }
.lf-menu__title {
    margin: 6px 14px 2px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--lf-muted);
}
.lf-menu__list { list-style: none; margin: 0; padding: 0; }
.lf-menu__list li { padding: 4px 14px; font-size: 14px; }

.lf-chipbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 16px; }
.lf-chipbar[hidden] { display: none; }
.lf-chipbar__list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.lf-applied {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--lf-purple-soft);
    border-radius: 999px;
    background: var(--lf-purple-wash);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--lf-navy);
    cursor: pointer;
}
.lf-applied span { font-size: 16px; line-height: 1; color: var(--lf-muted); }
.lf-applied:hover span { color: var(--lf-navy); }

/* ---------------------------------------------------------------- phones: the sidebar is a bottom sheet */
/* The sheet's chrome, shown by each page's own breakpoint: the homepage's below, the sold pages'
   in sold-vehicles.css. */
/* Tall enough to hold the close button, so the options scroll under it, not behind it. */
.lf-sheet-head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: none;
    justify-content: center;
    align-items: flex-start;
    box-sizing: border-box;
    min-height: 52px;
    padding-top: 8px;
    background: #FFFFFF;
}
.lf-sheet-head__grip { width: 40px; height: 4px; border-radius: 2px; background: #C9CED8; }
.lf-sheet-head__closewrap { position: absolute; right: 4px; top: 4px; }
.lf-sheet-head > .lf-sheet-head__close { position: absolute; right: 4px; top: 4px; }
.lf-sheet-head__close {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: transparent url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2319284A' stroke-width='2.2' stroke-linecap='round'><path d='M6 6l12 12M18 6L6 18'/></svg>") center / 22px no-repeat;
    cursor: pointer;
}
.lf-sheet-foot {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: none;
    margin: 8px -16px 0;
    padding: 12px 16px 20px;
    border-top: 1px solid var(--lf-line);
    background: #FFFFFF;
}

@media (max-width: 767px) {
    #col-lg-3 .lf-wrap {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        top: 64px;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        border-radius: 20px 20px 0 0;
        background: #FFFFFF;
        box-shadow: 0 -8px 30px rgba(12, 16, 28, 0.25);
    }
    #col-lg-3 .lf { border: none; border-radius: 0; padding: 0 16px 0; }
    #col-lg-3 .lf-sheet-head { display: flex; }
    #col-lg-3 .lf-sheet-foot { display: block; }
    /* The homepage's close button is the old offcanvas one, whose global rules this beats. */
    #filter-toggle .lf-sheet-head__close.offcanvas__close-btn {
        width: 44px;
        height: 44px;
        border: none;
        border-radius: 10px;
        background-color: transparent !important;
        background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2319284A' stroke-width='2.2' stroke-linecap='round'><path d='M6 6l12 12M18 6L6 18'/></svg>");
        background-size: 22px;
    }
    .lf-toolbar__count { margin-left: auto; }
    .lf-toolbar__actions { width: 100%; margin-left: 0; }
    .lf-toolbar__actions > * { flex: 1 1 0; }
    .lf-toolbar__actions .lf-btn { width: 100%; }
    .lf-menu { right: auto; left: 0; width: min(300px, calc(100vw - 32px)); }
    .lf-menu-wrap:last-child .lf-menu { left: auto; right: 0; }
}
