/* Final, intentionally small remediation layer for the public catalogue.
   It is loaded after the historical visual layers so the layout has one
   deterministic contract on desktop and mobile. */

body.catalog-reference-upgrade #search-date-hint,
body.marketplace-experience #search-date-hint {
    min-height: 18px;
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}

body.catalog-reference-upgrade #search-date-hint.is-required,
body.marketplace-experience #search-date-hint.is-required {
    color: var(--primary);
    font-weight: 700;
}

/* Do not cover the last quick-filter chip with a fake swipe hint. The mobile
   panel has an explicit expand button, while desktop rows wrap naturally. */
body.catalog-reference-upgrade #catalog-discovery-toolbar .catalog-discovery-row__cue,
body.marketplace-experience #catalog-discovery-toolbar .catalog-discovery-row__cue {
    display: none !important;
}

body.catalog-reference-upgrade #catalog-discovery-toolbar .catalog-discovery-row__body,
body.marketplace-experience #catalog-discovery-toolbar .catalog-discovery-row__body {
    min-width: 0;
    overflow: visible !important;
}

body.catalog-reference-upgrade #catalog-discovery-toolbar .catalog-brand-shortcuts__list,
body.catalog-reference-upgrade #catalog-discovery-toolbar .catalog-city-shortcuts__list,
body.catalog-reference-upgrade #catalog-discovery-toolbar #p0-quick-filters,
body.catalog-reference-upgrade #catalog-discovery-toolbar #cat-filters,
body.marketplace-experience #catalog-discovery-toolbar .catalog-brand-shortcuts__list,
body.marketplace-experience #catalog-discovery-toolbar .catalog-city-shortcuts__list,
body.marketplace-experience #catalog-discovery-toolbar #p0-quick-filters,
body.marketplace-experience #catalog-discovery-toolbar #cat-filters {
    max-height: none !important;
    overflow: visible !important;
    scrollbar-width: none;
}

body.catalog-reference-upgrade #catalog-discovery-toolbar .catalog-brand-shortcuts__list,
body.catalog-reference-upgrade #catalog-discovery-toolbar .catalog-city-shortcuts__list,
body.marketplace-experience #catalog-discovery-toolbar .catalog-brand-shortcuts__list,
body.marketplace-experience #catalog-discovery-toolbar .catalog-city-shortcuts__list {
    flex-wrap: wrap !important;
    align-items: stretch;
}

body.catalog-reference-upgrade #catalog-discovery-toolbar #p0-quick-filters button,
body.marketplace-experience #catalog-discovery-toolbar #p0-quick-filters button {
    min-width: 0 !important;
    min-height: 44px !important;
    height: auto !important;
    align-items: center !important;
    line-height: 1.2 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
}

body.catalog-reference-upgrade #catalog-discovery-toolbar #p0-quick-filters .p0-chip-label,
body.marketplace-experience #catalog-discovery-toolbar #p0-quick-filters .p0-chip-label {
    min-width: 0;
    white-space: normal !important;
    line-height: 1.2 !important;
}

body.catalog-reference-upgrade #catalog-discovery-toolbar .catalog-brand-shortcuts__list button,
body.catalog-reference-upgrade #catalog-discovery-toolbar .catalog-city-shortcuts__list button,
body.marketplace-experience #catalog-discovery-toolbar .catalog-brand-shortcuts__list button,
body.marketplace-experience #catalog-discovery-toolbar .catalog-city-shortcuts__list button {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

body.catalog-reference-upgrade #catalog-discovery-toolbar .brand-shortcut__logo,
body.marketplace-experience #catalog-discovery-toolbar .brand-shortcut__logo {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--surface-secondary);
    color: var(--text-main);
    font-size: 9px;
    font-weight: 900;
}

body.catalog-reference-upgrade #catalog-discovery-toolbar .brand-shortcut__logo img,
body.marketplace-experience #catalog-discovery-toolbar .brand-shortcut__logo img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

/* Keep the map controls in separate hit areas: the context label starts next
   to Leaflet zoom, and the area-search button never covers the label. */
#map-wrapper .map-context {
    left: 72px !important;
    right: 14px !important;
    max-width: none !important;
    pointer-events: none;
}

#map-wrapper .map-context > * {
    pointer-events: auto;
}

#map-wrapper .btn-search-area {
    right: 14px !important;
    max-width: calc(100% - 28px);
    white-space: nowrap;
}

#map-wrapper .map-preview-card {
    left: auto !important;
    right: 14px !important;
    width: min(430px, calc(100% - 28px)) !important;
    max-width: calc(100% - 28px) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

#map-wrapper .map-preview-card__image {
    display: block !important;
    width: 100% !important;
    height: clamp(136px, 14vw, 210px) !important;
    padding: 10px !important;
    box-sizing: border-box !important;
    object-fit: contain !important;
    object-position: center !important;
    background: var(--surface-secondary);
}

#map-wrapper .map-preview-card__actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding-top: 8px !important;
    background: var(--bg-card);
}

#map-wrapper .map-preview-card__open {
    min-height: 44px !important;
    white-space: normal !important;
    line-height: 1.2 !important;
}

/* Catalogue photos preserve the complete source image. The stable ratio is
   only the media box; the image itself is never cropped or stretched. */
body.catalog-reference-upgrade #fleet-grid .car-card--catalogue .offer-media,
body.marketplace-experience #fleet-grid .car-card--catalogue .offer-media,
body.catalog-reference-upgrade #fleet-grid .seo-catalog-card .card-img-box,
body.marketplace-experience #fleet-grid .seo-catalog-card .card-img-box {
    aspect-ratio: 16 / 10 !important;
    min-height: 0 !important;
    background: var(--surface-secondary);
}

body.catalog-reference-upgrade #fleet-grid .car-card--catalogue .offer-media .card-img,
body.marketplace-experience #fleet-grid .car-card--catalogue .offer-media .card-img,
body.catalog-reference-upgrade #fleet-grid .seo-catalog-card .card-img,
body.marketplace-experience #fleet-grid .seo-catalog-card .card-img {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    padding: 10px !important;
    object-fit: contain !important;
    object-position: center !important;
}

body.catalog-reference-upgrade .price-total > div,
body.marketplace-experience .price-total > div {
    min-width: 0;
}

body.catalog-reference-upgrade .price-total small,
body.marketplace-experience .price-total small,
body.catalog-reference-upgrade .card-price-guidance,
body.marketplace-experience .card-price-guidance {
    display: block;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

body.catalog-reference-upgrade .card-price-tiers,
body.marketplace-experience .card-price-tiers {
    min-width: 0;
    overflow: hidden;
}

@media (min-width: 1000px) {
    body.catalog-reference-upgrade #page-fleet > .journey-hero,
    body.marketplace-experience #page-fleet > .journey-hero {
        min-height: 0 !important;
        margin-top: 6px !important;
        margin-bottom: 8px !important;
        padding-top: 10px !important;
        padding-bottom: 8px !important;
    }

    body.catalog-reference-upgrade #p0-trust-markers,
    body.marketplace-experience #p0-trust-markers {
        gap: 6px !important;
        margin-top: 4px !important;
        margin-bottom: 6px !important;
    }
}

@media (max-width: 760px) {
    #map-wrapper .map-context {
        left: 58px !important;
        right: 10px !important;
    }

    #map-wrapper .btn-search-area {
        right: 10px !important;
        max-width: calc(100% - 20px);
    }

    #map-wrapper .map-preview-card {
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: none !important;
    }

    #map-wrapper .map-preview-card__image {
        height: 124px !important;
        padding: 8px !important;
    }

    body.catalog-reference-upgrade #catalog-discovery-toolbar .catalog-brand-shortcuts__list,
    body.catalog-reference-upgrade #catalog-discovery-toolbar .catalog-city-shortcuts__list,
    body.marketplace-experience #catalog-discovery-toolbar .catalog-brand-shortcuts__list,
    body.marketplace-experience #catalog-discovery-toolbar .catalog-city-shortcuts__list {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 6px !important;
        width: 100% !important;
    }

    body.catalog-reference-upgrade #catalog-discovery-toolbar .catalog-brand-shortcuts__list button,
    body.catalog-reference-upgrade #catalog-discovery-toolbar .catalog-city-shortcuts__list button,
    body.marketplace-experience #catalog-discovery-toolbar .catalog-brand-shortcuts__list button,
    body.marketplace-experience #catalog-discovery-toolbar .catalog-city-shortcuts__list button {
        width: 100%;
        min-height: 42px;
        justify-content: flex-start;
    }

    body.catalog-reference-upgrade #fleet-grid .car-card--catalogue .offer-media,
    body.marketplace-experience #fleet-grid .car-card--catalogue .offer-media,
    body.catalog-reference-upgrade #fleet-grid .seo-catalog-card .card-img-box,
    body.marketplace-experience #fleet-grid .seo-catalog-card .card-img-box {
        aspect-ratio: 16 / 10 !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.catalog-reference-upgrade *,
    body.marketplace-experience * {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}

/* The comparison tray is a compact utility on phones. It stays above the
   mobile navigation, but its reduced footprint leaves the selected offer and
   map preview visible instead of creating a second bottom navigation bar. */
@media (max-width: 760px) {
    body.site-shell:not(.is-tg-app) .compare-bar.show {
        right: max(10px, env(safe-area-inset-right));
        bottom: calc(80px + env(safe-area-inset-bottom));
        width: min(360px, calc(100vw - 20px));
        min-height: 48px;
        padding: 7px 9px 7px 12px;
        gap: 8px;
        border-radius: 14px;
        font-size: 12px;
        line-height: 1.2;
    }

    body.site-shell:not(.is-tg-app) .compare-bar.show button {
        min-height: 36px;
        padding: 7px 12px !important;
        border-radius: 10px !important;
        font-size: 12px;
        white-space: nowrap;
    }

    body.site-shell:not(.is-tg-app) .compare-bar.show.is-search-visible {
        bottom: calc(80px + env(safe-area-inset-bottom));
    }
}

/* A price marker represents one exact pickup address. The layer group is
   deliberately used instead of proximity-cluster bubbles; different nearby
   addresses must remain separate until the visitor chooses one. */
.leaflet-marker-icon.map-price-marker-icon {
    z-index: 400 !important;
}
