/* CORRECCIÓN PARA TRANSICIONES DEL CARRUSEL MÓVIL */
/* Soluciona el problema de slides compartiendo pantalla */

@media (max-width: 768px) {
  /* Hero Container - Base sólida */
  .hero.carousel-container {
    height: 100vh;
    position: relative;
    overflow: hidden;
    background: linear-gradient(45deg, #1a1a2e, #16213e, #0f3460);
  }

  /* Slides container - Configuración crítica para evitar superposiciones */
  .carousel-slides {
    display: flex;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
  }

  /* Cada slide - DEBE ocupar exactamente 100% sin excepciones */
  .carousel-slide {
    min-width: 100%;
    max-width: 100%;
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    overflow: hidden;
    padding: 0;
    flex-shrink: 0; /* CRÍTICO: Evita que los slides se compriman */
    flex-grow: 0;   /* CRÍTICO: Evita que los slides crezcan */
  }

  /* Estado inicial de slides no activos - OCULTOS COMPLETAMENTE */
  .carousel-slide:not(.active) {
    opacity: 0;
    pointer-events: none;
  }

  /* Slide activo - COMPLETAMENTE VISIBLE */
  .carousel-slide.active {
    opacity: 1;
    pointer-events: all;
    z-index: 2;
  }

  /* Imágenes - Configuración mejorada */
  .carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center right;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    filter: brightness(0.6) contrast(1.3) saturate(1.2);
    transform: scale(1.05);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, filter;
  }

  /* Overlay con gradiente específico */
  .slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.9) 0%,
      rgba(0, 0, 0, 0.8) 25%,
      rgba(135, 206, 235, 0.3) 50%,
      rgba(0, 0, 0, 0.4) 75%,
      rgba(0, 0, 0, 0.2) 100%
    );
    z-index: 2;
    opacity: 1;
    transition: opacity 0.3s ease;
  }

  /* Contenido del slide - Posicionamiento mejorado */
  .slide-content {
    position: relative;
    z-index: 3;
    color: #ffffff;
    text-align: left;
    padding: 30px 20px 40px 20px;
    max-width: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    min-height: 50vh;
    background: linear-gradient(
      135deg,
      rgba(0, 0, 0, 0.8) 0%,
      rgba(135, 206, 235, 0.1) 50%,
      transparent 100%
    );
    border-radius: 0 30px 0 0;
    backdrop-filter: blur(3px);
    border-top: 3px solid rgba(135, 206, 235, 0.6);
    border-right: 3px solid rgba(135, 206, 235, 0.6);
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  /* Contenido visible en slide activo */
  .carousel-slide.active .slide-content {
    opacity: 1;
    transform: translateX(0);
  }

  /* Títulos con animación controlada */
  .slide-content h1 {
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 15px;
    color: #ffffff;
    text-align: left;
    text-shadow: 
      0 0 15px rgba(135, 206, 235, 0.6),
      0 0 25px rgba(135, 206, 235, 0.4),
      3px 3px 6px rgba(0, 0, 0, 0.9);
    background: linear-gradient(135deg, #87ceeb, #ffd700, #ffb6c1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    max-width: 90%;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.2s;
  }

  /* Título visible en slide activo */
  .carousel-slide.active .slide-content h1 {
    opacity: 1;
    transform: translateY(0);
    animation: titleGlowLeft 3s ease-in-out infinite alternate 1s;
  }

  @keyframes titleGlowLeft {
    0% { 
      text-shadow: 
        0 0 15px rgba(135, 206, 235, 0.6),
        0 0 25px rgba(135, 206, 235, 0.4),
        3px 3px 6px rgba(0, 0, 0, 0.9);
    }
    100% { 
      text-shadow: 
        0 0 25px rgba(255, 215, 0, 0.8),
        0 0 35px rgba(255, 215, 0, 0.6),
        3px 3px 6px rgba(0, 0, 0, 0.9);
    }
  }

  /* Párrafos con animación controlada */
  .slide-content p {
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 25px;
    color: #f0f8ff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: 400;
    max-width: 85%;
    text-align: left;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 15px;
    border-radius: 0 15px 15px 0;
    border-left: 4px solid #87ceeb;
    backdrop-filter: blur(2px);
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.4s;
  }

  /* Párrafo visible en slide activo */
  .carousel-slide.active .slide-content p {
    opacity: 1;
    transform: translateY(0);
  }

  /* Botones con animación controlada */
  .hero-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 280px;
    align-items: flex-start;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.6s;
  }

  /* Botones visibles en slide activo */
  .carousel-slide.active .hero-buttons {
    opacity: 1;
    transform: translateY(0);
  }

  .btn {
    padding: 16px 25px;
    font-size: 1rem;
    font-weight: 700;
    width: 100%;
    max-width: 250px;
    min-height: 50px;
    border-radius: 0 25px 25px 0;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
  }

  .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
  }

  .btn:hover::before {
    left: 100%;
  }

  .btn-primary {
    background: linear-gradient(135deg, #87ceeb, #ffd700);
    color: #1a1a2e;
    box-shadow: 
      0 6px 20px rgba(135, 206, 235, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-left: 4px solid #87ceeb;
  }

  .btn-primary:hover {
    transform: translateX(8px) translateY(-2px);
    box-shadow: 
      0 8px 25px rgba(135, 206, 235, 0.6),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, #ffd700, #87ceeb);
    max-width: 260px;
  }

  .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 2px solid #87ceeb;
    border-left: 4px solid #ffd700;
    backdrop-filter: blur(10px);
    box-shadow: 
      0 6px 20px rgba(0, 0, 0, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }

  .btn-secondary:hover {
    background: rgba(135, 206, 235, 0.2);
    border-color: #ffd700;
    transform: translateX(8px) translateY(-2px);
    box-shadow: 
      0 8px 25px rgba(135, 206, 235, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
    max-width: 260px;
  }

  /* Controles de navegación */
  .carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(135, 206, 235, 0.4);
    color: #ffffff;
    padding: 12px 15px;
    cursor: pointer;
    z-index: 10;
    font-size: 1.6rem;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 
      0 6px 20px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .carousel-nav:hover {
    background: rgba(135, 206, 235, 0.3);
    border-color: #ffd700;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 
      0 8px 25px rgba(135, 206, 235, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }

  .carousel-nav.prev {
    left: 15px;
    border-radius: 50% 50% 50% 0;
  }

  .carousel-nav.next {
    right: 15px;
    border-radius: 50% 50% 0 50%;
  }

  /* Indicadores */
  .carousel-dots {
    position: absolute;
    bottom: 25px;
    left: 20px;
    transform: none;
    display: flex;
    gap: 10px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.4);
    padding: 12px 20px;
    border-radius: 0 20px 20px 0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(135, 206, 235, 0.3);
    border-left: 3px solid #87ceeb;
  }

  .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    border: 2px solid transparent;
  }

  .dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
  }

  .dot.active {
    background: linear-gradient(135deg, #87ceeb, #ffd700);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.4);
    box-shadow: 
      0 0 12px rgba(135, 206, 235, 0.7),
      0 0 20px rgba(255, 215, 0, 0.5);
  }

  .dot.active::before {
    background: #ffffff;
    width: 6px;
    height: 6px;
  }

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

  /* Efectos de partículas solo en slide activo */
  .carousel-slide.active::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60%;
    height: 100%;
    background-image: 
      radial-gradient(2px 2px at 20px 30px, rgba(135, 206, 235, 0.2), transparent),
      radial-gradient(1px 1px at 40px 70px, rgba(255, 215, 0, 0.2), transparent),
      radial-gradient(1px 1px at 60px 40px, rgba(255, 182, 193, 0.2), transparent);
    background-repeat: repeat;
    background-size: 150px 80px;
    animation: floatingParticlesRight 25s linear infinite;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    animation: floatingParticlesRight 25s linear infinite, 
               fadeInParticles 1s ease-in-out 0.8s forwards;
  }

  @keyframes floatingParticlesRight {
    0% { transform: translateY(0px) translateX(0px) rotate(0deg); }
    100% { transform: translateY(-80px) translateX(20px) rotate(180deg); }
  }

  @keyframes fadeInParticles {
    0% { opacity: 0; }
    100% { opacity: 1; }
  }

  /* Indicador de deslizamiento */
  .hero.carousel-container::before {
    content: '← Desliza →';
    position: absolute;
    bottom: 80px;
    left: 20px;
    transform: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    z-index: 5;
    animation: fadeInOut 4s ease-in-out infinite 2s;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 12px;
    border-radius: 0 15px 15px 0;
    backdrop-filter: blur(5px);
    border-left: 3px solid #87ceeb;
    opacity: 0;
  }

  @keyframes fadeInOut {
    0%, 100% { opacity: 0; transform: translateX(-10px); }
    50% { opacity: 1; transform: translateX(0); }
  }

  /* RESET de animaciones para slides no activos */
  .carousel-slide:not(.active) .slide-content,
  .carousel-slide:not(.active) .slide-content h1,
  .carousel-slide:not(.active) .slide-content p,
  .carousel-slide:not(.active) .hero-buttons {
    opacity: 0;
    transform: translateX(-50px);
    transition: none;
  }

  /* Optimización de rendimiento */
  .carousel-slides {
    will-change: transform;
  }

  .carousel-slide img {
    will-change: transform, filter;
  }

  .slide-content {
    will-change: opacity, transform;
  }
}

/* Estilos para móviles muy pequeños */
@media (max-width: 480px) {
  .slide-content {
    padding: 25px 15px 35px 15px;
    min-height: 40vh;
  }

  .slide-content h1 {
    font-size: 1.8rem;
    margin-bottom: 12px;
    max-width: 95%;
  }

  .slide-content p {
    font-size: 0.9rem;
    padding: 10px 12px;
    max-width: 90%;
    margin-bottom: 20px;
  }

  .btn {
    padding: 14px 20px;
    font-size: 0.9rem;
    min-height: 46px;
    max-width: 220px;
  }

  .carousel-nav {
    width: 48px;
    height: 48px;
    font-size: 1.4rem;
    padding: 10px 12px;
  }

  .carousel-nav.prev {
    left: 10px;
  }

  .carousel-nav.next {
    right: 10px;
  }

  .carousel-dots {
    bottom: 20px;
    left: 15px;
    padding: 10px 15px;
    gap: 8px;
  }

  .dot {
    width: 10px;
    height: 10px;
  }
}