.indicadores-summary {
  position: relative;
  overflow: hidden;
}

.indicadores-badge-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 400px;
  z-index: 1;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);

  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.03);
  padding: 8px 16px;
}

.indicadores-badge-center.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px) scale(0.8);
  pointer-events: none;
}

/* Animación más suave para expandir/colapsar */
.indicadores-details[open] .indicadores-badge-center {
  opacity: 0;
  transform: translateX(-50%) translateY(20px) scale(0.8);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animación suave para cuando se colapsa */
.indicadores-details:not([open]) .indicadores-badge-center {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  pointer-events: none;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s; /* Delay para que aparezca después del colapso */
}

.atencion-principal {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  transform: scale(1) translateY(0);
}

.atencion-sub {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* Animación suave para cuando se colapsa - los elementos del badge aparecen */
.indicadores-details:not([open]) .atencion-principal {
  animation: fadeFromBottom 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
}

.indicadores-details:not([open]) .atencion-sub {
  animation: fadeFromBottom 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.4s forwards;
}

.indicadores-content {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 0;
  overflow: hidden;
}

.indicadores-details[open] .indicadores-content {
  opacity: 1;
  transform: translateY(0);
  max-height: 2000px; /* Altura máxima generosa para el contenido */
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.indicadores-details:not([open]) .indicadores-content {
  opacity: 0;
  transform: translateY(-10px);
  max-height: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.indicadores-details[open] .atencion-principal {
  animation: fadeToBottom 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.indicadores-details[open] .atencion-sub {
  animation: fadeToBottom 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s forwards;
}

@keyframes fadeToBottom {
  0% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
}

@keyframes fadeFromBottom {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.containerIndicadores .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  align-items: start;
  justify-items: center;
}

@media (min-width: 1200px) {
  .containerIndicadores .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1400px) {
  .containerIndicadores .grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.indicadores-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  position: relative;
  min-height: 60px; /* Altura mínima para evitar saltos */
  width: 100%; /* Asegurar que ocupe todo el ancho */
}

.indicadores-title {
  flex: 0 0 auto; /* No crece ni se encoge */
  text-align: left;
  min-width: 200px; /* Ancho mínimo fijo */
  z-index: 3; /* Asegurar que esté sobre otros elementos */
}

.indicadores-badge-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 400px; /* Ancho máximo para evitar que se extienda demasiado */
  z-index: 1;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none; /* Evitar que interfiera con otros elementos */

  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.06),
    0 2px 8px rgba(0, 0, 0, 0.03);
  padding: 8px 16px;
  gap: 4px;
}

.indicadores-arrow {
  flex: 0 0 auto; /* No crece ni se encoge */
  text-align: right;
  min-width: 40px; /* Ancho mínimo fijo */
  margin-left: auto; /* Siempre al final */
  position: absolute; /* Cambio: posición absoluta */
  right: 16px; /* Fijo a la derecha */
  top: 50%;
  transform: translateY(-50%);
  z-index: 4; /* Asegurar que esté sobre todos los elementos */
  transition: transform 0.3s ease;
  pointer-events: all; /* Asegurar que sea clickeable */
}

.indicadores-details[open] .indicadores-arrow {
  transform: translateY(-50%) rotate(180deg); /* Mantener posición vertical */
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .indicadores-title {
    min-width: 150px;
  }

  .indicadores-badge-center {
    max-width: 300px;
    padding: 6px 12px; /* Ajustar padding en móvil */
    border-radius: 10px; /* Bordes más pequeños en móvil */
  }

  .indicadores-arrow {
    min-width: 30px;
    right: 12px; /* Ajustar posición en móvil */
  }

  .indicadores-summary {
    padding: 10px 12px;
  }
}
