/**
 * ConectaTerapia - Carrusel Infinito Autoloop
 * Scroll infinito con autoloop automático y efectos suaves
 *
 * @package ConectaTerapia
 * @author Soluciones Digitales M&E
 * @version 4.1.0
 */

/* ============================================
   CARRUSEL INFINITE - CONFIGURACIÓN PRINCIPAL
   ============================================ */
.ct-professionals-carousel {
  padding: 20px 0;
  background: transparent;
  width: 100%;
  overflow: hidden;
}

.ct-professionals-grid {
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  padding: 20px 10px;
  display: flex;
  align-items: stretch;
  height: auto;
  min-height: 500px;
  max-width: 100%;
  mask-image: linear-gradient(
    to right,
    transparent,
    black 5%,
    black 95%,
    transparent
  );
  -webkit-mask-image: linear-gradient(
    to right,
    transparent,
    black 5%,
    black 95%,
    transparent
  );
}

/* Carrusel Track - Contenedor principal */
.ct-carousel-track {
  display: flex;
  height: 100%;
  gap: 24px; /* Espaciado consistente */
  width: max-content; /* Asegura que el ancho se ajuste al contenido */
  will-change: transform;
}

/* ============================================
   CARDS DESIGN (PREMIUM)
   ============================================ */
.ct-pro-card {
  flex: 0 0 290px; /* Ancho fijo Desktop */
  width: 290px;
  height: 100%;
  margin: 0;
  background: #ffffff;
  border-radius: 24px;
  border: 1px solid rgba(80, 164, 167, 0.08); /* --color-primary con opacidad */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  /* Fix para Safari border-radius overflow */
  transform: translateZ(0);
}

.ct-pro-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: 0 20px 40px rgba(80, 164, 167, 0.12);
  border-color: rgba(80, 164, 167, 0.2);
  z-index: 10;
}

.ct-pro-card__inner {
  padding: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Asegura que el contenido se distribuya */
  align-items: center;
  text-align: center;
}

.ct-pro-card__header {
  width: 100%;
  margin-bottom: 12px;
  position: relative;
}

.ct-pro-card__avatar-container {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 14px;
}

.ct-pro-card__avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow: 0 8px 20px rgba(80, 164, 167, 0.15);
  margin: 0;
  display: block;
}

.ct-pro-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.5s ease;
  display: block;
}

.ct-pro-card:hover .ct-pro-card__avatar img {
  transform: scale(1.1);
}

.ct-pro-card__verified-badge {
  position: absolute;
  bottom: 0;
  right: -5px;
  background: #fff;
  color: #10b981;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  border: 2px solid #fff;
}

.ct-pro-card__identity {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ct-pro-card__prefix {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #177275; /* --color-secondary */
  font-weight: 700;
  opacity: 0.8;
}

.ct-pro-card__name {
  font-size: 17px;
  font-weight: 700;
  color: #0f3e43; /* --color-heading */
  margin: 0;
  line-height: 1.3;
}

.ct-pro-card__experience {
  font-size: 13px;
  color: #7a8b90; /* --color-muted */
  margin: 0;
  font-weight: 500;
}

.ct-pro-card__specialties {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 6px;
  margin: 16px 0;
  flex: 1 1 auto; /* Permite que crezca y se encoja pero ocupe espacio */
  overflow: hidden; /* Evita desbordamientos */
  align-items: center; /* Centrar verticalmente si hay pocas */
}

.ct-pro-card__specialty-tag {
  background: rgba(80, 164, 167, 0.06);
  color: #177275;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: normal; /* Permitir salto de línea */
  text-align: center; /* Centrar texto */
  line-height: 1.2; /* Mejorar lectura en multilínea */
  height: fit-content; /* Ajustar altura al contenido */
}

.ct-pro-card:hover .ct-pro-card__specialty-tag {
  background: rgba(80, 164, 167, 0.12);
}

.ct-pro-card__cta-section {
  width: 100%;
  margin-top: auto;
}

.ct-pro-card__cta {
  width: 100%;
  background: linear-gradient(135deg, #50a4a7 0%, #177275 100%);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(80, 164, 167, 0.2);
  text-decoration: none !important;
}

.ct-pro-card__cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(80, 164, 167, 0.35);
  filter: brightness(1.05);
  color: white;
}

.ct-pro-card__cta-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
  fill: currentColor;
}

.ct-pro-card__cta:hover .ct-pro-card__cta-icon {
  transform: translateX(3px);
}

/* ============================================
   INFINITE SCROLL ANIMATION
   ============================================ */
.ct-carousel-track.auto-scroll {
  animation: infiniteScroll linear infinite;
  /* La duración se define por data-speed */
}

@keyframes infiniteScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%); /* Asumiendo que tenemos clones duplicados */
  }
}

/* Pausar autoloop en hover */
.ct-carousel-track.auto-scroll:hover {
  animation-play-state: paused;
}

/* Velocidades Ajustadas (Más lentas = Zen Mode) */
.ct-carousel-track[data-speed="slow"] {
  animation-duration: 90s; /* Muy lento y relajante */
}

.ct-carousel-track[data-speed="normal"] {
  animation-duration: 50s; /* Estándar pausado */
}

.ct-carousel-track[data-speed="fast"] {
  animation-duration: 40s;
}

.ct-carousel-track[data-speed="very-fast"] {
  animation-duration: 25s;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet (<1024px) */
@media (max-width: 1024px) {
  .ct-professionals-grid {
    height: 400px;
  }

  .ct-pro-card {
    flex: 0 0 270px;
    width: 270px;
  }
}

/* Mobile (<768px) */
@media (max-width: 768px) {
  .ct-professionals-grid {
    height: auto; /* Altura automática en móvil */
    min-height: 380px;
    padding: 15px 0;
    mask-image: none; /* Quitar mascara en móvil para ver bordes */
    -webkit-mask-image: none;
  }

  .ct-carousel-track {
    gap: 16px;
  }

  .ct-pro-card {
    flex: 0 0 260px; /* Tarjetas más compactas */
    width: 260px;
    border-radius: 20px;
  }

  .ct-pro-card__inner {
    padding: 16px;
  }

  .ct-pro-card__avatar-container {
    width: 100px;
    height: 100px;
  }
}

/* Small Mobile (<480px) */
@media (max-width: 480px) {
  .ct-pro-card {
    flex: 0 0 240px;
    width: 240px;
  }

  .ct-pro-card__name {
    font-size: 16px;
  }
}

/* ============================================
   NAVEGACIÓN DEL CARRUSEL (FLECHAS)
   ============================================ */
.ct-carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: #ffffff;
  border: 1px solid rgba(80, 164, 167, 0.15);
  border-radius: 50%;
  color: #50A4A7;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ct-carousel-nav:hover {
  background: #50A4A7;
  color: #ffffff;
  border-color: #50A4A7;
  box-shadow: 0 6px 20px rgba(80, 164, 167, 0.3);
  transform: translateY(-50%) scale(1.05);
}

.ct-carousel-nav:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(80, 164, 167, 0.3);
}

.ct-carousel-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.ct-carousel-nav svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.ct-carousel-nav:hover svg {
  transform: scale(1.1);
}

.ct-carousel-prev {
  left: 0;
}

.ct-carousel-next {
  right: 0;
}

/* ============================================
   INDICADORES (DOTS) DEL CARRUSEL
   ============================================ */
.ct-carousel-indicators {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(8px);
}

.ct-carousel-dot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 10px;
  height: 10px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.ct-dot-inner {
  width: 8px;
  height: 8px;
  background: rgba(80, 164, 167, 0.3);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.ct-carousel-dot:hover .ct-dot-inner {
  background: rgba(80, 164, 167, 0.6);
  transform: scale(1.2);
}

.ct-carousel-dot.active .ct-dot-inner {
  background: #50A4A7;
  transform: scale(1.3);
}

.ct-carousel-dot:focus {
  outline: none;
}

.ct-carousel-dot:focus .ct-dot-inner {
  box-shadow: 0 0 0 3px rgba(80, 164, 167, 0.3);
}

/* ============================================
   RESPONSIVE PARA FLECHAS Y DOTS
   ============================================ */
@media (max-width: 768px) {
  .ct-carousel-nav {
    width: 40px;
    height: 40px;
  }

  .ct-carousel-nav svg {
    width: 18px;
    height: 18px;
  }

  .ct-carousel-prev {
    left: 4px;
  }

  .ct-carousel-next {
    right: 4px;
  }

  .ct-carousel-indicators {
    bottom: 8px;
    gap: 6px;
    padding: 6px 12px;
  }

  .ct-dot-inner {
    width: 7px;
    height: 7px;
  }
}
