/**
 * @file
 * Suggestions of the header product search.
 */

.sm-autocomplete {
  position: relative;
}

.sm-autocomplete__list {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 4px);
  left: 0;
  width: max(100%, min(440px, 92vw));
  max-height: 70vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  text-align: left;
}

.sm-autocomplete__list.is-loading {
  opacity: 0.6;
  transition: opacity 0.15s;
}

.sm-autocomplete__item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  color: inherit;
  text-decoration: none;
  line-height: 1.3;
}

.sm-autocomplete__item:hover,
.sm-autocomplete__item.is-active,
.sm-autocomplete__all:hover,
.sm-autocomplete__all.is-active {
  background: var(--light-primary, #f3f3f3);
}

.sm-autocomplete__image {
  width: 48px;
  height: 48px;
  overflow: hidden;
  background: var(--light-primary, #f3f3f3);
}

.sm-autocomplete__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sm-autocomplete__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sm-autocomplete__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sm-autocomplete__sku {
  font-size: 0.8em;
  opacity: 0.7;
}

.sm-autocomplete__price {
  font-weight: 600;
  white-space: nowrap;
}

.sm-autocomplete__all {
  display: block;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid var(--color-border, #ddd);
  color: var(--color-primary, inherit);
  font-weight: 600;
  text-decoration: none;
}

.sm-autocomplete__empty {
  padding: 0.75rem;
  opacity: 0.7;
}
