/**
 * Stats Section - Animated Counters & Enhanced Design
 * Contadores animados con efectos visuales premium
 * Versión: 2.0
 */

/* ========================================
   STATS SECTION MEJORADA
   ======================================== */

.stats-section {
  background: linear-gradient(135deg,
    rgba(212, 175, 55, 0.05) 0%,
    rgba(248, 249, 250, 1) 50%,
    rgba(212, 175, 55, 0.05) 100%);
  position: relative;
  overflow: hidden;
}

/* Patrón decorativo de fondo */
.stats-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(212, 175, 55, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(212, 175, 55, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}

.stats-section .container {
  position: relative;
  z-index: 2;
}

/* ========================================
   STAT CARDS MEJORADAS
   ======================================== */

.stat-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all 0.4s var(--ease-in-out-smooth);
  border: 1px solid rgba(212, 175, 55, 0.1);
  box-shadow: var(--shadow-sm);
}

/* Brillo de fondo sutil */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--piano-gold-gradient);
  transform: scaleX(0);
  transition: transform 0.6s var(--ease-in-out-smooth);
}

.stat-card:hover::before {
  transform: scaleX(1);
}

/* Efecto hover */
.stat-card:hover {
  transform: translateY(-10px);
  box-shadow:
    var(--shadow-gold-md),
    0 0 30px rgba(212, 175, 55, 0.15);
  border-color: var(--piano-gold);
  background: rgba(255, 255, 255, 1);
}

/* ========================================
   STAT NUMBER (CONTADOR)
   ======================================== */

.stat-number {
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 900;
  line-height: 1;
  margin-bottom: 0.75rem;
  background: var(--piano-gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  display: inline-block;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* Glow effect detrás del número */
.stat-number::after {
  content: attr(data-target);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: -1;
  background: var(--piano-gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: blur(20px);
  opacity: 0.4;
  animation: pulse 3s ease-in-out infinite;
}

/* Ícono decorativo */
.stat-card .stat-icon {
  font-size: 2.5rem;
  color: var(--piano-gold);
  margin-bottom: 1rem;
  filter: drop-shadow(0 5px 15px rgba(212, 175, 55, 0.3));
  transition: transform 0.4s var(--ease-in-out-smooth);
}

.stat-card:hover .stat-icon {
  transform: scale(1.15) rotate(10deg);
}

/* ========================================
   STAT LABEL
   ======================================== */

.stat-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--piano-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.stat-card:hover .stat-label {
  opacity: 1;
}

/* ========================================
   ANIMACIÓN DE CONTEO
   ======================================== */

/* Estado inicial antes de animar */
.stat-number[data-target]::before {
  content: '0';
}

/* Cuando está animando */
.stat-number.counting {
  animation: numberPulse 0.6s ease;
}

@keyframes numberPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* ========================================
   VARIANTES DE COLORES
   ======================================== */

.stat-card.stat-primary .stat-number {
  background: linear-gradient(135deg, #d4af37, #f4d03f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card.stat-success .stat-number {
  background: linear-gradient(135deg, #28a745, #5cb85c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card.stat-info .stat-number {
  background: linear-gradient(135deg, #17a2b8, #5bc0de);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card.stat-warning .stat-number {
  background: linear-gradient(135deg, #ffc107, #ffeb3b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========================================
   LOADING STATE
   ======================================== */

.stat-number.loading {
  opacity: 0.5;
  animation: shimmer 2s linear infinite;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 767.98px) {
  .stat-card {
    padding: 1.5rem 1rem;
  }

  .stat-number {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }

  .stat-label {
    font-size: 0.85rem;
  }

  .stat-card .stat-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
  }
}

@media (max-width: 575.98px) {
  .stat-card {
    padding: 1.25rem 0.75rem;
  }

  .stat-number {
    font-size: 1.75rem;
  }

  .stat-label {
    font-size: 0.75rem;
    letter-spacing: 0.5px;
  }
}

/* ========================================
   ANIMACIÓN DE ENTRADA
   ======================================== */

.stat-card {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.6s ease forwards;
}

.stat-card:nth-child(1) {
  animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
  animation-delay: 0.2s;
}

.stat-card:nth-child(3) {
  animation-delay: 0.3s;
}

.stat-card:nth-child(4) {
  animation-delay: 0.4s;
}

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

/* ========================================
   SUFFIX/PREFIX STYLING
   ======================================== */

/* Para números con sufijos como "+" o "%" */
.stat-number .suffix {
  font-size: 0.6em;
  opacity: 0.8;
  margin-left: 0.1em;
}

.stat-number .prefix {
  font-size: 0.6em;
  opacity: 0.8;
  margin-right: 0.1em;
}

/* ========================================
   PARTÍCULAS DECORATIVAS (OPCIONAL)
   ======================================== */

.stat-card::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  background: radial-gradient(
    circle,
    rgba(212, 175, 55, 0.1) 0%,
    transparent 70%
  );
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.stat-card:hover::after {
  opacity: 1;
}
