/* CSS optimizado para el nuevo sistema de testimonios */
.testimonios-grid {
  display: grid;
  grid-template-columns: 2fr 1fr; /* 2 columnas: principal más ancha, segunda más estrecha */
  grid-template-rows: 1fr 1fr; /* 2 filas para la segunda columna */
  gap: 2rem;
  align-items: stretch;
  min-height: 400px;
}

/* TESTIMONIO PRINCIPAL - Siempre blanco, contenido dinámico */
.testimonio-card-principal {
  grid-column: 1; /* Primera columna completa */
  grid-row: 1 / -1; /* Ocupa toda la altura (ambas filas) */
  position: relative;
}

.testimonio-card-principal > div {
  background: white !important;
  border-radius: 1.5rem;
  padding: 2rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 2px solid transparent;
  box-shadow: 0 15px 35px rgba(0,0,0,0.1);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.testimonio-card-principal:hover > div {
  transform: translateY(-8px) rotateX(5deg) rotateY(2deg);
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(216, 217, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* PREVIEW DEL SIGUIENTE TESTIMONIO */
.testimonio-preview {
  grid-column: 2; /* Segunda columna */
  grid-row: 1; /* Primera fila */
}

.testimonio-preview > div {
  background: #D8D900 !important; /* Fondo amarillo fijo, sin gradiente */
  border-radius: 1.5rem;
  padding: 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: none !important;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: all 0.2s ease;
}

.testimonio-preview:hover > div {
  transform: translateY(-8px) rotateX(-3deg) rotateY(-2deg);
  box-shadow: 
    0 20px 40px rgba(216, 217, 0, 0.2),
    0 0 0 1px rgba(216, 217, 0, 0.2);
}

/* STATS CARD */
.stats-card {
  grid-column: 2; /* Segunda columna */
  grid-row: 2; /* Segunda fila */
}

.stats-card > div {
  background: linear-gradient(135deg, #374151, #1f2937) !important;
  border-radius: 1rem;
  padding: 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  border: none !important;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.stats-card:hover > div {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 
    0 25px 50px rgba(6, 20, 0, 0.3),
    0 0 0 1px rgba(216, 217, 0, 0.3);
}

/* TEXTOS LEGIBLES Y BIEN CONTRASTADOS */
.testimonio-card-principal h3,
.testimonio-card-principal p,
.testimonio-card-principal div {
  color: #1f2937 !important;
}

.testimonio-card-principal .text-xl,
.testimonio-card-principal .testimonio-texto {
  color: #374151 !important;
  font-weight: 500 !important;
  line-height: 1.6 !important;
  transition: all 0.3s ease !important;
}

.testimonio-card-principal .font-bold {
  color: #111827 !important;
}

.testimonio-preview h4,
.testimonio-preview p,
.testimonio-preview div {
  color: #061400 !important;
  font-weight: 600 !important;
}

.stats-card .text-4xl,
.stats-card .text-white,
.stats-card div {
  color: #D8D900 !important;
}

.stats-card .font-medium {
  color: #e5e7eb !important;
}

/* NAVEGACIÓN CONSISTENTE - CUADRADOS REDONDEADOS COMO EL RESTO */
.testimonios-prev-new, 
.testimonios-next-new {
  width: 50px !important;
  height: 50px !important;
  background: rgba(216, 217, 0, 0.1) !important;
  border: 2px solid rgba(216, 217, 0, 0.3) !important;
  border-radius: 8px !important; /* Consistente con nav-btn */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #D8D900 !important;
  font-size: 1.25rem !important;
  font-weight: normal !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  backdrop-filter: blur(10px) !important;
  position: relative !important;
}

.testimonios-prev-new:hover,
.testimonios-next-new:hover {
  background: rgba(216, 217, 0, 0.2) !important;
  border-color: #D8D900 !important;
  transform: scale(1.1) !important;
}

.testimonios-prev-new:active,
.testimonios-next-new:active {
  transform: scale(0.95) !important;
  transition: all 0.1s ease !important;
}

/* Dots dinámicos */
.testimonios-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0;
}

.testimonios-dots .dot {
  width: 10px !important;
  height: 10px !important;
  border-radius: 3px !important; /* Ligeramente cuadrados como los botones */
  background: rgba(216, 217, 0, 0.3) !important;
  border: 1px solid transparent !important;
  transition: all 0.3s ease !important;
  cursor: pointer !important;
  position: relative !important;
  display: block !important;
}

.testimonios-dots .dot.activo {
  background: #D8D900 !important;
  border-color: rgba(216, 217, 0, 0.4) !important;
  transform: scale(1.2) !important;
  box-shadow: 0 2px 8px rgba(216, 217, 0, 0.3) !important;
}

.testimonios-dots .dot:hover:not(.activo) {
  background: rgba(216, 217, 0, 0.6) !important;
  transform: scale(1.1) !important;
  border-color: rgba(216, 217, 0, 0.3) !important;
}

/* Responsive */
@media (max-width: 1024px) {
  .testimonios-grid {
    grid-template-columns: 1fr; /* Una sola columna en tablet */
    grid-template-rows: auto auto auto; /* 3 filas: principal, preview, stats */
    gap: 1.5rem;
  }
  
  .testimonio-card-principal {
    grid-column: 1;
    grid-row: 1;
  }
  
  .testimonio-preview {
    grid-column: 1;
    grid-row: 2;
  }
  
  .stats-card {
    grid-column: 1;
    grid-row: 3;
  }
}

@media (max-width: 768px) {
  .testimonio-card-principal > div,
  .testimonio-preview > div,
  .stats-card > div {
    padding: 1.5rem;
    min-height: 280px;
  }
  
  .testimonios-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 1rem;
  }
  
  .testimonio-card-principal,
  .testimonio-preview,
  .stats-card {
    grid-column: 1;
  }
  
  .testimonio-card-principal {
    grid-row: 1;
  }
  
  .testimonio-preview {
    grid-row: 2;
  }
  
  .stats-card {
    grid-row: 3;
  }
  
  .testimonios-prev-new, .testimonios-next-new {
    width: 56px !important;
    height: 56px !important;
    font-size: 1.5rem !important;
    border-radius: 10px !important; /* Ligeramente más redondeado en móvil */
    border-width: 2px !important;
  }
  
  /* Remover el efecto ripple para mantener consistencia */
  .testimonios-prev-new::before, 
  .testimonios-next-new::before {
    display: none;
  }
  
  .testimonios-prev-new:hover, .testimonios-next-new:hover {
    transform: scale(1.15) !important;
    background: rgba(216, 217, 0, 0.3) !important;
  }
  
  /* Contenedor de navegación */
  .flex.justify-center.items-center.space-x-6 {
    gap: 1.5rem !important;
    padding: 1rem 0 !important;
  }
  
  /* Remover indicadores extra */
  .testimonios-prev-new:active::after,
  .testimonios-next-new:active::after {
    display: none;
  }
  
  .testimonios-dots {
    gap: 0.75rem;
    padding: 1.5rem 0;
  }
  
  .testimonios-dots .dot {
    width: 12px !important;
    height: 12px !important;
    border-radius: 4px !important;
    border-width: 1px !important;
  }
  
  .testimonios-dots .dot.activo {
    transform: scale(1.3) !important;
    box-shadow: 0 3px 12px rgba(216, 217, 0, 0.4) !important;
  }
}

/* Animaciones de entrada */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.testimonio-card-principal {
  animation: fadeInUp 0.8s ease-out;
}

.testimonio-preview {
  animation: slideInRight 0.8s ease-out 0.2s both;
}

.stats-card {
  animation: slideInRight 0.8s ease-out 0.4s both;
}

/* Efectos de transición para contenido dinámico */
.testimonio-texto,
#testimonioTexto {
  transition: opacity 0.3s ease !important;
}

.avatar-3d,
#testimonioAvatar,
#previewAvatar {
  transition: transform 0.3s ease !important;
}

#testimonioNombre,
#testimonioCargo,
#testimonioEmpresa,
#previewTexto,
#previewNombre,
#previewEmpresa {
  transition: opacity 0.3s ease !important;
}

/* Mejorar hover del preview */
.testimonio-preview {
  position: relative;
}

.testimonio-preview::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(216, 217, 0, 0.1) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: 1.5rem;
  pointer-events: none;
}

.testimonio-preview:hover::after {
  opacity: 1;
}

/* Asegurar que las transiciones funcionen bien */
.testimonios-grid {
  transform-origin: center;
}

/* Remover debug borders */
.testimonios-grid > div {
  border: none !important;
}

/* Estado de carga inicial */
.testimonios-grid > div {
  opacity: 0;
  animation-fill-mode: both;
}

/* Forzar visibilidad una vez que se cargan */
.testimonios-grid.loaded > div {
  opacity: 1;
}

/* Fallback para CSS Grid */
@supports not (display: grid) {
  .testimonios-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .testimonio-card-principal {
    flex: 1 1 100%;
  }
  
  .testimonio-preview,
  .stats-card {
    flex: 1 1 calc(50% - 0.5rem);
  }
}

/* Mejorar accesibilidad */
.testimonios-prev-new:focus,
.testimonios-next-new:focus {
  outline: 3px solid rgba(216, 217, 0, 0.5);
  outline-offset: 2px;
}

.testimonios-dots .dot:focus {
  outline: 2px solid rgba(216, 217, 0, 0.8);
  outline-offset: 2px;
}

/* Asegurar que el texto del preview sea siempre legible */
.testimonio-preview #previewTexto {
  color: #061400 !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
}

/* Animaciones adicionales */
@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.1;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

@keyframes fadeUpOut {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
}

/* Texto de preview con mejor legibilidad */
.testimonio-preview #previewTexto {
  color: #061400 !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
}

/* DOTS MEJORADOS ESPECÍFICAMENTE PARA MÓVIL */
@media (max-width: 768px) {
  .testimonios-dots {
    gap: 1rem;
    padding: 1.5rem 0;
  }
  
  .testimonios-dots .dot {
    width: 16px !important;
    height: 16px !important;
    border-width: 3px !important;
  }
  
  .testimonios-dots .dot.activo {
    transform: scale(1.4) !important;
    box-shadow: 
      0 6px 16px rgba(216, 217, 0, 0.5),
      0 0 0 4px rgba(216, 217, 0, 0.2) !important;
  }
}

/* Animaciones adicionales */
@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.1;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

@keyframes fadeUpOut {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
}

/* Fallback para navegadores que no soportan grid */
@supports not (display: grid) {
  .testimonios-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .testimonio-card-principal {
    flex: 1 1 100%;
  }
  
  .testimonio-preview,
  .stats-card {
    flex: 1 1 calc(50% - 0.5rem);
  }
}

/* Mejoras para accesibilidad */
.testimonios-prev-new:focus,
.testimonios-next-new:focus {
  outline: 3px solid rgba(216, 217, 0, 0.5);
  outline-offset: 2px;
}

.testimonios-dots .dot:focus {
  outline: 2px solid rgba(216, 217, 0, 0.8);
  outline-offset: 2px;
}

/* Asegurar que todo sea visible */
.testimonios-grid {
  opacity: 1 !important;
  visibility: visible !important;
}

.testimonios-grid > div {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
}

/* Transiciones suaves para contenido dinámico */
.testimonio-texto,
.avatar-3d,
#testimonioNombre,
#testimonioCargo,
#testimonioEmpresa,
#testimonioAvatar {
  transition: all 0.3s ease;
}

/* Preview hover mejorado */
.testimonio-preview {
  cursor: pointer;
}

/* Layout de las cards con mejor distribución */
.testimonio-card-principal > div,
.testimonio-preview > div,
.stats-card > div {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  border-radius: 1.5rem;
  padding: 2rem;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
