/* Generic search-input + autocomplete dropdown styles. Pages also load
   /components/search/trim-search/trim-search.css when they want the
   variant-specific meta row, but the shared scaffolding lives here so
   non-trim consumers (e.g. the routes/submit region picker) can opt in
   without pulling trim-search-specific rules. */

.search-input-wrap {
  position: relative;
  display: block;
}

/* Hide the browser's native search clear button — we render our own X
   so it can sit to the left of the chosen-checkmark. */
.search-input-wrap input[type="search"]::-webkit-search-cancel-button,
.search-input-wrap input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.search-input-wrap input[type="search"].search-input {
  padding-right: 32px;
}

.search-input-wrap input[type="search"].search-input.search-input-selected {
  padding-right: 56px;
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.search-clear:hover,
.search-clear:focus-visible {
  color: var(--text);
  outline: none;
}

.search-clear[hidden] {
  display: none;
}

/* When a selection has been made, the chosen-checkmark sits at the right
   edge and the clear-X shifts left of it. */
.search-input-wrap input.search-input-selected ~ .search-clear {
  right: 32px;
}

.search-check {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-weight: 700;
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-sizing: border-box;
}

.search-check[hidden] {
  display: none;
}

.autocomplete-results {
  list-style: none;
  margin: 4px 0 0;
  padding: 4px 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 280px;
  overflow-y: auto;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.autocomplete-results li {
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.autocomplete-results li:hover,
.autocomplete-results li.is-active {
  background: var(--panel);
  outline: none;
}

.autocomplete-results-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.autocomplete-result-aside {
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
}
