.loading-bar {
  display: none; /* cachée par défaut */
  position: fixed;
  top: 0px; /* ajuste pour ta navbar */
  left: 0;
  right: 0;
  height: 6px;
  z-index: 99999;
  overflow: hidden;
  pointer-events: none;
}

/* conteneur visible quand actif */
.loading-bar.active {
  display: block;
}

/* élément animé qui "remplit" vers la droite */
.loading-bar .bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  /*background: linear-gradient(90deg, #0d6efd 0%, #8eb1e5 60%); */
  background: #0d6efd; /* couleur unique */
  transform-origin: left center;
  /* animation : progresse de 0->100% puis reset instantané (100%->0 jump on loop) */
  opacity: 0.98;
}

/* shimmer / vague en superposition */
.loading-bar .bar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  mix-blend-mode: overlay;
  transform: translateX(-100%);
  will-change: transform;
  pointer-events: none;
}

/* active : lance l'animation de progression + le shimmer */
.loading-bar.active .bar {
  animation: progress 1100ms ease infinite;
}

/*
.loading-bar.active .bar::before {
  animation: shimmer 300ms linear infinite;
}*/

/* keyframes */
/* width goes 0 -> 100% nearly until end, then at final tiny step jumps to 0 on iteration */
@keyframes progress {
  0% {
    width: 0%;
  }
  92% {
    width: 100%;
  }
  99.99% {
    width: 100%;
  }
  100% {
    width: 0%;
  } /* jump at loop restart */
}

/* shimmer just scrolls the overlay left->right */
@keyframes shimmer {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

/* optionnel : disparition douce quand on retire .active via JS (si tu veux) */
.loading-bar.fade-out .bar {
  transition: opacity 0.35s ease;
  opacity: 0;
}
