/* ================================================================
   WeFiiT Map — HEADER + RECHERCHE + FILTRES
   Chargé APRÈS style.css : surcharge les sections barre/recherche/chips.
   Aucune modif JS. Thème par défaut CLAIR (data-theme="clair").
   Variantes possibles : data-theme="marine" | "glass".
   Stats : data-stats="sobre" (aucune icône) — choix actuel.
   ================================================================ */

:root {
  --bleu:        #1B3C6F;
  --bleu-clair:  #2563EB;
  --h-row1: 64px;
  --h-row2: 52px;
}

/* ---- Thème : variables pilotées par data-theme sur #filter-bar ---- */
#filter-bar {
  --bar-bg:        #ffffff;
  --bar-border:    #E8ECF2;
  --bar-shadow:    0 1px 0 rgba(15,28,51,.04), 0 6px 24px -8px rgba(15,28,51,.18);
  --fg:            #16243D;
  --fg-muted:      #6B7C93;
  --fg-faint:      #93A1B5;
  --chip-bg:       #ffffff;
  --chip-bg-hover: #F3F6FB;
  --chip-border:   #E2E8F2;
  --chip-fg:       #3D4D66;
  --search-bg:     #F5F7FB;
  --search-bg-focus:#ffffff;
  --search-border: #E2E8F2;
  --search-fg:     #16243D;
  --search-ph:     #93A1B5;
  --divider:       #EAEEF4;
}
#filter-bar[data-theme="marine"] {
  --bar-bg:        linear-gradient(180deg,#1F4480 0%, #173863 100%);
  --bar-border:    rgba(255,255,255,.10);
  --bar-shadow:    0 6px 24px -6px rgba(0,0,0,.45);
  --fg:#fff; --fg-muted:rgba(255,255,255,.66); --fg-faint:rgba(255,255,255,.42);
  --chip-bg:rgba(255,255,255,.06); --chip-bg-hover:rgba(255,255,255,.14);
  --chip-border:rgba(255,255,255,.20); --chip-fg:rgba(255,255,255,.86);
  --search-bg:rgba(255,255,255,.10); --search-bg-focus:rgba(255,255,255,.16);
  --search-border:rgba(255,255,255,.18); --search-fg:#fff; --search-ph:rgba(255,255,255,.55);
  --divider:rgba(255,255,255,.16);
}
#filter-bar[data-theme="glass"] {
  --bar-bg:        rgba(13,18,28,.72);
  --bar-border:    rgba(255,255,255,.08);
  --bar-shadow:    0 8px 30px -8px rgba(0,0,0,.6);
  --fg:#EAF0F8; --fg-muted:rgba(234,240,248,.6); --fg-faint:rgba(234,240,248,.38);
  --chip-bg:rgba(255,255,255,.05); --chip-bg-hover:rgba(255,255,255,.11);
  --chip-border:rgba(255,255,255,.14); --chip-fg:rgba(234,240,248,.82);
  --search-bg:rgba(255,255,255,.06); --search-bg-focus:rgba(255,255,255,.10);
  --search-border:rgba(255,255,255,.12); --search-fg:#EAF0F8; --search-ph:rgba(234,240,248,.42);
  --divider:rgba(255,255,255,.12);
}

/* ---- Barre ---- */
#filter-bar {
  flex-shrink: 0;
  position: relative;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 0 22px;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--bar-border);
  box-shadow: var(--bar-shadow);
  -webkit-backdrop-filter: saturate(1.2) blur(14px);
  backdrop-filter: saturate(1.2) blur(14px);
}

#filter-bar-row1 {
  height: var(--h-row1);
  display: flex;
  align-items: center;
  gap: 24px;
}

/* ---- Logo ---- */
#filter-logo { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand-logo { height: 27px; width: auto; display: block; flex-shrink: 0; }
/* logo navy : sur thèmes sombres, on le pose sur une pastille blanche */
#filter-bar[data-theme="marine"] .brand-logo,
#filter-bar[data-theme="glass"] .brand-logo {
  height: 23px; padding: 6px 11px; border-radius: 9px; background: #fff;
  box-shadow: 0 2px 10px -3px rgba(0,0,0,.4);
}
.logo-product {
  font-size: 14px; font-weight: 700; letter-spacing: .01em;
  color: var(--fg-muted); padding-left: 11px;
  border-left: 1px solid var(--divider); white-space: nowrap;
}

/* ---- Recherche ---- */
#filter-search { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
#search-input {
  width: 100%;
  max-width: 460px;
  height: 42px;
  padding: 0 16px 0 44px;
  border-radius: 12px;
  border: 1px solid var(--search-border);
  background-color: var(--search-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238A99AE' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7.5'/%3E%3Cpath d='m20 20-3.6-3.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 15px center;
  color: var(--search-fg);
  font-size: 14px;
  font-weight: 450;
  outline: none;
  transition: border-color .18s, background-color .18s, box-shadow .18s;
}
#search-input::placeholder { color: var(--search-ph); }
#search-input::-webkit-search-cancel-button { display: none; }
#search-input:hover { border-color: color-mix(in srgb, var(--bleu-clair) 35%, var(--search-border)); }
#search-input:focus {
  background-color: var(--search-bg-focus);
  border-color: var(--bleu-clair);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--bleu-clair) 16%, transparent);
}

/* ---- Stats ---- */
#filter-stats { flex-shrink: 0; display: flex; align-items: center; }
#stats-text {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
}
/* repère carto (épingle) — masqué en mode sobre */
#stats-text::before {
  content: "";
  width: 15px; height: 15px; flex-shrink: 0;
  background: center/contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232563EB'%3E%3Cpath d='M12 2C8.1 2 5 5.1 5 9c0 5.2 7 13 7 13s7-7.8 7-13c0-3.9-3.1-7-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E");
}
#filter-bar[data-stats="sobre"] #stats-text::before { display: none; }

/* ---- Ligne 2 : filtres ---- */
#filter-bar-row2 {
  height: var(--h-row2);
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--divider);
  overflow-x: auto;
  scrollbar-width: none;
}
#filter-bar-row2::-webkit-scrollbar { display: none; }
#filter-roles, #filter-secteurs { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.filter-divider { width: 1px; height: 22px; background: var(--divider); flex-shrink: 0; }
.filter-label {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fg-faint); white-space: nowrap; margin-right: 2px;
}
#role-buttons, #secteur-buttons { display: flex; align-items: center; gap: 7px; }

/* ---- Chips ---- */
.role-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-fg);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.role-btn:hover {
  background: var(--chip-bg-hover);
  border-color: color-mix(in srgb, var(--fg) 22%, var(--chip-border));
}
.role-btn:active { transform: translateY(.5px); }

/* pastille couleur par rôle : reprend le border-color inline de filters.js */
#role-buttons .role-btn[data-role]:not([data-role="all"])::before {
  content: "";
  box-sizing: border-box;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 4.5px solid;
  border-color: inherit;
  flex-shrink: 0;
}

/* actif : "Tous" + secteurs */
.role-btn.active {
  background: var(--bleu);
  border-color: var(--bleu);
  color: #fff;
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--bleu) 55%, transparent);
}
/* actif : un rôle se remplit de SA couleur (--rc, voir §4) ; sinon marine */
#role-buttons .role-btn[data-role]:not([data-role="all"]).active {
  background: var(--rc, var(--bleu));
  border-color: var(--rc, var(--bleu));
  color: #fff;
  box-shadow: 0 2px 10px -2px var(--rc, color-mix(in srgb, var(--bleu) 55%, transparent));
}
#role-buttons .role-btn[data-role]:not([data-role="all"]).active::before {
  border-color: rgba(255,255,255,.9);
}

/* ---- Responsive ---- */
@media (max-width: 880px) {
  #filter-bar { padding: 0 14px; }
  #filter-bar-row1 { gap: 14px; }
  #search-input { max-width: none; }
  #filter-bar:not([data-stats="sobre"]) #stats-text {
    font-size: 0; gap: 0; padding: 0; width: 34px; justify-content: center;
  }
  #filter-bar[data-stats="sobre"] #filter-stats { display: none; }
}
@media (max-width: 620px) {
  .logo-product { display: none; }
}
