/*
 * Dealers (store locator) page styles
 * Loaded via @push('styles') — only on /dealers.
 * Shared, brand-aware: all accents use the --brand-* tokens
 * (resources/css/{eb,mm}/brand.css) so EB renders pink and MM gold
 * with no per-brand duplication. Never hardcode brand hex here.
 */

/* Shared height for the map + the scrollable results panel so the list
   never runs down the page — it scrolls internally within the map's box. */
.dealers-locator {
    --dealers-map-height: 560px;
}

/* =================================================================
   1. PAGE HEADER
   ================================================================= */
.dealers-page {
    max-width: 1200px;
}

.dealers-page__title {
    font-weight: 900;
    text-transform: uppercase;
    font-size: 2rem;
    letter-spacing: 0.02em;
    color: #212529;
    margin-bottom: 0.75rem;
}

.dealers-page__intro {
    font-size: 1rem;
    line-height: 1.7;
    color: #555;
    max-width: 68ch;
    margin-bottom: 2rem;
}

.dealers-page__intro p:last-child {
    margin-bottom: 0;
}

/* =================================================================
   1b. FEATURED DEALERS LOGO STRIP (modest — above the finder)
   ================================================================= */
.dealers-featured {
    margin-bottom: 2rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid #eee;
    border-radius: 4px;
    background: #fafafa;
}

.dealers-featured__heading {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666; /* was #777: 4.29:1 on the #fafafa band (WAVE, 2026-09-01) */
    margin: 0 0 1rem;
    text-align: center;
}

/* Even grid at every breakpoint — no lopsided wrap, no horizontal scroll.
   Tablet & mobile: 3×2 (2 rows of 3). Desktop: a single even row of 6. */
.dealers-featured__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem 1rem;
    align-items: center;
    justify-items: stretch;
}

@media (min-width: 992px) {
    .dealers-featured__list {
        grid-template-columns: repeat(6, 1fr);
    }
}

.dealers-featured__item {
    display: flex;
    justify-content: center;
}

.dealers-featured__link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.5rem;
    border-radius: 4px;
    text-decoration: none;
    color: #555;
    font-weight: 700;
    font-size: 0.9375rem;
}

/* Larger marks that fill their cell so the strip doesn't feel empty on the
   sides; the 1fr columns spread the logos evenly across the container. */
.dealers-featured__logo {
    display: block;
    height: 42px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    /* Neutral by default, brand color on hover/focus (nice touch). */
    filter: grayscale(1);
    opacity: 0.7;
    transition: filter 0.15s ease, opacity 0.15s ease;
}

@media (min-width: 992px) {
    .dealers-featured__logo {
        height: 52px;
    }
}

.dealers-featured__link:hover .dealers-featured__logo,
.dealers-featured__link:focus-visible .dealers-featured__logo {
    filter: grayscale(0);
    opacity: 1;
}

.dealers-featured__link:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Text fallback if a logo asset is ever missing (never a broken/faked img). */
.dealers-featured__label {
    text-decoration: underline;
    text-decoration-color: var(--brand-primary);
}

@media (prefers-reduced-motion: reduce) {
    .dealers-featured__logo {
        transition: none;
    }
}

/* =================================================================
   2. LOCATOR CONTROLS
   ================================================================= */
.dealers-locator__form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.5rem;
    border: 1px solid #eee;
    border-left: 3px solid var(--brand-primary);
    border-radius: 4px;
    background: #fafafa;
}

.dealers-locator__field {
    display: flex;
    flex-direction: column;
}

.dealers-locator__field--grow {
    flex: 1 1 260px;
    min-width: 200px;
}

.dealers-locator__label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #333;
    margin-bottom: 0.5rem;
}

.dealers-locator__input,
.dealers-locator__select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    color: #212529;
    background-color: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dealers-locator__select {
    min-width: 130px;
    /* Custom chevron so we can control its inset — the native arrow sat
       crammed against the right border. Nudged ~5px off the edge (1rem inset)
       with extra right padding so the value never overlaps it. */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.5rem;
    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='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.dealers-locator__input::placeholder {
    color: #666; /* placeholders are text too: #999 on white was 2.85:1 */
}

.dealers-locator__input:focus,
.dealers-locator__input:focus-visible,
.dealers-locator__select:focus,
.dealers-locator__select:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.15);
}

/* "Use my address" is the shared OUTLINE button (.btn.btn-outline) — its
   fill/border/radius/padding/font/height and hover-invert all come from the
   canonical button system in global.css, so it matches the solid Search
   button (.btn.btn-pink) in every dimension except fill. Only the leading
   pin icon needs a local rule here. */
.dealers-locator__geolocate-icon {
    flex: 0 0 auto;
}

.dealers-locator__status {
    margin: 0 0 1rem;
    font-size: 0.9375rem;
    color: #555;
    min-height: 1.25rem;
}

.dealers-locator__status--error {
    color: #c4161c;
    font-weight: 600;
}

/* =================================================================
   3. TWO-COLUMN LAYOUT: results (left) + map (right)
   ================================================================= */
.dealers-locator__layout {
    display: grid;
    grid-template-columns: minmax(300px, 2fr) 3fr;
    gap: 1.5rem;
    align-items: start;
}

/* LEFT — scrollable, height-bounded results (internal overflow) */
.dealers-locator__results-panel {
    height: var(--dealers-map-height);
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 4px;
    background: #fff;
    -webkit-overflow-scrolling: touch;
}

/* Results header — sticky "# dealers found" count. Stays pinned to the top
   of the (internally scrolling) results panel so the count is always in view
   while the list scrolls. Intentional treatment: bold, brand-accent underline
   rule — reads as a designed header, not raw status text. Proper case (no
   uppercase), matching the site button/case direction. */
.dealers-results__count {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 0;
    padding: 0.875rem 1.25rem;
    background: #fafafa;
    border-bottom: 2px solid var(--brand-primary);
    font-size: 1rem;
    font-weight: 700;
    color: #212529;
}

.dealers-results {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dealers-results__empty {
    padding: 2rem 1.25rem;
    color: #666; /* was #999: 2.85:1 on white */
    font-size: 0.9375rem;
    text-align: center;
}

/* RIGHT — map */
.dealers-locator__map-panel {
    position: relative;
}

.dealers-map {
    height: var(--dealers-map-height);
    width: 100%;
    border: 1px solid #eee;
    border-radius: 4px;
    background: #f2f2f2;
}

.dealers-map__unavailable {
    padding: 1rem 1.25rem;
    color: #666; /* was #777: 4.0:1 on the #f2f2f2 panel */
    font-size: 0.875rem;
}

/* =================================================================
   4. RESULT ROWS (icon actions on the left, info on the right)
   ================================================================= */
.dealers-result {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #eee;
    border-left: 3px solid transparent;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.dealers-result.is-active {
    background: rgba(var(--brand-primary-rgb), 0.06);
    border-left-color: var(--brand-primary);
}

/* LEFT — icon action buttons (call + directions) */
.dealers-result__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.dealers-result__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--brand-primary);
    border-radius: 4px;
    background: #fff;
    color: var(--brand-primary);
    text-decoration: none;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.dealers-result__btn:hover {
    background: var(--brand-primary-fill, var(--brand-primary));
    color: var(--brand-on-primary, #fff);
}

.dealers-result__btn:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* RIGHT — stacked name / address / phone */
.dealers-result__info {
    flex: 1 1 auto;
    min-width: 0;
}

.dealers-result__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.dealers-result__name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #212529;
    line-height: 1.3;
}

.dealers-result__distance {
    flex: 0 0 auto;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--brand-primary);
    white-space: nowrap;
}

.dealers-result__address,
.dealers-result__phone {
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #555;
    margin: 0 0 0.15rem;
}

.dealers-result__phone a {
    color: var(--brand-link);
    text-decoration: none;
}

.dealers-result__phone a:hover,
.dealers-result__phone a:focus-visible {
    color: var(--brand-link-hover);
    text-decoration: underline;
}

/* Info window (Google Maps) */
.dealers-infowindow__name {
    font-weight: 700;
    font-size: 0.9375rem;
    margin: 0 0 0.25rem;
}

.dealers-infowindow__address {
    font-size: 0.8125rem;
    color: #555;
    margin: 0;
}

/* =================================================================
   5. FALLBACK
   ================================================================= */
.dealers-page__fallback {
    margin-top: 2rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #555;
}

.dealers-page__fallback a {
    color: var(--brand-link);
    font-weight: 600;
}

/* =================================================================
   RESPONSIVE — mobile stacks: controls → map → bounded list
   ================================================================= */
@media (max-width: 991.98px) {
    .dealers-locator__layout {
        grid-template-columns: 1fr;
    }

    /* Map first on mobile, then the (still bounded + scrollable) list. */
    .dealers-locator__map-panel {
        order: 1;
    }

    .dealers-locator__results-panel {
        order: 2;
        height: auto;
        max-height: 60vh;
    }

    .dealers-locator {
        --dealers-map-height: 360px;
    }
}

@media (max-width: 767.98px) {
    .dealers-page__title {
        font-size: 1.75rem;
    }

    .dealers-locator__form {
        align-items: stretch;
    }

    .dealers-locator__field,
    .dealers-locator__search,
    .dealers-locator__geolocate {
        width: 100%;
    }

    .dealers-locator__geolocate {
        justify-content: center;
    }
}

@media (max-width: 575.98px) {
    .dealers-page__title {
        font-size: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dealers-result,
    .dealers-result__btn {
        transition: none;
    }
}
