/**
 * Animaciones avanzadas para Conectemos Chile
 * Sistema de micro-interacciones y efectos visuales para mejorar la experiencia del usuario
 * @version 2.0.0 - 2025
 */

/* ===== ANIMACIONES BÁSICAS ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { 
    opacity: 0;
    transform: translateY(30px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from { 
    opacity: 0;
    transform: translateY(-30px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from { 
    opacity: 0;
    transform: translateX(-30px);
  }
  to { 
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from { 
    opacity: 0;
    transform: translateX(30px);
  }
  to { 
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes zoomIn {
  from { 
    opacity: 0;
    transform: scale(0.85);
  }
  to { 
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

/* ===== ANIMACIONES AVANZADAS ===== */
@keyframes gradientFlow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.5;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes rotateIn {
  from {
    transform: rotate(-10deg) scale(0.9);
    opacity: 0;
  }
  to {
    transform: rotate(0) scale(1);
    opacity: 1;
  }
}

@keyframes slideInBottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes blurIn {
  from {
    filter: blur(10px);
    opacity: 0;
  }
  to {
    filter: blur(0);
    opacity: 1;
  }
}

@keyframes borderPulse {
  0% {
    border-color: rgba(58, 134, 255, 0.4);
  }
  50% {
    border-color: rgba(58, 134, 255, 0.8);
  }
  100% {
    border-color: rgba(58, 134, 255, 0.4);
  }
}

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

.pulse {
  animation-name: pulse;
}

/* Delay para crear efecto cascada */

/* ===== ANIMACIONES PARA COMPONENTES ESPECÍFICOS ===== */

/* Header y navegación */
.header {
  transition: transform 0.4s cubic-bezier(0.215, 0.61, 0.355, 1), 
              background-color 0.3s ease, 
              box-shadow 0.3s ease, 
              padding 0.3s ease;
}

.header.scrolled .logo img {
  transform: scale(0.9);
}

.nav-menu a {
  transition: color 0.3s ease, transform 0.3s ease;
  position: relative;
}

.nav-menu a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary);
  transition: width 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
  border-radius: 2px;
  opacity: 0.7;
}

.nav-menu a:hover::after {
  width: 100%;
}

/* Botones con efecto avanzado de ondas */
.btn {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              box-shadow 0.3s ease, 
              background-color 0.3s ease;
}

.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  transform: scale(0);
  animation: ripple 0.6s linear;
}

/* Hero content animation */
.hero-title {
  animation: fadeInUp 1s ease-out;
}

.hero-subtitle {
  animation: fadeInUp 1s ease-out 0.2s both;
}

.hero-buttons .btn:first-of-type {
  animation: fadeInUp 1s ease-out 0.4s both;
}

.hero-buttons .btn:last-of-type {
  animation: fadeInUp 1s ease-out 0.6s both;
}

.hero-features {
  animation: fadeInUp 1s ease-out 0.8s both;
}

/* Animaciones para las formas del fondo del hero */
.hero-shape {
  animation: morphing 15s ease-in-out infinite alternate;
}

@keyframes morphing {
  0% {
    border-radius: 40% 60% 70% 30% / 40% 40% 60% 50%;
  }
  25% {
    border-radius: 70% 30% 50% 50% / 30% 30% 70% 70%;
  }
  50% {
    border-radius: 30% 70% 70% 30% / 50% 60% 30% 60%;
  }
  75% {
    border-radius: 50% 50% 20% 80% / 60% 30% 70% 40%;
  }
  100% {
    border-radius: 40% 60% 30% 70% / 60% 30% 70% 40%;
  }
}

/* Card animations */
.professional-card,
.price-card,
.reason-card,
.disorder-item,
.info-card,
.contact-item,
.about-card {
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              box-shadow 0.4s ease, 
              border-color 0.3s ease;
}

.price-card.featured {
  animation: pulse 3s infinite ease-in-out;
}

/* Tarjetas con efecto 3D suave */
.professional-card,
.price-card,
.reason-card {
  transform-style: preserve-3d;
  perspective: 1000px;
}

/* Efecto hover de tarjetas 3D */
.professional-card:hover .professional-card-inner,
.price-card:hover .price-card-inner,
.reason-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-lg);
}

/* Efectos especiales para íconos */
.reason-icon,
.disorder-icon,
.info-icon,
.contact-icon {
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.reason-card:hover .reason-icon,
.disorder-item:hover .disorder-icon,
.info-card:hover .info-icon,
.contact-item:hover .contact-icon {
  transform: scale(1.1);
  background-color: var(--primary);
  color: white;
}

/* Efecto de carga para imágenes */

/* Carousel fade animation */

/* Animaciones para la sección "About" */
.about-card {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* Animaciones para elementos del formulario */
.form-group {
  position: relative;
  overflow: hidden;
}

.form-control {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-highlight {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(to right, var(--primary), var(--accent));
  transition: width 0.3s ease;
  z-index: 0;
}

.form-control:focus + .form-highlight {
  width: 100%;
}

/* Animaciones para secciones lazy loaded */
.lazy-section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.215, 0.61, 0.355, 1), 
              transform 0.8s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.lazy-section.loaded {
  opacity: 1;
  transform: translateY(0);
}

/* Animaciones para elementos dentro de las secciones */
.animate-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.215, 0.61, 0.355, 1), 
              transform 0.6s cubic-bezier(0.215, 0.61, 0.355, 1);
  transition-delay: var(--delay, 0s);
}

.loaded .animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* Efecto de brillo para elementos destacados */

/* Botones flotantes con animación mejorada */
.floating-buttons a {
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-buttons a:hover {
  transform: scale(1.15) rotate(5deg);
}

.floating-tooltip {
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  transform: translateX(10px) translateY(-50%);
}

.whatsapp-btn:hover .floating-tooltip,
.calendar-btn:hover .floating-tooltip {
  transform: translateX(0) translateY(-50%);
}

/* Footer links animation */
.footer-links a {
  transition: all 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
  display: inline-block;
  position: relative;
}

.footer-links a::before {
  content: '→';
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
  position: absolute;
  left: -20px;
}

.footer-links a:hover {
  padding-left: 20px;
}

.footer-links a:hover::before {
  opacity: 1;
  transform: translateX(0);
}

/* Scroll indicator animation */
.scroll-indicator {
  animation: fadeInUp 1s ease 1.5s both;
}

.scroll-icon::before {
  animation: scrollIndicator 2s infinite;
}

@keyframes scrollIndicator {
  0% {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) translateY(15px);
    opacity: 0;
  }
}

/* Animaciones para el preloader */
.preloader {
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader-logo {
  animation: pulse 2s ease-in-out infinite;
}

.preloader-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Animaciones para el menú móvil */
.mobile-toggle {
  transition: transform 0.3s ease;
}

.mobile-toggle:hover {
  transform: scale(1.1);
}

.toggle-icon, 
.toggle-icon::before, 
.toggle-icon::after {
  transition: all 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
}

/* Responsive ajustments */
@media (max-width: 768px) {
  
  .hero-features {
    animation-delay: 0.4s;
  }
}

/* Accesibilidad: respeta la preferencia de reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
