/* Statistics Section Styles */
.statistics-section {
  padding: 5rem 0;
  background: linear-gradient(135deg, var(--white) 0%, var(--gray-50) 100%);
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
}

/* Patrón de fondo para la sección */
.statistics-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><circle cx="10" cy="10" r="1" fill="%23e5e7eb"/><circle cx="30" cy="10" r="1" fill="%23e5e7eb"/><circle cx="50" cy="10" r="1" fill="%23e5e7eb"/><circle cx="70" cy="10" r="1" fill="%23e5e7eb"/><circle cx="90" cy="10" r="1" fill="%23e5e7eb"/><circle cx="10" cy="30" r="1" fill="%23e5e7eb"/><circle cx="30" cy="30" r="1" fill="%23e5e7eb"/><circle cx="50" cy="30" r="1" fill="%23e5e7eb"/><circle cx="70" cy="30" r="1" fill="%23e5e7eb"/><circle cx="90" cy="30" r="1" fill="%23e5e7eb"/><circle cx="10" cy="50" r="1" fill="%23e5e7eb"/><circle cx="30" cy="50" r="1" fill="%23e5e7eb"/><circle cx="50" cy="50" r="1" fill="%23e5e7eb"/><circle cx="70" cy="50" r="1" fill="%23e5e7eb"/><circle cx="90" cy="50" r="1" fill="%23e5e7eb"/><circle cx="10" cy="70" r="1" fill="%23e5e7eb"/><circle cx="30" cy="70" r="1" fill="%23e5e7eb"/><circle cx="50" cy="70" r="1" fill="%23e5e7eb"/><circle cx="70" cy="70" r="1" fill="%23e5e7eb"/><circle cx="90" cy="70" r="1" fill="%23e5e7eb"/><circle cx="10" cy="90" r="1" fill="%23e5e7eb"/><circle cx="30" cy="90" r="1" fill="%23e5e7eb"/><circle cx="50" cy="90" r="1" fill="%23e5e7eb"/><circle cx="70" cy="90" r="1" fill="%23e5e7eb"/><circle cx="90" cy="90" r="1" fill="%23e5e7eb"/></svg>');
  opacity: 0.4;
  z-index: 1;
}

.statistics-section .container {
  position: relative;
  z-index: 2;
}

.statistics-section .section-header {
  margin-bottom: 4rem;
}

.statistics-section .section-header h2 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  margin-bottom: 1.5rem;
  position: relative;
  display: inline-block;
}

.statistics-section .section-header h2::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: var(--gradient-primary);
  border-radius: 2px;
}

.statistics-section .section-header p {
  font-size: 1.25rem;
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.8;
}

/* Grid de estadísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2.5rem;
  margin-bottom: 4rem;
}

/* Tarjetas de estadísticas */
.stat-card {
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: var(--border-radius-xl);
  box-shadow: var(--shadow-lg);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  height: 100%;
  min-height: 200px;
  transform-style: preserve-3d;
  perspective: 1000px;
}

.stat-card:hover {
  transform: translateY(-12px) rotateX(5deg);
  box-shadow: var(--shadow-xl), 0 30px 40px -20px rgba(0, 0, 0, 0.3);
}

/* Variantes de color para las tarjetas */
.stat-blue {
  background: linear-gradient(135deg, var(--info-color) 0%, var(--primary-color) 100%);
  color: var(--white);
}

.stat-yellow {
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--warning-color) 100%);
  color: var(--white);
}

.stat-green {
  background: linear-gradient(135deg, var(--success-color) 0%, var(--primary-color) 100%);
  color: var(--white);
}

.stat-purple {
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  color: var(--white);
}

.stat-orange {
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--danger-color) 100%);
  color: var(--white);
}

/* Patrón de fondo para las tarjetas */
.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60"><path d="M30 5L55 30L30 55L5 30L30 5Z" stroke="white" stroke-opacity="0.1" fill="none"/></svg>');
  background-size: 60px 60px;
  opacity: 0.2;
  z-index: 1;
}

/* Efecto de brillo al pasar el mouse */
.stat-card::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  opacity: 0;
  transform: rotate(30deg);
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 2;
}

.stat-card:hover::after {
  opacity: 1;
}

/* Contenido de la tarjeta */
.stat-content {
  display: flex;
  align-items: center;
  gap: 2rem;
  position: relative;
  z-index: 3;
  padding: 2.5rem;
  height: 100%;
}

/* Icono de la estadística */
.stat-icon {
  width: 90px;
  height: 90px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.75rem;
  flex-shrink: 0;
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.stat-card:hover .stat-icon {
  transform: scale(1.1) rotate(10deg);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

/* Efecto de onda en el icono */
.stat-icon::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
  transform: scale(0);
  border-radius: 50%;
  transition: transform 0.6s ease-out;
}

.stat-card:hover .stat-icon::before {
  transform: scale(2);
}

/* Información de la estadística */
.stat-info {
  flex: 1;
}

/* Número de la estadística */
.stat-number {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1;
  margin-bottom: 0.75rem;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  display: inline-block;
}

/* Animación de conteo para los números */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card.animate .stat-number {
  animation: countUp 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Etiqueta de la estadística */
.stat-label {
  font-size: 1.125rem;
  font-weight: 700;
  opacity: 0.95;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  position: relative;
  padding-bottom: 0.5rem;
}

.stat-label::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 3px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.stat-card:hover .stat-label::after {
  width: 60px;
}

/* Descripción adicional (opcional) */
.stat-description {
  margin-top: 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  opacity: 0.9;
  max-width: 90%;
}

/* Botón de acción (opcional) */
.stat-action {
  margin-top: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}

.stat-action:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateX(5px);
}

.stat-action i {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

.stat-action:hover i {
  transform: translateX(3px);
}

/* Insignia de tendencia (opcional) */
.trend-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  z-index: 4;
}

.trend-up {
  background: rgba(16, 185, 129, 0.2);
  color: #ecfdf5;
}

.trend-down {
  background: rgba(239, 68, 68, 0.2);
  color: #fef2f2;
}

/* Sección de estadísticas adicionales */
.additional-stats {
  margin-top: 4rem;
}

.stats-tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stats-tab {
  padding: 0.75rem 1.5rem;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--border-radius);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.3s ease;
}

.stats-tab:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.stats-tab.active {
  background: var(--gradient-primary);
  color: var(--white);
  border-color: transparent;
}

/* Gráficos de estadísticas */
.stats-chart {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2rem;
  margin-top: 2rem;
  height: 400px;
  position: relative;
  overflow: hidden;
}

.stats-chart::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: linear-gradient(0deg, var(--gray-50) 1px, transparent 1px),
    linear-gradient(90deg, var(--gray-50) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.5;
  z-index: 1;
}

.stats-chart-content {
  position: relative;
  z-index: 2;
  height: 100%;
}

/* Responsive */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }

  .stat-content {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }

  .stat-label::after {
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (max-width: 768px) {
  .statistics-section {
    padding: 4rem 0;
  }

  .stats-grid {
    gap: 2rem;
  }

  .stat-icon {
    width: 80px;
    height: 80px;
    font-size: 2.25rem;
  }

  .stat-number {
    font-size: clamp(2rem, 4vw, 3rem);
  }

  .stat-label {
    font-size: 1rem;
  }

  .stats-chart {
    height: 300px;
  }
}

@media (max-width: 480px) {
  .statistics-section {
    padding: 3rem 0;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: 180px;
  }

  .stat-icon {
    width: 70px;
    height: 70px;
    font-size: 2rem;
  }

  .stat-content {
    padding: 2rem;
  }

  .stats-tabs {
    flex-direction: column;
    align-items: center;
  }

  .stats-tab {
    width: 100%;
    text-align: center;
  }

  .stats-chart {
    height: 250px;
    padding: 1.5rem;
  }
}

/* Animaciones de entrada */
.statistics-section.in-view .stat-card {
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
}

.statistics-section.in-view .stat-card:nth-child(1) {
  animation-delay: 0.1s;
}

.statistics-section.in-view .stat-card:nth-child(2) {
  animation-delay: 0.3s;
}

.statistics-section.in-view .stat-card:nth-child(3) {
  animation-delay: 0.5s;
}

.statistics-section.in-view .stat-card:nth-child(4) {
  animation-delay: 0.7s;
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
  .statistics-section.in-view .stat-card,
  .stat-card:hover,
  .stat-card:hover .stat-icon,
  .stat-card:hover .stat-icon::before,
  .stat-card.animate .stat-number {
    animation: none;
    transition: none;
    transform: none;
  }
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
  .statistics-section {
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
  }

  .statistics-section::before {
    opacity: 0.1;
  }

  .stats-chart {
    background: var(--gray-800);
  }

  .stats-chart::before {
    background-image: linear-gradient(0deg, var(--gray-700) 1px, transparent 1px),
      linear-gradient(90deg, var(--gray-700) 1px, transparent 1px);
  }

  .stats-tab {
    background: var(--gray-800);
    border-color: var(--gray-700);
    color: var(--gray-300);
  }

  .stats-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
  }
}
