/* ══════════════════════════════════════════
   HEADER PARTAGÉ — The Experience : New Heaven
   Version 2 : barre d'icônes responsive
   ══════════════════════════════════════════ */

/* Variables globales partagées — utilisables dans n'importe quelle page/widget
   pour se positionner correctement par rapport au header fixed.
   Exemple : padding-top: calc(var(--header-h) + 1rem);
             top: var(--header-h); */
:root {
  --header-h: 85px;
  --header-h-mobile: 72px;
  --header-h-xs: 65px;
}
@media (max-width: 900px) {
  :root { --header-h: var(--header-h-mobile); }
}
@media (max-width: 500px) {
  :root { --header-h: var(--header-h-xs); }
}

header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  padding: 0 1.5rem;
  min-height: 80px;
  /* Background opaque (pas de backdrop-filter qui cause un clignotement
     des widgets à chaque navigation SPA car il force un recalcul du blur
     sur tout ce qui se trouve derrière le header à chaque repaint) */
  background: #050a14;
  border-bottom: 1px solid rgba(0,170,255,0.15);
}

header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #0af, transparent);
  opacity: 0.5;
  pointer-events: none;
}

.logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.logo img {
  height: 62px;
  width: auto;
  display: block;
  filter: brightness(1.2) drop-shadow(0 0 8px rgba(0,170,255,0.5));
  transition: filter 0.2s;
}
.logo img:hover {
  filter: brightness(1.4) drop-shadow(0 0 14px rgba(0,170,255,0.8));
}

/* ── NAV container ── */
nav#nav {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
}

/* ── Boutons CTA (Connexion / Déconnexion / Staff) ── */
.nav-cta,
.nav-cta-staff,
.nav-btn-deconnexion {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0 1rem;
  height: 42px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  white-space: nowrap;
  box-sizing: border-box;
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
  transition: background 0.2s, color 0.2s;
}

/* Connexion (bleu) */
.nav-cta {
  color: #040810;
  background: #0af;
}
.nav-cta:hover {
  background: #f0f8ff;
  color: #040810;
}

/* Staff (orange) */
.nav-cta-staff {
  color: #040810;
  background: #ff6b35;
}
.nav-cta-staff:hover {
  background: #ffa277;
}

/* Déconnexion (rouge discret) */
.nav-btn-deconnexion {
  color: #ff4455;
  background: rgba(255,68,85,0.1);
  border: 1px solid rgba(255,68,85,0.25);
  cursor: pointer;
}
.nav-btn-deconnexion:hover {
  background: rgba(255,68,85,0.2);
  color: #ff6677;
}

/* ── Pseudo (si affiché) ── */
.nav-pseudo {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
}
.nav-pseudo span { color: #0af; }

/* ── Cloche notifications ── */
.nav-notif-bell {
  position: relative;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  width: 56px; height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.nav-notif-bell:hover {
  background: rgba(0,170,255,0.1);
  color: #0af;
}
.nav-notif-count {
  position: absolute;
  top: -2px; right: -2px;
  background: #ff4455;
  color: white;
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.nav-notif-count.show { display: flex; }
.nav-notif-count:empty { display: none; }

/* ── Recherche globale ── */
.nav-search-wrap { position: relative; flex-shrink: 0; }
.nav-search-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  width: 56px; height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.nav-search-btn:hover {
  background: rgba(0,170,255,0.1);
  color: #0af;
}

/* ── RESPONSIVE MOBILE ── */
@media (max-width: 900px) {
  header {
    padding: 0 0.8rem;
    min-height: 68px;
    gap: 0.4rem;
  }
  .logo img { height: 48px; }
}

@media (max-width: 500px) {
  header {
    padding: 0 0.6rem;
    min-height: 62px;
    gap: 0.25rem;
  }
  .logo img { height: 42px; }
}

/* ══════════════════════════════════════════
   TRANSITIONS DE PAGE & ISOLATION WIDGETS
   (conservé — critique pour le fonctionnement SPA)
   ══════════════════════════════════════════ */

/* Empêche le flash blanc + scrollbar permanente */
html { background: #040810; overflow-y: scroll; }

/* Isolation widgets SPA — couche GPU dédiée pour éviter
   que le swap des styles SPA affecte leur rendu */
#widgets-layer {
  isolation: isolate;
  transform: translate3d(0,0,0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  perspective: 1000px;
}
#pw-root,
#chat-widget,
#notif-panel {
  transform: translate3d(0,0,0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* ══════════════════════════════════════════
   RECHERCHE GLOBALE — overlay
   ══════════════════════════════════════════ */
.recherche-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100000;
  align-items: flex-start;
  justify-content: center;
  padding-top: calc(var(--header-h) + 1rem);
}
.recherche-overlay.open {
  display: flex;
  animation: notifFadeUp 0.15s ease;
}
.recherche-box {
  background: #070d1a;
  border: 1px solid #112240;
  width: 100%;
  max-width: 680px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.recherche-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid #112240;
}
.recherche-input-wrap svg {
  color: rgba(0,170,255,0.5);
  flex-shrink: 0;
}
.recherche-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #f0f8ff;
  font-family: 'Exo 2', sans-serif;
  font-size: 1rem;
  font-weight: 300;
}
.recherche-input::placeholder { color: rgba(90,120,154,0.6); }
.recherche-close {
  background: none;
  border: none;
  color: #5a7a9a;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.2rem;
}
.recherche-close:hover { color: #f0f8ff; }
.recherche-filters {
  display: flex;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-bottom: 1px solid #112240;
  flex-wrap: wrap;
}
.recherche-filter-btn {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: none;
  border: 1px solid #112240;
  color: #5a7a9a;
  padding: 0.25rem 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
}
.recherche-filter-btn.active {
  border-color: #0af;
  color: #0af;
  background: rgba(0,170,255,0.08);
}
.recherche-filter-btn:hover {
  border-color: #5a7a9a;
  color: #c8dff5;
}
.recherche-results {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,170,255,0.2) transparent;
}
.recherche-empty {
  padding: 2rem;
  text-align: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.7rem;
  color: #5a7a9a;
}
.recherche-group-label {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #5a7a9a;
  padding: 0.6rem 1.2rem 0.3rem;
}
.recherche-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.7rem 1.2rem;
  border-bottom: 1px solid rgba(17,34,64,0.5);
  text-decoration: none;
  transition: background 0.15s;
}
.recherche-item:hover { background: rgba(0,170,255,0.05); }
.recherche-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #112240;
  flex-shrink: 0;
}
.recherche-item-avatar-ph {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0d1830;
  border: 1px solid #112240;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: #0af;
  flex-shrink: 0;
}
.recherche-item-body { flex: 1; min-width: 0; }
.recherche-item-titre {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: #f0f8ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recherche-item-meta {
  font-size: 0.7rem;
  color: #5a7a9a;
  margin-top: 0.1rem;
}
.recherche-item-type {
  font-family: 'Rajdhani', sans-serif;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #0af;
  border: 1px solid rgba(0,170,255,0.3);
  padding: 0.1rem 0.4rem;
  flex-shrink: 0;
}
@media (max-width: 900px) {
  .recherche-overlay { padding-top: calc(var(--header-h) + 0.5rem); }
  .recherche-box { max-width: calc(100% - 2rem); }
}
