/* === Styles pour la bannière d'authentification centralisés === */
.error-container,
#error-message {
  opacity: 1;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.error-container.is-hidden,
#error-message.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.auth-required-banner {
  background: linear-gradient(135deg, #f3f6ff 0%, #eef2ff 100%);
  border: 1px solid #d7dcff;
  color: #1a2a6c;
  padding: 14px 16px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(26, 42, 108, 0.05);
  margin-top: 10px;
  opacity: 1;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.auth-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.auth-banner-text {
  font-size: 0.98rem;
  line-height: 1.6;
  text-align: center;
  white-space: pre-line;
  margin: auto;
}
/* Pour forcer le retour à la ligne après un point suivi d'un espace dans le JS, on peut remplacer ". " par ".\n" lors de l'injection du texte. */
.auth-primary-btn,
.auth-secondary-btn {
  border: 0;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
}
.auth-primary-btn {
  background: #1a2a6c;
  color: #fff;
}
.auth-secondary-btn {
  background: #e7ebff;
  color: #1a2a6c;
}
.auth-primary-btn:hover {
  filter: brightness(1.05);
  background: linear-gradient(
    135deg,
    rgba(26, 42, 108, 0.9),
    rgba(178, 31, 31, 0.9)
  );
  color: #ffffff;
}
.auth-secondary-btn:hover {
  filter: brightness(0.98);
  background: linear-gradient(
    135deg,
    rgba(26, 42, 108, 0.9),
    rgba(178, 31, 31, 0.9)
  );
  color: #ffffff;
}

/* Classe appliquée par le JS pour masquer en douceur la bannière d'auth */
.auth-required-banner.is-hidden {
  opacity: 0;
  pointer-events: none;
}
/* Styles pour les messages d'erreur - Fichier centralisé */
/* Bandeau démo pour utilisateurs non connectés */
.demo-banner {
  background: linear-gradient(135deg, #fff7ed 0%, #fffbeb 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #92400e;
  padding: 14px 16px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  margin: 12px auto 16px; /* centrer */
  max-width: 720px; /* éviter une largeur excessive */
}
.demo-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.demo-banner-text {
  font-size: 0.98rem;
  line-height: 1.6;
  text-align: left;
}
.demo-banner-actions {
  display: flex;
  gap: 8px;
}

/* Style principal pour tous les messages d'erreur */
.error-message {
  /* Style modernisé, lisible sur fond sombre comme clair */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;

  color: #1f2937; /* gris ardoise foncé */
  background: linear-gradient(
    135deg,
    rgba(248, 250, 252, 0.9) 0%,
    rgba(241, 245, 249, 0.7) 100%
  );
  border: 1px solid rgba(203, 213, 225, 0.7); /* slate-300 */
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 12px;
  font-weight: normal;
  font-style: normal;
  line-height: 1.6;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  text-align: center;
}

/* Contenu textuel principal dans le bloc d'erreur */
.error-message .message {
  flex: 1;
  text-align: left;
}

/* Zone d'actions optionnelle (boutons) si présente dans le markup */
.error-message .actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.error-message .auth-btn,
.error-message .btn {
  border: 0;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
}

.error-message .auth-btn.primary,
.error-message .btn.primary {
  background: #1a2a6c; /* bleu profond cohérent avec la bannière d'auth */
  color: #ffffff;
}

.error-message .auth-btn.secondary,
.error-message .btn.secondary {
  background: #e7ebff;
  color: #1a2a6c;
}

/* Variantes de messages d'erreur */
.error-message.auth-error {
  background: linear-gradient(
    135deg,
    rgba(239, 246, 255, 0.9) 0%,
    rgba(219, 234, 254, 0.7) 100%
  );
  border-color: rgba(59, 130, 246, 0.3);
  color: #1e40af;
}

.error-message.loading {
  background: linear-gradient(
    135deg,
    rgba(255, 251, 235, 0.9) 0%,
    rgba(254, 243, 199, 0.7) 100%
  );
  border-color: rgba(245, 158, 11, 0.3);
  color: #92400e;
}

/* Variante pour les messages d'authentification requise (affiche un cadenas) */
.error-message.auth-required::before {
  content: "🔒";
  font-size: 18px;
  margin-right: 4px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

/* Variante d'état d'erreur plus marquée */
.error-message.is-danger {
  background: linear-gradient(
    135deg,
    rgba(254, 242, 242, 0.9) 0%,
    rgba(252, 231, 243, 0.7) 100%
  );
  border-color: rgba(251, 113, 133, 0.35);
  color: #991b1b;
}

/* Messages spécifiques pour différents contextes */
.loading-message,
.empty-message,
.info-message {
  text-align: center;
  padding: 20px;
  border-radius: 8px;
  margin: 15px 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.loading-message {
  background: linear-gradient(
    135deg,
    rgba(255, 251, 235, 0.9) 0%,
    rgba(254, 243, 199, 0.7) 100%
  );
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #92400e;
}

.empty-message {
  background: linear-gradient(
    135deg,
    rgba(249, 250, 251, 0.9) 0%,
    rgba(243, 244, 246, 0.7) 100%
  );
  border: 1px solid rgba(156, 163, 175, 0.3);
  color: #6b7280;
  font-style: italic;
}

.info-message {
  background: linear-gradient(
    135deg,
    rgba(239, 246, 255, 0.9) 0%,
    rgba(219, 234, 254, 0.7) 100%
  );
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #1e40af;
}

/* Responsive: empiler le texte et les actions sur petits écrans */
@media (max-width: 480px) {
  .error-message {
    flex-direction: column;
    align-items: flex-start;
  }

  .error-message .actions {
    width: 100%;
    justify-content: flex-start;
  }
}
