/*
 * TapNex Arena - Advanced Animations & Interactions
 * Modern, smooth, and performant animations for enhanced UX
 */

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */
[data-reveal] {
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-reveal].revealed {
  opacity: 1;
}

[data-reveal="fadeIn"].revealed {
  animation: revealFadeIn 0.6s ease-out forwards;
}

[data-reveal="fadeInUp"].revealed {
  animation: revealFadeInUp 0.8s ease-out forwards;
}

[data-reveal="fadeInDown"].revealed {
  animation: revealFadeInDown 0.8s ease-out forwards;
}

[data-reveal="fadeInLeft"].revealed {
  animation: revealFadeInLeft 0.8s ease-out forwards;
}

[data-reveal="fadeInRight"].revealed {
  animation: revealFadeInRight 0.8s ease-out forwards;
}

[data-reveal="scaleIn"].revealed {
  animation: revealScaleIn 0.6s ease-out forwards;
}

[data-reveal="rotateIn"].revealed {
  animation: revealRotateIn 0.8s ease-out forwards;
}

/* Reveal animation delays */
[data-reveal-delay="100"].revealed { animation-delay: 0.1s; }
[data-reveal-delay="200"].revealed { animation-delay: 0.2s; }
[data-reveal-delay="300"].revealed { animation-delay: 0.3s; }
[data-reveal-delay="400"].revealed { animation-delay: 0.4s; }
[data-reveal-delay="500"].revealed { animation-delay: 0.5s; }

@keyframes revealFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

@keyframes revealScaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* ============================================
   BUTTON RIPPLE EFFECT
   ============================================ */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
  width: 300px;
  height: 300px;
}

/* ============================================
   HOVER EFFECTS
   ============================================ */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.hover-scale {
  transition: transform 0.3s ease;
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-glow {
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(102, 126, 234, 0.6);
  transform: translateY(-2px);
}

.hover-neon-glow:hover {
  box-shadow: 
    0 0 20px rgba(0, 245, 255, 0.6),
    0 0 40px rgba(0, 245, 255, 0.4),
    0 0 60px rgba(0, 245, 255, 0.2);
  transform: scale(1.02);
}

.hover-border-glow {
  position: relative;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.hover-border-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(45deg, #667eea, #a855f7, #00f5ff);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.hover-border-glow:hover::before {
  opacity: 1;
}

/* ============================================
   GRADIENT ANIMATIONS
   ============================================ */
.gradient-animated {
  background: linear-gradient(270deg, #667eea, #a855f7, #00f5ff, #667eea);
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.gradient-text-animated {
  background: linear-gradient(270deg, #667eea, #a855f7, #00f5ff, #ff006e);
  background-size: 400% 400%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 8s ease infinite;
}

/* ============================================
   LOADING STATES
   ============================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s ease-in-out infinite;
  border-radius: var(--radius-lg);
}

@keyframes skeletonLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner-lg {
  width: 60px;
  height: 60px;
  border-width: 6px;
}

.dots-loading {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.dots-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #667eea;
  animation: dotsBounce 1.4s infinite ease-in-out both;
}

.dots-loading span:nth-child(1) { animation-delay: -0.32s; }
.dots-loading span:nth-child(2) { animation-delay: -0.16s; }

@keyframes dotsBounce {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================================
   PROGRESS BARS
   ============================================ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #a855f7);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-bar-animated {
  animation: progressIndeterminate 1.5s ease-in-out infinite;
}

@keyframes progressIndeterminate {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* ============================================
   PARALLAX & SCROLL EFFECTS
   ============================================ */
.parallax {
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-fade {
  transition: opacity 0.5s ease;
}

/* ============================================
   PARTICLE EFFECTS
   ============================================ */
.particle-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  pointer-events: none;
  animation: particleFloat 10s linear infinite;
}

@keyframes particleFloat {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100vh) translateX(100px);
    opacity: 0;
  }
}

/* ============================================
   NEON GLOW EFFECTS
   ============================================ */
.neon-text {
  color: #00f5ff;
  text-shadow: 
    0 0 10px rgba(0, 245, 255, 0.8),
    0 0 20px rgba(0, 245, 255, 0.6),
    0 0 30px rgba(0, 245, 255, 0.4),
    0 0 40px rgba(0, 245, 255, 0.2);
  animation: neonPulse 2s ease-in-out infinite;
}

@keyframes neonPulse {
  0%, 100% {
    text-shadow: 
      0 0 10px rgba(0, 245, 255, 0.8),
      0 0 20px rgba(0, 245, 255, 0.6),
      0 0 30px rgba(0, 245, 255, 0.4),
      0 0 40px rgba(0, 245, 255, 0.2);
  }
  50% {
    text-shadow: 
      0 0 20px rgba(0, 245, 255, 1),
      0 0 30px rgba(0, 245, 255, 0.8),
      0 0 40px rgba(0, 245, 255, 0.6),
      0 0 50px rgba(0, 245, 255, 0.4),
      0 0 60px rgba(0, 245, 255, 0.2);
  }
}

.neon-border {
  border: 2px solid #00f5ff;
  box-shadow: 
    0 0 10px rgba(0, 245, 255, 0.6),
    inset 0 0 10px rgba(0, 245, 255, 0.3);
  animation: neonBorderPulse 2s ease-in-out infinite;
}

@keyframes neonBorderPulse {
  0%, 100% {
    box-shadow: 
      0 0 10px rgba(0, 245, 255, 0.6),
      inset 0 0 10px rgba(0, 245, 255, 0.3);
  }
  50% {
    box-shadow: 
      0 0 20px rgba(0, 245, 255, 0.9),
      inset 0 0 20px rgba(0, 245, 255, 0.5);
  }
}

/* ============================================
   MODAL & OVERLAY ANIMATIONS
   ============================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  z-index: var(--z-modal-backdrop);
  animation: fadeIn 0.3s ease;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: var(--z-modal);
  animation: modalSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ============================================
   TOOLTIP ANIMATIONS
   ============================================ */
.tooltip {
  position: absolute;
  padding: var(--space-2) var(--space-3);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: var(--z-tooltip);
  white-space: nowrap;
}

.tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   TRANSITION UTILITIES
   ============================================ */
.transition-all {
  transition: all 0.3s ease;
}

.transition-transform {
  transition: transform 0.3s ease;
}

.transition-opacity {
  transition: opacity 0.3s ease;
}

.transition-colors {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.transition-shadow {
  transition: box-shadow 0.3s ease;
}

/* ============================================
   HOVER STATE TRANSITIONS
   ============================================ */
.smooth-hover {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.smooth-hover:hover {
  transform: translateY(-4px);
}

/* ============================================
   PAGE TRANSITIONS
   ============================================ */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.6s ease;
}

.page-transition-exit {
  opacity: 1;
}

.page-transition-exit-active {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* ============================================
   GLASS MORPHISM WITH ANIMATION
   ============================================ */
.glass-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(102, 126, 234, 0.3);
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */
.gpu-accelerated {
  transform: translateZ(0);
  will-change: transform;
}

.smooth-scroll {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .animate-float,
  .animate-pulse,
  .animate-spin {
    animation: none !important;
  }
}
