.search-wrapper {
  position: relative;
}

#search_autocomplete {
  max-height: calc(var(--vh, 100vh) - 125px);
  overscroll-behavior: contain;
}

@media (max-width: 767px) {
  .smile-elasticsuite-autocomplete-result {
    color: #323232;
  }
  #search_mini_form #search {
    z-index: 4;
  }

  #search_autocomplete {
    margin-top: 0;
  }
}

.block.block-search {
  position: static;
}

div#search_autocomplete[style*='absolute']:not([style*='display: none;']) {
  left: 0;
  display: flex !important;
  justify-content: space-around;
  width: 100% !important;
  margin: 32px 0 0;
  padding: 0;
}

@media (max-width: 1094px) {
  div#search_autocomplete[style*='absolute']:not([style*='display: none;']) {
    margin-top: 24px;
  }
}

@media (max-width: 1022px) {
  div#search_autocomplete[style*='absolute']:not([style*='display: none;']) {
    margin-top: 19px;
  }
}

@media (max-width: 767px) {
  div#search_autocomplete[style*='absolute']:not([style*='display: none;']) {
    margin-top: 8px;
  }
}

div#search_autocomplete[style*='absolute']:not([style*='display: none;'])::before {
  position: fixed;
  top: 118px;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  background: rgba(0, 0, 0, 0.4);
  content: '';
}

.block-search .block-content {
  position: static;
}

.smile-elasticsuite-autocomplete-result {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  width: 100%;
  max-width: 1130px;
  padding: 30px;
  overflow: auto;
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 5px 25px 0 rgba(0, 0, 0, 0.5);
  gap: 10px;
}

@media (max-width: 767px) {
  .smile-elasticsuite-autocomplete-result {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

@media (max-width: 1200px) {
  .smile-elasticsuite-autocomplete-result {
    max-width: 100%;
  }
}

dl.autocomplete-list.type-category .qs-option-name {
  font-size: 14px;
}

dl.autocomplete-list.type-category {
  order: 1;
  box-sizing: border-box;
  width: 250px;
  padding: 0 30px 0 0;
}
dl.autocomplete-list.type-cms_page {
  box-sizing: border-box;
  width: 220px;
  padding: 0 30px 0 0;
}
@media (min-width: 768px) {
  dl.autocomplete-list.type-category {
    max-width: 100%;
  }
}

@media (max-width: 767px) {
  dl.autocomplete-list.type-product {
    order: 1;
  }
  dl.autocomplete-list.type-category {
    order: 2;
  }
  dl.autocomplete-list.type-term {
    order: 2;
    box-sizing: content-box !important;
    min-height: 60px !important;
    padding-bottom: 60px !important;
  }
  dl.autocomplete-list {
    display: block;
    width: 100%;
  }
}

dl.autocomplete-list.type-product {
  order: 2;
}

@media (min-width: 768px) {
  dl.autocomplete-list.type-product {
    flex-basis: calc(100% - 490px);
  }
}

dl.autocomplete-list.type-term {
  display: flex;
  flex: 1 0 100%;
  align-items: center;
  order: 3;
  width: 100%;
  margin: 0 -30px -30px;
  padding: 10px 30px;
  background: #ececec;
  border-bottom-right-radius: 5px;
  border-bottom-left-radius: 5px;
}

@media (max-width: 767px) {
  dl.autocomplete-list.type-term {
    flex-shrink: 0;
    flex-wrap: wrap;
    margin-top: 20px;
  }
}

dl.autocomplete-list.type-term .title-term {
  margin-right: 15px;
  text-transform: uppercase;
}

dl.autocomplete-list.type-term dt {
  padding: 0;
  color: #959595;
  font-weight: normal;
  font-size: 12px;
  background: unset;
}

dl.autocomplete-list.type-term dd .qs-option-name {
  display: inline-block;
  margin-right: 5px;
  font-weight: bold;
}
dl.autocomplete-list.type-term dd {
  display: flex;
  align-items: center;
  margin-right: 10px;
  padding: 0 8px;
  color: #959595;
  font-size: 12px;
  text-transform: capitalize;
  background: unset;
  border: 1px solid #959595 !important;
  border-radius: 3px;
}

@media (max-width: 767px) {
  dl.autocomplete-list.type-term dd {
    margin-bottom: 5px;
  }
}

dl.autocomplete-list.type-term dd .amount {
  position: unset;
  top: unset;
  right: unset;
  display: inline-block;
}

dl.autocomplete-list.type-term dd .amount::before {
  content: '(';
}
dl.autocomplete-list.type-term dd .amount::after {
  content: ')';
}

@media (min-width: 768px) {
  dl.autocomplete-list.type-product {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
  }
}

.search-autocomplete dl dt:not(:empty),
.search-autocomplete dl dd:not(:empty) {
  border: none;
}

.autocomplete-list.type-product dt.autocomplete-list-title.title-product {
  flex-basis: 100%;
}

.search-autocomplete dl dt {
  padding: 0 0 15px;
}

.search-autocomplete dl dd {
  padding: 0;
}

.autocomplete-list.type-product dd {
  flex-basis: calc(50% - 25px);
  box-sizing: border-box;
  width: calc(50% - 25px);
}

@media (max-width: 767px) {
  .autocomplete-list.type-product dd {
    flex-shrink: 0;
    width: 100%;
  }
}

.smile-elasticsuite-autocomplete-result .product-image-box {
  width: 63px;
  margin: 0;
  margin-right: 15px;
  padding: 0;
}

.product-image-box img {
  display: inherit;
  min-width: 100%;
  height: auto;
}

.autocomplete-list.type-cms_page{
    margin-bottom: 15px;
}

.autocomplete-list.type-product dd[role='option'] {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #ebebeb;
}

.elastic-show-all-mobile,
.smile-elasticsuite-autocomplete-result .product-secondary {
  display: none;
}

dl.autocomplete-list.type-category dd:not(:last-child),
dl.autocomplete-list.type-cms_page dd:not(:last-child) {
  margin-bottom: 5px;
  padding-bottom: 5px;
  border-bottom: 1px solid #f2f2f2;
}

body .search-autocomplete dl dd:hover,
body .search-autocomplete dl dd.selected,
body .search-autocomplete dl dt:hover,
body .search-autocomplete dl dt.selected {
  background: none;
}

.elastic-show-all {
  order: 10;
  margin-left: auto;
}

@media (max-width: 767px) {
  .elastic-show-all {
    flex-basis: 100%;
    margin-top: 10px;
  }

  .elastic-show-all-mobile {
    display: unset;
    color: unset !important;
    font-weight: normal;
    font-size: 14px;
    text-decoration: underline;
  }
  dt.title-product {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}

.search-autocomplete {
  overflow: visible;
}

@media (min-width: 768px) {
  .is-sticky div#search_autocomplete[style*='absolute']:not([style*='display: none;'])::before {
    top: 66px;
  }
  .is-sticky div#search_autocomplete[style*='absolute']:not([style*='display: none;']) {
    margin-top: 9px;
  }
}

/* Target only iOS here, iOS keyboard is overlayed on page, while Android keyboards actually shrink the viewport size */
@supports (-webkit-touch-callout: none) {
  /* iphone 6, 6s, 7, 8 */
  @media only screen and (min-device-width: 375px) and (max-device-height: 667px) and (-webkit-device-pixel-ratio: 2) {
    #search_autocomplete {
      max-height: calc(var(--vh, 100vh) - 275px);
    }
  }

  /* iphone 6+, 6s+, 7+, 8+ */
  @media only screen and (min-device-width: 414px) and (max-device-height: 736px) and (-webkit-device-pixel-ratio: 3) {
    #search_autocomplete {
      max-height: calc(var(--vh, 100vh) - 340px);
    }
  }

  /* iPhone XS */
  @media (min-device-width: 375px) and (max-device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
    #search_autocomplete {
      max-height: calc(var(--vh, 100vh) - 312px);
    }
  }

  /* iPhone 11 Pro */
  @media (min-device-width: 375px) and (max-device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
    #search_autocomplete {
      max-height: calc(var(--vh, 100vh) - 312px);
    }
  }

  /* iPhone XS Max / iPhone 11 Pro Max / iPhone 11 */
  @media (min-device-width: 414px) and (max-device-height: 896px) and (-webkit-device-pixel-ratio: 3) {
    #search_autocomplete {
      max-height: calc(var(--vh, 100vh) - 400px);
    }
  }

  /* iPhone 12 */
  @media only screen and (device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) {
    #search_autocomplete {
      max-height: calc(var(--vh, 100vh) - 400px);
    }
  }
}

/* Target android devices */
@supports not (-webkit-touch-callout: none) {
  @media (max-width: 767px) {
    #search_autocomplete {
      max-height: calc(var(--vh, 100vh) - 60px);
    }
  }
}
