/* ========================================
   COMPONENT — SEARCH BAR (Clone Leboncoin-like)
   - .search-bar           : barre normale (dans le flux)
   - .search-bar--float    : clone fixed (animé sous header)
   ======================================== */

.search-bar{
  /* tokens locaux (tu peux garder/compléter) */
  --sb-maxw: 1060px;
  --sb-padinput: 20px;
  --sb-pad: 15px 25px;
  --sb-radius: 3px;
  --sb-shadow: 0 1px 20px rgba(0,0,0,.05);
  --sb-sep: 1px solid #eae9e6;
  --sb-gap: 20px;
  --sb-focuskey: var(--fc-munsell);
  --sb-focusloc: var(--fc-light-green);

  /* motion */
  --sb-drop-ease: cubic-bezier(.12,.71,.49,1.02);
  --sb-drop-dur: 320ms;

  /* normal = dans le flux */
  position: static;
  z-index: 1;
}

/* (optionnel) garde ton layout interne */
.search-bar__inner{
  display: flex;
  flex-direction: column;
  gap: var(--sb-gap);
  padding-block: 20px;
  padding-inline: 0;
}

/* ========================================
   CLONE FIXED (créé par JS)
   ======================================== */

.search-bar--float{
  position: fixed;
  top: calc(var(--header-h) - 1px);
  left: 0;
  right: 0;

  /* full-bleed */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);

  z-index: 10; /* < header-z (11) OK */
  background: var(--color-bg, #fff);

  /* état caché */
  transform: translateY(-100%);
  opacity: 1;
  pointer-events: none;

  transition:
    transform var(--sb-drop-dur) var(--sb-drop-ease),
    opacity 180ms ease;
  will-change: transform, opacity;
}

.search-bar--float.is-visible{
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  box-shadow: 0px 8px 13px 0px rgb(0 0 0 / 9%);
}

.search-bar--float.no-anim{
  transition: none !important;
}


/* viewport-friendly : on n’embarque pas les tags dans le clone */
.search-bar--float .search-bar__tags{
  display: none;
}

/* padding container sur le clone */
.search-bar--float .search-bar__inner{
  box-shadow: none;
  padding-inline:
    max(var(--container-px), env(safe-area-inset-left))
    max(var(--container-px), env(safe-area-inset-right));
}

/* reduced motion */
@media (prefers-reduced-motion: reduce){
  .search-bar--float{ transition: none; }
}

/* Responsive (tes règles existantes) */
@media (max-width: 768px){
  .search-bar{ display: none; }
  .search-bar--float{ display: none; } /* clone off aussi */
}

/* ======================================================
   TOOLBAR (Rechercher / location / Filtres) — Variante A
   Branché sur : .search-bar__nav .filter-toggle .filter-count
   ====================================================== */

:root{
  --ui-bg: #fff;
  --ui-text: #0f172a;
  --ui-muted: #64748b;
  --ui-border: #e6e8ee;
  --ui-border-strong: #d6dae3;

  --accent: #7c3aed;
  --accent-soft: #ede9fe;
  --accent-hover: #6d28d9;

  --radius-ctl: 8px;
  --radius-chip: 999px;
}

/* Ligne des 3 boutons */
.search-bar__nav{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Boutons */
.search-bar__nav .filter-toggle{
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;

  height: 38px;
  padding: 0 14px;

  background: transparent;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-ctl);

  color: var(--ui-text);
  font-weight: 600;
  font-size: .95rem;
  line-height: 1;

  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .12s ease, color .18s ease;
}

.search-bar__nav .filter-toggle i{
  font-size: 1rem;
  color: var(--ui-muted);
}

/* Hover/focus */
.search-bar__nav .filter-toggle:hover{
  background: rgba(15, 23, 42, .03);
  border-color: var(--ui-border-strong);
}
.search-bar__nav .filter-toggle:active{
  transform: translateY(1px);
}
.search-bar__nav .filter-toggle:focus-visible{
  outline: 3px solid rgba(124,58,237,.25);
  outline-offset: 2px;
}

/* Option : état actif si le sheet est ouvert (classe ajoutée par ton JS) */
.search-bar__nav .filter-toggle.is-active{
  border-color: rgba(124,58,237,.40);
  background: rgba(124,58,237,.06);
}
.search-bar__nav .filter-toggle.is-active i{
  color: var(--accent);
}

/* ======================================================
   TAGS (chips)
   Branché sur : .search-bar__tags .sheet__tags-container .filter-tag
   ====================================================== */

.search-bar__tags {
  display: flex;
  gap: 10px;
}

/* Si tes tags sont des .filter-tag générés par JS */
.search-bar__tags .filter-tag{
  display: inline-flex;
  align-items: center;
  gap: 10px;

  height: 32px;
  padding: 0 0.5rem 0 1rem;

  border-radius: 9999px;
  background: var(--accent-soft);

  font-size: .9rem;
  font-weight: 600;
}

/* bouton remove inside tag */
.search-bar__tags .filter-tag__remove{
  display: inline-flex;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 1.2rem;
  line-height: 1rem;
  cursor: pointer; 
}

.search-bar__tags .filter-tag__remove:hover{
  background: rgba(124,58,237,.18);
}
