.infocus-store-locator {
    display: grid;
    grid-template-columns: minmax(0, 575fr) minmax(0, 865fr);
    gap: 40px;
    align-items: start;

    &__content {
        display: flex;
        flex-direction: column;
        gap: 32px;
        min-width: 0;
        min-height: 760px;
    }

    &__intro {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    &__title {
        margin: 0;
        color: var(--wp--preset--color--primary-navy);
        font-size: 32px;
        font-weight: 400;
        line-height: 1.05;
    }

    &__text {
        color: var(--wp--preset--color--midnight-moss-800);
        font-size: 16px;
        line-height: 1.6;

        > * {
            margin: 0;
        }

        > * + * {
            margin-top: 12px;
        }
    }

    .wpsl-search {
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
    }

    #wpsl-search-wrap {
        width: 100%;
        max-width: 100%;

        div {
            margin-right: 0;
            float: none;
        }
    }

    &__search-form {
        display: flex;
        flex-direction: column;
        gap: 16px;
        width: 100%;
        margin: 0;
    }

    &__search-actions {
        display: flex;
        justify-content: flex-end;
        margin-bottom: 12px;
    }

    &__category-filter {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    &__state-reset {
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--wp--preset--color--primary-glacial-blue);
        font-size: 18px;
        font-weight: 400;
        line-height: 1.4;
        text-decoration-line: underline;
        text-decoration-thickness: 1px;
        text-underline-offset: 3px;
        cursor: pointer;

        &:hover,
        &:focus {
            color: var(--wp--preset--color--primary-navy);
        }
    }

    &__search-field-group {
        display: flex;
        align-items: stretch;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        border: 1px solid rgba(182, 207, 225, 0.5);
        border-radius: 100px;

        &:has(#wpsl-search-input.wpsl-error) {
            border-color: #bd0028;
        }
    }

    &__search-input-wrap {
        display: flex;
        align-items: center;
        flex: 1 1 auto;
        min-width: 0;
        padding-left: 24px;
        background: #B6CFE166;

        .wpsl-autocomplete-search-container {
            display: flex;
            flex: 1 1 auto;
            min-width: 0;
            align-items: stretch;
        }
    }

    &__search-input-icon {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: center;
        margin-right: 12px;

        img {
            display: block;
            width: 18px;
            height: 25px;
        }
    }

    #wpsl-search-input {
        width: 100%;
        min-width: 0;
        height: 68px;
        margin: 0;
        padding: 0 24px 0 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        box-sizing: border-box;
        color: var(--wp--preset--color--primary-navy);
        font-family: var(--wp--preset--font-family--basis-grotesque);
        font-size: var(--wp--preset--font-size--14);
        line-height: 1.625;
        appearance: none;

        &:focus {
            outline: none;
        }

        &::placeholder {
            color: rgba(14, 34, 69, 0.6);
        }
    }

    #wpsl-search-wrap {
        #wpsl-search-btn {
            display: inline-flex;
            flex: 0 0 auto;
            align-items: center;
            justify-content: center;
            gap: 12px;
            min-height: 68px;
            margin: 0;
            padding: 0 30px;
            float: none;
            border: 0;
            border-radius: 0;
            background: var(--wp--preset--color--secondary-coral);
            background-image: none;
            box-shadow: none;
            color: var(--wp--preset--color--white);
            font-family: var(--wp--preset--font-family--basis-grotesque);
            font-size: var(--wp--preset--font-size--16);
            font-weight: 400;
            flex-direction: row-reverse;
            line-height: 1;
            text-transform: uppercase !important;
            white-space: nowrap;
            cursor: pointer;
            transition: background-color 0.2s ease;
            appearance: none;

            &:hover,
            &:focus-visible {
                background: var(--wp--preset--color--coral-dark);
                background-image: none;
                color: var(--wp--preset--color--white);
            }

            &:focus {
                outline: none;
            }
        }
    }

    &__search-submit-icon {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: center;

        img {
            display: block;
            width: 21px;
            height: 21px;
        }
    }

    &__search-submit-label {
        display: inline-flex;
        align-items: center;
    }

    #wpsl-result-list {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        gap: 24px;
        min-height: 0;
        min-width: 0;
        width: 100%;
        margin: 0;
        float: none;
    }

    &__results-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 28px;
    }

    &__results-layout,
    &__state-browser,
    &__results-view {
        min-width: 0;
    }

    &__results-layout {
        display: grid;
        grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
        gap: 24px;
        align-items: start;
    }

    &__results-view {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
    }

    &__state-browser[hidden],
    &__results-header[hidden],
    &__results-view[hidden] {
        display: none;
    }

    &__state-browser {
        align-self: start;
        width: 100%;
    }

    &__state-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(205px, 1fr));
        gap: 16px;
    }

    &__state-card {
        display: flex;
        flex-direction: column;
        gap: 10px;
        min-height: 78px;
        width: 100%;
        padding: 10px 17px;
        border: 1px solid var(--wp--preset--color--primary-glacial-blue);
        border-radius: 6px;
        background: #DAE7F066;
        color: var(--wp--preset--color--primary-navy);
        font: inherit;
        text-align: left;
        text-decoration: none;
        cursor: pointer;
        transition: border-color 0.2s ease, transform 0.2s ease;

        &:hover,
        &:focus {
            border-color: var(--wp--preset--color--primary-glacial-blue);
            transform: translateY(-1px);
        }
    }

    &__state-card-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        color: var(--wp--preset--color--primary-navy);
        font-size: 18px;
        font-weight: 600;
        line-height: 1.4;

        &::after {
            content: '';
            width: 16px;
            height: 16px;
            flex: 0 0 16px;
            background: url('../svg/arrow-right.svg') no-repeat center / contain;
        }
    }

    &__state-card-count {
        color: var(--wp--preset--color--midnight-moss-800);
        font-size: 16px;
        font-weight: 400;
        line-height: 1.6;
    }

    &__results-count {
        margin: 0;
        color: var(--wp--preset--color--primary-navy);
        font-size: 18px;
        font-weight: 600;
        line-height: 1.4;
    }

    #wpsl-stores,
    #wpsl-direction-details {
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
        min-width: 0;
    }

    #wpsl-stores ul,
    #wpsl-direction-details ul {
        display: flex;
        flex-direction: column;
        gap: 16px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    #wpsl-stores li,
    #wpsl-direction-details li {
        margin: 0;
    }

    .infocus-store-locator-card {
        &__inner {
            display: flex;
            flex-direction: column;
            gap: 20px;
            padding: 24px;
            border: 1.5px solid var(--wp--preset--color--platinum-500);
            border-radius: 8px;
            background: var(--wp--preset--color--base);
        }

        &__content {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        &__header {
            display: flex;
            align-items: baseline;
            justify-content: space-between;
            gap: 16px;
        }

        &__title {
            flex: 1 1 auto;
            min-width: 0;
            margin: 0;
            color: var(--wp--preset--color--primary-navy);
            font-size: 18px;
            font-weight: 600;
            line-height: 1.4;

            a {
                color: inherit;
                text-decoration: none;
            }
        }

        &__distance {
            margin-left: auto;
            color: var(--wp--preset--color--midnight-moss-800);
            font-size: 14px;
            font-weight: 500;
            line-height: 1.4;
            text-align: right;
            white-space: nowrap;
        }

        &__address {
            position: relative;
            display: flex;
            flex-direction: column;
            gap: 4px;
            padding-left: 28px;
            color: var(--wp--preset--color--midnight-moss-800);
            font-size: 16px;
            font-weight: 400;
            line-height: 1.6;

            &::before {
                content: '';
                position: absolute;
                left: 0;
                top: 4px;
                width: 16px;
                height: 16px;
                background-color: var(--wp--preset--color--secondary-coral);
                mask: url('/wp-content/themes/infocus-eyecare-spark-child/assets/svg/location-dot-store.svg') no-repeat center / 16px 16px;
                -webkit-mask: url('/wp-content/themes/infocus-eyecare-spark-child/assets/svg/location-dot-store.svg') no-repeat center / 16px 16px;
            }
        }

        &__phone {
            position: relative;
            margin: 0;
            padding-left: 28px;
            color: var(--wp--preset--color--midnight-moss-800);
            font-size: 16px;
            font-weight: 400;
            line-height: 1.6;

            &::before {
                content: '';
                position: absolute;
                left: 0;
                top: 4px;
                width: 16px;
                height: 16px;
                background-color: var(--wp--preset--color--secondary-coral);
                mask: url('/wp-content/themes/infocus-eyecare-spark-child/assets/svg/phone.svg') no-repeat center / 16px 16px;
                -webkit-mask: url('/wp-content/themes/infocus-eyecare-spark-child/assets/svg/phone.svg') no-repeat center / 16px 16px;
            }

            a {
                color: inherit;
                text-decoration: none;
            }
        }

        &__actions {
            display: flex;
            flex-wrap: wrap;
            gap: 16px;

            .infocus-store-locator-card__button:first-child {
                border-color: var(--wp--preset--color--primary-navy);
                background: var(--wp--preset--color--primary-navy);
                color: var(--wp--preset--color--white);
            }
        }

        &__button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 44px;
            padding: 0 24px;
            border: 1px solid var(--wp--preset--color--primary-glacial-blue);
            border-radius: 999px;
            background: var(--wp--preset--color--primary-glacial-blue);
            color: var(--wp--preset--color--base);
            font-size: 14px;
            font-weight: 400;
            line-height: 1;
            text-decoration: none;
            text-transform: uppercase;

            &:hover,
            &:focus {
                background: var(--wp--preset--color--primary-navy);
                border-color: var(--wp--preset--color--primary-navy);
                color: var(--wp--preset--color--base);
            }
        }

        &__button--secondary {
            min-height: 0;
            padding: 0;
            border: 0;
            border-radius: 0;
            background: transparent;
            color: var(--wp--preset--color--primary-navy);
            font-size: 16px;
            font-weight: 400;
            text-decoration-color: var(--wp--preset--color--secondary-platinum);
            text-decoration-line: underline;
            text-decoration-thickness: 2px;
            text-underline-offset: 8px;
            transition: color 0.2s ease, text-decoration-color 0.2s ease;

            &:hover,
            &:focus {
                border: 0;
                background: transparent;
                color: var(--wp--preset--color--primary-navy);
                text-decoration-color: var(--wp--preset--color--secondary-coral);
            }
        }
    }

    #wpsl-result-list li .infocus-store-locator-card__phone {
        margin: 0;
        padding-left: 28px;
    }

    #wpsl-gmap {
        .infocus-store-locator-popup {
            width: 380px;
            max-width: 365px;

            .infocus-store-locator-card__inner {
                gap: 0;
                padding: 0;
                border: 0;
            }

            .infocus-store-locator-card__content {
                gap: 8px;
                padding: 0px 24px;
            }

            .infocus-store-locator-popup__header {
                position: relative;
                display: flex;
                align-items: flex-start;
                justify-content: space-between;
                gap: 16px;
                padding-right: 40px;
            }

            .infocus-store-locator-popup__header-actions {
                display: flex;
                justify-content: flex-end;
                margin-left: auto;
            }

            .infocus-store-locator-card__distance {
                padding-top: 2px;
            }

            .infocus-store-locator-card__address {
                margin-top: 8px;
                padding-top: 15px;

                &::before {
                    top: 19px;
                }

                &::after {
                    content: '';
                    position: absolute;
                    top: 0;
                    left: -24px;
                    right: -24px;
                    border-top: 1px solid var(--wp--preset--color--platinum-500);
                }
            }

            .infocus-store-locator-popup__close {
                position: absolute;
                top: 0;
                right: 0;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                width: 24px;
                height: 24px;
                margin: 0;
                padding: 0;
                border: 0;
                background: transparent;
                color: var(--wp--preset--color--primary-navy);
                font-size: 24px;
                font-weight: 400;
                line-height: 1;
                cursor: pointer;

                span {
                    position: absolute;
                    width: 16px;
                    height: 1.5px;
                    background: var(--wp--preset--color--midnight-moss-500);
                    border-radius: 999px;

                    &:first-child {
                        transform: rotate(50deg);
                    }

                    &:last-child {
                        transform: rotate(-50deg);
                    }
                }
            }

            .infocus-store-locator-card__actions {
                gap: 12px;
                padding: 20px 24px 24px;
                border-top: 1px solid var(--wp--preset--color--platinum-500);
            }
            .infocus-store-locator-card__hours {
                padding-left: 28px;
                margin-top: 0;
                padding-top: 0px;
                margin-bottom: 16px;
                position: relative;                

                .wpsl-opening-hours {
                    font-size: 16px !important;

                    &:before {
                        content: '';
                        position: absolute;
                        left: 0;
                        top: 2px;
                        width: 16px;
                        height: 16px;
                        background-color: var(--wp--preset--color--secondary-coral);
                        mask: url(../../assets/svg/clock.svg) no-repeat center / 16px 16px;
                    }
                }
                tr td:first-child {
                    font-weight: 600;
                }
            }
        }        

        .gm-style {
            .gm-ui-hover-effect[aria-label='Close'] {
                display: none !important;
            }

            .gm-style-iw-c {
                padding: 0 !important;
            }

            .gm-style-iw-d,
            .gm-style-iw-d > div {
                margin: 0 !important;
                padding: 0 !important;
            }

            .gm-style-iw-d {
                overflow: hidden !important;
            }
        }
    }

    .wpsl-preloader,
    .wpsl-no-results-msg {
        padding: 24px;
        border: 1px solid var(--wp--preset--color--platinum-500);
        border-radius: 8px;
        background: var(--wp--preset--color--base);
        color: var(--wp--preset--color--midnight-moss-800);
    }

    .wpsl-preloader {
        display: flex;
        gap: 12px;
        align-items: center;

        img {
            width: 18px;
            height: 18px;
        }
    }

    #wpsl-direction-details {
        display: none;
    }

    .wpsl-direction-before,
    .wpsl-direction-after {
        color: var(--wp--preset--color--midnight-moss-800);
    }

    &__map {
        position: sticky;
        top: 32px;
    }

    #wpsl-gmap {
        float: none;
        width: 100%;
        min-height: 760px;
        margin: 0;
        overflow: hidden;
    }
}

@media (max-width: 1024px) {
    .infocus-store-locator {
        grid-template-columns: minmax(0, 1fr);

        &__content {
            min-height: 0;
        }

        &__map {
            position: static;
        }

        #wpsl-gmap {
            min-height: 480px;
        }
    }
}

@media (max-width: 781px) {
    .infocus-store-locator {
        gap: 24px;

        &__search-input-wrap {
            padding-left: 18px;
        }

        #wpsl-search-input {
            height: 60px;
            padding-right: 18px;
        }

        #wpsl-search-wrap {
            #wpsl-search-btn {
                gap: 10px;
                min-height: 60px;
                padding: 0 22px;
                font-size: 14px;
            }
        }

        &__results-layout {
            grid-template-columns: minmax(0, 1fr);
        }

        &__state-grid {
            grid-template-columns: minmax(0, 1fr);
            gap: 12px;
        }

        &__state-card {
            min-height: 0;

            &::after {
                content: '';
                width: 16px;
                height: 16px;
                flex: 0 0 16px;
                background: url('../svg/arrow-right.svg') no-repeat center / contain;
            }
        }

        &__state-card-title {
            flex: 1 1 auto;

            &::after {
                content: none;
            }
        }

        &__state-card-count {
            flex: 0 0 auto;
            line-height: 1.4;
            white-space: nowrap;
        }

        .infocus-store-locator-card {
            &__header {
                align-items: flex-start;
            }

            &__actions {
                flex-direction: column;
            }

            &__button {
                width: 100%;
            }
        }

        #wpsl-gmap {
            .infocus-store-locator-popup {
                .infocus-store-locator-popup__header-actions {
                    padding-right: 0;
                }

                .infocus-store-locator-card__content {
                    padding: 20px;
                }

                .infocus-store-locator-card__actions {
                    padding: 20px;
                }

                .infocus-store-locator-card__address::after {
                    left: -20px;
                    right: -20px;
                }
            }
        }

        #wpsl-gmap {
            min-height: 360px;
        }
    }
}
