/**
 * Vyrian Autocomplete — Sidebar Widget Styles
 * Matches the Vyrian blog theme design system.
 */

.vyrian-autocomplete {
  position: relative;
  width: 100%;
}

.vyrian-searchbar_wrapper {
  position: relative;
  display: flex;
  align-items: center;
  border: 2px solid var(--light, #ddd);
  border-radius: 6px;
  background: var(--white, #fff);
  transition: border-color 0.2s;
  padding: 0 10px;
}
.vyrian-searchbar_wrapper:focus-within {
  border-color: var(--blue, #56719D);
}

.vyrian-searchbar_wrapper .search-icon {
  flex-shrink: 0;
  color: var(--gray, #5C5C5C);
  display: flex;
  align-items: center;
}

/* Loading spinner — replaces search icon during request */
.vyrian-searchbar_wrapper.is-loading .search-icon { display: none; }
.vyrian-searchbar_wrapper::after {
  content: '';
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--light, #ddd);
  border-top-color: var(--orange, #FE6331);
  border-radius: 50%;
  animation: vyrian-spin 0.6s linear infinite;
  flex-shrink: 0;
  order: -1;
}
.vyrian-searchbar_wrapper.is-loading::after { display: block; }
@keyframes vyrian-spin { to { transform: rotate(360deg); } }

.vyrian-searchbar_wrapper input[type="text"] {
  flex: 1;
  border: none;
  padding: 10px 8px;
  font-family: inherit;
  font-size: 13px;
  color: var(--dark, #1a1a1a);
  background: transparent;
  outline: none;
  margin: 0;
  height: auto;
  width: auto;
  box-shadow: none;
}
.vyrian-searchbar_wrapper input[type="text"]:focus {
  border: none;
  box-shadow: none;
  outline: none;
}
.vyrian-searchbar_wrapper input[type="text"]::placeholder {
  color: var(--gray, #5C5C5C);
  opacity: 0.7;
}

.vyrian-searchbar_wrapper .clear-icon {
  position: static;
  flex-shrink: 0;
  font-size: 18px;
  color: var(--gray, #5C5C5C);
  cursor: pointer;
  display: none;
  line-height: 1;
  transform: none;
}
.vyrian-searchbar_wrapper .clear-icon:hover {
  color: var(--orange, #FE6331);
}

/* Results dropdown */
.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  background: var(--white, #fff);
  border: 1px solid var(--light, #ddd);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.autocomplete-results li {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--light, #ddd);
}
.autocomplete-results li:last-child {
  border-bottom: none;
}

.autocomplete-results li a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--dark, #1a1a1a);
  font-size: 13px;
  transition: background 0.15s;
}
.autocomplete-results li a:hover {
  background: #f8f8f8;
}

.autocomplete-results .part-number {
  font-weight: 900;
  font-size: 14px;
  color: var(--dark, #1a1a1a);
}
.autocomplete-results .result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.autocomplete-results .category {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.4;
  white-space: nowrap;
}
.autocomplete-results .manufacturer {
  font-size: 12px;
  font-weight: 700;
  color: var(--dark, #1a1a1a);
}

/* Category badge colors — same category always gets same color */
.cat-color-0 { background: #fff0eb; color: #c0441a; }
.cat-color-1 { background: #e8f4fd; color: #1a5c8a; }
.cat-color-2 { background: #e6f7ee; color: #1a7a3a; }
.cat-color-3 { background: #f3edf9; color: #6a3d9a; }
.cat-color-4 { background: #fff4e0; color: #9a6d1a; }
.cat-color-5 { background: #e8f0f0; color: #1a7a7a; }
.cat-color-6 { background: #fdecea; color: #a82a2a; }
.cat-color-7 { background: #eef0f8; color: #3a4a8a; }

.vyrian-search-hint {
  font-size: 10px;
  color: #999;
  margin: 8px 0 0;
  line-height: 1.4;
  font-style: italic;
}
.vyrian-search-hint strong {
  color: #777;
  font-style: normal;
}
