/* ════════════════════════════════════════════════════════════════════════════
   CAGOR DATA — Système d'animations
   Entrées fluides · Compteurs · Pulses · Hover · Scroll-reveal
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Respect de la préférence accessibilité ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Keyframes ─────────────────────────────────────────────────────────────── */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-7px); }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%       { transform: translateY(-12px) rotate(3deg); }
}

/* Pulse pour les points de statut actif */
@keyframes pulseGreen {
  0%   { box-shadow: 0 0 0 0 rgba(46,125,50,0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(46,125,50,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,125,50,0); }
}

@keyframes pulseAmber {
  0%   { box-shadow: 0 0 0 0 rgba(255,143,0,0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(255,143,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,143,0,0); }
}

/* Halo brillant sur les KPI en live */
@keyframes glowUpdate {
  0%   { box-shadow: 0 0 0 0 rgba(46,125,50,0); }
  30%  { box-shadow: 0 0 16px 4px rgba(46,125,50,0.28); }
  100% { box-shadow: 0 0 0 0 rgba(46,125,50,0); }
}

/* Skeleton loader */
@keyframes skeleton {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

/* Gradient animé (hero banner) */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Rotation douce pour icônes refresh */
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Ondulation chaleur pour températures élevées */
@keyframes heatShimmer {
  0%, 100% { text-shadow: 0 0 0px rgba(198,40,40,0); }
  50%       { text-shadow: 0 0 14px rgba(198,40,40,0.45); }
}

/* Slide in depuis la gauche (bandeau) */
@keyframes slideInBanner {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Rebond subtil au chargement des cartes */
@keyframes bounceIn {
  0%   { opacity: 0; transform: scale(0.85) translateY(16px); }
  60%  { opacity: 1; transform: scale(1.03) translateY(-4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Clignotement doux des données en cours de chargement */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Progression barre agroclimatique */
@keyframes growWidth {
  from { width: 0; }
  to   { width: var(--target-w, 100%); }
}

/* Particule flottante */
@keyframes particle {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0.7; }
  100% { transform: translateY(-100vh) translateX(30px) rotate(360deg); opacity: 0; }
}

/* ── Classes utilitaires ────────────────────────────────────────────────────── */

/* Scroll-reveal : état initial */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s cubic-bezier(0.22,1,0.36,1),
              transform 0.55s cubic-bezier(0.22,1,0.36,1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays pour grilles */
.reveal:nth-child(1)  { transition-delay: 0.04s; }
.reveal:nth-child(2)  { transition-delay: 0.09s; }
.reveal:nth-child(3)  { transition-delay: 0.14s; }
.reveal:nth-child(4)  { transition-delay: 0.19s; }
.reveal:nth-child(5)  { transition-delay: 0.24s; }
.reveal:nth-child(6)  { transition-delay: 0.29s; }
.reveal:nth-child(7)  { transition-delay: 0.34s; }
.reveal:nth-child(8)  { transition-delay: 0.39s; }
.reveal:nth-child(9)  { transition-delay: 0.44s; }
.reveal:nth-child(10) { transition-delay: 0.49s; }

/* Skeleton loader générique */
.skeleton {
  background: linear-gradient(90deg, #e8e8e8 25%, #f5f5f5 50%, #e8e8e8 75%);
  background-size: 600px 100%;
  animation: skeleton 1.4s infinite linear;
  border-radius: 4px;
  color: transparent !important;
}

/* Indicateur de statut actif avec pulse */
.status-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #9E9E9E;
  margin-right: 5px;
  vertical-align: middle;
}
.status-dot.active {
  background: #2E7D32;
  animation: pulseGreen 2s infinite;
}
.status-dot.warning {
  background: #FF8F00;
  animation: pulseAmber 2s infinite;
}

/* Float pour les icônes de section */
.icon-float {
  display: inline-block;
  animation: float 3.5s ease-in-out infinite;
}

/* Halo update sur KPI mis à jour */
.kpi-card.updated {
  animation: glowUpdate 1.5s ease-out forwards;
}

/* Couleurs température — statiques, pas d'animation infinie */
.temp-hot    { color: #c62828 !important; }
.temp-warm   { color: #E65100 !important; }
.temp-normal { color: #2E7D32 !important; }
.temp-cool   { color: #1565C0 !important; }

/* Bandeau update animé */
.update-banner {
  animation: slideInBanner 0.5s ease-out;
}

/* Hover amélioré sur les cartes */
.kpi-card,
.nav-card,
.province-card,
.station-card {
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1),
              box-shadow 0.22s ease;
}
.kpi-card:hover,
.nav-card:hover {
  transform: translateY(-5px) scale(1.015);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}

/* Barre de progression agroclimatique */
.progress-bar-anim {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #2E7D32, #4CAF50);
  animation: growWidth 1.2s cubic-bezier(0.22,1,0.36,1) forwards;
  width: 0;
}

/* Logo flottant dans le header */
.header-logo img {
  transition: transform 0.3s ease, filter 0.3s ease;
}
.header-logo img:hover {
  transform: scale(1.08) rotate(-2deg);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

/* Nav links : underline animé */
.header-nav a:not(.btn-retour)::after {
  content: '';
  display: block;
  height: 2px;
  width: 0;
  background: white;
  transition: width 0.25s ease;
  border-radius: 2px;
}
.header-nav a:not(.btn-retour):hover::after,
.header-nav a.active::after {
  width: 100%;
}

/* Particules décoratives (optionnelles) */
.particle {
  position: fixed;
  bottom: -20px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(46,125,50,0.15);
  pointer-events: none;
  animation: particle linear infinite;
}

/* Animation d'entrée pour les sections */
.section-card,
.section-block {
  animation: fadeInUp 0.6s cubic-bezier(0.22,1,0.36,1) both;
}

/* Compteur de KPI */
.kpi-value[data-count],
.kpi-val[data-count] {
  transition: color 0.3s;
}

/* ── Animations page-titre ──────────────────────────────────────────────────── */
.page-title {
  animation: fadeInLeft 0.6s cubic-bezier(0.22,1,0.36,1) both;
}
.page-subtitle {
  animation: fadeInLeft 0.6s 0.1s cubic-bezier(0.22,1,0.36,1) both;
}

/* ── Bandeau taux de change (index) ──────────────────────────────────────────── */
#tauxBandeauSection {
  animation: scaleIn 0.7s cubic-bezier(0.22,1,0.36,1) both;
}

/* ── Graphiques : entrée ──────────────────────────────────────────────────────── */
.chart-wrapper,
.chart-box,
.chart-box-wide {
  animation: fadeInUp 0.65s 0.1s cubic-bezier(0.22,1,0.36,1) both;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .reveal { transition-delay: 0s !important; }
}

