.amg-smart-search {
  position: relative;
  overflow: visible;
}

.amg-smart-search__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 1200;
  width: min(560px, calc(100vw - 32px));
  max-height: min(620px, 72vh);
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 16px;
  background: #fff;
  color: #111827;
  box-shadow: 0 24px 70px rgba(10, 18, 28, 0.22);
  overscroll-behavior: contain;
}

.amg-smart-search__panel[hidden] {
  display: none;
}

.amg-mobile-search-panel.is-open.has-smart-results {
  overflow: visible;
}

.amg-offcanvas .amg-smart-search__panel {
  top: auto;
  bottom: calc(100% + 8px);
}

.amg-smart-search__results {
  display: grid;
  padding: 8px;
}

.amg-smart-search__group {
  display: grid;
  gap: 2px;
  padding: 6px 0;
}

.amg-smart-search__group + .amg-smart-search__group {
  border-top: 1px solid rgba(17, 24, 39, 0.07);
}

.amg-smart-search__group-title {
  margin: 0;
  padding: 5px 10px 4px;
  color: #6b7280;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.055em;
  line-height: 1.35;
  text-transform: uppercase;
}

.amg-smart-search__item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-height: 62px;
  padding: 7px 10px;
  border-radius: 10px;
  color: #111827;
  text-decoration: none;
}

.amg-smart-search__item:hover,
.amg-smart-search__item:focus-visible,
.amg-smart-search__item.is-active {
  outline: none;
  background: rgba(166, 226, 46, 0.14);
  box-shadow: none;
}

.amg-smart-search__media {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, 0.07);
  border-radius: 9px;
  background: #f5f6f2;
}

.amg-smart-search__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.amg-smart-search__media--placeholder {
  color: #668f15;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.amg-smart-search__copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  text-align: left;
}

.amg-smart-search__title,
.amg-smart-search__meta {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.amg-smart-search__title {
  color: #111827;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.amg-smart-search__meta {
  color: #737b87;
  font-size: 11px;
  line-height: 1.3;
}

.amg-smart-search__price {
  padding-left: 8px;
  color: #38520a;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.amg-smart-search__correction,
.amg-smart-search__all {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.35;
}

.amg-smart-search__correction {
  margin-bottom: 4px;
  background: #f5f6f2;
  color: #4f7114;
}

.amg-smart-search__all {
  margin-top: 4px;
  border-top: 1px solid rgba(17, 24, 39, 0.07);
  color: #38520a;
  font-weight: 800;
  text-align: center;
}

.amg-smart-search__correction:hover,
.amg-smart-search__correction:focus-visible,
.amg-smart-search__correction.is-active,
.amg-smart-search__all:hover,
.amg-smart-search__all:focus-visible,
.amg-smart-search__all.is-active {
  outline: none;
  background: rgba(166, 226, 46, 0.16);
  box-shadow: none;
}

.amg-smart-search__message {
  margin: 0;
  padding: 18px 14px;
  color: #6b7280;
  font-size: 13px;
  text-align: center;
}

.amg-smart-search__message.is-loading::before {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid rgba(17, 24, 39, 0.15);
  border-top-color: #79aa1a;
  border-radius: 50%;
  vertical-align: -2px;
  content: "";
  animation: amg-smart-search-spin 0.7s linear infinite;
}

.amg-smart-search__message.is-error {
  color: #b42318;
}

.amg-search-correction {
  margin: -4px 0 2px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.amg-search-correction a {
  margin-left: 4px;
  color: var(--accent);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@keyframes amg-smart-search-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 680px) {
  .amg-smart-search__panel {
    right: 0;
    left: auto;
    width: min(100%, calc(100vw - 32px));
    max-height: min(520px, 65vh);
  }

  .amg-smart-search__item {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .amg-smart-search__media {
    width: 44px;
    height: 44px;
  }

  .amg-smart-search__price {
    grid-column: 2;
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .amg-smart-search__message.is-loading::before {
    animation: none;
  }
}
