/* =========================================================
   Animations communes de l'intranet (tous les espaces + site public)
   — pilotées par assets/js/animations.js via des attributs data-*.
   Règle : des animations courtes, aux couleurs de la ligue, réservées
   aux moments qui comptent ; toutes désactivées si l'appareil réduit
   les animations.
   ========================================================= */

/* ---------- Coche qui se dessine (messages de succès) ---------- */
.anim-coche { display: inline-flex; vertical-align: -4px; margin-right: 8px; flex-shrink: 0; }
.anim-coche circle { fill: none; stroke: currentColor; stroke-width: 2.4; opacity: 0.45; stroke-dasharray: 64; stroke-dashoffset: 64; transform: rotate(-90deg); transform-origin: 50% 50%; animation: anim-trace 0.5s ease-out 0.05s forwards; }
.anim-coche polyline { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 20; stroke-dashoffset: 20; animation: anim-trace 0.35s ease-out 0.45s forwards; }
.flash.success.anim-flash { animation: anim-flash-entree 0.45s cubic-bezier(0.2, 0.8, 0.3, 1.2) both; }
@keyframes anim-trace { to { stroke-dashoffset: 0; } }
@keyframes anim-flash-entree { from { opacity: 0; transform: translateY(-8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---------- Compteurs qui montent ---------- */
[data-compteur] { font-variant-numeric: tabular-nums; }

/* ---------- Compte à rebours ---------- */
.compte-a-rebours { display: inline-flex; gap: 10px; align-items: flex-end; }
.compte-a-rebours .car-bloc { display: flex; flex-direction: column; align-items: center; min-width: 3.1em; padding: 8px 6px 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.compte-a-rebours .car-nombre { font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.compte-a-rebours .car-unite { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-top: 4px; }
.compte-a-rebours .car-nombre.anim-tic { animation: anim-tic 0.35s ease-out; }
@keyframes anim-tic { 0% { transform: translateY(-5px); opacity: 0.4; } 100% { transform: none; opacity: 1; } }

/* Bandeau d'accueil du site public : prochain rendez-vous */
.prochain-rdv {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; margin-top: 22px;
  padding: 16px 20px; background: var(--card-bg); border: 1px solid var(--border);
  border-left: 4px solid var(--gold); border-radius: var(--radius);
}
.prochain-rdv-texte { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prochain-rdv-surtitre { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); font-weight: 700; }
.prochain-rdv-nom { font-family: var(--font-display); font-size: 1.3rem; color: var(--text-main); text-decoration: none; }
.prochain-rdv-nom:hover { color: var(--gold); text-decoration: none; }
.prochain-rdv-date { font-size: 0.85rem; color: var(--text-muted); }
.prochain-rdv-compteur { margin-left: auto; font-family: var(--font-display); font-size: 1.3rem; color: var(--gold); }
@media (max-width: 600px) { .prochain-rdv-compteur { margin-left: 0; } .compte-a-rebours .car-bloc { min-width: 2.6em; } .compte-a-rebours .car-nombre { font-size: 1.5rem; } }

/* ---------- Barre qui se charge (opérations longues) ---------- */
.anim-chargement {
  position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: rgba(10, 12, 16, 0.82); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.25s ease;
}
.anim-chargement.visible { opacity: 1; }
.anim-chargement svg { width: min(420px, 80vw); height: auto; }
.anim-chargement .ac-texte { font-family: var(--font-display); font-size: 1.25rem; color: #eef0f2; letter-spacing: 0.02em; }
.anim-chargement .ac-sous { font-size: 0.85rem; color: #98a1ab; margin-top: -12px; }
.anim-chargement .ac-disque { opacity: 0.12; animation: anim-disque 2.6s ease-in-out infinite; }
.anim-chargement .ac-disque:nth-of-type(2) { animation-delay: 0.3s; }
.anim-chargement .ac-disque:nth-of-type(3) { animation-delay: 0.6s; }
.anim-chargement .ac-disque:nth-of-type(4) { animation-delay: 0.9s; }
.anim-chargement .ac-disque:nth-of-type(5) { animation-delay: 1.2s; }
.anim-chargement .ac-disque:nth-of-type(6) { animation-delay: 1.5s; }
@keyframes anim-disque { 0%, 10% { opacity: 0.12; } 30%, 80% { opacity: 1; } 100% { opacity: 0.12; } }

/* ---------- Confettis ---------- */
.anim-confetti {
  position: fixed; top: -14px; width: 9px; height: 14px; border-radius: 2px; z-index: 210;
  pointer-events: none; animation-name: anim-chute; animation-timing-function: linear; animation-fill-mode: both;
}
@keyframes anim-chute {
  from { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 1; }
  to { transform: translate3d(var(--dx), 110vh, 0) rotate(var(--rot)); opacity: 0.85; }
}

/* ---------- Célébration (record, qualification, accession, titre) ---------- */
.anim-celebration {
  position: fixed; inset: 0; z-index: 205; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(10, 12, 16, 0.78); backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.3s ease; cursor: pointer;
}
.anim-celebration.visible { opacity: 1; }
.anim-celebration .acl-carte {
  max-width: 520px; width: 100%; text-align: center; background: var(--card-bg); border: 1px solid var(--border);
  border-top: 5px solid rgb(var(--acl-couleur, 201, 162, 39)); border-radius: 18px; padding: 34px 30px 28px; cursor: default;
  animation: anim-tampon 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.25) 0.1s both;
}
.anim-celebration .acl-icone {
  width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(var(--acl-couleur, 201, 162, 39), 0.16); color: rgb(var(--acl-couleur, 201, 162, 39));
  animation: anim-onde 1.6s ease-out 0.7s 1;
}
.anim-celebration .acl-icone img { width: 100%; height: 100%; object-fit: contain; }
.anim-celebration .acl-surtitre { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: rgb(var(--acl-couleur, 201, 162, 39)); margin: 0 0 6px; font-weight: 700; }
.anim-celebration .acl-titre { font-family: var(--font-display); font-size: 2rem; line-height: 1.15; margin: 0 0 10px; color: var(--text-main); }
.anim-celebration .acl-texte { color: var(--text-muted); line-height: 1.55; margin: 0 0 22px; }
.anim-celebration .acl-fermer { background: none; border: 1px solid var(--border); color: var(--text-main); border-radius: var(--radius); padding: 9px 22px; cursor: pointer; font: inherit; }
.anim-celebration .acl-fermer:hover { border-color: var(--steel); }
@keyframes anim-tampon {
  0% { opacity: 0; transform: scale(1.8) rotate(-8deg); }
  60% { opacity: 1; transform: scale(0.96) rotate(1deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes anim-onde {
  0% { box-shadow: 0 0 0 0 rgba(var(--acl-couleur, 201, 162, 39), 0.55); }
  100% { box-shadow: 0 0 0 30px rgba(var(--acl-couleur, 201, 162, 39), 0); }
}

/* ---------- Brillance d'une ligne mise en avant (record récent…) ---------- */
.anim-brille {
  background-image: linear-gradient(100deg, transparent 20%, rgba(201, 162, 39, 0.22) 50%, transparent 80%);
  background-size: 250% 100%; animation: anim-balayage 3.2s ease-in-out infinite;
}
@keyframes anim-balayage { from { background-position: 150% 0; } to { background-position: -100% 0; } }

/* Badge « Nouveau » d'un record récent (site public) */
.badge-nouveau-record {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; vertical-align: 1px;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--gold); color: #14171c; animation: anim-pulse-or 2s ease-in-out infinite;
}
@keyframes anim-pulse-or { 0%, 100% { box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.5); } 50% { box-shadow: 0 0 0 6px rgba(201, 162, 39, 0); } }

/* Badge de qualification nationale : s'allume à l'affichage (3 pulsations dorées + reflet) */
.badge-qualifie { position: relative; overflow: hidden; animation: anim-pulse-or 1.6s ease-in-out 0.4s 3; }
.badge-qualifie::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  animation: anim-reflet-badge 1s ease-in-out 0.6s both;
}
@keyframes anim-reflet-badge { from { left: -60%; } to { left: 130%; } }

/* Classement public : lignes qui entrent en cascade, podium qui s'illumine, flèches d'évolution */
.classement-anime tbody tr { animation: anim-ligne 0.5s ease-out both; animation-delay: calc(var(--i, 0) * 0.06s); }
@keyframes anim-ligne { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.classement-anime .rank-badge.r1, .classement-anime .rank-badge.r2, .classement-anime .rank-badge.r3 { animation: anim-podium 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.4) both; animation-delay: calc(var(--i, 0) * 0.06s + 0.35s); }
.classement-anime .rank-badge.r1 { box-shadow: 0 0 14px 2px rgba(201, 162, 39, 0.55); }
@keyframes anim-podium { from { transform: scale(0.3); } to { transform: scale(1); } }
.evolution { display: inline-block; margin-left: 6px; font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.evolution.monte { color: var(--green); }
.evolution.descend { color: var(--red); }
.evolution.stable { color: var(--text-muted); }

/* Bandeau des titres et accessions d'un club (étoile qui tourne, reflet doré) */
.distinctions-club { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.distinction {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(201, 162, 39, 0.16), rgba(201, 162, 39, 0.04) 60%, rgba(201, 162, 39, 0.16));
  background-size: 250% 100%; border: 1px solid rgba(201, 162, 39, 0.5); animation: anim-balayage 4s ease-in-out infinite;
}
.distinction-accession { border-color: rgba(47, 109, 179, 0.6); background-image: linear-gradient(100deg, rgba(47, 109, 179, 0.18), rgba(47, 109, 179, 0.04) 60%, rgba(47, 109, 179, 0.18)); }
.distinction-icone { display: flex; color: var(--gold); flex-shrink: 0; animation: anim-etoile 1s cubic-bezier(0.2, 0.9, 0.3, 1.4) 0.2s both; }
.distinction-accession .distinction-icone { color: #5b93d6; }
.distinction-texte { display: flex; flex-direction: column; gap: 2px; }
.distinction-texte strong { font-family: var(--font-display); font-size: 1.2rem; color: var(--text-main); }
.distinction-texte span { font-size: 0.85rem; color: var(--text-muted); }
@keyframes anim-etoile { from { transform: scale(0) rotate(-180deg); } to { transform: scale(1) rotate(0); } }

/* ---------- Mouvement réduit : tout est affiché directement ---------- */
@media (prefers-reduced-motion: reduce) {
  .anim-coche circle, .anim-coche polyline { animation: none; stroke-dashoffset: 0; }
  .flash.success.anim-flash, .anim-celebration .acl-carte, .anim-celebration .acl-icone,
  .compte-a-rebours .car-nombre.anim-tic, .anim-chargement .ac-disque, .anim-brille,
  .badge-nouveau-record, .badge-qualifie, .distinction, .distinction-icone, .badge-qualifie::after, .classement-anime tbody tr, .classement-anime .rank-badge { animation: none; }
  .anim-chargement .ac-disque { opacity: 1; }
}
