/* Écran de chargement de l'application (avant le démarrage d'Angular) — couleurs APEJ */
.app-loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem;
  background: radial-gradient(circle at 50% 40%, #ffffff 0%, #f3f6fa 60%, #e8eef6 100%);
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    Arial,
    sans-serif;
  color: #172b4d;
  text-align: center;
  z-index: 9999;
}

.app-loading__logo {
  position: relative;
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
}

.app-loading__logo img {
  width: 96px;
  height: auto;
  animation: apej-pulse 1.8s ease-in-out infinite;
}

/* Anneau qui tourne autour du logo : jaune APEJ + bleu nuit */
.app-loading__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid rgba(23, 43, 77, 0.1);
  border-top-color: #fbcc00;
  border-right-color: #172b4d;
  animation: apej-spin 1.1s linear infinite;
}

.app-loading__title {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7280;
}

.app-loading__text {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.app-loading__dots::after {
  content: '';
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: apej-dots 1.2s steps(4, end) infinite;
}

/* Barre de progression indéterminée */
.app-loading__bar {
  position: relative;
  width: min(260px, 70vw);
  height: 4px;
  margin-top: 0.4rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 43, 77, 0.1);
}

.app-loading__bar span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, #fbcc00, #172b4d);
  animation: apej-slide 1.3s ease-in-out infinite;
}

.app-loading__error {
  max-width: 34rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 0.6rem;
  background: #fff4d6;
  color: #5c4500;
  font-size: 0.9rem;
}

.app-loading__error p {
  margin: 0.2rem 0;
}

@keyframes apej-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes apej-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.92);
    opacity: 0.85;
  }
}

@keyframes apej-slide {
  0% {
    left: -40%;
  }
  100% {
    left: 100%;
  }
}

@keyframes apej-dots {
  0% {
    content: '';
  }
  25% {
    content: '.';
  }
  50% {
    content: '..';
  }
  75% {
    content: '...';
  }
}

/* Respect du réglage « réduire les animations » du système */
@media (prefers-reduced-motion: reduce) {
  .app-loading__ring,
  .app-loading__logo img,
  .app-loading__bar span,
  .app-loading__dots::after {
    animation: none;
  }
  .app-loading__bar span {
    left: 30%;
  }
}
