/**
 * HERO CAROUSEL CSS
 * Carrusel automático de imágenes con transiciones suaves
 */

/* ============================================ */
/* CONTENEDOR PRINCIPAL DEL CARRUSEL */
/* ============================================ */

.hero-carousel {
  position: relative;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  border-radius: var(--radius-lg, 24px);
  overflow: hidden;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  background: #1a1a2e;
}

/* Aspecto 16:9 responsive */
.hero-carousel::before {
  content: '';
  display: block;
  padding-top: 56.25%; /* 16:9 aspect ratio */
}

/* ============================================ */
/* CARRUSEL INTERNO */
/* ============================================ */

.carousel-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
  z-index: 1;
}

.carousel-slide.active {
  opacity: 1;
  z-index: 2;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================ */
/* NAVEGACIÓN: DOTS */
/* ============================================ */

.carousel-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  border-radius: 20px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.carousel-dot:hover {
  background: rgba(255, 255, 255, 0.6);
  transform: scale(1.2);
}

.carousel-dot.active {
  width: 24px;
  border-radius: 4px;
  background: white;
}

/* ============================================ */
/* CONTROLES: FLECHAS */
/* ============================================ */

.carousel-controls {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
  pointer-events: none;
}

.carousel-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  pointer-events: all;
  opacity: 0;
}

.hero-carousel:hover .carousel-btn {
  opacity: 1;
}

.carousel-btn:hover {
  background: rgba(102, 126, 234, 0.8);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.carousel-btn:active {
  transform: scale(0.95);
}

/* ============================================ */
/* CONTADOR DE SLIDES */
/* ============================================ */

.carousel-counter {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 10;
}

/* ============================================ */
/* INDICADOR DE CARGA */
/* ============================================ */

.carousel-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 1.5rem;
  z-index: 5;
}

.carousel-loading::after {
  content: '';
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================ */
/* TÍTULO/CAPTION DEL SLIDE */
/* ============================================ */

.carousel-caption {
  position: absolute;
  bottom: 70px;
  left: 20px;
  right: 20px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  color: white;
  z-index: 10;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s ease;
}

.carousel-slide.active .carousel-caption {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.3s;
}

.carousel-caption h3 {
  font-size: 1.25rem;
  margin: 0 0 8px 0;
  font-weight: 600;
}

.carousel-caption p {
  font-size: 0.875rem;
  margin: 0;
  opacity: 0.9;
}

/* ============================================ */
/* PROGRESS BAR (Auto-advance indicator) */
/* ============================================ */

.carousel-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(102, 126, 234, 0.8);
  width: 0;
  z-index: 11;
  transition: width 0.1s linear;
}

.carousel-slide.active .carousel-progress {
  animation: progress 4s linear forwards;
}

@keyframes progress {
  to { width: 100%; }
}

/* Pausar animación al hover */
.hero-carousel:hover .carousel-progress {
  animation-play-state: paused;
}

/* ============================================ */
/* RESPONSIVE: MÓVIL */
/* ============================================ */

@media (max-width: 640px) {
  .carousel-dots {
    bottom: 12px;
    gap: 6px;
    padding: 6px 12px;
  }
  
  .carousel-dot {
    width: 6px;
    height: 6px;
  }
  
  .carousel-dot.active {
    width: 18px;
  }
  
  .carousel-controls {
    padding: 0 12px;
  }
  
  .carousel-btn {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }
  
  .carousel-counter {
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    font-size: 0.75rem;
  }
  
  .carousel-caption {
    bottom: 50px;
    left: 12px;
    right: 12px;
    padding: 12px 16px;
  }
  
  .carousel-caption h3 {
    font-size: 1rem;
  }
  
  .carousel-caption p {
    font-size: 0.8rem;
  }
}

/* ============================================ */
/* TABLET */
/* ============================================ */

@media (min-width: 641px) and (max-width: 768px) {
  .carousel-btn {
    opacity: 1; /* Siempre visible en tablet */
  }
}

/* ============================================ */
/* ACCESIBILIDAD */
/* ============================================ */

.carousel-btn:focus,
.carousel-dot:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Reducir animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
  .carousel-slide,
  .carousel-caption,
  .carousel-btn,
  .carousel-dot {
    transition: none !important;
  }
  
  .carousel-progress {
    display: none;
  }
}

/* ============================================ */
/* PLACEHOLDER STYLES (cuando no hay imágenes) */
/* ============================================ */

.carousel-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-align: center;
  padding: 2rem;
}

.carousel-placeholder-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.8;
}

.carousel-placeholder h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.carousel-placeholder p {
  opacity: 0.9;
  font-size: 1rem;
}
