/*  Search — live product search (Search/parts/form.php)
————————————————————————————————————————————————*/
/* The field is excluded from the site-wide input base in style.css and fully
   styled here: same fluid height, radius and 2px frame as the header
   «Каталог» button (.button / .button--outline), so the two read as one row.
   Gray frame at rest, accent on focus — the button's outline colour. */
.search {
  position: relative;
  width: 100%;
}

.search__form {
  position: relative;
  display: block;
  margin: 0;
}

.search__input {
  --search-height: clamp(48px, calc(45.18px + 0.751vw), 56px); /* = .button */

  width: 100%;
  height: var(--search-height);
  padding: 0 48px 0 52px;

  font: inherit;
  color: var(--color-black);

  border-radius: 8px;
  border: 2px solid var(--color-gray);
  background: var(--color-white);
  outline: none;
  -webkit-appearance: none;
  appearance: none;

  transition: border-color 0.16s ease-in-out;
}

.search__input:hover {
  border-color: color-mix(in srgb, var(--color-gray), #000 12%);
}

.search__input:focus {
  border-color: var(--color-accent);
}

/* hide the browser's own clear «×» — Esc closes the list instead */
.search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* Iconify 1.x writes an inline `transform: rotate(360deg)` onto the SVG, which
   would wipe a translateY() — so the icon is centred with top/margin instead. */
.search__icon {
  position: absolute;
  top: 50%;
  left: 18px;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  color: var(--color-accent);
  pointer-events: none;
}

.search__loader {
  position: absolute;
  top: 50%;
  right: 18px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid var(--color-gray);
  border-top-color: var(--color-accent);
  animation: starlab-search-spin 0.7s linear infinite;
}

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

/* dropdown */
.search__dropdown {
  position: absolute;
  z-index: 100;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--color-gray);
  background: var(--color-white);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.search__group + .search__group {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--color-gray);
}

.search__heading {
  margin: 0;
  padding: 8px 12px 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-gray-dark);
}

.search__cat,
.search__item,
.search__all {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--color-black);
  text-decoration: none;
}

.search__cat.is-active,
.search__item.is-active,
.search__all.is-active {
  background: var(--color-accent-trans);
}

.search__cat {
  justify-content: space-between;
  font-weight: 600;
}

.search__count {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-gray-dark);
}

.search__thumb {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 6px;
  background: var(--color-white);
}

.search__body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search__title {
  font-size: 14px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 12px;
  color: var(--color-gray-dark);
}

.search__stock {
  color: #c0392b;
}

.search__item.is-out .search__thumb {
  opacity: 0.55;
}

.search__price {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.search__price del {
  font-weight: 400;
  color: var(--color-gray-dark);
}

.search__status {
  margin: 0;
  padding: 16px 12px;
  font-size: 14px;
  color: var(--color-gray-dark);
}

.search__all {
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-accent);
}

@media (max-width: 576px) {
  .search__price {
    display: none;
  }
}
