/* ============================================
   carousel-bootstrap5-fix.css - Carrusel compatible con Bootstrap 5
   ============================================ */

/* Configuración para animaciones suaves entre slides */
.carousel-fade .carousel-item {
  transition: opacity 1s ease-in-out !important;
}

.carousel-fade .carousel-item.active,
.carousel-fade .carousel-item-next.carousel-item-start,
.carousel-fade .carousel-item-prev.carousel-item-end {
  opacity: 1;
}

.carousel-fade .active.carousel-item-start,
.carousel-fade .active.carousel-item-end {
  opacity: 0;
}

.carousel-fade .carousel-item-next,
.carousel-fade .carousel-item-prev,
.carousel-fade .carousel-item.active,
.carousel-fade .active.carousel-item-start,
.carousel-fade .active.carousel-item-end {
  transform: translateX(0);
}

/* Animación para el texto */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 30px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Añadir animación al cambiar slides */
.carousel-caption h2 {
  animation: fadeInUp 1s ease-out forwards 0.5s;
  opacity: 0;
}

.btn-explore {
  animation: fadeInUp 1s ease-out forwards 0.8s;
  opacity: 0;
}

/* Contenedor principal */
.carousel-container {
  position: relative;
  width: 100%;
  height: 600px;
  overflow: hidden;
  margin-bottom: 2rem;
}

/* Slide */
.carousel-item {
  position: relative;
  height: 600px;
}

/* Fondo con imagen */
.carousel-item-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Overlay oscurecedor */
.carousel-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1;
}

/* ====== CENTRADO ABSOLUTO DEL TEXTO ====== */
.carousel-caption-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.carousel-caption {
  position: static !important;
  text-align: center;
  padding: 2rem;
  border-radius: 4px;
  max-width: 80%;
  width: auto;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  transform: none !important;
  margin: 0 !important;
}

.carousel-caption h2 {
  font-size: 6.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Estilo del botón */
.btn-explore {
  background-color: #9F2241;
  color: #fff;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border: none;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: inline-block;
  transition: background-color 0.3s;
  text-decoration: none;
}

.btn-explore:hover {
  background-color: #691C32;
  color: #fff;
  text-decoration: none;
}

/* Controles Bootstrap 5 */
.carousel-control-prev,
.carousel-control-next {
  z-index: 3;
  width: 10%;
  opacity: 0.7;
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
  opacity: 1;
}

/* Indicadores Bootstrap 5 */
.carousel-indicators {
  z-index: 3;
  bottom: 30px;
}

.carousel-indicators [data-bs-target] {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin: 0 2px;
  background-color: rgba(255, 255, 255, 0.5);
  border: none;
}

.carousel-indicators .active {
  background-color: #9F2241;
}

/* Estados de carga */
.carousel-item-background.loading {
  background-color: #f8f9fa;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="20" fill="none" stroke="%23dee2e6" stroke-width="4"/><circle cx="50" cy="50" r="20" fill="none" stroke="%236c757d" stroke-width="4" stroke-dasharray="31.416" stroke-dashoffset="31.416" opacity="0.3"><animateTransform attributeName="transform" type="rotate" dur="1s" repeatCount="indefinite" values="0 50 50;360 50 50"/></circle></svg>');
  background-size: 50px 50px;
  background-position: center;
  background-repeat: no-repeat;
}

.carousel-item-background.error {
  background-color: #f8d7da;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23721c24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>');
  background-size: 30px 30px;
  background-position: center;
  background-repeat: no-repeat;
}

/* Preloader */
.carousel-preloader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 600px;
  background-color: #f8f9fa;
}

.carousel-preloader .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e9ecef;
  border-top: 4px solid #9F2241;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.carousel-preloader p {
  color: #6c757d;
  font-size: 1.1rem;
  margin: 0;
}

/* Error state */
.carousel-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 600px;
  background-color: #f8d7da;
  color: #721c24;
  font-size: 1.2rem;
  text-align: center;
  padding: 2rem;
}

/* Ajustes responsivos */
@media (max-width: 767px) {
  .carousel-container, 
  .carousel-item {
    height: 450px;
  }
  
  .carousel-caption {
    max-width: 90%;
    padding: 1.2rem;
  }
  
  .carousel-caption h2 {
    font-size: 2.75rem;
    margin-bottom: 1rem;
  }
  
  .btn-explore {
    font-size: 1rem;
    padding: 0.5rem 1rem;
  }
  
  .carousel-preloader,
  .carousel-error {
    height: 450px;
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  .carousel-caption h2 {
    font-size: 3rem;
  }
}

/* Mejoras de accesibilidad */
.carousel-control-prev-icon,
.carousel-control-next-icon {
  width: 2rem;
  height: 2rem;
}

@media (prefers-reduced-motion: reduce) {
  .carousel-fade .carousel-item {
    transition: none !important;
  }
  
  .carousel-caption h2,
  .btn-explore {
    animation: none !important;
    opacity: 1 !important;
  }
}