/*---*\
    Find Your Nearest Location
    Homepage map + filter section for locating dealer branches

    KEY FEATURES:
    - Content/filters above map on mobile & tablet; map left / content right on desktop
    - Yellow accent divider between content and map
    - Location info popup with details and CTAs over the map
    - City/zip and service filter fields

    IMPLEMENTATION NOTES:
    - Mobile-first; breakpoints 768px / 1200px
    - Google Map markers from Location CPT mock (www/src/data/locations.json)
    - No location card grid — markers + popup only
\*---*/

.find-your-nearest-location {
    background-color: var(--color-surface-gray);
    position: relative;
    z-index: 10;
}

/* Map-only shell (e.g. singular location page): full-width map, no filter column */
.find-your-nearest-location--map-only .find-your-nearest-location__map-wrap {
    width: 100%;
    flex: 1 1 100%;
    border-top: 4px solid var(--color-primary);
}

@media (min-width: 1200px) {
    .find-your-nearest-location--map-only .find-your-nearest-location__layout {
        min-height: 551px;
    }

    .find-your-nearest-location--map-only .find-your-nearest-location__map-wrap {
        order: 1;
        width: 100%;
        flex: 1 1 100%;
        min-height: 551px;
        height: 551px;
    }
}

.find-your-nearest-location__layout {
    display: flex;
    flex-direction: column;
}

.find-your-nearest-location__content {
    order: 1;
}

.find-your-nearest-location__content-inner {
    padding: 36px 22px 36px;
}

.find-your-nearest-location__text .sub-heading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--color-heading);
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.find-your-nearest-location__text h2 {
    margin: 5px 0 0;
    color: var(--color-heading);
    font-family: var(--font-heading);
    font-size: 27px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.find-your-nearest-location__text > p:not(.sub-heading) {
    margin: 20px 0 0;
    color: var(--color-paragraph);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
}

.find-your-nearest-location__filters {
    margin-top: 20px;
}

.find-your-nearest-location__fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.find-your-nearest-location__field {
    display: flex;
    flex-direction: column;
    gap: 11px;
    max-width: 266px;
}

.find-your-nearest-location__label {
    margin: 0;
    color: var(--color-heading);
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: uppercase;
}

.find-your-nearest-location__input-wrap,
.find-your-nearest-location__select-wrap {
    position: relative;
}

.find-your-nearest-location__input,
.find-your-nearest-location__select {
    width: 100%;
    height: 53px;
    padding: 15px 44px 15px 15px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background-color: var(--color-surface-white);
    color: var(--color-heading);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
}

.find-your-nearest-location__input::placeholder {
    color: var(--color-text-muted);
    opacity: 1;
}

.find-your-nearest-location__input:focus-visible,
.find-your-nearest-location__select:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-color: var(--color-border);
}

.find-your-nearest-location__input-icon {
    position: absolute;
    top: 50%;
    right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-heading);
    font-size: 18px;
    pointer-events: none;
    transform: translateY(-50%);
}

.find-your-nearest-location__select {
    appearance: none;
    padding-right: 44px;
    cursor: pointer;
}

.find-your-nearest-location__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-top: 20px;
}

.find-your-nearest-location__actions .btn {
    margin: 0;
}

.find-your-nearest-location__actions .btn + .btn {
    margin: 0;
}

.find-your-nearest-location__map-wrap {
    position: relative;
    order: 2;
    height: 551px;
    overflow: hidden;
    border-top: 4px solid var(--color-primary);
    background-color: var(--color-surface-gray);
}

.find-your-nearest-location__map {
    width: 100%;
    height: 100%;
}

.find-your-nearest-location__map-empty {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: rgba(255, 255, 255, 0.72);
    pointer-events: none;
}

.find-your-nearest-location__map-empty[hidden] {
    display: none;
}

.find-your-nearest-location__map-empty-text {
    max-width: 380px;
    margin: 0;
    padding: 20px 24px;
    background-color: var(--color-surface-white);
    border-radius: 8px;
    border-bottom: 3px solid var(--color-primary);
    box-shadow: 0 4px 24px rgb(0 0 0 / 18%);
    color: var(--color-paragraph);
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
}

.find-your-nearest-location__popup {
    position: absolute;
    top: 12px;
    left: 50%;
    z-index: 2;
    width: calc(100% - 16px);
    max-width: 359px;
    padding: 20px 12px 20px;
    background-color: var(--color-surface-white);
    border-radius: 8px;
    border-bottom: 3px solid var(--color-primary);
    box-shadow: 0 4px 24px rgb(0 0 0 / 18%);
    transform: translateX(-50%);
}

.find-your-nearest-location__popup[hidden] {
    display: none;
}

.find-your-nearest-location__popup::after {
    content: "";
    position: absolute;
    bottom: -23px;
    left: 50%;
    width: 22px;
    height: 22px;
    background-color: var(--color-primary);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    transform: translateX(-50%);
}

.find-your-nearest-location__popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 14px;
    cursor: pointer;
}

.find-your-nearest-location__popup-close:hover {
    color: var(--color-heading);
}

.find-your-nearest-location__popup-close:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.find-your-nearest-location__popup-category {
    margin: 0;
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.find-your-nearest-location__popup-title {
    margin: 0;
    color: var(--color-heading);
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.find-your-nearest-location__popup-body {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
    margin-top: 20px;
}

.find-your-nearest-location__popup-details {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.find-your-nearest-location__popup-details > li {
    padding-left: 0;
    margin-bottom: 0 !important;
}

.find-your-nearest-location__popup-details > li + li {
    margin-top: 0;
    margin-bottom: 0;
}

.find-your-nearest-location__popup-details > li::before {
    display: none;
    content: none;
}

.find-your-nearest-location__popup-detail {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    color: var(--color-heading);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.35;
}

.find-your-nearest-location__detail-icon {
    display: block;
    flex-shrink: 0;
    width: 25px;
    height: 25px;
    color: var(--color-primary);
    position: relative;
}

.find-your-nearest-location__detail-icon--clock {
    width: 26px;
    height: 26px;
}

.location-hours__group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.location-hours__group + .location-hours__group {
    margin-top: 12px;
}

.location-hours__label {
    font-weight: 700;
}

.find-your-nearest-location__popup-detail a {
    color: inherit;
    text-decoration: none !important;
    font-weight: 400 !important;
    position: relative;
    display: inline-block;

    svg path {
        fill: var(--color-primary);
    }

    &:after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 2px;
        background-color: var(--color-primary);
        transform: scaleX(0);
        transform-origin: right;
        transition: transform 0.2s ease;
    }
}

.find-your-nearest-location__popup-detail a:hover {
    text-decoration: none !important;
    font-weight: 500 !important;
}

.find-your-nearest-location__popup-detail a:hover:after {
    transform: scaleX(1);
    transform-origin: left;
}

.find-your-nearest-location__popup-detail a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.find-your-nearest-location__popup-actions {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 20px;
}

.find-your-nearest-location__popup-actions .btn {
    margin: 0;
    padding: 12px 14px;
    font-size: 14px;
}

.find-your-nearest-location__popup-actions .btn + .btn {
    margin: 0;
}

.find-your-nearest-location__popup-actions .icon-chevrons {
    font-size: 12px;
}

@media (min-width: 768px) {
    .find-your-nearest-location__content-inner {
        padding: 76px 52px 36px;
    }

    .find-your-nearest-location__text .sub-heading {
        font-size: 18px;
    }

    .find-your-nearest-location__text h2 {
        margin-top: 10px;
        font-size: 26px;
    }

    .find-your-nearest-location__text > p:not(.sub-heading) {
        margin-top: 20px;
        font-size: 18px;
    }

    .find-your-nearest-location__filters {
        margin-top: 20px;
    }

    .find-your-nearest-location__fields {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 32px;
        align-items: flex-start;
    }

    .find-your-nearest-location__field {
        flex: 0 1 232px;
    }

    .find-your-nearest-location__field:last-child {
        flex-basis: 266px;
    }

    .find-your-nearest-location__input,
    .find-your-nearest-location__select {
        height: 54px;
        font-size: 16px;
    }

    .find-your-nearest-location__actions {
        margin-top: 20px;
    }

    .find-your-nearest-location__map-wrap {
        height: 584px;
    }

    .find-your-nearest-location__popup {
        top: 40px;
        left: 50%;
        width: 487px;
        max-width: calc(100% - 48px);
        padding: 24px;
    }

    .find-your-nearest-location__popup-category {
        font-size: 16px;
    }

    .find-your-nearest-location__popup-title {
        font-size: 20px;
    }

    .find-your-nearest-location__popup-body {
        gap: 32px;
        margin-top: 20px;
    }

    .find-your-nearest-location__popup-details {
        gap: 20px;
    }

    .find-your-nearest-location__popup-detail {
        gap: 8px;
        font-size: 16px;
    }

    .find-your-nearest-location__detail-icon {
        width: 25px;
        height: 25px;
    }

    .find-your-nearest-location__detail-icon--clock {
        width: 26px;
        height: 26px;
    }

    .find-your-nearest-location__popup-actions {
        gap: 20px;
    }

    .find-your-nearest-location__popup-actions .btn {
        padding: var(--button-padding-y) var(--button-padding-x);
        font-size: var(--button-font-size);
    }

    .find-your-nearest-location__popup-actions .icon-chevrons {
        font-size: 15px;
    }
}

@media (min-width: 1200px) {
    .find-your-nearest-location__layout {
        flex-direction: row;
        align-items: stretch;
        min-height: 631px;
    }

    .find-your-nearest-location__map-wrap {
        order: 1;
        flex: 1 1 50%;
        width: 50%;
        height: auto;
        min-height: 631px;
        border-top: 0;
    }

    .find-your-nearest-location__content {
        order: 2;
        display: flex;
        flex: 1 1 50%;
        align-items: center;
        width: 50%;
        border-left: 4px solid var(--color-primary);
    }

    .find-your-nearest-location__content-inner {
        width: 100%;
        max-width: 684px;
        padding: 60px 52px;
    }

    .find-your-nearest-location__text .sub-heading {
        font-size: 20px;
    }

    .find-your-nearest-location__text h2 {
        margin-top: 16px;
        max-width: 580px;
        font-size: 55px;
    }

    .find-your-nearest-location__text > p:not(.sub-heading) {
        margin-top: 20px;
        max-width: 580px;
        font-size: 18px;
    }

    .find-your-nearest-location__filters {
        margin-top: 20px;
        max-width: 580px;
    }

    .find-your-nearest-location__fields {
        gap: 61px;
    }

    .find-your-nearest-location__field {
        /* flex: 1 1 0; */
        width: 50%;
        max-width: none;
    }

    .find-your-nearest-location__input,
    .find-your-nearest-location__select {
        height: 57px;
        font-size: 16px;
    }

    .find-your-nearest-location__actions {
        margin-top: 20px;
    }

    .find-your-nearest-location__popup {
        top: 24px;
        left: 50%;
        width: 487px;
        max-width: none;
        transform: translateX(-50%);
    }

    .find-your-nearest-location__popup-title {
        font-size: 24px;
    }

    .find-your-nearest-location__map-wrap {
        width: 50%;
        position: relative;
        padding-top: 0;
    }
}

.find-your-nearest-location__map-wrap {
    li {
        margin: 0;
        padding: 0;
        position: static;
    }
}