/******************** Search box *************************/
/* The search box only opens the search window (search-overlay.tpl) */

.lupa-search-input-container {
    width: 100%;
}

.lupa-search-input-form {
    display: flex;
    outline: 2px solid transparent;
    outline-offset: 1px;
    transition: 0.2s ease-in-out;
    border-bottom: 2px solid #929292;
    background: white;
    gap: 4px;

    &:has([data-component="lupa-search-text-input"]:focus) {
        border-color: black;
    }

    @media (max-width: 767px) {
        border-top: 1px solid #D3D3D3;
        border-bottom: 1px solid #D3D3D3;
    }
}

.lupa-search-text-input {
    width: 0;
    flex: 1;
    border: none;
    background: none;
    padding: .5em 0 .5em 1em;
    height: 46px;
}

.lupa-search-text-input:focus {
    outline: none;
}

.lupa-search-input-submit-button {
    border: none;
    order: 3;
    background: none;
    padding-left: 0.75rem;
    padding-right: 0.75rem;

    &:before {
        content: ' ';
        display: block;
        width: 2rem;
        height: 2rem;
        background-image: url('./img/search-icon.svg');
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
    }
}

.lupa-search-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

/******************** Search window (ASANA-1220162804183793) *************************/
/* Full screen on desktop and mobile: the search box on top, then the popular brands and
   products, or while typing the search suggestions, "See all" and the found products.
   No CSS nesting here, older iPhones (Safari before 16.5) would drop the rules. */

/* The page under the window does not scroll */
html.lupa-search-overlay-open,
html.lupa-search-overlay-open body {
    overflow: hidden;
}

.lupa-search-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100010;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: #FFFFFF;
    color: #000104;
    text-align: left;
}

.lupa-search-overlay[hidden],
.lupa-search-overlay [hidden] {
    display: none !important;
}

.lupa-search-overlay a,
.lupa-search-overlay a:hover,
.lupa-search-overlay a:focus {
    text-decoration: none;
}

.lupa-search-overlay-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding-left: 30px;
    padding-right: 30px;
}

.lupa-search-overlay-header {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #FFFFFF;
    border-bottom: 1px solid #E6E6E6;
}

.lupa-search-overlay-header .lupa-search-overlay-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 16px;
    padding-bottom: 16px;
}

.lupa-search-overlay-form {
    display: flex;
    flex: 1;
    align-items: center;
    min-width: 0;
    margin: 0;
    border: 1px solid #D3D3D3;
    background: #FFFFFF;
    transition: border-color 0.2s ease-in-out;
}

.lupa-search-overlay-form:focus-within {
    border-color: #343434;
}

.lupa-search-overlay-submit,
.lupa-search-overlay-clear,
.lupa-search-overlay-close {
    flex: 0 0 auto;
    padding: 0;
    border: none;
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
}

.lupa-search-overlay-submit {
    width: 48px;
    height: 48px;
    background-image: url('./img/search-icon.svg');
    background-size: 20px 20px;
}

/* The search runs with a loader in place of the search icon */
.lupa-search-overlay-loading .lupa-search-overlay-submit {
    background-image: url('./img/loader.svg');
    background-size: 18px 18px;
}

.lupa-search-overlay-input {
    flex: 1;
    width: 0;
    height: 48px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: #000104;
    /* 16px keeps iOS from zooming in on the input */
    font-size: 16px;
    line-height: 20px;
}

.lupa-search-overlay-input:focus {
    outline: none;
    box-shadow: none;
}

.lupa-search-overlay-input::placeholder {
    color: #A0A0A0;
    opacity: 1;
}

.lupa-search-overlay-clear {
    width: 44px;
    height: 48px;
    background-image: url('./img/close.svg');
    background-size: 12px 12px;
    opacity: 0.6;
}

.lupa-search-overlay-clear:hover {
    opacity: 1;
}

.lupa-search-overlay-close {
    width: 40px;
    height: 40px;
    background-image: url('./img/close.svg');
    background-size: 20px 20px;
}

.lupa-search-overlay-body .lupa-search-overlay-inner {
    padding-top: 28px;
    padding-bottom: 48px;
}

.lupa-search-overlay-loader {
    height: 120px;
    background: url('./img/loader.svg') center / 24px 24px no-repeat;
}

/* Sections */

.lupa-search-section + .lupa-search-section,
.lupa-search-section + .lupa-search-see-all,
.lupa-search-section + .lupa-search-no-results,
.lupa-search-see-all + .lupa-search-section,
.lupa-search-no-results + .lupa-search-section {
    margin-top: 32px;
}

.lupa-search-overlay .lupa-search-section-title {
    margin: 0 0 16px;
    padding: 0;
    color: #000104;
    font-size: 16px;
    font-weight: 700;
    line-height: 20px;
    letter-spacing: 0.5px;
    text-align: left;
    text-transform: uppercase;
}

/* Popular brands */

.lupa-search-brands {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 200px));
    gap: 12px;
}

.lupa-search-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    padding: 14px 18px;
    border: 1px solid #E6E6E6;
    background: #FFFFFF;
    color: #000104;
    text-align: center;
    transition: border-color 0.2s ease-in-out;
}

.lupa-search-brand:hover,
.lupa-search-brand:focus {
    border-color: #343434;
    color: #000104;
}

.lupa-search-brand-logo {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    margin: 0;
    object-fit: contain;
}

.lupa-search-brand-name {
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    line-height: 16px;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    word-break: break-word;
}

/* Search suggestions: a row of chips on desktop, a list on mobile */

.lupa-search-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lupa-search-suggestion {
    padding: 8px 14px;
    background: #F2F2F2;
    color: #000104;
    font-size: 14px;
    line-height: 18px;
    transition: background-color 0.2s ease-in-out;
}

.lupa-search-suggestion:hover,
.lupa-search-suggestion:focus {
    background: #E6E6E6;
    color: #000104;
}

/* "See all results" */

.lupa-search-see-all-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    padding: 13px 24px;
    background: #343434;
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 500;
    line-height: 14px;
    transition: background-color 0.2s ease-in-out;
}

.lupa-search-see-all-button:after {
    content: '';
    display: inline-block;
    flex: 0 0 18px;
    height: 12px;
    background: url('./img/arrow-right-white.svg') center / contain no-repeat;
}

.lupa-search-see-all-button:hover,
.lupa-search-see-all-button:focus {
    background: #151515;
    color: #FFFFFF;
}

/* Products */

.lupa-search-products {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 24px 16px;
}

.lupa-search-product {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    color: #000104;
}

.lupa-search-product:hover,
.lupa-search-product:focus {
    color: #000104;
}

.lupa-search-product:hover .lupa-search-product-name {
    text-decoration: underline;
}

.lupa-search-product-image {
    display: block;
    margin-bottom: 6px;
    aspect-ratio: 249 / 354;
    background: #F7F7F7;
}

.lupa-search-product-image img {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: contain;
}

.lupa-search-product-brand {
    overflow: hidden;
    font-size: 11px;
    font-weight: 700;
    line-height: 13px;
    letter-spacing: 0.9px;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.lupa-search-product-name {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 13px;
    font-weight: 300;
    line-height: 17px;
    word-break: break-word;
}

.lupa-search-product-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 8px;
    margin-top: 2px;
    font-size: 15px;
    font-weight: 500;
    line-height: 20px;
}

.lupa-search-product-price-old {
    color: #A0A0A0;
    font-size: 13px;
    font-weight: 400;
    text-decoration: line-through;
}

.lupa-search-product-price.has-discount .lupa-search-product-price-current {
    color: #EA1C2D;
}

.lupa-search-no-results {
    padding: 8px 0;
    font-size: 15px;
    line-height: 20px;
}

@media (max-width: 1199px) {
    .lupa-search-products {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .lupa-search-overlay-inner {
        padding-left: 15px;
        padding-right: 15px;
    }

    .lupa-search-overlay-header .lupa-search-overlay-inner {
        gap: 8px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .lupa-search-overlay-body .lupa-search-overlay-inner {
        padding-top: 20px;
        padding-bottom: 32px;
    }

    .lupa-search-section + .lupa-search-section,
    .lupa-search-section + .lupa-search-see-all,
    .lupa-search-section + .lupa-search-no-results,
    .lupa-search-see-all + .lupa-search-section,
    .lupa-search-no-results + .lupa-search-section {
        margin-top: 24px;
    }

    .lupa-search-overlay .lupa-search-section-title {
        margin-bottom: 12px;
        font-size: 14px;
        line-height: 18px;
    }

    .lupa-search-brands {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .lupa-search-brand {
        height: 64px;
        padding: 10px;
    }

    .lupa-search-suggestions {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 0;
    }

    .lupa-search-suggestion {
        padding: 10px 0;
        background: none;
        border-bottom: 1px solid #F0F0F0;
    }

    .lupa-search-suggestion:hover,
    .lupa-search-suggestion:focus {
        background: none;
        color: #EA1C2D;
    }

    .lupa-search-see-all-button {
        display: flex;
        width: 100%;
    }

    .lupa-search-products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 12px;
    }
}
