/* ========================= */
/*      HEADER NAVIGATION    */
/* ========================= */

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: 20px var(--page-side-padding);
  background: rgba(11, 11, 11, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 62, 181, 0.2);
  margin: 0;
  max-width: 100%;
  overflow: visible;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0;
  position: relative;
  overflow: visible;
}

.logo {
  display: flex;
  align-items: center;
}

.logo a {
  display: block;
  line-height: 0;
}

.logo img {
  display: block;
  height: 50px;
  transition: transform 0.3s ease;
}

.logo img:hover {
  transform: scale(1.05);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 30px;
}

.nav-links {
  display: flex;
  gap: 30px;
  align-items: center;
}

.nav-links a {
  color: var(--blanc-pur);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  transition: color 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  padding: 10px 5px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--rose-fuchsia);
  transition: width 0.3s ease;
}

.nav-links a:hover {
  color: var(--rose-fuchsia);
}

.nav-links a:hover::after {
  width: 100%;
}

/* Logout icon styling */
/* Lien Accueil : icône seule, sans libellé. display:block sur le SVG évite
   l'espace de ligne de base qui décalerait l'icône par rapport aux autres
   entrées du menu. */
.nav-links a.nav-link-activity > svg { display: block; }
.nav-links a.nav-link-activity {
  transition: all 0.3s ease;
}
.nav-links a.nav-link-activity:hover {
  transform: scale(1.1);
}
.nav-links a.nav-link-activity::after,
.nav-links a.nav-link-activity:hover::after {
  display: none;
}

.nav-links a.logout-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  flex-shrink: 0;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.nav-links a.logout-link::after {
  display: none;
}

.nav-links a.logout-link:hover {
  transform: scale(1.1);
}

.nav-links a.logout-link svg {
  display: block;
  width: 20px;
  height: 20px;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--blanc-pur);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.3s ease;
  width: 44px;
  height: 44px;
  position: relative;
  padding: 0;
}

.mobile-menu-toggle:hover {
  color: var(--rose-fuchsia);
}

.mobile-menu-toggle::before,
.mobile-menu-toggle::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  height: 2px;
  background: var(--blanc-pur);
  border-radius: 2px;
  transition: background 0.3s ease;
}

.mobile-menu-toggle::before {
  top: 13px;
  box-shadow: 0 9px 0 var(--blanc-pur);
}

.mobile-menu-toggle::after {
  top: 31px;
}

.mobile-menu-toggle:hover::before,
.mobile-menu-toggle:hover::after {
  background: var(--rose-fuchsia);
}

.mobile-menu-toggle:hover::before {
  box-shadow: 0 9px 0 var(--rose-fuchsia);
}

/* Un libellé du menu ne se coupe jamais en deux lignes (« TABLEAU DE / BORD ») */
.nav-links a { white-space: nowrap; }

/* ========================= */
/*      RESPONSIVE HEADER    */
/* ========================= */

/* Tablette paysage et petit portable (993-1199 px) : le menu créatrice (5 libellés + 2 icônes)
   ne tenait pas sur une ligne et passait sur deux (audit responsive du 14/11/2026).
   Menu resserré plutôt que burger : il reste lisible et toujours visible à ces largeurs. */
@media (min-width: 993px) and (max-width: 1199px) {
  .header-nav,
  .nav-links { gap: 18px; }
  .nav-links a {
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 10px 2px;
  }
  .logo img { height: 44px; }
}

@media (max-width: 992px) {
  header {
    padding: 15px 20px;
  }

  .logo img {
    height: 40px;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .header-nav {
    display: none;
    flex-direction: column;
    background: rgba(11, 11, 11, 0.98);
    position: absolute;
    top: 70px;
    right: 20px;
    left: 20px;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 62, 181, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 9999;
  }

  .header-nav.active {
    display: flex;
    animation: menuSlideIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  }

  .header-nav.closing {
    display: flex;
    animation: menuSlideOut 0.2s ease-in forwards;
    pointer-events: none;
  }

  @keyframes menuSlideIn {
    from {
      opacity: 0;
      transform: translateY(-12px) scale(0.96);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  @keyframes menuSlideOut {
    from {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
    to {
      opacity: 0;
      transform: translateY(-8px) scale(0.97);
    }
  }

  /* Apparition en cascade des liens */
  .header-nav.active .nav-links a,
  .header-nav.active .nav-links .logout-link {
    animation: linkFadeIn 0.2s ease forwards;
    opacity: 0;
  }

  .header-nav.active .nav-links a:nth-child(1) { animation-delay: 0.05s; }
  .header-nav.active .nav-links a:nth-child(2) { animation-delay: 0.10s; }
  .header-nav.active .nav-links a:nth-child(3) { animation-delay: 0.15s; }
  .header-nav.active .nav-links a:nth-child(4) { animation-delay: 0.20s; }
  .header-nav.active .nav-links a:nth-child(5) { animation-delay: 0.25s; }
  .header-nav.active .nav-links a:nth-child(6) { animation-delay: 0.30s; }

  @keyframes linkFadeIn {
    from {
      opacity: 0;
      transform: translateX(-8px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  /* Sélecteur renforcé (.header-nav) : account.css, services.css et
     responsive.css redéclarent .nav-links en colonne et passent après. */
  .header-nav .nav-links {
    /* Ligne + retour à la ligne plutôt que colonne : les liens texte, en
       largeur 100 %, occupent chacun leur ligne, tandis que les boutons
       ronds Accueil et Déconnexion se partagent la dernière. */
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    width: 100%;
  }

  .nav-links a {
    width: 100%;
    padding: 12px 10px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 8px;
    background: rgba(255, 62, 181, 0.05);
  }

  .nav-links a:hover {
    background: rgba(255, 62, 181, 0.15);
  }

  .nav-links a::after {
    display: none;
  }

  /* Logout button - Mobile: round and centered.
     Le lien Accueil (icône seule) reprend le même bouton rond. */
  .nav-links a.logout-link,
  .nav-links a.nav-link-activity {
    width: 48px;
    height: 48px;
    padding: 0;
    margin: 10px 0 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 62, 181, 0.15), rgba(227, 0, 73, 0.1));
    border: 1px solid rgba(255, 62, 181, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nav-links a.logout-link:hover,
  .nav-links a.nav-link-activity:hover {
    background: linear-gradient(135deg, rgba(255, 62, 181, 0.25), rgba(227, 0, 73, 0.2));
    border-color: rgba(255, 62, 181, 0.5);
    transform: scale(1.05);
  }

  .nav-links a.logout-link svg,
  .nav-links a.nav-link-activity svg {
    width: 22px;
    height: 22px;
    color: #FF3EB5;
  }
}

/* ════════════════════════════════════════════════════════════
   BARRE D'APPLI — repris de s2 (header.css, 11-12/11/2026) le 14/11/2026.
   Script : /static/js/barre-appli.js (inclus par les en-têtes connectés). Tout est conditionné à
   html.en-appli, posée seulement en appli installée : dans le navigateur, rien ne change.
   ════════════════════════════════════════════════════════════ */
.barre-appli { display: none; }
@media (max-width: 768px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  html.en-appli {
    /* 14/11/2026 : descendue d'environ 20 px, posée juste au-dessus du trait d'accueil de l'iPhone
       (zone de sécurité 34 px − 14 px = 20 px du bord) ; 10 px du bord sans barre d'accueil. */
    --barre-appli-bas: max(calc(env(safe-area-inset-bottom, 0px) - 14px), 10px);
    --barre-appli-h: calc(60px + var(--barre-appli-bas) + 12px);
  }

  /* l'en-tête : le logo à gauche, la déconnexion en icône à droite ; plus de burger ni de volet */
  html.en-appli body > header .mobile-menu-toggle,
  html.en-appli body > header .header-nav { display: none !important; }
  html.en-appli body > header .appli-sortie {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    -webkit-tap-highlight-color: transparent;
  }
  html.en-appli body > header .appli-sortie svg { width: 22px; height: 22px; }
  html.en-appli body > header .appli-sortie:active { background: rgba(255, 255, 255, 0.08); }

  html.en-appli body { padding-bottom: var(--barre-appli-h); }
  /* Page avec pied de page : la réserve sous la barre est prise par le pied de page
     lui-même (bordure de sa couleur), sinon le fond du body faisait une bande d'une
     autre teinte tout en bas (audit responsive du 14/11/2026). */
  html.en-appli body:has(> footer) { padding-bottom: 0; }
  html.en-appli body > footer { border-bottom: var(--barre-appli-h) solid rgba(11, 11, 11, 0.9); }

  /* la pilule de verre */
  .en-appli .barre-appli {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: var(--barre-appli-bas);
    z-index: 950;                         /* sous l'en-tête (1000) et les fenêtres (10000) */
    display: flex;
    align-items: stretch;
    gap: 2px;
    box-sizing: border-box;
    max-width: 440px;
    height: 60px;
    margin: 0 auto;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(30, 30, 34, 0.62);
    -webkit-backdrop-filter: blur(22px) saturate(170%);
    backdrop-filter: blur(22px) saturate(170%);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    touch-action: none;                   /* glisser sur la barre ne fait pas défiler la page */
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    transition: transform 0.2s ease;
  }
  /* doigt posé et qui glisse : la barre grossit un peu, la pilule s'éclaircit (comme la barre d'Instagram) */
  .en-appli .barre-appli.au-doigt { transform: scale(1.04); }
  @supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    .en-appli .barre-appli { background: rgba(30, 30, 34, 0.94); }
  }
  .barre-appli a {
    position: relative;
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s ease, color 0.2s ease;
  }
  /* l'onglet en cours : une pilule plus claire, l'icône en blanc et plus marquée. La pilule est un
     élément à part (barre-appli.js) : elle glisse d'une icône à l'autre sous le doigt */
  .barre-appli-pilule {
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 0;
    border-radius: 999px;
    background: rgba(214, 22, 138, 0.92);  /* rose des boutons (--rose-action), à la demande : icône blanche lisible */
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), background-color 0.2s ease;
  }
  .barre-appli.au-doigt .barre-appli-pilule { background: rgba(240, 36, 159, 0.95); }   /* un rose plus vif sous le doigt */
  .barre-appli a { z-index: 1; }
  .barre-appli a[aria-current="page"],
  .barre-appli a.sous-pilule { color: #fff; }
  .barre-appli a.sous-pilule .nav-icone svg { stroke-width: 2.3; }
  .barre-appli a.sous-pilule .chat-unread-bubble:not([hidden]) { background: #fff; }   /* point blanc sur la pilule rose */
  .barre-appli a::after { display: none; }   /* pas de trait sous l'icône (celui des liens de l'en-tête) */
  .barre-appli .nav-icone { display: block; width: 26px; height: 26px; transition: transform 0.12s ease; }
  .barre-appli .nav-icone svg { display: block; width: 100%; height: 100%; }
  .barre-appli a[aria-current="page"] .nav-icone svg { stroke-width: 2.3; }
  .barre-appli a:active .nav-icone { transform: scale(0.88); }
  .barre-appli a:focus-visible { outline: 2px solid var(--rose); outline-offset: -2px; }
  .barre-appli .barre-libelle {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  /* nouveautés (messages non lus, commandes à traiter) : un point rose à côté de l'icône, comme
     Instagram ; le nombre reste dans le nom du lien pour les lecteurs d'écran */
  .barre-appli .chat-unread-bubble:not([hidden]) {
    position: absolute;
    top: auto;
    bottom: 13px;
    left: calc(50% + 9px);
    right: auto;
    display: block;
    width: 8px;
    min-width: 0;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--rose);
    box-shadow: none;
    font-size: 0;
    animation: none;
  }

  /* éléments fixés en bas : au-dessus de la pilule */
  html.en-appli .profil-barre { bottom: var(--barre-appli-h); }

  /* La barre d'icônes reste TOUJOURS là, au même endroit, sur toutes les pages (décision de l'utilisateur, 12/11/2026 :
     un essai où elle s'effaçait au défilement sur les profils a été retiré). */

  /* messagerie : la liste défile sous la pilule et s'arrête au-dessus ; dans une conversation, la barre
     s'efface (la saisie reste en bas, comme les messages d'Instagram) et la flèche ramène à la liste */
  html.en-appli .conversations-list { padding-bottom: var(--barre-appli-h); }
  html.en-appli body:has(.chat-container) { padding-bottom: 0; }
  html.en-appli body:has(.chat-container):not(.chat-empty):not(:has(.conversations-sidebar.open)) .barre-appli { display: none; }
}
/* Appli installée : la page suit le doigt quand on la glisse à gauche / à droite (barre-appli.js pose
   « page-glisse » et --page-dx / --page-o sur <html>). Seuls les blocs de la page bougent : l'en-tête et la
   barre restent en place. « page-revient » : retour en place ; « page-part » : départ vers la rubrique voisine. */
html.en-appli.page-glisse body > :not(header):not(.barre-appli):not(script):not(style):not(link) {
  transform: translateX(var(--page-dx, 0px));
  opacity: var(--page-o, 1);
}
html.en-appli.page-revient body > :not(header):not(.barre-appli):not(script):not(style):not(link) {
  transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.25s ease;
}
html.en-appli.page-part body > :not(header):not(.barre-appli):not(script):not(style):not(link) {
  transition: transform 0.15s ease-in, opacity 0.15s ease-in;
}
@media (prefers-reduced-motion: reduce) {
  html.en-appli.page-glisse body > :not(header):not(.barre-appli) { transform: none; transition: none; }
}

/* Appli installée : d'une rubrique à l'autre en fondu, la barre et sa pilule restent en place (la pilule glisse
   vers la nouvelle rubrique). View Transitions entre pages ; sans elles, changement de page normal. */
@media (display-mode: standalone) and (max-width: 768px) {
  @view-transition { navigation: auto; }
  .barre-appli { view-transition-name: barre-appli; }
  .barre-appli-pilule { view-transition-name: barre-appli-pilule; }
  ::view-transition-old(root),
  ::view-transition-new(root) { animation-duration: 0.2s; }
  ::view-transition-group(barre-appli-pilule) { animation-duration: 0.3s; animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1); }
}
@media (prefers-reduced-motion: reduce) {
  .barre-appli a,
  .barre-appli .nav-icone,
  .barre-appli-pilule,
  .en-appli .barre-appli { transition: none; }
  .en-appli .barre-appli.au-doigt { transform: none; }
}
@media (display-mode: standalone) and (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}
