/* ================================================================================================
   RECHERCHE GLOBALE — déclencheur dans l'en-tête, palette façon Spotlight par-dessus l'application.
   Tout vient des jetons de thème (clair et sombre), aucune couleur en dur.
   ================================================================================================ */
.rch-trigger {
  display: inline-flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 12px 0 10px;
  border: 1px solid var(--color-border); border-radius: 10px;
  background: var(--color-bg-input); color: var(--color-text-tertiary);
  font: inherit; font-size: 0.85rem; cursor: text; min-width: 220px; max-width: 320px;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}
.rch-trigger:hover, .rch-trigger:focus-visible { border-color: var(--color-text-tertiary); color: var(--color-text-secondary); outline: none; }
.rch-trigger svg { width: 15px; height: 15px; flex-shrink: 0; }
.rch-trigger__label { flex: 1; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rch-trigger kbd {
  font-family: var(--font-body); font-size: 0.72rem; color: var(--color-text-tertiary);
  border: 1px solid var(--color-border); border-radius: 5px; padding: 1px 6px; background: var(--color-bg-card);
}
@media (max-width: 900px) {
  /* Carré fixe qui ne cède jamais de place : laissé compressible, il était écrasé à 20 px par la
     pastille de prospection et la loupe débordait du cadre (téléphone de ~400 px, 03/12/2026). */
  .rch-trigger { flex: 0 0 36px; width: 36px; min-width: 0; padding: 0; justify-content: center; }
  .rch-trigger__label, .rch-trigger kbd { display: none; }
}

.rch-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 1200; display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; }
.rch-box {
  width: 100%; max-width: 640px;
  background: var(--color-bg-card); color: var(--color-text-primary);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.rch-input-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--color-border-subtle); }
.rch-input-row svg { width: 20px; height: 20px; color: var(--color-text-tertiary); flex-shrink: 0; }
.rch-input {
  flex: 1; border: 0; background: transparent; color: var(--color-text-primary);
  font: inherit; font-size: 1.05rem; outline: none; min-width: 0;
}
.rch-input::placeholder { color: var(--color-text-muted); }
.rch-input-row kbd { font-family: var(--font-body); font-size: 0.72rem; color: var(--color-text-tertiary); border: 1px solid var(--color-border); border-radius: 5px; padding: 2px 6px; }
.rch-list { max-height: min(60vh, 520px); overflow-y: auto; padding: 6px 0 8px; }
.rch-group { font-size: 0.72rem; font-weight: 600; color: var(--color-text-tertiary); padding: 10px 18px 4px; }
.rch-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 18px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.rch-item.is-active, .rch-item:hover { background: var(--color-bg-card-hover); }
.rch-item__ico {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-bg-input); color: var(--color-text-secondary); overflow: hidden;
}
.rch-item__ico img { width: 100%; height: 100%; object-fit: cover; }
.rch-item__ico svg { width: 16px; height: 16px; }
.rch-item__text { flex: 1; min-width: 0; }
.rch-item__title { font-size: 0.92rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rch-item__title mark { background: transparent; color: var(--color-primary); font-weight: 700; }
.rch-item__sub { font-size: 0.78rem; color: var(--color-text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rch-item__where {
  flex-shrink: 0; font-size: 0.72rem; font-weight: 600; color: var(--color-text-secondary);
  border: 1px solid var(--color-border); border-radius: 999px; padding: 3px 9px; background: var(--color-bg-input);
}
.rch-empty { padding: 22px 18px; color: var(--color-text-tertiary); font-size: 0.9rem; text-align: center; }
.rch-foot { display: flex; gap: 16px; padding: 8px 18px 10px; border-top: 1px solid var(--color-border-subtle); font-size: 0.72rem; color: var(--color-text-tertiary); }
.rch-foot kbd { font-family: var(--font-body); border: 1px solid var(--color-border); border-radius: 4px; padding: 0 5px; margin-right: 4px; }
@media (prefers-reduced-motion: no-preference) { .rch-box { animation: rch-in 120ms ease-out; } @keyframes rch-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } } }
/* Un affilié n'a qu'un écran : pas de recherche. */
.spruce-affiliate-only .rch-trigger { display: none; }
.rch-item__title, .rch-item__sub { display: block; }
