/*
 * Mayflower - LiveSearch Styles
 * Bear Group, www.beargroup.com
*/

/* Hide PDP/PLP PNG stickers while Live Search is open */
body.mf-livesearch-open .product-labels,
body.mf-livesearch-open .has-label-new::before,
body.mf-livesearch-open .has-label-sale::before,
body:has(.block-search .label.active) .product-labels,
body:has(.block-search .label.active) .has-label-new::before,
body:has(.block-search .label.active) .has-label-sale::before {
    display: none !important;
    content: none !important;
    visibility: hidden !important;
}

body.mf-livesearch-open .mf-sticky-atc,
body.mf-livesearch-open .mf-sticky-checkout {
    display: none !important;
}

#search_autocomplete .has-label-new::before,
#search_autocomplete .has-label-sale::before,
#search_autocomplete img[src*="new-label"],
#search_autocomplete img[src*="sale-label"],
#search_autocomplete .product-labels {
    display: none !important;
    content: none !important;
    background: none !important;
}

.mf-livesearch-badges {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    pointer-events: none;
}

.mf-livesearch-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.4;
    text-transform: uppercase;
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
}

.mf-livesearch-badge--sale {
    background: #e23d4d;
}

.mf-livesearch-badge--new {
    background: #7b4b9a;
}

/* Desktop/tablet: offset results below the in-header search field */
@media screen and (min-width: 768px) {
    .search-autocomplete {
        margin-top: 43px !important;
    }
    .search-autocomplete.active {
        margin-top: 55px !important;
    }

    .livesearch.products-container img {
        width: auto !important;
        justify-self: center !important;
        max-height: 90% !important;
    }
}

@media screen and (max-width: 767.98px) {
    body.mf-livesearch-open .page-header .panel.wrapper {
        z-index: 200 !important;
        /* Keep the purple bar fixed height so the search icon stays visible */
        height: 56px !important;
        min-height: 56px !important;
        max-height: 56px !important;
        overflow: visible !important;
    }

    .page-header .panel.wrapper .block-search .control,
    .page-header .panel.wrapper .block-search .form.minisearch,
    .page-header .panel.wrapper .block-search .form.minisearch.active {
        overflow: visible !important;
    }

    .page-header .panel.wrapper .block-search .form.minisearch,
    .page-header .panel.wrapper .block-search .form.minisearch.active {
        height: 40px !important;
        max-height: 40px !important;
    }

    .page-header .panel.wrapper .block-search .block-title {
        display: none !important;
    }

    .page-header .panel.wrapper .block-search .label,
    .page-header .panel.wrapper .block-search .label.active {
        display: flex !important;
        align-items: center;
        justify-content: center;
        visibility: visible !important;
        opacity: 1 !important;
        clip: auto !important;
        width: 40px !important;
        height: 40px !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        position: relative !important;
        font-size: 0;
        line-height: 0;
        color: transparent;
    }

    .page-header .panel.wrapper .block-search .label > span {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        margin: -1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        white-space: nowrap !important;
        border: 0 !important;
    }

    .page-header .panel.wrapper .block-search .search-autocomplete,
    .page-header .panel.wrapper .block-search .search-autocomplete.active,
    .page-header .panel.wrapper .block-search #search_autocomplete {
        display: none !important;
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 70vh !important;
        margin: 0 !important;
        padding: 0 0 12px !important;
        background: #fff !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        z-index: 80 !important;
        border: 0 !important;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.16) !important;
    }

    .page-header .panel.wrapper .block-search.search-open.has-query .search-autocomplete,
    .page-header .panel.wrapper .block-search.search-open.has-query .search-autocomplete.active,
    .page-header .panel.wrapper .block-search.search-open.has-query #search_autocomplete {
        display: block !important;
    }

    .page-header .panel.wrapper .block-search .search-autocomplete > ul {
        display: none !important;
    }

    .page-header .panel.wrapper .block-search .search-autocomplete .livesearch.popover-container {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        row-gap: 0 !important;
        column-gap: 0 !important;
        grid-template-areas: "previews" "viewall" !important;
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto !important;
        overflow: visible !important;
        background: #fff !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .page-header .panel.wrapper .block-search .search-autocomplete .livesearch.suggestions-container,
    .page-header .panel.wrapper .block-search .search-autocomplete .livesearch.suggestions-header {
        display: none !important;
    }

    .page-header .panel.wrapper .block-search .search-autocomplete .livesearch.products-container {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: none !important;
        grid-auto-rows: min-content !important;
        gap: 8px !important;
        padding: 8px !important;
        margin: 0 !important;
        align-items: start !important;
        background: #fff !important;
        border: 0 !important;
    }

    .page-header .panel.wrapper .block-search .search-autocomplete .livesearch.product-link {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        text-decoration: none !important;
        color: inherit !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .page-header .panel.wrapper .block-search .search-autocomplete .livesearch.product-result {
        display: grid !important;
        grid-template-areas: "image" "productName" "price" !important;
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto 0 !important;
        justify-items: center !important;
        align-items: start !important;
        position: relative !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 6px 4px 8px !important;
        margin: 0 !important;
        background: #fff !important;
        border: 0 !important;
        box-shadow: none !important;
        text-align: center !important;
    }

    .page-header .panel.wrapper .block-search .search-autocomplete .mf-livesearch-badges {
        grid-area: unset !important;
        position: absolute !important;
        top: 4px !important;
        left: 4px !important;
        width: auto !important;
        height: auto !important;
    }

    .page-header .panel.wrapper .block-search .search-autocomplete .livesearch.product-result img {
        grid-area: image !important;
        width: auto !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: 90px !important;
        object-fit: contain !important;
        margin: 0 auto !important;
        border: 0 !important;
    }

    .page-header .panel.wrapper .block-search .search-autocomplete .livesearch.product-result > .mf-livesearch-badges + *,
    .page-header .panel.wrapper .block-search .search-autocomplete .livesearch.product-result > *:nth-child(2) {
        width: 100% !important;
        justify-self: stretch !important;
        text-align: center !important;
    }

    .page-header .panel.wrapper .block-search .search-autocomplete .livesearch.product-name,
    .page-header .panel.wrapper .block-search .search-autocomplete .livesearch.product-name * {
        display: block !important;
        width: 100% !important;
        margin: 6px 0 0 !important;
        padding: 0 !important;
        font-size: 13px !important;
        line-height: 1.3 !important;
        font-weight: 600 !important;
        text-align: center !important;
        color: #333 !important;
    }

    .page-header .panel.wrapper .block-search .search-autocomplete .livesearch.product-price,
    .page-header .panel.wrapper .block-search .search-autocomplete .livesearch.product-price * {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        font-size: 0 !important;
        line-height: 0 !important;
    }
}
