/* ===========================================================================
   Be Safe Safety — search autocomplete dropdown
   ---------------------------------------------------------------------------
   Styles the "show as you type" results panel injected by bss-interactions.js
   into the full-width search overlay (.bss-searchbar). All classes prefixed
   .bss-search-. Uses design tokens from tokens.css. No !important.

   Layout intent: the results read as part of the search overlay, NOT a small
   floating card. The panel is appended to .bss-searchbar (the full-width
   overlay) — NOT the padded .bss-searchbar__inner column — so it spans the
   overlay edge to edge, with result rows running fully edge to edge too.
   =========================================================================== */

/* ---------------------------------------------------------------------------
   Native search input clear button — kill the browser's default blue "X".
--------------------------------------------------------------------------- */
.bss-searchbar__input::-webkit-search-cancel-button,
.bss-searchbar__input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

/* ---------------------------------------------------------------------------
   Results panel — absolutely positioned so it overlays the page. Anchored to
   .bss-searchbar (the full-width overlay): left/right:0 makes it span the
   ENTIRE overlay width, edge to edge — not the padded inner content column.
   Flat panel (no card border/radius/floating shadow) — a soft drop shadow only
   so it reads as the overlay continuing downward.
--------------------------------------------------------------------------- */
.bss-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--neutral-0);
  border-top: 1px solid var(--border);
  box-shadow: 0 8px 8px rgba(0, 0, 0, 0.08);
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
}

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

/* ---------------------------------------------------------------------------
   Result row — spans the panel edge to edge (full overlay width), left-aligned,
   comfortable padding, full-width hover. No inset.
--------------------------------------------------------------------------- */
.bss-search-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem var(--bss-search-inset, 15.8125rem);
  text-decoration: none;
  color: var(--neutral-900);
  transition: background-color var(--t-fast) var(--ease);
}

.bss-search-row + .bss-search-row {
  border-top: 1px solid var(--border);
}

.bss-search-row:hover,
.bss-search-row:focus {
  background: var(--neutral-100);
}

/* Thumbnail — ~44px light-grey rounded square at the row's left edge. */
.bss-search-thumb {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.375rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--neutral-100);
}

body.breakdance .bss-search-thumb img {
  max-width: 100%;
  max-height: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Text column — product name above price, left-aligned. */
.bss-search-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.bss-search-name {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--neutral-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bss-search-price {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: normal;
  color: var(--neutral-400);
}

/* Empty state — same horizontal rhythm as a row. */
.bss-search-empty {
  padding: 0.875rem var(--bss-search-inset, 15.8125rem);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--neutral-400);
}

/* ---------------------------------------------------------------------------
   Loading state — shown the instant the user types (>=2 chars), before the
   debounced fetch resolves. A spinning ring next to "Searching…" text. Same
   horizontal rhythm as a result row so it doesn't shift layout on swap-in.
--------------------------------------------------------------------------- */
.bss-search-loading {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem var(--bss-search-inset, 15.8125rem);
}

.bss-search-loading__text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--neutral-400);
}

.bss-search-spinner {
  flex: 0 0 auto;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  border: 2px solid var(--neutral-200);
  border-top-color: var(--neutral-900);
  animation: bss-search-spin 600ms linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .bss-search-spinner { animation-duration: 1.5s; }
}

/* The row inset (--bss-search-inset) is measured from the live search icon
   and set on .bss-search-results by bss-interactions.js (syncInset), so the
   result column always lines up with the input at any viewport width. */
