/* animations.css - Sistema de animaciones premium para Colegio Imagínate */

/* ========== ANIMACIONES DE ENTRADA Y SALIDA ========== */

/* Entrada suave con efecto de rebote suave */
@keyframes softBounceIn {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  60% {
    opacity: 1;
    transform: translateY(-10px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Entrada con efecto de rebote lateral */
@keyframes slideBounceIn {
  0% {
    opacity: 0;
    transform: translateX(-60px) rotate(-2deg);
  }
  70% {
    opacity: 0.8;
    transform: translateX(10px) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotate(0);
  }
}

/* Entrada con efecto de zoom y rotación */
@keyframes zoomRotateIn {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(-15deg);
  }
  70% {
    opacity: 0.8;
    transform: scale(1.05) rotate(5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

/* Entrada con efecto de flip (giro) */
@keyframes flipIn {
  0% {
    opacity: 0;
    transform: perspective(1000px) rotateY(90deg);
  }
  100% {
    opacity: 1;
    transform: perspective(1000px) rotateY(0);
  }
}

/* Entrada en cascada para elementos en lista */
@keyframes cascadeIn {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== ANIMACIONES DE HOVER ========== */

/* Flotación sutil continua */
@keyframes gentleFloat {
  0%, 100% {
    transform: translateY(0) rotate(0);
  }
  50% {
    transform: translateY(-10px) rotate(0.5deg);
  }
}

/* Latido cardíaco sutil */
@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.05);
  }
  50% {
    transform: scale(1);
  }
  75% {
    transform: scale(1.03);
  }
}

/* Brillos y destellos */
@keyframes shine {
  0% {
    background-position: -100px;
  }
  40%, 100% {
    background-position: 140px;
  }
}

/* Efecto de ondas concéntricas */
@keyframes ripple {
  0% {
    box-shadow: 0 0 0 0 rgba(109, 74, 255, 0.4),
                0 0 0 0 rgba(76, 175, 80, 0.4);
  }
  100% {
    box-shadow: 0 0 0 20px rgba(109, 74, 255, 0),
                0 0 0 40px rgba(76, 175, 80, 0);
  }
}

/* ========== ANIMACIONES DE FONDO Y EFECTOS VISUALES ========== */

/* Partículas flotantes */
@keyframes floatParticles {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(10px, -15px) rotate(90deg);
  }
  50% {
    transform: translate(-5px, -25px) rotate(180deg);
  }
  75% {
    transform: translate(-15px, -10px) rotate(270deg);
  }
}

/* Gradiente animado */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Efecto de neón pulsante */
@keyframes neonPulse {
  0%, 100% {
    text-shadow: 
      0 0 7px rgba(109, 74, 255, 0.7),
      0 0 10px rgba(109, 74, 255, 0.5),
      0 0 21px rgba(109, 74, 255, 0.3),
      0 0 42px rgba(76, 175, 80, 0.1);
  }
  50% {
    text-shadow: 
      0 0 10px rgba(109, 74, 255, 0.9),
      0 0 15px rgba(109, 74, 255, 0.7),
      0 0 25px rgba(109, 74, 255, 0.5),
      0 0 50px rgba(76, 175, 80, 0.3);
  }
}

/* ========== ANIMACIONES DE CARGA ========== */

/* Carga con puntos */
@keyframes loadingDots {
  0%, 20% {
    color: rgba(0,0,0,0);
    text-shadow: .25em 0 0 rgba(0,0,0,0),
                .5em 0 0 rgba(0,0,0,0);
  }
  40% {
    color: var(--primary);
    text-shadow: .25em 0 0 rgba(0,0,0,0),
                .5em 0 0 rgba(0,0,0,0);
  }
  60% {
    text-shadow: .25em 0 0 var(--primary),
                .5em 0 0 rgba(0,0,0,0);
  }
  80%, 100% {
    text-shadow: .25em 0 0 var(--primary),
                .5em 0 0 var(--primary);
  }
}

/* Spinner con gradiente */
@keyframes gradientSpinner {
  0% {
    transform: rotate(0deg);
    background: conic-gradient(from 0deg, var(--primary), var(--secondary), var(--accent), var(--primary));
  }
  100% {
    transform: rotate(360deg);
    background: conic-gradient(from 360deg, var(--primary), var(--secondary), var(--accent), var(--primary));
  }
}

/* ========== ANIMACIONES DE BOTONES ========== */

/* Botón con efecto de ondas al hacer clic */
@keyframes buttonRipple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  50% {
    transform: scale(2);
    opacity: 0.5;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* Botón con efecto de carga horizontal */
@keyframes buttonLoading {
  0% {
    background-position: -100% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ========== ANIMACIONES DE TEXTO ========== */

/* Efecto de máquina de escribir */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/* Texto que aparece letra por letra */
@keyframes textReveal {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Texto que brilla intermitentemente */
@keyframes textGlow {
  0%, 100% {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  }
  50% {
    text-shadow: 0 0 20px rgba(255, 255, 255, 1), 0 0 30px rgba(109, 74, 255, 0.6);
  }
}

/* ========== ANIMACIONES DE ICONOS ========== */

/* Icono que rebota */
@keyframes iconBounce {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-8px) scale(1.1);
  }
}

/* Icono que gira suavemente */
@keyframes iconSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Icono que late como corazón */
@keyframes iconPulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.9;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========== ANIMACIONES DE FORMS ========== */

/* Input que se expande */
@keyframes inputExpand {
  0% {
    transform: scaleX(0.95);
    opacity: 0.8;
  }
  100% {
    transform: scaleX(1);
    opacity: 1;
  }
}

/* Checkmark animado */
@keyframes checkmark {
  0% {
    stroke-dashoffset: 100;
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

/* Error shake */
@keyframes errorShake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* ========== ANIMACIONES DE NAVEGACIÓN ========== */

/* Línea que se desliza bajo enlaces */
@keyframes navLineSlide {
  0% {
    width: 0;
    left: 50%;
  }
  100% {
    width: 100%;
    left: 0;
  }
}

/* Menú que se desliza desde arriba */
@keyframes menuSlideDown {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== ANIMACIONES DE SCROLL ========== */

/* Indicador de scroll que pulsa */
@keyframes scrollIndicator {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  50% {
    transform: translateY(10px);
    opacity: 1;
  }
}

/* Sección que aparece al hacer scroll */
@keyframes scrollReveal {
  0% {
    opacity: 0;
    transform: translateY(60px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ========== CLASES DE ANIMACIÓN PARA APLICAR ========== */

/* Clases para animaciones de entrada */
.animate-soft-bounce {
  animation: softBounceIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.animate-slide-bounce {
  animation: slideBounceIn 0.9s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.animate-zoom-rotate {
  animation: zoomRotateIn 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.animate-flip-in {
  animation: flipIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  transform-origin: left center;
}

.animate-cascade-in {
  animation: cascadeIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

/* Clases para animaciones continuas */
.animate-float {
  animation: gentleFloat 4s ease-in-out infinite;
}

.animate-heartbeat {
  animation: heartbeat 1.5s ease-in-out infinite;
}

.animate-pulse-glow {
  animation: neonPulse 2s ease-in-out infinite;
}

.animate-gradient-shift {
  background-size: 200% 200%;
  animation: gradientShift 5s ease infinite;
}

/* Clases para efectos hover */
.hover-glow:hover {
  animation: neonPulse 1s ease-in-out;
}

.hover-float:hover {
  animation: gentleFloat 3s ease-in-out infinite;
}

.hover-heartbeat:hover {
  animation: heartbeat 1s ease-in-out;
}

.hover-ripple:hover::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(109, 74, 255, 0.1);
  animation: ripple 0.6s ease-out;
  transform: translate(-50%, -50%);
}

/* Clases para texto animado */
.text-typewriter {
  overflow: hidden;
  border-right: .15em solid var(--primary);
  white-space: nowrap;
  animation: typewriter 3.5s steps(40, end),
             blink-caret .75s step-end infinite;
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--primary); }
}

.text-reveal {
  opacity: 0;
  animation: textReveal 0.8s ease-out forwards;
}

/* Clases para botones animados */
.btn-animated {
  position: relative;
  overflow: hidden;
}

.btn-animated::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%);
  transform-origin: 50% 50%;
}

.btn-animated:focus:not(:active)::after {
  animation: buttonRipple 1s ease-out;
}

.btn-loading {
  background: linear-gradient(90deg, var(--primary) 25%, var(--primary-light) 50%, var(--primary) 75%);
  background-size: 200% 100%;
  animation: buttonLoading 2s linear infinite;
}

/* Clases para iconos animados */
.icon-bounce {
  animation: iconBounce 2s ease-in-out infinite;
}

.icon-spin {
  animation: iconSpin 2s linear infinite;
}

.icon-pulse {
  animation: iconPulse 1.5s ease-in-out infinite;
}

/* Clases para formularios */
.input-expand:focus {
  animation: inputExpand 0.3s ease-out;
}

.error-shake {
  animation: errorShake 0.5s ease-in-out;
}

.success-check {
  animation: checkmark 0.5s ease-out forwards;
}

/* Clases para navegación */
.nav-line-slide::after {
  animation: navLineSlide 0.4s ease-out forwards;
}

.menu-slide-down {
  animation: menuSlideDown 0.3s ease-out;
}

/* Clases para scroll */
.scroll-indicator {
  animation: scrollIndicator 2s ease-in-out infinite;
}

.scroll-reveal {
  opacity: 0;
  transform: translateY(60px);
  transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scroll-reveal.visible {
  animation: scrollReveal 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Clases de retraso para animaciones en cascada */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }
.delay-7 { animation-delay: 0.7s; }
.delay-8 { animation-delay: 0.8s; }
.delay-9 { animation-delay: 0.9s; }
.delay-10 { animation-delay: 1s; }

/* ========== MEDIA QUERIES PARA ANIMACIONES ========== */

/* Reducir movimiento para usuarios que lo prefieren */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Optimizar para dispositivos móviles */
@media (max-width: 768px) {
  .animate-float,
  .animate-heartbeat,
  .animate-pulse-glow {
    animation-duration: 1.5s;
  }
  
  .scroll-reveal {
    transform: translateY(40px);
  }
}

/* ========== EFECTOS ESPECIALES PARA ELEMENTOS ESPECÍFICOS ========== */

/* Hero section - partículas flotantes */
.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: floatParticles 15s linear infinite;
}

/* Card con efecto de brillo en hover */
.card-shine {
  position: relative;
  overflow: hidden;
}

.card-shine::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 20%;
  height: 200%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(30deg);
  transition: left 0.6s ease;
}

.card-shine:hover::before {
  left: 140%;
}

/* Botón con efecto de gradiente animado */
.btn-gradient-animated {
  background: linear-gradient(45deg, var(--primary), var(--secondary), var(--accent), var(--primary));
  background-size: 300% 300%;
  animation: gradientShift 4s ease infinite;
  transition: all 0.3s ease;
}

.btn-gradient-animated:hover {
  background-size: 400% 400%;
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(109, 74, 255, 0.4);
}

/* Loading spinner con gradiente */
.gradient-spinner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  animation: gradientSpinner 1s linear infinite;
  mask: radial-gradient(circle at center, transparent 55%, black 56%);
  -webkit-mask: radial-gradient(circle at center, transparent 55%, black 56%);
}

/* ========== UTILIDADES DE ANIMACIÓN ========== */

.animation-paused {
  animation-play-state: paused;
}

.animation-running {
  animation-play-state: running;
}

.animation-fill-forwards {
  animation-fill-mode: forwards;
}

.animation-infinite {
  animation-iteration-count: infinite;
}

.animation-once {
  animation-iteration-count: 1;
}

/* ========== ANIMACIONES PARA EL CHATBOT ========== */

.chat-message-entering {
  animation: messageSlide 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes messageSlide {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.typing-dot-bounce {
  animation: typingBounce 1.4s infinite ease-in-out;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* ========== ANIMACIONES PARA EL SLIDER ========== */

.slide-transition {
  transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
              opacity 1.2s ease-in-out;
}

.indicator-pulse {
  animation: indicatorPulse 2s infinite;
}

@keyframes indicatorPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* ========== ANIMACIONES PARA STATS COUNTER ========== */

.counter-animate {
  animation: counterIncrement 2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes counterIncrement {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== ANIMACIONES PARA LA GALERÍA ========== */

.gallery-item-enter {
  animation: galleryReveal 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes galleryReveal {
  0% {
    opacity: 0;
    transform: scale(0.8) rotate(-5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

/* ========== FIN DE ANIMATIONS.CSS ========== */