/* ============================================================
   STAF GROS — searchbar.css  v1.0
   Instant search dropdown
   ============================================================ */

/* ── Theme-proof reset ────────────────────────────────────── */
.sg-search,
.sg-search *,
.sg-search *::before,
.sg-search *::after {
  box-sizing: border-box !important;
}
.sg-search button,
.sg-search input,
.sg-search a {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  text-decoration: none !important;
}
.sg-search button {
  border: none !important;
  border-radius: 0 !important;
  background: none !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer !important;
  -webkit-appearance: none !important;
  box-shadow: none !important;
}

/* ── Container ────────────────────────────────────────────── */

.sg-search {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  z-index: 100;
}

/* ── Input wrapper ────────────────────────────────────────── */

.sg-search__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--sg-white, #fff) !important;
  border: 2px solid var(--sg-border, #dde3ea) !important;
  border-radius: 14px !important;
  transition: border-color .2s, box-shadow .2s;
  overflow: hidden;
}

.sg-search__input-wrap:focus-within {
  border-color: var(--sg-red, #e63128) !important;
  box-shadow: 0 0 0 4px rgba(230,49,40,.1), 0 4px 16px rgba(0,0,0,.06) !important;
}

.sg-search.is-open .sg-search__input-wrap {
  border-bottom-left-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-bottom-color: transparent !important;
}

/* Search icon */
.sg-search__icon {
  position: absolute;
  left: 16px;
  color: var(--sg-muted, #718096);
  pointer-events: none;
  flex-shrink: 0;
  transition: color .2s;
}
.sg-search__input-wrap:focus-within .sg-search__icon {
  color: var(--sg-red, #e63128);
}

/* Input */
.sg-search__input {
  width: 100% !important;
  padding: 14px 90px 14px 48px !important;
  border: none !important;
  background: transparent !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  color: var(--sg-dark, #0d1b2a) !important;
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
}
.sg-search__input::placeholder {
  color: var(--sg-muted, #718096) !important;
  font-weight: 400 !important;
}
/* Hide native search cancel in webkit */
.sg-search__input::-webkit-search-cancel-button,
.sg-search__input::-webkit-search-decoration {
  -webkit-appearance: none !important;
  display: none !important;
}

/* Spinner */
.sg-search__spinner {
  display: none;
  position: absolute;
  right: 48px;
  align-items: center;
  justify-content: center;
}
.sg-search__spinner svg {
  animation: sg-search-spin .8s linear infinite;
  color: var(--sg-red, #e63128);
}
@keyframes sg-search-spin {
  to { transform: rotate(360deg); }
}

/* Clear button */
.sg-search__clear {
  position: absolute !important;
  right: 14px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  background: var(--sg-bg, #f7f9fb) !important;
  color: var(--sg-muted, #718096) !important;
  transition: background .15s, color .15s !important;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}
.sg-search__clear:hover {
  background: var(--sg-red-bg, rgba(230,49,40,.07)) !important;
  color: var(--sg-red, #e63128) !important;
}


/* ══════════════════════════════════════════════════════════════
   VOICE SEARCH — Mic button
   Only visible when JS injects it (browser supports SpeechRecognition).
   Container gets .sg-search--has-voice class for padding adjustment.
   ══════════════════════════════════════════════════════════════ */

/* Widen input right padding to fit mic + clear */
.sg-search--has-voice .sg-search__input {
  padding-right: 120px !important;
}

/* Mic button: positioned between spinner and clear */
.sg-search__mic {
  position: absolute !important;
  right: 48px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: var(--sg-bg, #f7f9fb) !important;
  color: var(--sg-muted, #718096) !important;
  border: none !important;
  padding: 0 !important;
  cursor: pointer !important;
  transition: background .2s, color .2s, transform .15s, box-shadow .2s !important;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .sg-search__mic:hover {
    background: var(--sg-red-bg, rgba(230,49,40,.07)) !important;
    color: var(--sg-red, #e63128) !important;
    transform: scale(1.08);
  }
}

.sg-search__mic:active {
  transform: scale(.92) !important;
}

.sg-search__mic:focus-visible {
  outline: 2px solid var(--sg-red, #e63128) !important;
  outline-offset: 2px;
}

/* Mic icon */
.sg-search__mic-icon {
  display: block;
  transition: opacity .2s;
}

/* Pulse dot — hidden by default, visible while listening */
.sg-search__mic-pulse {
  display: none;
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sg-red, #e63128);
}

/* ── LISTENING STATE ──────────────────────────────────────── */

.sg-search.is-listening .sg-search__mic {
  background: var(--sg-red, #e63128) !important;
  color: #fff !important;
  box-shadow: 0 0 0 4px rgba(230,49,40,.2) !important;
  animation: sg-mic-breathe 1.5s ease-in-out infinite !important;
}

.sg-search.is-listening .sg-search__mic-pulse {
  display: block;
  background: #fff;
  animation: sg-mic-dot-pulse 1s ease-in-out infinite;
}

/* Breathing scale animation on the mic button */
@keyframes sg-mic-breathe {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 0 4px rgba(230,49,40,.2); }
  50%      { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(230,49,40,.1); }
}

/* Blinking red dot */
@keyframes sg-mic-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .4; transform: scale(.7); }
}

/* Input border goes red while listening */
.sg-search.is-listening .sg-search__input-wrap {
  border-color: var(--sg-red, #e63128) !important;
  box-shadow: 0 0 0 4px rgba(230,49,40,.08) !important;
}

/* Move spinner further left when voice button exists */
.sg-search--has-voice .sg-search__spinner {
  right: 86px;
}

/* Screen reader only (for voice announcements) */
.sg-search .sg-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  border: 0 !important;
}


/* ══════════════════════════════════════════════════════════════
   CAMERA / IMAGE SEARCH — button + popover + preview + labels
   ══════════════════════════════════════════════════════════════ */

/* Camera button — same base style as mic */
.sg-search__cam {
  position: absolute !important;
  right: 48px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: var(--sg-bg, #f7f9fb) !important;
  color: var(--sg-muted, #718096) !important;
  border: none !important;
  padding: 0 !important;
  cursor: pointer !important;
  transition: background .2s, color .2s, transform .15s !important;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .sg-search__cam:hover {
    background: var(--sg-red-bg, rgba(230,49,40,.07)) !important;
    color: var(--sg-red, #e63128) !important;
    transform: scale(1.08);
  }
}
.sg-search__cam:active { transform: scale(.92) !important; }
.sg-search__cam:focus-visible { outline: 2px solid var(--sg-red, #e63128) !important; outline-offset: 2px; }
.sg-search__cam-icon { display: block; transition: opacity .2s; }

/* ── Position stacking: cam → mic → clear ──────────────── */
/* With camera only (no voice) */
.sg-search--has-camera .sg-search__input {
  padding-right: 120px !important;
}
.sg-search--has-camera .sg-search__cam {
  right: 48px !important;
}
.sg-search--has-camera .sg-search__spinner {
  right: 86px;
}
/* With both camera + voice */
.sg-search--has-camera.sg-search--has-voice .sg-search__input {
  padding-right: 156px !important;
}
.sg-search--has-camera.sg-search--has-voice .sg-search__cam {
  right: 84px !important;
}
.sg-search--has-camera.sg-search--has-voice .sg-search__spinner {
  right: 120px;
}

/* ── Camera popover menu ──────────────────────────────── */
.sg-search__cam-menu {
  position: absolute;
  z-index: 110;
  background: var(--sg-white, #fff);
  border: 1px solid var(--sg-border, #dde3ea);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  padding: 6px;
  min-width: 200px;
}
.sg-search__cam-option {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  padding: 10px 14px !important;
  border-radius: 7px !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  color: var(--sg-dark, #0d1b2a) !important;
  background: none !important;
  border: none !important;
  cursor: pointer !important;
  transition: background .15s !important;
}
.sg-search__cam-option:hover {
  background: var(--sg-bg, #f7f9fb) !important;
}
.sg-search__cam-option svg {
  flex-shrink: 0;
  color: var(--sg-muted, #718096);
}

/* Hidden file inputs */
.sg-search__file-input {
  position: absolute !important;
  width: 1px !important; height: 1px !important;
  overflow: hidden !important; clip: rect(0,0,0,0) !important; border: 0 !important;
}

/* ── Image preview bar (inside dropdown top) ───────────── */
.sg-search__imgbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--sg-border, #dde3ea);
  background: var(--sg-bg, #f7f9fb);
}
.sg-search__imgbar-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--sg-border, #dde3ea);
  flex-shrink: 0;
}
.sg-search__imgbar-status {
  flex: 1;
  min-width: 0;
}
.sg-search__imgbar-text {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--sg-mid, #4a5568);
  margin-top: 4px;
  line-height: 1.4;
  word-break: break-word;
}
.sg-search__imgbar-text.is-error {
  color: var(--sg-red, #e63128);
  font-size: 11.5px;
}
.sg-search__imgbar-progress {
  width: 100%;
  height: 3px;
  background: var(--sg-border, #dde3ea);
  border-radius: 2px;
  overflow: hidden;
}
.sg-search__imgbar-progress-bar {
  height: 100%;
  background: var(--sg-red, #e63128);
  border-radius: 2px;
  width: 0%;
  transition: width .3s;
}
.sg-search__imgbar-remove {
  flex-shrink: 0;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  background: transparent !important;
  color: var(--sg-muted, #718096) !important;
  transition: background .15s, color .15s !important;
}
.sg-search__imgbar-remove:hover {
  background: var(--sg-red-bg, rgba(230,49,40,.07)) !important;
  color: var(--sg-red, #e63128) !important;
}

/* ── Analyzing state: pulsing border ──────────────────── */
.sg-search.is-analyzing .sg-search__input-wrap {
  border-color: var(--sg-red, #e63128) !important;
  animation: sg-analyze-pulse 1.5s ease-in-out infinite !important;
}
@keyframes sg-analyze-pulse {
  0%, 100% { box-shadow: 0 0 0 0px rgba(230,49,40,.1); }
  50%      { box-shadow: 0 0 0 6px rgba(230,49,40,.08); }
}
.sg-search.is-analyzing .sg-search__cam {
  background: var(--sg-red, #e63128) !important;
  color: #fff !important;
}

/* ── Detected labels (pills) ─────────────────────────── */
.sg-search__labels {
  padding: 10px 14px 6px;
  border-bottom: 1px solid var(--sg-border, #dde3ea);
}
.sg-search__labels-title {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--sg-muted, #718096);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 8px;
}
.sg-search__labels-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 6px;
}
.sg-search__label-pill {
  display: inline-flex !important;
  align-items: center !important;
  padding: 4px 12px !important;
  border-radius: 20px !important;
  border: 1.5px solid var(--sg-red, #e63128) !important;
  background: transparent !important;
  color: var(--sg-red, #e63128) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: background .15s, color .15s !important;
  white-space: nowrap;
}
.sg-search__label-pill:hover,
.sg-search__label-pill:focus {
  background: var(--sg-red, #e63128) !important;
  color: #fff !important;
}
.sg-search__label-pill--logo {
  border-color: var(--sg-dark, #0d1b2a) !important;
  color: var(--sg-dark, #0d1b2a) !important;
}
.sg-search__label-pill--logo:hover,
.sg-search__label-pill--logo:focus {
  background: var(--sg-dark, #0d1b2a) !important;
  color: #fff !important;
}

/* ── Color swatches (visual search) ─────────────────────── */
.sg-search__color-swatch {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--sg-white, #fff);
  box-shadow: 0 0 0 1px var(--sg-border, #dde3ea);
  flex-shrink: 0;
}

/* ── Similarity score bar (visual search results) ────────── */
.sg-search__sim {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.sg-search__sim-bar {
  flex: 1;
  height: 3px;
  background: var(--sg-red, #e63128);
  border-radius: 2px;
  max-width: 80px;
  transition: width .3s;
}
.sg-search__sim-text {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--sg-red, #e63128);
  white-space: nowrap;
}


/* ══════════════════════════════════════════════════════════════
   DROPDOWN
   ══════════════════════════════════════════════════════════════ */

.sg-search__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--sg-white, #fff);
  border: 2px solid var(--sg-red, #e63128);
  border-top: none;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.1);
  max-height: 70vh;
  overflow-y: auto;
  overscroll-behavior: contain;

  /* Scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--sg-border, #dde3ea) transparent;
}
.sg-search__dropdown::-webkit-scrollbar { width: 5px; }
.sg-search__dropdown::-webkit-scrollbar-thumb { background: var(--sg-border); border-radius: 4px; }


/* ── Section titles ───────────────────────────────────────── */

.sg-search__section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sg-muted, #718096);
}
.sg-search__section-title svg {
  flex-shrink: 0;
  opacity: .6;
}


/* ── Category / Brand pills ───────────────────────────────── */

.sg-search__cat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 16px 12px;
}

.sg-search__cat-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 6px 14px !important;
  background: var(--sg-bg, #f7f9fb) !important;
  border: 1.5px solid var(--sg-border, #dde3ea) !important;
  border-radius: 999px !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  color: var(--sg-mid, #4a5568) !important;
  transition: all .15s !important;
  white-space: nowrap;
}
.sg-search__cat-pill:hover,
.sg-search__cat-pill.is-focused {
  border-color: var(--sg-red, #e63128) !important;
  color: var(--sg-red, #e63128) !important;
  background: var(--sg-red-bg, rgba(230,49,40,.07)) !important;
}

.sg-search__cat-pill--brand {
  border-color: var(--sg-dark, #0d1b2a) !important;
  background: rgba(13,27,42,.04) !important;
}
.sg-search__cat-pill--brand:hover,
.sg-search__cat-pill--brand.is-focused {
  border-color: var(--sg-dark, #0d1b2a) !important;
  background: rgba(13,27,42,.1) !important;
  color: var(--sg-dark, #0d1b2a) !important;
}

.sg-search__cat-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--sg-muted, #718096);
  background: var(--sg-white, #fff);
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}


/* ── Product rows ─────────────────────────────────────────── */

.sg-search__product-row {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 10px 16px !important;
  color: var(--sg-dark, #0d1b2a) !important;
  border-bottom: 1px solid rgba(0,0,0,.04);
  transition: background .12s !important;
}
.sg-search__product-row:last-child {
  border-bottom: none;
}
.sg-search__product-row:hover,
.sg-search__product-row.is-focused {
  background: var(--sg-bg, #f7f9fb) !important;
}

/* Image */
.sg-search__result-img {
  position: relative;
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--sg-bg, #f7f9fb);
  border: 1px solid var(--sg-border, #dde3ea);
}
.sg-search__result-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Sale badge */
.sg-search__badge {
  position: absolute;
  top: 2px;
  left: 2px;
  padding: 1px 5px;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--sg-red, #e63128);
  color: #fff;
  border-radius: 4px;
  letter-spacing: .03em;
}

/* Body */
.sg-search__result-body {
  flex: 1;
  min-width: 0;
}

.sg-search__result-meta {
  display: flex;
  gap: 6px;
  margin-bottom: 2px;
}

.sg-search__result-cat,
.sg-search__result-brand {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--sg-muted, #718096);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-search__result-brand {
  color: var(--sg-red, #e63128);
}

.sg-search__result-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--sg-dark, #0d1b2a);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sg-search__result-sku {
  font-size: 11px;
  color: var(--sg-muted, #718096);
  margin-top: 1px;
}

/* Price */
.sg-search__result-price {
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  color: var(--sg-dark, #0d1b2a);
  white-space: nowrap;
  flex-shrink: 0;
}
.sg-search__result-price del {
  font-size: 11px;
  font-weight: 400;
  color: var(--sg-muted, #718096);
  display: block;
}
.sg-search__result-price ins {
  text-decoration: none;
  color: var(--sg-red, #e63128);
}

/* Out of stock */
.sg-search__oos {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--sg-muted, #718096);
  margin-top: 2px;
}

/* ── Result right column (price + score bar) ──────────────── */

.sg-search__result-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

/* ── Fuzzy match score bar ────────────────────────────────── */

.sg-search__score {
  width: 40px;
  height: 3px;
  background: var(--sg-border, #dde3ea);
  border-radius: 2px;
  overflow: hidden;
}
.sg-search__score-bar {
  height: 100%;
  background: var(--sg-green, #0ea970);
  border-radius: 2px;
  transition: width .3s ease;
  min-width: 2px;
}

/* ── "Did you mean?" suggestions ──────────────────────────── */

.sg-search__suggest {
  padding: 12px 16px 14px;
  border-top: 1px solid rgba(0,0,0,.04);
}
.sg-search__suggest-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--sg-muted, #718096);
  margin-bottom: 8px;
}
.sg-search__suggest-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sg-search__suggest-link {
  display: inline-flex !important;
  align-items: center !important;
  padding: 7px 16px !important;
  background: var(--sg-red-bg, rgba(230,49,40,.07)) !important;
  border: 1.5px solid var(--sg-red-soft, rgba(230,49,40,.12)) !important;
  border-radius: 999px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--sg-red, #e63128) !important;
  transition: all .15s !important;
  white-space: nowrap;
}
.sg-search__suggest-link:hover,
.sg-search__suggest-link.is-focused {
  background: var(--sg-red, #e63128) !important;
  color: #fff !important;
  border-color: var(--sg-red, #e63128) !important;
}


/* ── Text highlight ───────────────────────────────────────── */

.sg-search__highlight {
  background: rgba(230,49,40,.12);
  color: var(--sg-red, #e63128);
  font-weight: 700;
  border-radius: 2px;
  padding: 0 1px;
}


/* ── Empty state ──────────────────────────────────────────── */

.sg-search__empty {
  padding: 32px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.sg-search__empty svg {
  color: var(--sg-border, #dde3ea);
}
.sg-search__empty p {
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--sg-muted, #718096);
}


/* ── View all link ────────────────────────────────────────── */

.sg-search__view-all {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 12px 16px !important;
  background: var(--sg-bg, #f7f9fb) !important;
  border-top: 1.5px solid var(--sg-border, #dde3ea) !important;
  border-radius: 0 0 12px 12px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--sg-red, #e63128) !important;
  transition: background .15s !important;
}
.sg-search__view-all:hover,
.sg-search__view-all.is-focused {
  background: var(--sg-red-bg, rgba(230,49,40,.07)) !important;
}
.sg-search__view-all svg {
  transition: transform .2s;
}
.sg-search__view-all:hover svg {
  transform: translateX(3px);
}


/* ══════════════════════════════════════════════════════════════
   SEARCH HISTORY
   ══════════════════════════════════════════════════════════════ */

.sg-search__history {}

.sg-search__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 4px;
}

.sg-search__section-head .sg-search__section-title {
  padding: 0;
}

.sg-search__history-clear {
  font-size: 11.5px !important;
  color: var(--sg-muted, #718096) !important;
  cursor: pointer !important;
  transition: color .15s !important;
  line-height: 1.4 !important;
  background: none !important;
}
.sg-search__history-clear:hover {
  color: var(--sg-red, #e63128) !important;
}

.sg-search__history-list {
  padding: 0 8px 8px;
}

.sg-search__history-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  padding: 9px 12px !important;
  border-radius: 8px !important;
  font-size: 13.5px !important;
  color: var(--sg-dark, #0d1b2a) !important;
  cursor: pointer !important;
  transition: background .15s !important;
  text-align: left !important;
}
.sg-search__history-item:hover,
.sg-search__history-item.is-focused {
  background: var(--sg-red-bg, rgba(230,49,40,.07)) !important;
}
.sg-search__history-item svg {
  color: var(--sg-muted, #718096);
  flex-shrink: 0;
}
.sg-search__history-item span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sg-search__history-arrow {
  color: var(--sg-border, #dde3ea);
  flex-shrink: 0;
  margin-left: auto;
}
.sg-search__history-item:hover .sg-search__history-arrow {
  color: var(--sg-red, #e63128);
}


/* ══════════════════════════════════════════════════════════════
   TRENDING
   ══════════════════════════════════════════════════════════════ */

.sg-search__trending {
  padding-bottom: 6px;
}

.sg-search__trending-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 16px 10px;
}

.sg-search__trending-term {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 5px 12px !important;
  border-radius: 999px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  color: var(--sg-mid, #4a5568) !important;
  background: var(--sg-bg, #f7f9fb) !important;
  border: 1px solid var(--sg-border, #dde3ea) !important;
  cursor: pointer !important;
  transition: all .15s !important;
  white-space: nowrap !important;
}
.sg-search__trending-term:hover,
.sg-search__trending-term.is-focused {
  color: var(--sg-red, #e63128) !important;
  border-color: var(--sg-red, #e63128) !important;
  background: var(--sg-red-bg, rgba(230,49,40,.07)) !important;
}
.sg-search__trending-term svg {
  flex-shrink: 0;
  opacity: .5;
}

.sg-search__trending-products {
  padding: 0 8px;
}

.sg-search__trending-product {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 8px 12px !important;
  border-radius: 8px !important;
  transition: background .15s !important;
  text-decoration: none !important;
  color: var(--sg-dark, #0d1b2a) !important;
}
.sg-search__trending-product:hover,
.sg-search__trending-product.is-focused {
  background: var(--sg-red-bg, rgba(230,49,40,.07)) !important;
}


/* ══════════════════════════════════════════════════════════════
   MOBILE OVERLAY (≤768px full-screen)
   ══════════════════════════════════════════════════════════════ */

.sg-search__overlay {
  display: none;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .sg-search {
    max-width: 100%;
  }

  /* ── Mobile overlay ── */
  .sg-search__overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
  }
  .sg-search__overlay.is-active {
    opacity: 1;
    pointer-events: auto;
  }

  .sg-search--mobile-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999 !important;
    max-width: 100% !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--sg-white, #fff) !important;
    padding: 12px 12px 0 !important;
    animation: sg-overlay-in .2s ease both;
  }

  @keyframes sg-overlay-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: none; }
  }

  .sg-search--mobile-overlay .sg-search__input-wrap {
    border-radius: 12px !important;
    flex-shrink: 0;
  }

  .sg-search--mobile-overlay .sg-search__input {
    font-size: 16px !important; /* prevent iOS zoom */
    padding: 14px 80px 14px 48px !important;
  }
  .sg-search--mobile-overlay.sg-search--has-voice .sg-search__input {
    padding-right: 112px !important;
  }
  .sg-search--mobile-overlay.sg-search--has-camera .sg-search__input {
    padding-right: 112px !important;
  }
  .sg-search--mobile-overlay.sg-search--has-camera.sg-search--has-voice .sg-search__input {
    padding-right: 148px !important;
  }

  .sg-search--mobile-overlay .sg-search__dropdown {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    margin-top: 8px !important;
    border: none !important;
    border-top: 1px solid var(--sg-border, #dde3ea) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    max-height: none !important;
    flex: 1 !important;
    overflow-y: auto !important;
    animation: none !important;
  }

  /* Large touch targets for mobile buttons */
  .sg-search--mobile-overlay .sg-search__mic,
  .sg-search--mobile-overlay .sg-search__cam {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
  }
  .sg-search--mobile-overlay .sg-search__mic-icon,
  .sg-search--mobile-overlay .sg-search__cam-icon {
    width: 18px !important;
    height: 18px !important;
  }

  .sg-search--mobile-overlay .sg-search__clear {
    width: 32px !important;
    height: 32px !important;
  }

  /* Swipe indicator */
  .sg-search--mobile-overlay .sg-search__dropdown::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--sg-border, #dde3ea);
    margin: 6px auto 8px;
    flex-shrink: 0;
  }

  /* History items — bigger touch target */
  .sg-search--mobile-overlay .sg-search__history-item {
    padding: 12px 14px !important;
    font-size: 14.5px !important;
    min-height: 44px !important;
  }

  /* Trending terms — bigger on mobile */
  .sg-search--mobile-overlay .sg-search__trending-term {
    padding: 8px 14px !important;
    font-size: 13px !important;
    min-height: 36px !important;
  }

  /* Product rows — bigger touch targets */
  .sg-search--mobile-overlay .sg-search__product-row,
  .sg-search--mobile-overlay .sg-search__trending-product {
    padding: 10px 14px !important;
    min-height: 52px !important;
  }

  /* Non-overlay mobile defaults */
  .sg-search__input {
    padding: 12px 80px 12px 44px !important;
    font-size: 14px !important;
  }
  .sg-search--has-voice .sg-search__input {
    padding-right: 110px !important;
  }
  .sg-search--has-camera .sg-search__input {
    padding-right: 110px !important;
  }
  .sg-search--has-camera.sg-search--has-voice .sg-search__input {
    padding-right: 142px !important;
  }

  .sg-search__icon {
    left: 14px;
    width: 16px;
    height: 16px;
  }

  /* Mic: slightly smaller on mobile */
  .sg-search__mic {
    width: 30px !important;
    height: 30px !important;
    right: 44px !important;
  }
  .sg-search__cam {
    width: 30px !important;
    height: 30px !important;
  }
  .sg-search--has-camera .sg-search__cam { right: 44px !important; }
  .sg-search--has-camera.sg-search--has-voice .sg-search__cam { right: 78px !important; }

  .sg-search--has-voice .sg-search__spinner { right: 78px; }
  .sg-search--has-camera .sg-search__spinner { right: 78px; }
  .sg-search--has-camera.sg-search--has-voice .sg-search__spinner { right: 112px; }

  /* Dropdown takes more vertical space */
  .sg-search__dropdown {
    max-height: 60vh;
  }

  .sg-search__product-row {
    padding: 8px 12px !important;
    gap: 10px !important;
  }

  .sg-search__result-img {
    width: 44px;
    height: 44px;
    border-radius: 6px;
  }

  .sg-search__result-name {
    font-size: 12.5px;
  }
  .sg-search__result-price {
    font-size: 13px;
  }

  /* Label pills scroll horizontally on mobile */
  .sg-search__labels-list {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 8px;
  }
  .sg-search__labels-list::-webkit-scrollbar { display: none; }
}

@media (max-width: 480px) {
  .sg-search__input-wrap {
    border-radius: 10px !important;
  }
  .sg-search.is-open .sg-search__input-wrap {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
  }

  .sg-search__input {
    padding: 11px 70px 11px 40px !important;
    font-size: 13.5px !important;
  }
  .sg-search--has-voice .sg-search__input {
    padding-right: 100px !important;
  }
  .sg-search--has-camera .sg-search__input {
    padding-right: 100px !important;
  }
  .sg-search--has-camera.sg-search--has-voice .sg-search__input {
    padding-right: 130px !important;
  }

  /* Smaller buttons on phone */
  .sg-search__mic {
    width: 28px !important;
    height: 28px !important;
    right: 40px !important;
  }
  .sg-search__cam {
    width: 28px !important;
    height: 28px !important;
  }
  .sg-search--has-camera .sg-search__cam { right: 40px !important; }
  .sg-search--has-camera.sg-search--has-voice .sg-search__cam { right: 72px !important; }

  .sg-search__mic-icon,
  .sg-search__cam-icon {
    width: 14px;
    height: 14px;
  }

  .sg-search--has-voice .sg-search__spinner { right: 72px; }
  .sg-search--has-camera .sg-search__spinner { right: 72px; }
  .sg-search--has-camera.sg-search--has-voice .sg-search__spinner { right: 104px; }

  .sg-search__dropdown {
    border-radius: 0 0 10px 10px;
    max-height: 55vh;
  }

  .sg-search__cat-pill {
    padding: 5px 10px !important;
    font-size: 11.5px !important;
  }

  .sg-search__result-img {
    width: 40px;
    height: 40px;
  }

  .sg-search__imgbar-thumb {
    width: 40px;
    height: 40px;
  }
  .sg-search__label-pill {
    padding: 3px 10px !important;
    font-size: 11px !important;
  }
}


/* ── Animations ───────────────────────────────────────────── */

@keyframes sg-search-fadein {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.sg-search__dropdown:not([hidden]) {
  animation: sg-search-fadein .15s ease both;
}

@media (prefers-reduced-motion: reduce) {
  .sg-search__dropdown:not([hidden]) {
    animation: none;
  }
  .sg-search__spinner svg {
    animation-duration: .01ms !important;
  }
  .sg-search.is-listening .sg-search__mic {
    animation: none !important;
  }
  .sg-search__mic-pulse {
    animation: none !important;
  }
  .sg-search.is-analyzing .sg-search__input-wrap {
    animation: none !important;
  }
  .sg-search__imgbar-progress-bar {
    transition: none !important;
  }
}
