.predictive-search {
  display: none;
  position: absolute;
  top: calc(100% + var(--border-hairline));
  left: calc(var(--border-hairline) * -1);
  border-width: var(--border-hairline);
  border-style: solid;
  border-color: rgba(var(--color-foreground), var(--popup-border-opacity));
  background-color: rgb(var(--color-background));
  z-index: var(--z-dropdown);
  border-bottom-right-radius: var(--radius-surface);
  border-bottom-left-radius: var(--radius-surface);
  box-shadow: var(--shadow-xl);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.predictive-search--search-template {
  z-index: var(--z-dropdown);
  width: calc(100% + var(--border-hairline) * 2);
}

.predictive-search__results-groups-wrapper {
  display: flex;
  border-bottom: var(--border-hairline) solid var(--color-border);
  padding: var(--space-2) 0;
}

@media screen and (max-width: 749px) {
  .predictive-search--header {
    right: 0;
    left: 0;
    top: 100%;
  }

  .predictive-search__results-groups-wrapper {
    flex-direction: column;
  }

  .predictive-search__results-groups-wrapper:not(.predictive-search__results-groups-wrapper--no-suggestions) {
    gap: var(--space-4);
  }
}

@media screen and (min-width: 750px) {
  .predictive-search {
    border-top: none;
    width: calc(100% + var(--border-hairline) * 2);
  }

  .header predictive-search {
    position: relative;
  }
}

predictive-search[open] .predictive-search,
predictive-search[loading] .predictive-search {
  display: block;
}

.predictive-search__result-group {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: var(--space-4);
}

.predictive-search__result-group:first-child .predictive-search__pages-wrapper {
  display: none;
}

@media screen and (min-width: 750px) {
  .predictive-search__results-groups-wrapper--no-products .predictive-search__result-group:nth-child(2),
  .predictive-search__result-group:last-child .predictive-search__pages-wrapper {
    display: none;
  }
  .predictive-search__result-group:first-child .predictive-search__pages-wrapper {
    display: initial;
  }
  .predictive-search__result-group:first-child {
    flex: 0 0 var(--sidebar-width, 16rem);
  }
  .predictive-search__results-groups-wrapper--no-products .predictive-search__result-group:first-child,
  .predictive-search__result-group:only-child {
    flex-grow: 1;
  }
}

.predictive-search__heading {
  border-bottom: var(--border-hairline) solid var(--color-border);
  margin: 0 var(--space-4);
  padding: var(--space-3) 0 var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: rgba(var(--color-foreground), var(--opacity-70));
}

predictive-search .spinner {
  width: var(--icon-sm);
  height: var(--icon-sm);
  line-height: 0;
}

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: var(--space-2-5);
}

predictive-search[loading] .predictive-search__search-for-button {
  display: none;
}

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__list-item[aria-selected='true'] > *,
.predictive-search__list-item:hover > *,
.predictive-search__item[aria-selected='true'],
.predictive-search__item:hover {
  color: rgb(var(--color-foreground));
  background-color: rgba(var(--color-foreground), 0.05);
}

.predictive-search__list-item[aria-selected='true'] .predictive-search__item-heading,
.predictive-search__list-item:hover .predictive-search__item-heading {
  text-decoration: underline;
  text-underline-offset: var(--space-0-5);
}

.predictive-search__item {
  display: flex;
  padding: var(--space-2) var(--space-3);
  margin: var(--space-0-5) var(--space-2);
  border-radius: var(--radius-control);
  text-align: left;
  text-decoration: none;
  width: calc(100% - var(--space-4));
  transition: background-color var(--duration-fast) var(--ease-default), color var(--duration-fast) var(--ease-default);
}

.predictive-search__item--link-with-thumbnail {
  display: grid;
  grid-template-columns: var(--space-12) 1fr;
  grid-column-gap: var(--space-3-5);
  grid-template-areas: 'product-image product-content';
  align-items: center;
}

.predictive-search__item-content {
  grid-area: product-content;
  display: flex;
  flex-direction: column;
  gap: var(--space-0-5);
}

.predictive-search__item-content--centered {
  justify-content: center;
}

.predictive-search__item-vendor {
  font-size: var(--font-size-2xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: rgba(var(--color-foreground), var(--opacity-60));
}

.predictive-search__item-heading {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.35;
  color: rgb(var(--color-foreground));
}

.predictive-search__item-query-result *:not(mark) {
  font-weight: var(--font-weight-semibold);
}

.predictive-search__item-query-result mark {
  color: rgba(var(--color-foreground), var(--opacity-75));
  background-color: transparent;
}

.predictive-search__item .price {
  color: rgba(var(--color-foreground), var(--opacity-70));
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.predictive-search__item-vendor + .predictive-search__item-heading,
.predictive-search .price {
  margin-top: var(--space-0-5);
}

.predictive-search__item--term {
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2-5) var(--space-4);
  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: var(--space-2);
    padding-bottom: var(--space-2);
  }
}

.predictive-search__item--term .icon-arrow {
  width: var(--icon-sm);
  height: var(--icon-sm);
  flex-shrink: 0;
  margin-left: var(--space-3);
  color: var(--color-primary);
}

.predictive-search__image {
  grid-area: product-image;
  width: var(--space-12);
  height: var(--space-12);
  object-fit: cover;
  border-radius: var(--radius-control);
  border: var(--border-hairline) solid rgba(var(--color-foreground), 0.08);
}
