/* Predictive Search */

/* ONS-027DM Advanced Search */
.predictive-search {
  display: none;
  position: absolute;
}

@media screen and (min-width: 750px) {
  .predictive-search {
    position: relative;
  }
}

.predictive-search-results {
  display: none;
  /* ONS-027DM Advanced Search */
  position: absolute;
  /* top: 0; */
  left: 0;
  right: 0;
  z-index: 3;
  max-height: calc(100vh - var(--header-height));
  /* -webkit-overflow-scrolling: touch; <-- causes header to flicker on safari */
  color: var(--color-black);
  background-color: var(--color-white);
  border-bottom: 1px solid #000;
}

body .predictive-search__overlay-mobile,
body .predictive-search__overlay {
  display: none;
  overscroll-behavior: contain;
  touch-action: none;
}

@media screen and (max-width: 749px) {
  body.mobile-suggestions-open {
    overflow: hidden !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
  }
  body.mobile-suggestions-open main::before {
    content: "";
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 99;
    width: 100%;
    display: block;
    position: fixed;
    background: var(--overlay-background);
  }
  /* body.mobile-suggestions-open .predictive-search__overlay-mobile {
    display: flex;
    flex-direction: column;
  } */
}

@media screen and (min-width: 750px) {
  body.suggestions-open {
    overflow: hidden !important;
    /* position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%; */
  }
  body.suggestions-open main::before {
    content: "";
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 99;
    width: 100%;
    display: block;
    position: fixed;
    background: var(--overlay-background);
  }
  /* body.suggestions-open .predictive-search__overlay {
    display: flex;
    flex-direction: column;
  } */
}

@media screen and (min-width: 750px) {
  .predictive-search-results {
    height: auto !important;
    top: 2px;
    left: -0.1rem;
    right: 0.1rem;
    border-width: var(--popup-border-width);
    border-style: solid;
    border-color: rgba(var(--color-foreground), var(--popup-border-opacity));
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 4px;
    filter: drop-shadow(var(--drawer-shadow-horizontal-offset) var(--drawer-shadow-vertical-offset) var(--drawer-shadow-blur-radius) rgba(var(--color-shadow), var(--drawer-shadow-opacity)));
  }
}

predictive-search-mobile .spinner,
predictive-search .spinner {
  width: 1.5rem;
  height: 1.5rem;
  line-height: 0;
}

@media screen and (max-width: 749px) {
  predictive-search-mobile[open] .predictive-search,
  predictive-search-mobile[loading] .predictive-search {
    display: block;
  }

  predictive-search-mobile[open] .predictive-search-results,
  predictive-search-mobile[loading] .predictive-search-results {
    display: block;
    overflow-y: auto;
  }

  predictive-search-mobile:not([loading]) .predictive-search__loading-state,
  predictive-search-mobile:not([loading]) .predictive-search-status__loading {
    display: none;
  }

  predictive-search-mobile[loading] .predictive-search__loading-state {
    display: flex;
    justify-content: center;
    padding: 1rem;
  }

  predictive-search-mobile[loading] .predictive-search__search-for-button,
  predictive-search-mobile[loading] .predictive-search__results-groups-wrapper~.predictive-search__loading-state {
    display: none;
  }

  predictive-search-mobile[loading] .predictive-search__results-groups-wrapper~.predictive-search__search-for-button {
    display: initial;
  }
}

@media screen and (min-width: 750px) {
  predictive-search[open] .predictive-search,
  predictive-search[loading] .predictive-search {
    display: block;
  }

  predictive-search[open] .predictive-search-results,
  predictive-search[loading] .predictive-search-results {
    display: block;
    overflow-y: auto;
  }

  predictive-search:not([loading]) .predictive-search__loading-state,
  predictive-search:not([loading]) .predictive-search-status__loading {
    display: none;
  }

  predictive-search[loading] .predictive-search__loading-state {
    display: flex;
    justify-content: center;
    padding: 1rem;
  }

  predictive-search[loading] .predictive-search__search-for-button,
  predictive-search[loading] .predictive-search__results-groups-wrapper~.predictive-search__loading-state {
    display: none;
  }

  predictive-search[loading] .predictive-search__results-groups-wrapper~.predictive-search__search-for-button {
    display: initial;
  }
}

.predictive-search__heading {
  color: var(--color-black) !important;
}

.predictive-search__item-heading {
  color: var(--color-black) !important;
}

.predictive-search__item-query-result *:not(mark) {
  font-weight: 500 !important;
}

.predictive-search__item-query-result mark {
  color: var(--color-black) !important;
  font-weight: 800 !important;
}

/* Remove extra spacing for search inputs in Safari */
input::-webkit-search-decoration {
  -webkit-appearance: none;
}

/* Component - Search */
p.predictive-search__item-heading {
  /* line-height: calc(1 + 0.3 / max(1, var(--font-heading-scale))); */
  font-weight: 500;
}

p.predictive-search__item-heading>span {
  font-weight: 400;
  /* color: var(--color-grey4) */
}

.predictive-search__heading {
  color: var(--color-grey4) !important;
  font-weight: 600;
}

.predictive-search--search-template {
  z-index: 2;
  width: calc(100% + 0.2rem);
}

.predictive-search__results-groups-wrapper {
  display: flex;
  padding: 0 1em 1em;
  gap: 1rem;
}

@media screen and (max-width: 749px) {
  .predictive-search--header {
    right: 0;
    left: 0;
  }

  .predictive-search__results-groups-wrapper {
    flex-direction: column;
    padding-bottom: 0;
  }

  .predictive-search__results-groups-wrapper:not(.predictive-search__results-groups-wrapper--no-suggestions) {
    /* On mobile, when there are no suggestions the first .predictive-search__results-groups-wrapper
     * is virtually empty due to a display: hidden on the predictive-search__pages-wrapper child.
     * This causes the gap to render and look like a big top margin */
    gap: 0;
  }
}

@media screen and (min-width: 750px) {
  .predictive-search {
    border-top: none;
    width: calc(100% + 0.2rem);
  }

  .header predictive-search {
    position: relative;
  }
}

.predictive-search__heading {
  border-bottom: 0.1rem solid rgba(var(--color-foreground), 0.08);
  margin: 0 2rem;
  padding: 1.5rem 0 0.75rem;
  color: rgba(var(--color-foreground), 0.7);
  /* display: none; */
}


.predictive-search__result-group {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 0;
}

@media screen and (max-width: 749px) {
  .predictive-search__result-group {
    border-bottom: 1px solid var(--color-grey3);
    padding: 0.5rem 0;
  }
}

@media screen and (min-width: 750px) {

  .predictive-search__result-group:first-child {
    flex: 0 0 33.333333%;
  }

  .predictive-search__results-groups-wrapper--no-products .predictive-search__result-group:first-child,
  .predictive-search__result-group:only-child {
    flex-grow: 1;
  }
}

.predictive-search__item {
  display: inline-flex;
  padding: 0.5em 0;
  text-decoration: none;
  align-items: center;
  gap: 0.5em;
  line-height: 1;
  /* line-height: calc(1 + .3 / max(1, var(--font-heading-scale))); */
  /* width: 100%; */
}

.predictive-search__item-heading {
  line-height: 1.5em;
}


.predictive-search__item>i {
  margin-top: 3px;
}

.predictive-search__search-for-button {
  display: block;
}

@media screen and (min-width: 750px) {
  .predictive-search__search-for-button {
    display: block;
    border-top: 1px solid var(--color-grey3);
  }
}

.predictive-search__item:hover .predictive-search__item-content {
  text-decoration: underline;
  text-underline-offset: 0.3rem;
}

.predictive-search__item--link-with-thumbnail {
  align-items: center;
  padding: 0.5rem 0;
  display: grid;
  grid-template-columns: 5rem 1fr;
  grid-column-gap: 1rem;
  grid-template-areas: "product-image product-content";
}

.predictive-search__item--link-with-thumbnail .predictive-search__item-heading {
  line-height: 1.5em;
}

@media screen and (min-width: 750px) {
  .predictive-search__item--link-with-thumbnail {
    padding: 1rem 0;
  }
}

/* .predictive-search__item-content {
  grid-area: product-content;
  display: flex;
  flex-direction: column;
} */

.predictive-search__item-content--centered {
  justify-content: center;
}

.predictive-search__item-vendor {
  font-size: 0.9rem;
}

.predictive-search__item-heading {
  margin: 0;
}

.predictive-search__item-query-result *:not(mark) {
  font-weight: bolder;
}

.predictive-search__item-query-result mark {
  color: rgba(var(--color-foreground), 0.75);
}

.predictive-search__item-query-result mark {
  background-color: transparent;
}

.predictive-search__item .price {
  color: rgba(var(--color-foreground), 0.7);
  font-size: 1.2rem;
}

.predictive-search__item-vendor+.predictive-search__item-heading,
.predictive-search .price {
  margin-top: 0.5rem;
}

.predictive-search__item--term {
  justify-content: space-between;
  align-items: center;
  padding: 1.3rem 2rem;
  word-break: break-all;
  /* line-height: calc(1 + 0.4 / var(--font-body-scale)); */
}

@media screen and (min-width: 750px) {
  .predictive-search__item--term {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
}

.predictive-search__item--term .icon-arrow {
  width: calc(var(--font-heading-scale) * 1.4rem);
  height: calc(var(--font-heading-scale) * 1.4rem);
  flex-shrink: 0;
  margin-left: calc(var(--font-heading-scale) * 2rem);
  color: rgb(var(--color-link));
}

.predictive-search__image {
  grid-area: product-image;
  object-fit: contain;
  font-family: "object-fit: contain";
}