/* ==== Secciones ==== */
.section-logos {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background-color: var(--bg-primary);
  padding: 3rem 0;
  transition: background-color 0.3s ease;
}

.section-logos.bg-alt {
  background-color: var(--bg-tertiary);
  transition: background-color 0.3s ease;
}

.section-logos h1,
.section-logos h3 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2rem;
  transition: color 0.3s ease;
}

/* ==== Carousel de Clientes y Alianzas ==== */
.clients-carousel-wrapper {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  position: relative;
  margin: 2rem auto;
  padding: 1rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
  /* Mostrar aproximadamente 3 logos a la vez con fade en los bordes */
  mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}

.clients-carousel {
  display: inline-flex;
  gap: 3rem;
  /* animation: slide 30s linear infinite; REMOVIDO - se aplica dinámicamente via JavaScript */
  will-change: transform;
  white-space: nowrap;
}

.clients-carousel:hover {
  animation-play-state: paused;
}

.carousel-logo-item {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  padding: 0 1rem;
  min-width: 150px;
}

/* Ajustar tamaño del contenedor para logos grandes de Clientes */
#clients .carousel-logo-item {
  min-width: 200px;
  padding: 0 1.5rem;
}

.client-logo {
  width: auto;
  object-fit: contain;
  transition: transform 0.3s ease;
  filter: none !important;
  opacity: 1 !important;
}

/* Logos grandes para Nuestros Clientes */
.client-logo-large {
  height: 140px !important;
  max-width: 320px !important;
  width: auto !important;
  object-fit: contain !important;
}

/* Logos pequeños para Alianzas Estratégicas */
.client-logo-small {
  height: 70px !important;
  max-width: 180px !important;
  width: auto !important;
}

/* Asegurar que los tamaños se apliquen en la sección de clientes */
#clients .client-logo-large,
#clients .carousel-logo-item img,
#clientsCarousel .carousel-logo-item img,
#clientsCarousel img {
  height: 140px !important;
  max-width: 320px !important;
  width: auto !important;
  object-fit: contain !important;
  display: block !important;
}

/* Asegurar que los tamaños se apliquen en la sección de alianzas */
#alianzas .client-logo-small {
  height: 70px !important;
  max-width: 180px !important;
  width: auto !important;
}

.client-logo:hover {
  transform: scale(1.1);
  opacity: 1 !important;
}

/* Sobrescribir estilos de style.css que afectan a #clients img */
#clients .client-logo,
#clients img.client-logo,
#clients img {
  opacity: 1 !important;
  filter: none !important;
}

/* Sobrescribir max-width: 100% de style.css para #clients img */
#clients .carousel-logo-item img,
#clients .client-logo-large,
#clientsCarousel img,
#clientsCarousel .client-logo {
  max-width: 320px !important;
  width: auto !important;
  height: 140px !important;
  object-fit: contain !important;
  display: block !important;
}

#alianzas .carousel-logo-item img,
#alianzas .client-logo-small {
  max-width: 180px !important;
  width: auto !important;
  height: 70px !important;
}

/* Animación que avanza gradualmente logo por logo con pausas */
/* Cada paso: 2s movimiento + 4s pausa = 6s por logo */
/* La animación acumula movimiento hasta llegar al 50% y reinicia */

@keyframes slideIncremental {
  0% {
    transform: translateX(0);
  }
  /* Logo 1 */
  16.66% {
    transform: translateX(calc(-1 * (200px + 1.5rem + 3rem)));
  }
  33.33% {
    transform: translateX(calc(-1 * (200px + 1.5rem + 3rem)));
  }
  /* Logo 2 */
  50% {
    transform: translateX(calc(-2 * (200px + 1.5rem + 3rem)));
  }
  66.66% {
    transform: translateX(calc(-2 * (200px + 1.5rem + 3rem)));
  }
  /* Logo 3 */
  83.33% {
    transform: translateX(calc(-3 * (200px + 1.5rem + 3rem)));
  }
  100% {
    transform: translateX(calc(-3 * (200px + 1.5rem + 3rem)));
  }
}

@keyframes slideIncrementalReverse {
  0% {
    transform: translateX(calc(-3 * (200px + 1.5rem + 3rem)));
  }
  16.66% {
    transform: translateX(calc(-2 * (200px + 1.5rem + 3rem)));
  }
  33.33% {
    transform: translateX(calc(-2 * (200px + 1.5rem + 3rem)));
  }
  50% {
    transform: translateX(calc(-1 * (200px + 1.5rem + 3rem)));
  }
  66.66% {
    transform: translateX(calc(-1 * (200px + 1.5rem + 3rem)));
  }
  83.33% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(0);
  }
}

/* Animación base - será sobrescrita por JavaScript */
#clientsCarousel {
  display: inline-flex !important;
  /* animation: slideIncremental 18s ease-in-out infinite !important; REMOVIDO - se aplica dinámicamente via JavaScript */
}

#alianzasCarousel {
  display: inline-flex !important;
  animation: slideIncrementalReverse 18s ease-in-out infinite !important;
}

/* ========== KPIs Section Styles ========== */
#kpis {
  padding: 40px 0;
  background-color: #f8f9fa;
}

#kpis .section-title {
  margin-bottom: 10px;
}

#kpis .section-description {
  margin-bottom: 30px;
  color: var(--text-secondary);
  font-size: 16px;
  transition: color 0.3s ease;
}

#kpis .row.mt-5 {
  margin-top: 2rem !important;
}

#kpis .mb-5 {
  margin-bottom: 2rem !important;
}

.kpi-card {
  background: var(--bg-primary);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 15px var(--shadow-dark);
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
}

.kpi-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px var(--shadow-medium);
  border-color: var(--turquoise-primary);
}

.kpi-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  text-align: center;
  transition: color 0.3s ease;
}

.kpi-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 15px;
  text-align: center;
  font-style: italic;
  transition: color 0.3s ease;
}

.chart-container {
  position: relative;
  height: 380px;
  width: 100%;
  margin: 10px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 380px;
}

.chart-container canvas {
  max-height: 280px;
  width: 100% !important;
  height: auto !important;
  flex-shrink: 0;
}

/* Contenedor de odómetros */
.odometer-container {
  display: flex;
  justify-content: space-around;
  width: 100%;
  margin-top: 15px;
  padding: 0 20px;
  flex-shrink: 0;
}

.odometer-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  max-width: 120px;
}

.odometer-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
}

.odometer-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Montserrat', sans-serif;
  transition: color 0.3s ease;
}

.odometer-value.animating {
  animation: numberRoll 2s ease-out;
}

.odometer-value[data-color="red"] {
  color: #dc3545;
}

.odometer-value[data-color="green"] {
  color: #28a745;
}

.odometer-unit {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 5px;
  font-weight: 500;
  transition: color 0.3s ease;
}

/* Animación de números que ruedan */
@keyframes numberRoll {
  0% {
    transform: translateY(20px);
    opacity: 0;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

.kpi-footer {
  margin-top: 15px;
  text-align: center;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  transition: border-color 0.3s ease;
}

.kpi-reduction {
  font-size: 16px;
  font-weight: 600;
  color: #28a745;
  display: inline-block;
}

/* Responsive adjustments para KPIs */
@media (max-width: 768px) {
  #kpis {
    padding: 40px 0;
  }

  .kpi-card {
    padding: 20px;
    margin-bottom: 30px;
  }

  .chart-container {
    height: 380px;
    min-height: 380px;
  }

  .chart-container canvas {
    max-height: 280px;
  }

  .odometer-value {
    font-size: 28px;
    min-height: 35px;
  }

  .odometer-label {
    font-size: 12px;
  }

  .odometer-unit {
    font-size: 11px;
  }

  .kpi-title {
    font-size: 18px;
  }
}

@media (max-width: 576px) {
  .chart-container {
    height: 350px;
    min-height: 350px;
  }

  .chart-container canvas {
    max-height: 250px;
  }

  .odometer-value {
    font-size: 24px;
    min-height: 30px;
  }

  .odometer-container {
    flex-direction: column;
    gap: 15px;
  }

  .odometer-wrapper {
    max-width: 100%;
  }
}

/* Responsive adjustments para carousel */
@media (max-width: 768px) {
  .clients-carousel {
    gap: 2rem;
  }
  
  .carousel-logo-item {
    min-width: 120px;
    padding: 0 0.5rem;
  }
  
  .client-logo-large {
    height: 120px !important;
    max-width: 280px !important;
    width: auto !important;
  }
  
  .client-logo-small {
    height: 50px !important;
    max-width: 130px !important;
    width: auto !important;
  }
  
  #clients .client-logo-large {
    height: 100px !important;
    max-width: 240px !important;
  }
  
  #alianzas .client-logo-small {
    height: 50px !important;
    max-width: 130px !important;
  }
}

/* ==== Logos (para otras secciones) ==== */
.logo-wrapper {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==== Espaciado entre columnas ==== */
.row>.col-md-2,
.row>.col-md-3,
.row>.col-md-4,
.row>.col-md-6 {
  padding: 10px;
}