/* ═══════════════════════════════════════════════════
   Recherche — overlay doux, thème violet / noir / blanc
   ═══════════════════════════════════════════════════ */

.search-bg {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(0.65rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right))
    max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  background: var(--modal-overlay);
  backdrop-filter: blur(22px) saturate(1.15);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s var(--ease);
}

.search-bg.open {
  opacity: 1;
  pointer-events: all;
}

.search-panel {
  width: min(1160px, 100%);
  max-height: calc(100dvh - 1.25rem);
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid var(--modal-border);
  background: var(--modal-panel-bg);
  box-shadow: var(--modal-shadow);
  overflow: hidden;
  transform: translateY(12px) scale(0.985);
  transition: transform 0.38s var(--ease);
}

.search-bg.open .search-panel {
  transform: translateY(0) scale(1);
}

.search-top {
  flex-shrink: 0;
  padding: 1.35rem 1.5rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(155, 140, 248, 0.07) 0%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-top-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.search-brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.search-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(180, 168, 255, 0.75);
}

.search-title {
  margin: 0;
  font-family: var(--font-display), var(--font);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 400;
  color: #fff;
  line-height: 1.1;
}

.search-hint {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.search-hd {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(155, 140, 248, 0.22);
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.22s, box-shadow 0.22s, background 0.22s;
}

.search-hd:focus-within {
  border-color: rgba(155, 140, 248, 0.45);
  background: rgba(155, 140, 248, 0.06);
  box-shadow: 0 0 0 3px rgba(155, 140, 248, 0.12);
}

.search-icon {
  color: var(--accent-bright);
  flex-shrink: 0;
  opacity: 0.9;
}

#searchInput {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 6px 0;
  color: #fff;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  outline: none;
  font-family: var(--font);
  font-weight: 500;
  caret-color: var(--accent-bright);
}

#searchInput::placeholder {
  color: rgba(240, 240, 248, 0.32);
}

.search-close {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}

.search-close:hover {
  background: var(--accent-soft);
  border-color: rgba(155, 140, 248, 0.35);
  color: #fff;
  transform: scale(1.04);
}

.search-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-filters .chip {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.search-filters .chip:hover {
  background: rgba(155, 140, 248, 0.1);
  border-color: rgba(155, 140, 248, 0.25);
  color: #fff;
}

.search-filters .chip.active {
  background: linear-gradient(135deg, rgba(155, 140, 248, 0.35), rgba(107, 92, 231, 0.25));
  border-color: rgba(180, 168, 255, 0.45);
  color: #fff;
  box-shadow: 0 6px 18px rgba(155, 140, 248, 0.2);
}

.search-popular-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.search-popular-chips::before {
  content: 'Populaire';
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-right: 2px;
}

.search-pop-chip {
  padding: 6px 13px;
  border-radius: 999px;
  background: transparent;
  border: 1px dashed rgba(155, 140, 248, 0.28);
  color: rgba(180, 168, 255, 0.85);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.search-pop-chip:hover {
  background: var(--accent-soft);
  border-color: rgba(155, 140, 248, 0.45);
  border-style: solid;
  color: #fff;
}

.search-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 1.5rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(155, 140, 248, 0.35) transparent;
}

.search-body::-webkit-scrollbar {
  width: 6px;
}
.search-body::-webkit-scrollbar-thumb {
  background: rgba(155, 140, 248, 0.35);
  border-radius: 999px;
}

.search-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(180, 168, 255, 0.8);
  margin-bottom: 1rem;
}

.search-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(155, 140, 248, 0.25), transparent);
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px 12px;
}

.search-grid .card {
  width: 100%;
  flex: unset;
  border-radius: 12px;
  transition: transform 0.28s var(--ease), box-shadow 0.28s;
}

.search-grid .card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4), 0 0 24px rgba(155, 140, 248, 0.15);
}

.search-grid .card-img {
  height: auto;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
}

.search-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 3rem 1.5rem;
  grid-column: 1 / -1;
  font-size: 0.95rem;
  line-height: 1.6;
  border-radius: 16px;
  border: 1px dashed rgba(155, 140, 248, 0.2);
  background: rgba(155, 140, 248, 0.04);
}

.search-loading {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(155, 140, 248, 0.25);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  animation: searchSpin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes searchSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .search-bg {
    padding: 0;
    align-items: stretch;
  }

  .search-panel {
    max-height: 100dvh;
    border-radius: 0;
    border: none;
    transform: translateY(100%);
  }

  .search-bg.open .search-panel {
    transform: translateY(0);
  }

  .search-top {
    padding: max(1rem, env(safe-area-inset-top)) 1rem 0.85rem;
  }

  .search-top-head {
    flex-wrap: wrap;
  }

  .search-hint {
    display: none;
  }

  .search-body {
    padding: 1rem;
  }

  .search-grid {
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 10px 8px;
  }
}
