/* ===================================================================
   FERAITECH - ANIMACIONES Y MICROINTERACCIONES
   Inspirado en Apple y Revolut - Animaciones fluidas y elegantes
   =================================================================== */

/* ===================
   SCROLL ANIMATIONS
   =================== */
@keyframes fadeInUp {
  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 fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Clases para animaciones de scroll */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll.animate {
  opacity: 1;
  transform: translateY(0);
}

.animate-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-left.animate {
  opacity: 1;
  transform: translateX(0);
}

.animate-right {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-right.animate {
  opacity: 1;
  transform: translateX(0);
}

.animate-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-scale.animate {
  opacity: 1;
  transform: scale(1);
}

/* ===================
   LOADING ANIMATIONS
   =================== */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    transform: translate3d(0, 0, 0);
  }
  40%, 43% {
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
    transform: translate3d(0, -30px, 0);
  }
  70% {
    animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
    transform: translate3d(0, -15px, 0);
  }
  90% {
    transform: translate3d(0, -4px, 0);
  }
}

.loading-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.loading-spin {
  animation: spin 1s linear infinite;
}

.loading-bounce {
  animation: bounce 1s infinite;
}

/* ===================
   TEXT ANIMATIONS
   =================== */
@keyframes typewriter {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

@keyframes blinkCursor {
  from, to {
    border-color: transparent;
  }
  50% {
    border-color: var(--color-primary);
  }
}

.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--color-primary);
  white-space: nowrap;
  animation: typewriter 3s steps(40, end), blinkCursor 0.75s step-end infinite;
}

/* Gradient text animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.animated-gradient {
  background: linear-gradient(-45deg, var(--color-primary), var(--color-accent), var(--color-primary-light), var(--color-accent-orange));
  background-size: 400% 400%;
  animation: gradientShift 3s ease infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===================
   HOVER ANIMATIONS
   =================== */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.hover-scale {
  transition: transform var(--transition-base);
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-glow {
  position: relative;
  transition: all var(--transition-base);
}

.hover-glow::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  padding: 2px;
  background: var(--gradient-primary);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: xor;
  -webkit-mask-composite: xor;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.hover-glow:hover::before {
  opacity: 1;
}

/* ===================
   CARD FLIP ANIMATION
   =================== */
.flip-card {
  background-color: transparent;
  perspective: 1000px;
  height: 400px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
}

.flip-card-front {
  background: var(--color-white);
}

.flip-card-back {
  background: var(--gradient-primary);
  color: var(--color-white);
  transform: rotateY(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: var(--space-8);
}

/* ===================
   PROGRESS ANIMATIONS
   =================== */
@keyframes fillProgress {
  from {
    width: 0%;
  }
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--color-gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  animation: fillProgress 2s ease-out;
  transition: width var(--transition-base);
}

/* ===================
   MODAL ANIMATIONS
   =================== */
@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes backdropFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-backdrop {
  animation: backdropFadeIn 0.3s ease-out;
}

.modal-content {
  animation: modalSlideIn 0.3s ease-out;
}

/* ===================
   RIPPLE EFFECT
   =================== */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.ripple:active::before {
  width: 300px;
  height: 300px;
}

/* ===================
   PARTICLE BACKGROUND
   =================== */
@keyframes float-particles {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  33% {
    transform: translateY(-30px) rotate(120deg);
  }
  66% {
    transform: translateY(30px) rotate(240deg);
  }
}

.particle-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--color-primary);
  border-radius: 50%;
  opacity: 0.3;
  animation: float-particles 6s ease-in-out infinite;
}

/* ===================
   SCROLL INDICATOR
   =================== */
.scroll-indicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--color-gray-200);
  z-index: var(--z-fixed);
}

.scroll-progress {
  height: 100%;
  background: var(--gradient-primary);
  transform-origin: left;
  transition: transform 0.1s ease-out;
}

/* ===================
   STAGGER ANIMATIONS
   =================== */
.stagger-item {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-item.animate {
  opacity: 1;
  transform: translateY(0);
}

.stagger-item:nth-child(1) { transition-delay: 0.1s; }
.stagger-item:nth-child(2) { transition-delay: 0.2s; }
.stagger-item:nth-child(3) { transition-delay: 0.3s; }
.stagger-item:nth-child(4) { transition-delay: 0.4s; }
.stagger-item:nth-child(5) { transition-delay: 0.5s; }
.stagger-item:nth-child(6) { transition-delay: 0.6s; }

/* ===================
   MAGNETIC BUTTON EFFECT
   =================== */
.magnetic-btn {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.magnetic-btn:hover {
  transform: scale(1.02);
}

/* ===================
   SMOOTH SCROLL SNAP
   =================== */
.scroll-snap-container {
  scroll-snap-type: y mandatory;
  overflow-y: scroll;
  height: 100vh;
}

.scroll-snap-section {
  scroll-snap-align: start;
  min-height: 100vh;
}

/* ===================
   COOKIE NOTICE ANIMATION
   =================== */
.cookie-notice {
  position: fixed;
  bottom: -100px;
  left: 0;
  right: 0;
  background: var(--color-white);
  border-top: 1px solid var(--color-gray-200);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-modal);
  transition: bottom var(--transition-base);
}

.cookie-notice.show {
  bottom: 0;
}

.cookie-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  max-width: var(--container-xl);
  margin: 0 auto;
}

.cookie-actions {
  display: flex;
  gap: var(--space-3);
}

@media (max-width: 768px) {
  .cookie-content {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }
}

/* ===================
   PRELOADER
   =================== */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease-out;
}

.preloader.fade-out {
  opacity: 0;
  pointer-events: none;
}

.preloader-logo {
  animation: pulse 2s ease-in-out infinite;
}

/* ===================
   PARALLAX EFFECT
   =================== */
.parallax {
  transform: translateZ(0);
  transition: transform 0.1s ease-out;
}

/* ===================
   REDUCE MOTION
   =================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .animate-on-scroll,
  .animate-left,
  .animate-right,
  .animate-scale {
    opacity: 1;
    transform: none;
  }
}