/* =========================================================================
 * ec_vehicle_listing — storefront search (hero block + detailed page)
 *
 * Visual reference: mobile.de homepage hero + detailsuche page.
 * Plain CSS (no preprocessor) so the file ships ready to use.
 * ===================================================================== */

/*
 * Phase 15.12 — design tokens upgraded to match mobile.de's live hero
 * exactly (extracted from the rendered computed styles 2026-06-09):
 *   --ec-vs-accent  brand orange: was #ff6a00 → now #DB3000 (CTA + active rail icon)
 *   --ec-vs-purple  Buy/Lease + Brutto/Netto toggle outline
 *   --ec-vs-text    softer near-black
 *   --ec-vs-field-* filled-state vs disabled-state field backgrounds
 *   --ec-vs-card-ring  1px ring around the white card (no real border)
 */
:root {
    --ec-vs-bg:           #ebeef2;
    --ec-vs-card:         #ffffff;
    --ec-vs-border:       #7e838f;
    --ec-vs-border-disabled: #b9bfc7;
    --ec-vs-card-ring:    #d5dae0;
    --ec-vs-text:         #1b1b21;
    --ec-vs-muted:        #5d616b;
    --ec-vs-muted-2:      #93979b;
    --ec-vs-accent:       #db3000;  /* mobile.de brand orange */
    --ec-vs-accent-2:     #003c8f;  /* deep blue (used for "Detailed search" link) */
    --ec-vs-purple:       #68298a;  /* Buy/Lease toggle outline */
    --ec-vs-field-active: #e6eaf0;  /* dropdown bg when usable */
    --ec-vs-field-disabled: #f5f7fa;
    --ec-vs-shadow:       0 1px 2px rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.04);
    --ec-vs-radius:       8px;
    --ec-vs-radius-card:  16px;
}

/* =========================================================================
 * Homepage hero
 * ===================================================================== */

.ec-hero {
    background: linear-gradient(135deg, #1a2750 0%, #003c8f 100%);
    color: #fff;
    padding: 48px 16px;
    border-radius: var(--ec-vs-radius);
    margin-bottom: 24px;
}
.ec-hero__inner { max-width: 1100px; margin: 0 auto; }
.ec-hero__title { font-size: 32px; font-weight: 700; margin: 0 0 8px; line-height: 1.2; color: #fff; }
.ec-hero__sub   { font-size: 16px; opacity: .85; margin: 0 0 24px; }

/* =========================================================================
 * Phase 13 — mobile.de homepage clone.
 *
 * Coloured band (.ec-hero) holds a WHITE card (.ec-hero__card) which
 * houses a vertical icon rail on the left + form on the right. Matches
 * mobile.de's homepage structure: dark band on top of page, off-white
 * search panel inside it, with the rail and form sharing horizontal
 * space inside the card.
 *
 * The Phase-12 horizontal tab rules below this comment are legacy and
 * no longer used by the hero template; kept here as a fallback for any
 * cached compiled templates that haven't rebuilt yet. They'll get GC'd
 * on the next CSS cleanup pass.
 * ===================================================================== */

.ec-hero__card {
    background: var(--ec-vs-card);
    /* Phase 15.12 — mobile.de uses 16px corner radius + a hairline
       1px ring (box-shadow), not a heavy drop shadow. */
    border-radius: var(--ec-vs-radius-card);
    box-shadow: 0 0 0 1px var(--ec-vs-card-ring);
    overflow: visible;
    color: var(--ec-vs-text);
}

.ec-hero__shell {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    align-items: stretch;
    min-height: 280px;
}

.ec-hero__rail {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: #f7f8fa;
    border-right: 1px solid var(--ec-vs-border);
    border-radius: var(--ec-vs-radius) 0 0 var(--ec-vs-radius);
    padding: 12px 0;
}
.ec-hero__rail-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
    border: none;
    background: transparent;
    color: var(--ec-vs-muted);
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
    /* Anchor reset */
    text-decoration: none;
}
.ec-hero__rail-item:hover,
.ec-hero__rail-item:focus-visible {
    background: #eef0f3;
    color: var(--ec-vs-text);
    outline: none;
}
.ec-hero__rail-item:focus-visible { box-shadow: inset 2px 0 0 var(--ec-vs-accent); }
.ec-hero__rail-item--active {
    color: var(--ec-vs-accent);
    background: #fff;
    box-shadow: inset 3px 0 0 var(--ec-vs-accent);
}
/* Mobile.de's icons use viewBox="0 0 48 24" (2:1 aspect). Sizing at
   44x22 keeps them readable in the 80px rail without distortion. */
.ec-hero__rail-icon { display: inline-flex; width: 44px; height: 22px; }
.ec-hero__rail-icon svg { width: 100%; height: 100%; display: block; }
/* The "More" SVG is 24x24 (square dots), so keep it tighter — UNLESS
   it's been promoted (Phase 15.10) to show an overflow-class's 48x24
   icon, in which case match the regular rail-item sizing. */
.ec-hero__rail-more .ec-hero__rail-icon { width: 24px; height: 24px; }
.ec-hero__rail-more--promoted .ec-hero__rail-icon { width: 44px; height: 22px; }
/* Promoted state shows the same orange-on-white accent that a top-4
   active rail item gets, so the user sees consistent feedback for
   "which class is selected" regardless of whether it lives in the
   visible rail or the overflow tray. */
.ec-hero__rail-more--promoted {
    color: var(--ec-vs-accent);
    background: #fff;
    box-shadow: inset 3px 0 0 var(--ec-vs-accent);
}
.ec-hero__more-tile-icon { display: inline-flex; width: 44px; height: 22px; }
.ec-hero__more-tile-icon svg { width: 100%; height: 100%; display: block; }

/* "More" rail toggle — dashed divider above. */
.ec-hero__rail-more {
    margin-top: auto;
    border-top: 1px dashed var(--ec-vs-border);
}
.ec-hero__rail-more[aria-expanded="true"] {
    color: var(--ec-vs-accent);
    background: #fff;
}

.ec-hero__content {
    position: relative;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
}

.ec-hero__active-label {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ec-vs-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Overflow panel — pops out as an overlay inside the content area. */
.ec-hero__more-panel {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 4;
    background: #fff;
    border: 1px solid var(--ec-vs-border);
    border-radius: var(--ec-vs-radius);
    box-shadow: 0 8px 28px rgba(0,0,0,.10);
    padding: 14px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    align-content: start;
}
.ec-hero__more-panel[hidden] { display: none; }
.ec-hero__more-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    background: #fff;
    border: 1px solid var(--ec-vs-border);
    border-radius: 6px;
    color: var(--ec-vs-text);
    text-decoration: none;
    font-size: 13px;
    text-align: center;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.ec-hero__more-tile:hover {
    background: rgba(219,48,0,.06);
    border-color: var(--ec-vs-accent);
    color: var(--ec-vs-accent);
}
.ec-hero__more-tile.is-active {
    background: rgba(219,48,0,.08);
    border-color: var(--ec-vs-accent);
    color: var(--ec-vs-accent);
    font-weight: 600;
}
/* Tile-icon sizing lives ONCE at the top of the rail block (44x22 for
   mobile.de's 48x24 viewBox). The line below is the only label rule
   that survived the Phase 13 cleanup. */
.ec-hero__more-tile-label { word-break: break-word; }

/* Mobile (<880px) — collapse rail to a horizontal scroll strip at the
   top of the card; form stacks below. Matches mobile.de's responsive
   behaviour. */
@media (max-width: 880px) {
    .ec-hero__shell { grid-template-columns: 1fr; min-height: 0; }
    .ec-hero__rail {
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--ec-vs-border);
        border-radius: var(--ec-vs-radius) var(--ec-vs-radius) 0 0;
        padding: 8px;
    }
    .ec-hero__rail-item {
        flex: 0 0 auto;
        padding: 8px 14px;
    }
    .ec-hero__rail-item--active { box-shadow: inset 0 -3px 0 var(--ec-vs-accent); }
    .ec-hero__rail-more { margin-top: 0; margin-left: auto; border-top: none; border-left: 1px dashed var(--ec-vs-border); }
}

/* ----- Phase 12 legacy (no longer used by hero) ----- */
.ec-hero__tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    overflow-x: auto;
}
.ec-hero__tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 96px;
    padding: 10px 8px;
    text-decoration: none;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    color: rgba(255,255,255,.82);
    background: rgba(255,255,255,.06);
    border: 1px solid transparent;
    border-radius: 8px;
    transition: background .15s ease, color .15s ease, transform .15s ease;
    cursor: pointer;
    /* Reset the button base styling so .ec-hero__tab--more lines up
       pixel-perfect with the <a> siblings. */
    font-family: inherit;
}
.ec-hero__tab:hover {
    color: #fff;
    background: rgba(255,255,255,.14);
    transform: translateY(-1px);
}
.ec-hero__tab--active {
    color: var(--ec-vs-text);
    background: var(--ec-vs-card);
    border-color: var(--ec-vs-card);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.ec-hero__tab-icon {
    display: inline-flex;
    width: 28px;
    height: 28px;
    color: inherit;
}
.ec-hero__tab-icon svg { width: 100%; height: 100%; }
.ec-hero__tab-label {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
}

/*
 * Phase 13/15 cleanup: removed the Phase 12 horizontal-tabs leftovers
 * (`.ec-hero__tab--more`, `.ec-hero__more`, and DUPLICATE
 * `.ec-hero__more-tile` / icon / label rules with dark-theme
 * `color: rgba(255,255,255,.82)` on near-transparent white background
 * — which made the overflow tiles render invisible on top of the new
 * Phase 13 white card). Canonical rules now live in the Phase 13 block
 * above (.ec-hero__more-panel, .ec-hero__more-tile, *-icon, *-label).
 */

/* Form lives inside .ec-hero__card now (Phase 13); strip the redundant
   background/shadow so we don't nest a card inside a card. The colour
   inheritance is set on .ec-hero__content. */
.ec-hero__form {
    background: transparent;
    color: var(--ec-vs-text);
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}
.ec-hero__fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.ec-hero__field { display: flex; flex-direction: column; }
/* Phase 15.12 — mobile.de labels are 14px / weight 500, no uppercase, no
   letter-spacing tweaks. Casing comes from the markup, not CSS. */
.ec-hero__label {
    font-size: 14px;
    font-weight: 500;
    color: var(--ec-vs-text);
    padding-bottom: 2px;
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
}
/* 38px control height, 8px radius, #E6EAF0 filled state, #7E838F border.
   Padding matches mobile.de: 11px left / 43px right on selects to leave
   room for the chevron. Inputs share the height but a tighter right
   padding (no chevron). */
.ec-hero__select,
.ec-hero__input {
    width: 100%;
    height: 38px;
    border: 1px solid var(--ec-vs-border);
    border-radius: var(--ec-vs-radius);
    padding: 0 11px;
    font-size: 14px;
    font-weight: 400;
    background: var(--ec-vs-field-active);
    color: var(--ec-vs-text);
    box-sizing: border-box;
    line-height: 36px;
}
.ec-hero__select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 0 43px 0 11px;
    /* Chevron baked into the field-background SVG; #1B1B21 stroke,
       12px x 8px positioned 14px from the right edge. */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%231b1b21' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
.ec-hero__input { background: #fff; }
.ec-hero__input::placeholder { color: var(--ec-vs-muted-2); }
/* Disabled state — used on Model when no Make has been picked.
   Lighter background, lighter border, muted placeholder. */
.ec-hero__select:disabled,
.ec-hero__input:disabled {
    background-color: var(--ec-vs-field-disabled);
    border-color: var(--ec-vs-border-disabled);
    color: var(--ec-vs-muted-2);
    cursor: not-allowed;
}
.ec-hero__select:focus,
.ec-hero__input:focus {
    outline: none;
    border-color: var(--ec-vs-purple);
    box-shadow: 0 0 0 1px var(--ec-vs-purple);
}

.ec-hero__actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ec-hero__submit {
    background: var(--ec-vs-accent);
    border: 1px solid var(--ec-vs-accent);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: var(--ec-vs-radius);
    height: 38px;
    line-height: 1;
}
.ec-hero__submit:hover { background: #c12a00; border-color: #c12a00; }
.ec-hero__detail-link { color: var(--ec-vs-accent-2); text-decoration: none; font-size: 14px; font-weight: 600; }
.ec-hero__detail-link:hover { text-decoration: underline; }

/* --- Phase 14: per-class field extras (toggles, checkbox, full-width) --- */

/* Full-width field spans the entire fields grid — used by Kategorie on
   Motorbike/Motorhome/EBike where mobile.de places the sub-category
   dropdown above the make/model row. */
.ec-hero__field--full { grid-column: 1 / -1; }

/*
 * Phase 15.12 — segmented toggle (Kaufen/Leasen + Brutto/Netto) using
 * mobile.de's exact treatment: white pills inside a single hairline
 * row, purple outline on the active segment. Left segment rounded
 * left-only, right segment rounded right-only, no internal seam.
 */
.ec-hero__toggle-row {
    display: inline-flex;
    height: 38px;
    margin-bottom: 14px;
}
.ec-hero__toggle {
    position: relative;
    margin: 0;
    cursor: pointer;
}
.ec-hero__toggle input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.ec-hero__toggle span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ec-vs-text);
    background: #fff;
    border: 1px solid var(--ec-vs-border);
    line-height: 1;
    transition: border-color .12s, box-shadow .12s;
}
.ec-hero__toggle:first-child span { border-radius: var(--ec-vs-radius) 0 0 var(--ec-vs-radius); }
.ec-hero__toggle:last-child  span { border-radius: 0 var(--ec-vs-radius) var(--ec-vs-radius) 0; border-left: 0; }
.ec-hero__toggle input[type="radio"]:checked + span,
.ec-hero__toggle--active span {
    border-color: var(--ec-vs-purple);
    box-shadow: 0 0 0 1px var(--ec-vs-purple);
    position: relative;
    z-index: 1;
}
.ec-hero__toggle:hover span { color: var(--ec-vs-text); }

/* Inline checkbox row: "Nur Elektroautos" (Car). Sits between the
   field grid and the submit row. */
.ec-hero__check-row {
    margin: 4px 0 14px;
}
.ec-hero__check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--ec-vs-text);
    margin: 0;
}
.ec-hero__check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--ec-vs-accent);
    cursor: pointer;
}

/*
 * --- Phase 15.13: mobile.de footer row + geolocation button + bolt -------
 *
 * Footer: single flex row, electric checkbox + Show offers on the left,
 * Reset / More filters / Detailed search on the right.
 */
.ec-hero__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.ec-hero__footer-left,
.ec-hero__footer-right {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Electric-cars checkbox: gets a small blue-circle bolt badge alongside
   the text, per the mobile.de spec. */
.ec-hero__check-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--ec-vs-text);
}
.ec-hero__bolt {
    display: inline-block;
    flex: 0 0 auto;
    /* Blue square panel with the bolt inside is rendered via the SVG
       fill above; this CSS just makes sure the SVG sits cleanly next
       to the text. */
}

/* Text + icon button (Reset, More filters). Inherits font-weight 500,
   14px from the spec, with a small gap between icon and label. */
.ec-hero__text-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--ec-vs-text);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
}
.ec-hero__text-btn:hover { color: var(--ec-vs-accent); }
.ec-hero__text-btn:focus-visible {
    outline: 2px solid var(--ec-vs-purple);
    outline-offset: 2px;
    border-radius: 4px;
}
.ec-hero__detail-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--ec-vs-text);
}
.ec-hero__detail-link:hover { color: var(--ec-vs-accent); }
.ec-hero__detail-link--muted { color: var(--ec-vs-accent-2); }
.ec-hero__detail-link--muted:hover { text-decoration: underline; color: var(--ec-vs-accent-2); }

/* Postcode field with trailing geolocation button. The input gets
   right-padding to leave room; the button is absolute-positioned. */
.ec-hero__input-wrap { position: relative; }
.ec-hero__input--with-icon { padding-right: 38px; }
.ec-hero__geo-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    color: var(--ec-vs-muted);
    transition: color .12s ease, background-color .12s ease;
}
.ec-hero__geo-btn:hover {
    color: var(--ec-vs-text);
    background: rgba(0,0,0,.04);
}
.ec-hero__geo-btn:focus-visible {
    outline: 2px solid var(--ec-vs-purple);
    outline-offset: 1px;
}
.ec-hero__geo-btn[aria-busy="true"] svg { animation: ec-hero-spin 0.8s linear infinite; opacity: 0.7; }
@keyframes ec-hero-spin { to { transform: rotate(360deg); } }

/* Footer responsive: stack on narrow screens. */
@media (max-width: 720px) {
    .ec-hero__footer { flex-direction: column; align-items: flex-start; }
    .ec-hero__footer-right { width: 100%; justify-content: flex-start; }
}

/* --- Phase 15: AJAX swap loading state ----------------------------------
   When hero_ajax.js fetches a different class, dim + freeze the form
   so users don't tap into stale fields mid-swap. ~150ms swap is too
   short to warrant a spinner — opacity dip + pointer-events:none is
   enough feedback. */
.ec-hero__form-inner--loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.12s ease-out;
}

/* =========================================================================
 * Detailed search page
 * ===================================================================== */

.ec-vs {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 16px;
    color: var(--ec-vs-text);
}
.ec-vs__hero { margin-bottom: 16px; }
.ec-vs__title { font-size: 28px; font-weight: 700; margin: 0 0 4px; }
.ec-vs__sub   { color: var(--ec-vs-muted); margin: 0; }

/* =========================================================================
 * Side rail + class grid (mobile.de-style class picker)
 *
 * Desktop (>= 880px): vertical icon rail in a 72px-wide column to the
 *   left of the filter form. The rail and the .ec-vs__content column
 *   are grid siblings inside .ec-vs__shell.
 *
 * Mobile (< 880px): rail flips to a horizontal scroll-strip across the
 *   top, labels visible. The class grid still expands but takes the
 *   full content width.
 *
 * The grid panel (.ec-vs__class-grid) is absolutely positioned inside
 * .ec-vs__content so it overlays the filter form rather than pushing
 * it down — matches mobile.de's behaviour where the form vanishes
 * behind the picker while it's open.
 * ===================================================================== */

.ec-vs__shell {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.ec-vs__rail {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--ec-vs-card);
    border: 1px solid var(--ec-vs-border);
    border-radius: var(--ec-vs-radius);
    padding: 8px 6px;
    box-shadow: var(--ec-vs-shadow);
    position: sticky;
    top: 16px;
    /* Stay above the absolutely-positioned grid overlay so the user can
       still click the rail (e.g. to dismiss the grid by re-clicking the
       active class) while the grid is open. */
    z-index: 2;
}

.ec-vs__rail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    border-radius: 6px;
    color: var(--ec-vs-muted);
    text-decoration: none;
    font-size: 11px;
    line-height: 1.1;
    text-align: center;
    cursor: pointer;
    /* Override default button styling so the .ec-vs__rail-more button
       lines up pixel-perfectly with the <a> siblings. */
    background: transparent;
    border: 1px solid transparent;
    width: 100%;
    transition: background .12s ease, color .12s ease;
}
.ec-vs__rail-item:hover,
.ec-vs__rail-item:focus-visible {
    background: var(--ec-vs-bg);
    color: var(--ec-vs-text);
    outline: none;
}
.ec-vs__rail-item:focus-visible {
    box-shadow: 0 0 0 2px rgba(219,48,0,.45);
}
.ec-vs__rail-item--active {
    background: rgba(219,48,0,.10);
    color: var(--ec-vs-accent);
    font-weight: 600;
}
.ec-vs__rail-icon {
    /* mobile.de icons are viewBox 0 0 48 24 (2:1); match the hero rail. */
    display: inline-flex;
    width: 44px;
    height: 22px;
}
.ec-vs__rail-icon svg { width: 100%; height: 100%; }
.ec-vs__rail-label {
    /* Two-line clamp — keeps "Construction Machine" etc. from blowing
       the rail width. Falls back to text-overflow on browsers that
       don't support line-clamp. */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

/* "More" toggle reuses the rail-item shell. Dotted top border separates
   it from the canonical visible-set above. */
.ec-vs__rail-more {
    border-top: 1px dashed var(--ec-vs-border);
    border-radius: 0;
    margin-top: 4px;
    padding-top: 10px;
}
.ec-vs__rail-more[aria-expanded="true"] {
    background: var(--ec-vs-bg);
    color: var(--ec-vs-accent);
}

/* Content column needs `position: relative` so the absolute-positioned
   grid panel anchors to it. */
.ec-vs__content {
    position: relative;
    min-width: 0;
}

/* Class grid overlay. Sized to match the filter-form area; the JS adds
   .is-open and removes the [hidden] attribute. We keep [hidden] in the
   selector so progressive enhancement works — without JS the user
   still sees the rail items as navigation links. */
.ec-vs__class-grid {
    position: absolute;
    inset: 0;
    background: var(--ec-vs-card);
    border: 1px solid var(--ec-vs-border);
    border-radius: var(--ec-vs-radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    padding: 20px;
    z-index: 3;
    overflow: auto;
}
.ec-vs__class-grid[hidden] { display: none; }
.ec-vs__class-grid-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ec-vs-border);
}
.ec-vs__class-grid-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--ec-vs-text);
}
.ec-vs__class-grid-close {
    background: transparent;
    border: none;
    color: var(--ec-vs-muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
}
.ec-vs__class-grid-close:hover { background: var(--ec-vs-bg); color: var(--ec-vs-text); }

.ec-vs__class-grid-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.ec-vs__tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 12px;
    border: 1px solid var(--ec-vs-border);
    border-radius: var(--ec-vs-radius);
    background: var(--ec-vs-card);
    color: var(--ec-vs-text);
    text-decoration: none;
    text-align: center;
    transition: border-color .12s ease, transform .12s ease, box-shadow .12s ease;
    position: relative;
    min-height: 110px;
}
.ec-vs__tile:hover {
    border-color: var(--ec-vs-accent);
    color: var(--ec-vs-accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,.05);
}
.ec-vs__tile--active {
    border-color: var(--ec-vs-accent);
    color: var(--ec-vs-accent);
    background: rgba(219,48,0,.06);
}
.ec-vs__tile-icon {
    /* mobile.de icons are viewBox 0 0 48 24 (2:1) — keep the wide ratio. */
    display: inline-flex;
    width: 56px;
    height: 28px;
    color: var(--ec-vs-muted);
}
.ec-vs__tile:hover .ec-vs__tile-icon,
.ec-vs__tile--active .ec-vs__tile-icon { color: var(--ec-vs-accent); }
.ec-vs__tile-icon svg { width: 100%; height: 100%; }
.ec-vs__tile-label {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
}
.ec-vs__tile-count {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--ec-vs-bg);
    color: var(--ec-vs-muted);
}
.ec-vs__tile--active .ec-vs__tile-count {
    background: var(--ec-vs-accent);
    color: #fff;
}

/* Mobile: horizontal scroll-strip rail along the top.
   We re-do the grid as a single column so the rail sits above the
   content column. Sticky positioning is dropped because the rail
   no longer stays in view as a column. */
@media (max-width: 880px) {
    .ec-vs__shell { grid-template-columns: 1fr; gap: 12px; }
    .ec-vs__rail {
        flex-direction: row;
        overflow-x: auto;
        position: static;
        padding: 6px 8px;
        gap: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .ec-vs__rail-item {
        flex: 0 0 auto;
        width: auto;
        min-width: 72px;
        padding: 6px 10px;
    }
    .ec-vs__rail-more {
        border-top: none;
        border-left: 1px dashed var(--ec-vs-border);
        margin-top: 0;
        margin-left: 4px;
        padding-top: 6px;
        padding-left: 14px;
        border-radius: 6px;
    }
    .ec-vs__class-grid { padding: 14px; }
    .ec-vs__class-grid-tiles { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
    .ec-vs__tile { min-height: 90px; padding: 12px 8px; }
}

/* Layout */
.ec-vs__layout {
    display: grid;
    grid-template-columns: minmax(0,1fr) 280px;
    gap: 24px;
}
@media (max-width: 880px) { .ec-vs__layout { grid-template-columns: 1fr; } }

/* Filter groups (sidebar / left column) */
.ec-vs__sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.ec-vs__group {
    background: var(--ec-vs-card);
    border: 1px solid var(--ec-vs-border);
    border-radius: var(--ec-vs-radius);
    padding: 16px 18px;
    box-shadow: var(--ec-vs-shadow);
    margin: 0;
}
.ec-vs__group-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ec-vs-accent-2);
    padding: 0 0 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--ec-vs-border);
    width: 100%;
}

.ec-vs__field { margin-bottom: 12px; }
.ec-vs__field:last-child { margin-bottom: 0; }
.ec-vs__field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ec-vs-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: 4px;
}
.ec-vs__select,
.ec-vs__text {
    width: 100%;
    border: 1px solid var(--ec-vs-border);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 14px;
    background: #fff;
    color: var(--ec-vs-text);
}
.ec-vs__range { display: flex; align-items: center; gap: 6px; }
.ec-vs__range-input {
    flex: 1;
    border: 1px solid var(--ec-vs-border);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 14px;
    background: #fff;
}
.ec-vs__range-sep { color: var(--ec-vs-muted); }
.ec-vs__checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 0;
}
.ec-vs__checkbox input { margin: 0; }

.ec-vs__multi { font-size: 14px; }
.ec-vs__multi-summary { cursor: pointer; color: var(--ec-vs-accent-2); font-weight: 600; }
.ec-vs__multi-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    padding-top: 8px;
}
@media (max-width: 600px) { .ec-vs__multi-list { grid-template-columns: 1fr; } }

/* Submit card (right column) */
.ec-vs__main { display: flex; flex-direction: column; gap: 16px; }
.ec-vs__submit-card {
    background: var(--ec-vs-card);
    border: 1px solid var(--ec-vs-border);
    border-radius: var(--ec-vs-radius);
    padding: 18px;
    box-shadow: var(--ec-vs-shadow);
    text-align: center;
    position: sticky;
    top: 16px;
}
.ec-vs__submit-title { font-size: 16px; margin: 0 0 6px; }
.ec-vs__submit-sub   { font-size: 13px; color: var(--ec-vs-muted); margin: 0 0 14px; }
.ec-vs__submit {
    width: 100%;
    background: var(--ec-vs-accent);
    border-color: var(--ec-vs-accent);
    color: #fff;
    font-weight: 600;
    position: relative;
    transition: opacity .15s;
}
.ec-vs__submit:hover { background: #c12a00; border-color: #c12a00; }
/* Phase 7 — live-count loading state. JS toggles .is-loading while the
   count request is in flight; we dim the label slightly so the user
   knows the number they see is one update behind. */
.ec-vs__submit.is-loading { opacity: .55; cursor: progress; }
.ec-vs__reset { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--ec-vs-muted); }
.ec-vs__reset:hover { color: var(--ec-vs-text); }

.ec-vs__class-card {
    background: var(--ec-vs-bg);
    border: 1px solid var(--ec-vs-border);
    border-radius: var(--ec-vs-radius);
    padding: 14px 16px;
    font-size: 14px;
}
.ec-vs__class-name { font-weight: 600; font-size: 16px; margin: 4px 0; }
.ec-vs__class-stats { color: var(--ec-vs-muted); margin: 0; }

/* =========================================================================
 * Search results grid
 * ===================================================================== */
.ec-vsr { max-width: 1280px; margin: 0 auto; padding: 24px 16px; color: var(--ec-vs-text); }
.ec-vsr__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.ec-vsr__title { font-size: 24px; margin: 0; }
.ec-vsr__count { color: var(--ec-vs-muted); font-size: 14px; font-weight: 400; margin-left: 8px; }
.ec-vsr__refine { color: var(--ec-vs-accent-2); font-weight: 600; text-decoration: none; }
.ec-vsr__refine:hover { text-decoration: underline; }

.ec-vsr__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.ec-vsr__card {
    background: var(--ec-vs-card);
    border: 1px solid var(--ec-vs-border);
    border-radius: var(--ec-vs-radius);
    overflow: hidden;
    box-shadow: var(--ec-vs-shadow);
    display: flex;
    flex-direction: column;
    transition: transform .15s, box-shadow .15s;
}
.ec-vsr__card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.ec-vsr__card-img-wrap {
    display: block;
    aspect-ratio: 4/3;
    background: var(--ec-vs-bg);
    overflow: hidden;
}
.ec-vsr__card-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ec-vsr__card-noimg { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--ec-vs-muted); font-size: 13px; }
.ec-vsr__card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.ec-vsr__card-title { font-size: 15px; line-height: 1.3; margin: 0; }
.ec-vsr__card-title a { color: var(--ec-vs-text); text-decoration: none; }
.ec-vsr__card-title a:hover { color: var(--ec-vs-accent-2); }
.ec-vsr__card-price { font-size: 18px; font-weight: 700; color: var(--ec-vs-accent-2); margin: 0; }
/* mobile.de-style key-spec row: FR 03/2020 · 98,765 km · 81 kW (110 PS) · Diesel */
.ec-vsr__card-specs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; column-gap: 4px; row-gap: 2px; color: var(--ec-vs-text); font-size: 13px; font-weight: 500; }
.ec-vsr__card-specs li { white-space: nowrap; }
.ec-vsr__card-specs li + li::before { content: "\00B7"; margin: 0 4px; color: var(--ec-vs-muted); }
.ec-vsr__card-snippet { color: var(--ec-vs-muted); font-size: 13px; margin: 0; }

.ec-vsr__empty { background: var(--ec-vs-card); border: 1px solid var(--ec-vs-border); border-radius: var(--ec-vs-radius); padding: 32px; text-align: center; }
.ec-vsr__pager { margin-top: 24px; }

/* Phase 2: location filter chip + attribution line */
.ec-vsr__chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.ec-vsr__chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--ec-vs-bg);
    border: 1px solid var(--ec-vs-border);
    color: var(--ec-vs-text);
    font-size: 13px;
    line-height: 1.4;
}
.ec-vsr__chip--location { font-weight: 600; }
.ec-vs__attribution { margin: 6px 0 0; color: var(--ec-vs-muted); }
.ec-vs__attribution small { font-size: 11px; }
.ec-vs__group--location .ec-vs__field + .ec-vs__field { margin-top: 8px; }

/* =========================================================================
 * Phase 3: "Save this search" + Saved searches list page
 * ===================================================================== */

/* The save block sits inside the results header next to "Refine search". */
.ec-vsr__head-actions {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-left: auto;
}
.ec-vsr__save {
    position: relative;
    display: inline-block;
}
.ec-vsr__save-toggle {
    background: var(--ec-vs-card);
    border: 1px solid var(--ec-vs-accent-2);
    color: var(--ec-vs-accent-2);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 6px;
}
.ec-vsr__save-toggle:hover { background: var(--ec-vs-accent-2); color: #fff; }
.ec-vsr__save-form {
    display: none;
    margin-top: 8px;
    padding: 12px;
    background: var(--ec-vs-card);
    border: 1px solid var(--ec-vs-border);
    border-radius: var(--ec-vs-radius);
    box-shadow: var(--ec-vs-shadow);
    min-width: 280px;
}
.ec-vsr__save--open .ec-vsr__save-form { display: block; }
.ec-vsr__save-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ec-vs-muted);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: 4px;
}
.ec-vsr__save-input {
    width: 100%;
    border: 1px solid var(--ec-vs-border);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 14px;
    margin-bottom: 8px;
}
.ec-vsr__save-submit {
    background: var(--ec-vs-accent);
    border-color: var(--ec-vs-accent);
    color: #fff;
    font-weight: 600;
    padding: 8px 16px;
    font-size: 14px;
}
.ec-vsr__save-submit:hover { background: #c12a00; border-color: #c12a00; }
.ec-vsr__save-link {
    display: inline-block;
    margin-left: 12px;
    font-size: 13px;
    color: var(--ec-vs-accent-2);
}
.ec-vsr__save-link:hover { text-decoration: underline; }

/* Saved searches list page */
.ec-vss {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 16px;
    color: var(--ec-vs-text);
}
.ec-vss__head { margin-bottom: 18px; }
.ec-vss__title { font-size: 28px; font-weight: 700; margin: 0 0 4px; }
.ec-vss__sub   { color: var(--ec-vs-muted); margin: 0; }

.ec-vss__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.ec-vss__card {
    background: var(--ec-vs-card);
    border: 1px solid var(--ec-vs-border);
    border-radius: var(--ec-vs-radius);
    padding: 16px 18px;
    box-shadow: var(--ec-vs-shadow);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ec-vss__card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid var(--ec-vs-border);
    padding-bottom: 8px;
}
.ec-vss__card-name { font-size: 16px; font-weight: 600; margin: 0; }
.ec-vss__card-class {
    font-size: 11px;
    background: var(--ec-vs-bg);
    color: var(--ec-vs-muted);
    padding: 2px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.ec-vss__card-summary { color: var(--ec-vs-muted); font-size: 13px; margin: 0; }
.ec-vss__card-count   { font-size: 14px; margin: 0; }
.ec-vss__card-count strong { color: var(--ec-vs-accent-2); font-size: 18px; }
.ec-vss__card-meta    { color: var(--ec-vs-muted); margin: 0; font-size: 12px; }
.ec-vss__badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}
.ec-vss__badge--on  { background: #d4f4dd; color: #1a7637; }
.ec-vss__badge--off { background: var(--ec-vs-bg); color: var(--ec-vs-muted); }

.ec-vss__card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.ec-vss__action-form { display: inline-block; margin: 0; }
.ec-vss__action {
    font-size: 13px;
    padding: 6px 12px;
}
.ec-vss__action--run {
    background: var(--ec-vs-accent);
    border-color: var(--ec-vs-accent);
    color: #fff;
    font-weight: 600;
}
.ec-vss__action--run:hover { background: #c12a00; border-color: #c12a00; color: #fff; }
.ec-vss__action--danger {
    background: transparent;
    border: 1px solid #e0b7b7;
    color: #b53b3b;
}
.ec-vss__action--danger:hover { background: #fbecec; }

.ec-vss__empty {
    background: var(--ec-vs-card);
    border: 1px solid var(--ec-vs-border);
    border-radius: var(--ec-vs-radius);
    padding: 32px;
    text-align: center;
}

/* =========================================================================
 * Phase 10 — Typeahead autocomplete (mdc_makers / mdc_models)
 *
 * Wraps a native <select> with an input + popup list. Native select stays
 * in the DOM (display:none) so the form submission still carries a
 * variant_id. The CSS owns layout + appearance; behaviour is in
 * js/addons/ec_vehicle_listing/typeahead.js.
 * ===================================================================== */

.ec-ta { position: relative; width: 100%; }

.ec-ta__input {
    width: 100%;
    border: 1px solid var(--ec-vs-border);
    border-radius: 6px;
    /* Left padding leaves room for the magnifying-glass icon so users
       can tell at a glance this is a searchable field, not a native
       dropdown — the underlying select is hidden, so the visual cue
       has to come from this icon + the placeholder text. */
    padding: 8px 12px 8px 34px;
    font-size: 14px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat left 10px center;
    background-size: 14px 14px;
    color: var(--ec-vs-text);
    box-sizing: border-box;
}
.ec-ta__input:focus {
    outline: none;
    border-color: var(--ec-vs-accent);
    box-shadow: 0 0 0 3px rgba(219,48,0,.15);
}

.ec-ta__list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    /* Cap height to ~10 rows; scroll the rest. */
    max-height: 320px;
    overflow-y: auto;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--ec-vs-border);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
    /* Above sticky filter cards + price chips */
    z-index: 25;
}
.ec-ta__list[hidden] { display: none; }

.ec-ta__opt {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--ec-vs-text);
    /* Allow long brand names to wrap rather than truncate */
    word-break: break-word;
}
.ec-ta__opt:hover,
.ec-ta__opt.is-active {
    background: rgba(219,48,0,.08);
    color: var(--ec-vs-accent);
}
.ec-ta__opt.is-selected {
    font-weight: 600;
}

.ec-ta__empty {
    padding: 8px 12px;
    color: var(--ec-vs-muted);
    font-size: 13px;
    font-style: italic;
}

/* Admin-wizard variant — sit alongside CS-Cart's input style without
   inheriting its larger spacing. The wizard's CSS uses the same border
   colour so this stays visually consistent. */
.ec-vl2-field .ec-ta__input { padding: 10px 12px 10px 34px; }
