/* ============================================================
   VIGIE-SUB — Styles de l'en-tête (header.php + _brand.php)
   ============================================================
   Chargé indépendamment du bundle React (voir index.php :
   <link rel="stylesheet" href="/header.css">). Reprend la palette
   de marque définie côté React (App.jsx) — si la palette change un
   jour d'un côté, penser à répercuter ici aussi.
   ============================================================ */

/* ---------- Fragment marque (logo + titre), réutilisable ---------- */

.vs-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vs-brand__logo {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
}

.vs-brand__title {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.5rem;
  color: #C9A15A; /* viel or */
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Variante autonome (grand format), utilisée par les écrans React
   qui affichent le logo seul, sans nav — voir .vs-standalone-brand
   ci-dessous, posé directement dans le JSX de LoginScreen /
   OrgSelectorScreen plutôt que dans header.php. */
.vs-standalone-brand .vs-brand__logo {
  width: 34px;
  height: 34px;
}
.vs-standalone-brand .vs-brand__title {
  font-size: 22px;
}

/* ---------- Header : conteneur général ---------- */

.vs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 32px;
  background: #1B5E4A; /* EMERAUDE */
  position: relative;
}

/* PILOTAGE DU HEADER PAR ÉCRAN — voir le commentaire correspondant
   dans header.php et dans App.jsx ("PILOTAGE DU HEADER PAR ÉCRAN").
   React pose la classe vs-header-nav-hidden sur <body> quand l'écran
   affiché ne doit montrer QUE le logo (Login, sélection d'association
   superadmin) — la nav et le hamburger disparaissent, seul le
   fragment marque reste visible. */
body.vs-header-nav-hidden .vs-header__nav,
body.vs-header-nav-hidden .vs-header__burger {
  display: none;
}
body.vs-header-nav-hidden .vs-header {
  justify-content: center;
}

/* ---------- Navigation (desktop) ---------- */

.vs-header__nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.vs-header__link {
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(246, 243, 234, 0.75); /* CREME à 75% */
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 7px;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.vs-header__link:hover {
  background: rgba(246, 243, 234, 0.1);
  color: #F6F3EA;
}

.vs-header__link--logout {
  color: rgba(246, 243, 234, 0.55);
}

.vs-header__link--logout:hover {
  background: rgba(139, 58, 58, 0.18); /* BRIQUE léger */
  color: #F6F3EA;
}

/* Emplacement où React insère "Mes alertes" / "Gérer" (portail DOM,
   voir HEADER_REACT_SLOT_ID dans App.jsx). Vide et sans dimension
   tant que React n'a rien inséré dedans, pour ne jamais laisser un
   espace vide visible avant l'hydratation. */
.vs-header__react-slot {
  display: contents; /* le contenu inséré par React suit le flex du parent .vs-header__nav, comme s'il n'y avait pas de wrapper */
}

.vs-manage { position: relative; }
.vs-manage > button { background: none; border: 0; cursor: pointer; }
.vs-manage__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 55;
  width: 260px;
  max-width: calc(100vw - 36px);
  padding: 6px;
  border: 1px solid #1B5E4A22;
  border-radius: 10px;
  background: white;
  box-shadow: 0 12px 32px #00000030;
}
.vs-manage__item {
  display: block;
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #1B5E4A;
  text-align: left;
  font: 600 13.5px 'Inter', sans-serif;
  cursor: pointer;
}
.vs-manage__item:hover, .vs-manage__item:focus-visible { background: #1B5E4A0F; }
@media (max-width: 720px) {
  .vs-manage__panel { position: static; width: 100%; max-width: none; margin-top: 6px; }
}

/* ---------- Bouton hamburger (masqué par défaut, desktop) ---------- */

.vs-header__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.vs-header__burger span {
  display: block;
  height: 2px;
  width: 100%;
  background: #F6F3EA;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* État ouvert : transforme les 3 barres en croix. Piloté par
   header.js qui bascule cette classe au clic (voir ce fichier). */
.vs-header__burger.is-open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.vs-header__burger.is-open span:nth-child(2) {
  opacity: 0;
}
.vs-header__burger.is-open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ---------- Responsive : mobile ---------- */

@media (max-width: 720px) {
  .vs-header {
    padding: 14px 18px;
  }

  .vs-header__burger {
    display: flex;
  }

  /* Sur mobile, la nav devient un panneau déroulant sous le header,
     empilé verticalement, masqué par défaut. header.js bascule
     .is-open sur .vs-header__nav au clic sur le hamburger. */
  .vs-header__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: #1B5E4A;
    padding: 10px 18px 18px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
    z-index: 50;
  }

  .vs-header__nav.is-open {
    display: flex;
  }

  .vs-header__link {
    padding: 10px 12px;
  }

  /* Sur mobile, le slot React (Mes alertes / Gérer) suit le flux
     vertical du panneau comme n'importe quel autre lien — on annule
     le display:contents desktop pour que chaque bouton React inséré
     s'empile proprement lui aussi. */
  .vs-header__react-slot {
    display: contents;
  }

  body.vs-header-nav-hidden .vs-header {
    justify-content: center;
  }
}
