/* ===============================
   Motion Design Hero - PeopleMetrics
   Animation CSS pure ultra-performante
   =============================== */

/* ========== Container du Motion Design ========== */
.hero-motion {
  position: relative;
  width: 100%;
  height: 500px;
  background: var(--gradient-hero);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--elevation-3);
}

/* ========== Background animé avec dégradé ========== */
.hero-motion::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(124, 58, 237, 0.05) 0%,
    rgba(30, 64, 175, 0.08) 25%,
    rgba(124, 58, 237, 0.05) 50%,
    rgba(30, 64, 175, 0.08) 75%,
    rgba(124, 58, 237, 0.05) 100%
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  z-index: 1;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ========== Particules - Représentent les personnes/données ========== */
.motion-particle {
  position: absolute;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
  z-index: 2;
  opacity: 0.7;
}

/* Différentes tailles de particules */
.motion-particle--large {
  width: 80px;
  height: 80px;
  animation: float 8s ease-in-out infinite;
}

.motion-particle--medium {
  width: 50px;
  height: 50px;
  animation: float 6s ease-in-out infinite;
}

.motion-particle--small {
  width: 30px;
  height: 30px;
  animation: float 4s ease-in-out infinite;
}

/* Animation de flottement */
@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.7;
  }
  25% {
    transform: translate(15px, -20px) scale(1.1);
    opacity: 0.9;
  }
  50% {
    transform: translate(-10px, -40px) scale(1);
    opacity: 0.7;
  }
  75% {
    transform: translate(-20px, -20px) scale(0.9);
    opacity: 0.8;
  }
}

/* Positions des particules */
.particle-1 { top: 15%; left: 18%; animation-delay: 0s; }
.particle-2 { top: 28%; left: 55%; animation-delay: 1s; }
.particle-3 { top: 58%; left: 28%; animation-delay: 2s; }
.particle-4 { top: 22%; left: 72%; animation-delay: 1.5s; }
.particle-5 { top: 68%; left: 65%; animation-delay: 0.5s; }
.particle-6 { top: 42%; left: 38%; animation-delay: 2.5s; }
.particle-7 { top: 75%; left: 48%; animation-delay: 1.2s; }
.particle-8 { top: 18%; left: 38%; animation-delay: 3s; }

/* ========== Lignes de connexion - Représentent les métriques ========== */
.motion-line {
  position: absolute;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--primary-color),
    transparent
  );
  transform-origin: left center;
  animation: drawLine 4s ease-in-out infinite;
  z-index: 1;
  opacity: 0.5;
}

@keyframes drawLine {
  0%, 100% {
    width: 0%;
    opacity: 0;
  }
  50% {
    width: 100%;
    opacity: 0.6;
  }
}

.line-1 {
  top: 15%;
  left: 18%;
  width: 40%;
  animation-delay: 0s;
  transform: rotate(15deg);
}

.line-2 {
  top: 35%;
  left: 50%;
  width: 30%;
  animation-delay: 1s;
  transform: rotate(-20deg);
}

.line-3 {
  top: 65%;
  left: 20%;
  width: 45%;
  animation-delay: 2s;
  transform: rotate(25deg);
}

.line-4 {
  top: 75%;
  left: 45%;
  width: 35%;
  animation-delay: 1.5s;
  transform: rotate(-15deg);
}

/* ========== Graphique animé SVG - Courbe de données ========== */
.motion-graph {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 200px;
  z-index: 2;
  opacity: 0.2;
}

.motion-graph svg {
  width: 100%;
  height: 100%;
}

.graph-line {
  fill: none;
  stroke: var(--primary-color);
  stroke-width: 3;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawGraph 8s ease-in-out infinite;
}

@keyframes drawGraph {
  0%, 100% {
    stroke-dashoffset: 1000;
    opacity: 0;
  }
  20%, 80% {
    stroke-dashoffset: 0;
    opacity: 0.3;
  }
}

.graph-fill {
  fill: url(#graphGradient);
  opacity: 0.1;
}

/* ========== Cercles pulsants - Accent visuel ========== */
.motion-pulse {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
  z-index: 1;
  animation: pulse 3s ease-out infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.pulse-1 {
  top: 20%;
  left: 60%;
  width: 100px;
  height: 100px;
  animation-delay: 0s;
}

.pulse-2 {
  top: 60%;
  left: 25%;
  width: 120px;
  height: 120px;
  animation-delay: 1.5s;
}

.pulse-3 {
  top: 70%;
  left: 70%;
  width: 90px;
  height: 90px;
  animation-delay: 3s;
}

/* ========== Cards métriques flottantes ========== */
.motion-card {
  position: absolute;
  background: var(--glass-premium);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md);
  box-shadow: var(--elevation-2);
  z-index: 3;
  animation: floatCard 6s ease-in-out infinite;
}

@keyframes floatCard {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-15px) rotate(2deg);
  }
}

@keyframes floatCardCentered {
  0%, 100% {
    transform: translateX(-50%) translateY(0) rotate(0deg);
  }
  50% {
    transform: translateX(-50%) translateY(-15px) rotate(2deg);
  }
}

.motion-card__value {
  font-size: var(--font-h3);
  font-weight: var(--font-weight-black);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.motion-card__label {
  font-size: var(--font-tiny);
  color: var(--text-color-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-xs);
}

.card-1 {
  top: 15%;
  left: 8%;
  animation-delay: 0s;
}

.card-2 {
  top: 45%;
  right: 10%;
  animation-delay: 1.5s;
}

.card-3 {
  bottom: 20%;
  left: 50%;
  animation: floatCardCentered 6s ease-in-out infinite;
  animation-delay: 0.5s;
}

/* ========== Badge "Analytics" central ========== */
.motion-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.7)
  );
  backdrop-filter: blur(20px);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-lg) var(--space-2xl);
  box-shadow: var(--elevation-4), var(--shadow-glow);
  z-index: 4;
  animation: pulseBadge 4s ease-in-out infinite;
}

@keyframes pulseBadge {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: var(--elevation-4), var(--shadow-glow);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: var(--elevation-5), 0 0 40px rgba(124, 58, 237, 0.6);
  }
}

.motion-badge__icon {
  font-size: var(--font-display);
  background: var(--gradient-luxury);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  text-align: center;
}

.motion-badge__text {
  font-size: var(--font-h4);
  font-weight: var(--font-weight-bold);
  color: var(--text-color);
  text-align: center;
  margin-top: var(--space-sm);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .hero-motion {
    height: 350px;
    display: block !important; /* Force l'affichage sur mobile */
  }

  .motion-particle--large {
    width: 50px;
    height: 50px;
  }

  .motion-particle--medium {
    width: 35px;
    height: 35px;
  }

  .motion-particle--small {
    width: 20px;
    height: 20px;
  }

  .motion-card {
    padding: var(--space-xs) var(--space-sm);
    display: block; /* Affiche les cards sur mobile */
  }

  .motion-card__value {
    font-size: var(--font-h4);
  }

  .motion-card__label {
    font-size: 0.625rem;
  }

  /* Ajustement des positions des cards sur mobile */
  .card-1 {
    top: 12%;
    left: 5%;
  }

  .card-2 {
    top: 45%;
    right: 5%;
  }

  .card-3 {
    bottom: 12%;
    left: 50%;
    animation: floatCardCentered 6s ease-in-out infinite;
  }
}

/* ===== Responsive (Très petits mobiles) ===== */
@media (max-width: 480px) {
  .hero-motion {
    height: 300px;
  }

  .motion-particle--large {
    width: 40px;
    height: 40px;
  }

  .motion-particle--medium {
    width: 28px;
    height: 28px;
  }

  .motion-particle--small {
    width: 16px;
    height: 16px;
  }

  .motion-card {
    padding: 4px 8px;
  }

  .motion-card__value {
    font-size: 1.25rem;
  }

  .motion-card__label {
    font-size: 0.5rem;
  }

  /* Masquer la 3ème card sur très petits écrans pour éviter la surcharge */
  .card-3 {
    display: none;
  }

  /* Ajuster les positions des 2 cards restantes */
  .card-1 {
    top: 15%;
    left: 4%;
  }

  .card-2 {
    top: 50%;
    right: 4%;
  }
}

/* ========== Performance optimizations ========== */
.hero-motion,
.motion-particle,
.motion-line,
.motion-pulse,
.motion-card,
.motion-badge {
  will-change: transform, opacity;
}

/* Désactiver les animations si l'utilisateur préfère */
@media (prefers-reduced-motion: reduce) {
  .hero-motion *,
  .hero-motion::before {
    animation: none !important;
    transition: none !important;
  }
}
