/* ===== CARRUSEL - CONTENEDOR PRINCIPAL ===== */
.carrusel-wrapper {
  max-width: 1200px;
  margin: 40px auto;
  padding: 20px;
  text-align: center;
}

.carrusel-title {
  font-size: 2rem;
  color: #1A3864;
  margin-bottom: 30px;
  font-weight: 700;
}

/* Contenedor del carrusel */
.carrusel-container {
  position: relative;
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  background: white;
  overflow: visible; /* Permite que botones sobresalgan */
}

/* Track del carrusel - CRÍTICO PARA EL FUNCIONAMIENTO */
.carrusel-track {
  overflow: hidden; /* Mantiene las imágenes dentro */
  position: relative;
  border-radius: 12px;
  width: 100%; /* Asegurar que ocupe el 100% */
}

/* Lista de slides - CORREGIDA PARA RESPONSIVE */
.carrusel-slides {
  display: flex;
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  /* CRÍTICO: Evitar que se comprima el contenedor */
  min-width: 100%;
  box-sizing: border-box;
}

/* Cada slide - CORREGIDO PARA PANTALLAS PEQUEÑAS */
.slide {
  position: relative;
  min-width: 100%;
  width: 100%; /* Asegurar ancho completo */
  max-width: 100%; /* Prevenir overflow */
  height: 550px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s ease;
  /* CRÍTICO: Box-sizing para cálculos precisos */
  box-sizing: border-box;
}

.slide a {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
}

.slide img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover; /* IMPORTANTE: Mantener aspecto sin recortar */
  object-position: center;
}

/* Overlay de contenido - VERSION DESKTOP */
.card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.85) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  opacity: 0;
  transform: rotate(-45deg);
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  pointer-events: none;
}

/* Hover effect para desktop */
@media (hover: hover) and (pointer: fine) {
  .slide:hover .card-overlay {
    opacity: 1;
    transform: rotate(0deg);
  }
  
  .slide:active {
    transform: scale(0.98);
  }
}

/* RESPONSIVE PARA PANTALLAS PEQUEÑAS - CORREGIDO */
@media (max-width: 768px) {
  .carrusel-wrapper {
    margin: 20px auto;
    padding: 10px;
  }
  
  .carrusel-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
  }
  
  .slide {
    height: 400px; /* Altura más manejable en móvil */
  }
}

/* CRÍTICO: Correcciones específicas para pantallas muy pequeñas */
@media (max-width: 450px) {
  .carrusel-wrapper {
    padding: 5px;
    margin: 15px auto;
  }
  
  .carrusel-container {
    border-radius: 8px;
  }
  
  .carrusel-track {
    border-radius: 8px;
    /* CRÍTICO: Asegurar que el track no cause overflow */
    position: relative;
    width: 100%;
    overflow: hidden;
  }
  
  .carrusel-slides {
    /* CRÍTICO: Mantener flexbox sin compresión */
    min-width: 100%;
    flex-wrap: nowrap;
  }
  
  .slide {
    /* CRÍTICO: Cada slide debe ocupar exactamente el 100% */
    min-width: 100%;
    width: 100%;
    max-width: 100%;
    height: 350px;
    border-radius: 6px;
    flex-shrink: 0;
    flex-grow: 0;
    flex-basis: 100%;
  }
  
  .slide img {
    object-fit: cover;
  }
  
  .carrusel-title {
    font-size: 1.2rem;
  }
}

/* Información siempre visible en mobile - MEJORADO */
@media (hover: none) and (pointer: coarse) {
  .slide {
    touch-action: manipulation;
  }
  
  .card-overlay {
    background: linear-gradient(to top, 
      rgba(0,0,0,0.85) 0%, 
      rgba(0,0,0,0.6) 15%, 
      rgba(0,0,0,0.2) 35%,
      transparent 50%);
    opacity: 1;
    transform: rotate(0deg);
    justify-content: flex-end;
    text-align: left;
    pointer-events: auto;
    padding: 15px;
  }
  
  .card-overlay .text-container {
    background: rgba(0,0,0,0.75);
    border-radius: 8px;
    padding: 12px 15px;
    backdrop-filter: blur(3px);
    border: 1px solid rgba(255,255,255,0.1);
    max-width: 90%;
    margin: 0 auto;
  }
  
  .card-overlay h3 {
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
    background: none;
    padding: 0;
    border-radius: 0;
    backdrop-filter: none;
  }
  
  .card-overlay p {
    color: rgba(255,255,255,0.95);
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    font-size: 0.8rem;
    line-height: 1.3;
    font-weight: 400;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    background: none;
    padding: 0;
    border-radius: 0;
    backdrop-filter: none;
  }
  
  /* Efecto táctil visual */
  .slide:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
}

/* Estilos para desktop */
.card-overlay h3 {
  font-size: 1.5rem;
  color: #1A3864;
  margin-bottom: 10px;
  text-align: center;
}

.card-overlay p {
  font-size: 1rem;
  color: #555;
  text-align: center;
  line-height: 1.5;
}

/* Botones de navegación - MEJORADOS PARA RESPONSIVE */
.carrusel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: #1A3864;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carrusel-btn:hover:not(:disabled) {
  background: #f89b29;
  transform: translateY(-50%) scale(1.1);
}

.carrusel-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.carrusel-btn.prev {
  left: -25px;
}

.carrusel-btn.next {
  right: -25px;
}

/* BOTONES RESPONSIVE PARA MÓVIL */
@media (max-width: 768px) {
  .carrusel-btn {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .carrusel-btn.prev {
    left: -20px;
  }
  
  .carrusel-btn.next {
    right: -20px;
  }
}

@media (max-width: 450px) {
  .carrusel-btn {
    width: 35px;
    height: 35px;
    font-size: 1rem;
  }
  
  .carrusel-btn.prev {
    left: -17px;
  }
  
  .carrusel-btn.next {
    right: -17px;
  }
}

/* INDICADORES - CONTENEDOR PRINCIPAL */
.carrusel-wrapper .carrusel-indicators {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 20px !important;
  margin: 25px auto !important;
  padding: 20px 30px !important;
  width: auto !important;
  min-width: auto !important;
  max-width: none !important;
  background: rgba(26, 56, 100, 0.08) !important;
  border-radius: 40px !important;
  border: 1px solid rgba(26, 56, 100, 0.15) !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}

/* INDICADORES PARA DESKTOP - ADAPTABLES AL ANCHO DE PANTALLA */
@media (min-width: 769px) {
  .carrusel-wrapper .carrusel-indicators {
    width: 100% !important;
    max-width: 90vw !important;
    padding: 2vw 4vw !important;
    gap: max(2vw, 30px) !important;
  }

  .carrusel-wrapper .carrusel-indicators .carrusel-indicator,
  .carrusel-indicators .carrusel-indicator,
  #indicators .carrusel-indicator,
  button.carrusel-indicator {
    width: clamp(24px, 3vw, 60px) !important;
    height: clamp(24px, 3vw, 60px) !important;
    min-width: clamp(24px, 3vw, 60px) !important;
    min-height: clamp(24px, 3vw, 60px) !important;
    max-width: clamp(24px, 3vw, 60px) !important;
    max-height: clamp(24px, 3vw, 60px) !important;
    
    box-sizing: content-box !important;
    border: max(2px, 0.2vw) solid rgba(26, 56, 100, 0.6) !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 50% !important;
    
    flex: 1 !important;
    flex-shrink: 1 !important;
    flex-grow: 1 !important;
    flex-basis: 0 !important;
    
    background: rgba(26, 56, 100, 0.4) !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    
    position: relative !important;
    display: inline-block !important;
    touch-action: manipulation !important;
    
    transform: none !important;
    scale: 1 !important;
  }

  .carrusel-wrapper .carrusel-indicators .carrusel-indicator.active,
  .carrusel-indicators .carrusel-indicator.active,
  #indicators .carrusel-indicator.active,
  button.carrusel-indicator.active {
    background: #1A3864 !important;
    border-color: #f89b29 !important;
    box-shadow: 0 0 0 max(4px, 0.4vw) rgba(248, 155, 41, 0.4) !important;
    transform: scale(0.96) !important;
    scale: 1.8 !important;
  }

  .carrusel-wrapper .carrusel-indicators .carrusel-indicator:hover:not(.active),
  .carrusel-indicators .carrusel-indicator:hover:not(.active),
  #indicators .carrusel-indicator:hover:not(.active),
  button.carrusel-indicator:hover:not(.active) {
    transform: scale(1.2) !important;
    scale: 1.2 !important;
    background: rgba(26, 56, 100, 0.6) !important;
  }

  .carrusel-wrapper .carrusel-indicators .carrusel-indicator:active,
  .carrusel-indicators .carrusel-indicator:active,
  #indicators .carrusel-indicator:active,
  button.carrusel-indicator:active {
    transform: scale(1.1) !important;
    scale: 1.1 !important;
  }
}

/* INDICADORES PARA MÓVIL - TAMAÑOS FIJOS */
@media (max-width: 768px) {
  .carrusel-wrapper .carrusel-indicators {
    gap: 15px !important;
    padding: 15px 25px !important;
    margin: 20px auto !important;
    border-radius: 30px !important;
  }
  
  .carrusel-wrapper .carrusel-indicators .carrusel-indicator,
  .carrusel-indicators .carrusel-indicator,
  #indicators .carrusel-indicator,
  button.carrusel-indicator {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    
    box-sizing: content-box !important;
    border: 1px solid rgba(26, 56, 100, 0.6) !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 50% !important;
    
    flex: none !important;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    flex-basis: auto !important;
    
    background: rgba(26, 56, 100, 0.4) !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    
    position: relative !important;
    display: inline-block !important;
    touch-action: manipulation !important;
    
    transform: none !important;
    scale: 1 !important;
  }
  
  .carrusel-wrapper .carrusel-indicators .carrusel-indicator.active,
  .carrusel-indicators .carrusel-indicator.active,
  #indicators .carrusel-indicator.active,
  button.carrusel-indicator.active {
    background: #1A3864 !important;
    border-color: #f89b29 !important;
    box-shadow: 0 0 0 3px rgba(248, 155, 41, 0.4) !important;
    transform: scale(0.98) !important;
    scale: 1.2 !important;
  }

  .carrusel-wrapper .carrusel-indicators .carrusel-indicator:hover:not(.active),
  .carrusel-indicators .carrusel-indicator:hover:not(.active),
  #indicators .carrusel-indicator:hover:not(.active),
  button.carrusel-indicator:hover:not(.active) {
    transform: scale(1.2) !important;
    scale: 1.2 !important;
    background: rgba(26, 56, 100, 0.6) !important;
  }

  .carrusel-wrapper .carrusel-indicators .carrusel-indicator:active,
  .carrusel-indicators .carrusel-indicator:active,
  #indicators .carrusel-indicator:active,
  button.carrusel-indicator:active {
    transform: scale(1.1) !important;
    scale: 1.1 !important;
  }
}

/* CORRECCIÓN ESPECÍFICA PARA PANTALLAS MUY PEQUEÑAS */
@media (max-width: 450px) {
  .carrusel-wrapper .carrusel-indicators {
    gap: 10px !important;
    padding: 12px 20px !important;
    margin: 15px auto !important;
    border-radius: 25px !important;
  }
  
  .carrusel-wrapper .carrusel-indicators .carrusel-indicator,
  .carrusel-indicators .carrusel-indicator,
  #indicators .carrusel-indicator,
  button.carrusel-indicator {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
  }
}