/* m10 update 5: "x miles away" next to vehicle locations (assets/js/distance.js). One line, no layout shift: the town
   name gives way (ellipsis) and the distance never wraps, so card heights stay the same with or without a distance. */
.motorit-v126-location { min-width: 0; max-width: 100%; }
.motorit-v126-card .motorit-card-location-v19 { display: inline-flex; align-items: center; max-width: 100%; min-width: 0; white-space: nowrap; overflow: hidden; vertical-align: top; }
.motorit-v126-card .motorit-card-location-v19 .motorit-location-name-v19 { display: block; flex: 0 1 auto; min-width: 2.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.motorit-v126-card .motorit-card-location-v19 .motorit-location-distance-v19 { flex: 0 0 auto; white-space: nowrap; color: #475569; }
.motorit-v126-card .motorit-card-location-v19 .motorit-location-distance-v19:empty { display: none; }
.motorit-card-location-v19.has-distance .motorit-location-distance-v19::before { content: "\00b7"; margin: 0 4px 0 3px; font-weight: 700; }
/* Reset the theme's generic button look (padding, red background, borders) so the button is exactly the old static label. */
.motorit-v126-card button.motorit-card-location-v19[type="button"], button.motorit-garage-location[type="button"], .motorit-distance-use[type="button"], .motorit-distance-clear[type="button"] { min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; line-height: 1.25; font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: normal; color: #334155; width: auto; height: auto; }
.motorit-distance-use[type="button"], .motorit-distance-clear[type="button"] { font-weight: 700; color: #067b9d; text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }
button.motorit-card-location-v19:not(.has-distance) { cursor: pointer; }
button.motorit-card-location-v19:not(.has-distance):hover .motorit-location-name-v19 { text-decoration: underline; text-underline-offset: 2px; }
button.motorit-card-location-v19:focus-visible { outline: 2px solid #067b9d; outline-offset: 2px; border-radius: 4px; }
.motorit-card-location-v19.is-loading .motorit-location-name-v19 { opacity: .7; }

/* Vehicle page: seller facts "Ramsgate · 25 miles away" + an opt-in "Show distance" link-button. */
.motorit-distance-use { display: inline; margin: 0 0 0 6px; padding: 0; border: 0; background: none; color: #067b9d; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.motorit-distance-use:focus-visible, .motorit-distance-clear:focus-visible { outline: 2px solid #067b9d; outline-offset: 2px; border-radius: 4px; }
.motorit-distance-use[hidden], .motorit-distance-clear[hidden] { display: none; }

/* Search toolbar: where distances are measured from. */
.motorit-distance-origin { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; font-size: 12px; font-weight: 600; color: #475569; min-height: 18px; }
.motorit-distance-origin .motorit-distance-use { margin: 0; }
.motorit-distance-origin .motorit-location-pin-v19 { width: 12px; height: 12px; flex: 0 0 12px; }
.motorit-distance-clear { padding: 0; border: 0; background: none; color: #067b9d; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* Garage (shortlist) cards. */
.motorit-garage-location { display: flex; align-items: center; gap: 6px; min-width: 0; margin: -4px 0 12px; font-size: 12px; font-weight: 600; color: #334155; white-space: nowrap; }
.motorit-garage-location .motorit-location-name-v19 { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.motorit-garage-location .motorit-location-distance-v19 { flex: 0 0 auto; color: #475569; }
.motorit-garage-location .motorit-location-distance-v19:empty { display: none; }
.motorit-garage-location .motorit-location-pin-v19 { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; flex: 0 0 14px; background: #38b6ff; border-radius: 999px 999px 999px 0; transform: rotate(-45deg); }
.motorit-garage-location .motorit-location-pin-v19 i { width: 5px; height: 5px; background: #fff; border-radius: 999px; }
button.motorit-garage-location { border: 0; background: none; padding: 0; font: inherit; font-size: 12px; font-weight: 600; color: #334155; cursor: pointer; max-width: 100%; }
.motorit-garage-location.has-distance .motorit-location-distance-v19::before { content: "\00b7"; margin: 0 4px 0 2px; font-weight: 700; }

/* Narrow cards (4-up grids, featured rows): distance.js drops " away", then shortens "miles" to "mi", only when the
   town name would otherwise be cut. */
.motorit-location-distance-v19 .motorit-distance-unit-short { display: none; }
.motorit-location-distance-v19.is-short .motorit-distance-away { display: none; }
.motorit-location-distance-v19.is-shorter .motorit-distance-away, .motorit-location-distance-v19.is-shorter .motorit-distance-unit { display: none; }
.motorit-location-distance-v19.is-shorter .motorit-distance-unit-short { display: inline; }
.motorit-v126-card .motorit-card-location-v19 .motorit-location-distance-v19, .motorit-garage-location .motorit-location-distance-v19 { display: inline-block; }
.motorit-vehicle-distance-line { display: block; min-height: 18px; margin-top: 2px; font-size: 12px; line-height: 18px; }
.motorit-vehicle-distance-line .motorit-location-distance-v19 { display: inline; white-space: nowrap; font-weight: 700; color: #067b9d; }
.motorit-vehicle-seller__fact .motorit-vehicle-distance-line .motorit-distance-use[type="button"] { margin: 0; font-size: 12px; line-height: 18px; }

/* m10 update 6: "· How far?" in the distance slot while no location is known (same line, same size, so no layout
   shift), the "Change" control and the location chooser dialog. */
.motorit-card-location-v19.has-hint .motorit-location-distance-v19::before, .motorit-garage-location.has-hint .motorit-location-distance-v19::before { content: "\00b7"; margin: 0 4px 0 3px; font-weight: 700; color: #475569; }
button[data-motorit-distance].has-hint .motorit-location-distance-v19[data-motorit-distance-text] { color: #067b9d !important; font-weight: 600 !important; } /* beats home.css !important */
.motorit-location-distance-v19.is-hint-off { display: none !important; }
button.motorit-card-location-v19, button.motorit-garage-location { cursor: pointer; }
button.motorit-card-location-v19.has-hint:hover .motorit-location-distance-v19, button.motorit-garage-location.has-hint:hover .motorit-location-distance-v19,
button.motorit-card-location-v19.has-distance:hover .motorit-location-distance-v19 { text-decoration: underline; text-underline-offset: 2px; }
button.motorit-card-location-v19.has-hint:hover .motorit-location-name-v19 { text-decoration: none; }
button.motorit-garage-location:focus-visible { outline: 2px solid #067b9d; outline-offset: 2px; border-radius: 4px; }
.motorit-distance-change[hidden] { display: none; }

.motorit-distance-dialog { width: min(420px, calc(100vw - 32px)); max-width: none; margin: auto; padding: 0; border: 0; border-radius: 16px; background: #fff; color: #0f172a; box-shadow: 0 24px 60px rgba(15, 23, 42, .28); }
.motorit-distance-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.motorit-distance-dialog__form { position: relative; display: block; margin: 0; padding: 22px 22px 18px; font-size: 14px; line-height: 1.45; }
.motorit-distance-dialog h2 { margin: 0 32px 4px 0; font-size: 20px; line-height: 1.25; font-weight: 800; color: #0f172a; }
.motorit-distance-dialog__lead { margin: 0 0 14px; color: #475569; }
.motorit-distance-dialog label { display: block; margin: 0 0 6px; font-weight: 700; font-size: 13px; color: #0f172a; }
.motorit-distance-dialog__row { display: flex; gap: 8px; }
.motorit-distance-dialog input[type="text"] { flex: 1 1 auto; min-width: 0; height: 44px; margin: 0; padding: 0 12px; border: 1px solid #94a3b8; border-radius: 10px; background: #fff; color: #0f172a; font: inherit; font-size: 16px; }
.motorit-distance-dialog input[type="text"]::placeholder { color: #64748b; }
.motorit-distance-dialog input[type="text"]:focus { outline: 2px solid #067b9d; outline-offset: 1px; border-color: #067b9d; }
.motorit-distance-dialog input[aria-invalid="true"] { border-color: #b00020; }
.motorit-distance-dialog .motorit-distance-dialog__go[type="submit"] { flex: 0 0 auto; height: 44px; min-height: 0; margin: 0; padding: 0 16px; border: 0; border-radius: 10px; background: #067b9d; color: #fff; font: inherit; font-weight: 800; font-size: 14px; text-transform: none; letter-spacing: normal; box-shadow: none; cursor: pointer; width: auto; }
.motorit-distance-dialog .motorit-distance-dialog__go[type="submit"]:hover { background: #05637f; }
.motorit-distance-dialog__err { min-height: 18px; margin: 6px 0 4px; font-size: 13px; font-weight: 600; color: #b00020; }
.motorit-distance-dialog__err:empty { min-height: 0; margin: 0 0 4px; }
.motorit-distance-dialog__or { display: flex; align-items: center; gap: 10px; margin: 8px 0 12px; color: #64748b; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.motorit-distance-dialog__or::before, .motorit-distance-dialog__or::after { content: ""; flex: 1; height: 1px; background: #e2e8f0; }
.motorit-distance-dialog .motorit-distance-dialog__device[type="button"] { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 44px; min-height: 0; margin: 0; padding: 0 16px; border: 1px solid #067b9d; border-radius: 10px; background: #fff; color: #067b9d; font: inherit; font-weight: 800; font-size: 14px; text-transform: none; letter-spacing: normal; box-shadow: none; cursor: pointer; }
.motorit-distance-dialog .motorit-distance-dialog__device[type="button"]:hover { background: #f3f9fd; }
.motorit-distance-dialog__device .motorit-location-pin-v19 { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; background: #38b6ff; border-radius: 999px 999px 999px 0; transform: rotate(-45deg); }
.motorit-distance-dialog__device .motorit-location-pin-v19 i { width: 5px; height: 5px; background: #fff; border-radius: 999px; }
.motorit-distance-dialog .motorit-distance-dialog__close[type="button"] { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 999px; background: #f1f5f9; color: #0f172a; font: inherit; font-size: 22px; line-height: 36px; text-align: center; box-shadow: none; cursor: pointer; }
.motorit-distance-dialog button:focus-visible { outline: 2px solid #067b9d; outline-offset: 2px; }
.motorit-distance-dialog button:disabled { opacity: .6; cursor: progress; }
.motorit-distance-dialog__note { margin: 14px 0 0; font-size: 12px; color: #475569; }
.motorit-distance-dialog__note a { color: #067b9d; font-weight: 700; }

/* Update 74: the Android Capacitor app has no location permission, so hide "Use my location"
   and the "or" divider. Postcode / town typing stays. The class is set on <html> before paint
   (header.php / motorit_html_class). JS also sets [hidden] if it detects Android later. */
html.is-motorit-android .motorit-distance-dialog__or,
html.is-motorit-android .motorit-distance-dialog .motorit-distance-dialog__device[type="button"],
.motorit-distance-dialog__or[hidden],
.motorit-distance-dialog .motorit-distance-dialog__device[hidden] {
  display: none;
}
