/* tools */
.search-featured {
    --product-card-image-container-padding: 27px;

    position: absolute;
    top: var(--search-featured-top, 49px);
    right: var(--search-featured-right, -16px);
    max-width: 100vw;

    .product-card__image {
        aspect-ratio: 112 / 112;
    }
}

.search-featured .featured-product-grid {
    background-color: var(--color-white);
}

.search-autocomplete {
 z-index: 100;
 position: absolute;
 box-sizing: border-box;
 top: var(--search-featured-top, 49px);
 right: var(--search-featured-right, -16px);
 border: 1px solid var(--color-gray-300);
}

.livesearch.view-all {
    text-decoration: underline;
}

.livesearch.product-image-wrapper {
    background-color: var(--color-gray-50);
    padding: 27px;
}

.livesearch.brand {
    color: var(--color-gray-1100);
}

.livesearch.product-name {
    display: -webkit-box;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
}

.suggestions-link-container {
    color: var(--color-gray-600);

    svg {
        min-width: 13px;
    }
}

.livesearch.suggestions-header {
    align-self: flex-start;
}

header .nav-search-input .search_autocomplete .popover-container {
 width: 100%;
}

.search-input-wrapper {
    position: relative;
}

.search-bar {
 --search-bar-width: 100%;

 position: relative;

 .search-input {
        width: var(--search-bar-width);
        padding: 6px 20px 6px 32px;
        border-radius: 16px;
        border-color: var(--color-gray-1200);
        font: var(--type-headline-1-font);
        letter-spacing: var(--type-headline-1-letter-spacing);
        text-overflow: ellipsis;
        background-color: var(--color-gray-50);
        color: var(--color-gray-1200);
        font-weight: normal;
        cursor: pointer;
        border: .5px solid var(--color-gray-700);

  &::placeholder {
   color: rgba(0 0 0 / 80%);
  }

  &::-webkit-search-cancel-button {
    -webkit-appearance: none;
    display: none;
  }
 }

 .nav-search-button {
        position: absolute;
        left: 3px;
        top: 3px;
        background: transparent;
        border: 0;
        line-height: 1;
        padding-inline: 0;
        padding-block: 0;
        padding: 6px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;

  &:hover {
   cursor: pointer;
  }
 }
}

.search-actions-right {
    position: absolute;
    right: 4px;
    top: 3px;
    background: none;
    border: 0;
    line-height: 1;
    padding-inline: 0;
    padding-block: 0;
    padding: 6px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    column-gap: 16px;
}

.search-clear-button,
.search-submit-button {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    padding: 0;

    &::before {
        content: '';
        display: block;
        background: url('../../../../icons/X.svg') no-repeat 50% 50%;
        cursor: pointer;
    }
}

.search-clear-button {
    display: flex;
    align-items: center;

    &::before {
        height: 1.2rem;
        width: 1.2rem;
    }
}

.search-submit-button {
    display: flex;
    align-items: center;

    &::before {
        height: 1.6rem;
        width: 1.6rem;
        background: url('../../../../icons/arrow.svg') no-repeat 50% 50%;
    }
}

.nav-tools > div:has(.mobile-search-button) {
 flex-grow: 1;
}

.mobile-search-button {
 background-color: var(--color-gray-50);
 border: .5px solid var(--color-gray-700);
 border-radius: 16px;
 padding: 6px 16px;
 font: var(--type-headline-1-font);
 font-weight: normal;
 letter-spacing: 0;
 cursor: pointer;
 display: inline-flex;
 justify-content: space-between;
 align-items: center;
 color: var(--color-gray-1200);
 width: 100%;

 &::after {
  background-image: url('../../../../icons/search.svg');
  background-size: 16px;
  background-repeat: no-repeat;
  background-position: center;
  content: '';
  width: 16px;
  height: 16px;
  display: block;
 }
}

/* Modal search */
.search-modal-container {
 position: fixed;
 top: 0;
 left: 0;
 width: 100%;
 height: 100%;
 z-index: 1000;
}

.search-modal-content {
 display: flex;
 flex-direction: column;
 background: var(--color-white);
 padding: 24px 16px 22px;
 width: 100%;
 box-sizing: border-box;
 row-gap: 15px;
}

.modal-close-button {
 background: none;
 border: none;
 font-size: 1.6rem;
 cursor: pointer;
 align-self: flex-end;
}

@media (width >= 1024px) {
 .search-featured,
 .search-autocomplete {
    --search-featured-top: 49px;
    --search-featured-right: -67px;
 }

 .search-featured {
    max-width: 784px;

    .featured-product-grid {
        padding-bottom: 42px;
    }

    .product-card__name {
        height: 58px;
        -webkit-line-clamp: 3;
    }

    .featured-product-grid__header {
        max-height: 18px;
    }
 }

 .search-actions-right {
        top: 5px;
        right: 10px;
        background-color: var(--color-gray-50);
}

    .suggestions-container {
        border-right: 1px solid var(--color-gray-300);
    }

    .search-submit-button {
        display: none;
    }

 .search-featured .featured-product-grid {
    background-color: var(--color-white);
    border: 1px solid var(--color-gray-300);
 }

 .search-bar {
  --search-bar-width: clamp(12.3rem, -26.477rem + 37.831vw, 28rem);
 }

 .custom-search-button {
  display: none;
 }
}

@media (width < 1024px) {
 html:has(.search-modal-container) {
    overflow: hidden;
 }

 .wishlist-wrapper {
  display: none;
 }

 .popover-container:has(.suggestions-container) .view-all-wrapper {
    display: none;
 }

 .search-clear-button::after {
    content: '|';
    margin-left: 16px;
    font-size: 1.65rem;
}

 .search-autocomplete {
    min-width: 100vw;
    border-width: 1px 0 0;
 }

 .search-featured {
    --featured-product-grid-flex-flow: wrap;

    width: 100vw;

    .featured-product-grid {
        padding: 16px;
    }

    .featured-product-grid__list {
        --product-card-search-image-container-min-width: 100%;

        display: grid;
        grid-template-columns: repeat(4, 1fr);
    }
 }
}

@media (width < 526px) {
    .search-featured {
       .featured-product-grid__list {
           grid-template-columns: repeat(2, 1fr);
       }
    }
}
