/* ==========================================
   ANIMATIONS & EFFECTS
   ========================================== */

/* ==========================================
   KEYFRAME ANIMATIONS
   ========================================== */

@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 slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

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

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

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

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

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

@keyframes glow {
  0%, 100% {
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
  }
  50% {
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.6), 0 0 40px rgba(59, 130, 246, 0.4);
  }
}

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

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes bounce {
  0%, 20%, 53%, 80%, 100% {
    transform: translateY(0);
  }
  40%, 43% {
    transform: translateY(-30px);
  }
  70% {
    transform: translateY(-15px);
  }
  90% {
    transform: translateY(-4px);
  }
}

@keyframes wiggle {
  0%, 7% {
    transform: rotateZ(0);
  }
  15% {
    transform: rotateZ(-15deg);
  }
  20% {
    transform: rotateZ(10deg);
  }
  25% {
    transform: rotateZ(-10deg);
  }
  30% {
    transform: rotateZ(6deg);
  }
  35% {
    transform: rotateZ(-4deg);
  }
  40%, 100% {
    transform: rotateZ(0);
  }
}

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

@keyframes heartbeat {
  0%, 40%, 80%, 100% {
    transform: scale(1);
  }
  20%, 60% {
    transform: scale(1.15);
  }
}

@keyframes rainbow {
  0% { color: #ff0000; }
  16.666% { color: #ff8000; }
  33.333% { color: #ffff00; }
  50% { color: #00ff00; }
  66.666% { color: #0080ff; }
  83.333% { color: #8000ff; }
  100% { color: #ff0000; }
}

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

/* ==========================================
   FUN MODE ANIMATIONS
   ========================================== */

/* Fun Mode Bounce Animation */
[data-mode="fun"] .btn {
  animation: bounce 2s infinite;
}

[data-mode="fun"] .btn:hover {
  animation: heartbeat 1s infinite;
}

/* Fun Mode Wiggle Animation */
[data-mode="fun"] .product-card:hover {
  animation: wiggle 0.5s ease-in-out;
}

[data-mode="fun"] .feature-card:hover {
  animation: wiggle 0.5s ease-in-out;
}

/* Fun Mode Logo Animation */
[data-mode="fun"] .logo-text {
  animation: rainbow 3s linear infinite;
}

[data-mode="fun"] .hero-char {
  animation: glow 2s ease-in-out infinite alternate, pulse 3s ease-in-out infinite;
}

/* Fun Mode Gradient Background */
[data-mode="fun"] .hero {
  background: linear-gradient(-45deg, #ff6b6b, #4ecdc4, #45b7d1, #ffd93d);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

[data-mode="fun"] .products {
  background: linear-gradient(-45deg, #ffd93d, #ff6b6b, #4ecdc4, #45b7d1);
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
}

/* Fun Mode Floating Elements */
[data-mode="fun"] .floating-card {
  animation: float 3s ease-in-out infinite, pulse 2s ease-in-out infinite;
}

[data-mode="fun"] .floating-card:nth-child(1) {
  animation-delay: 0s;
}

[data-mode="fun"] .floating-card:nth-child(2) {
  animation-delay: 1s;
}

[data-mode="fun"] .floating-card:nth-child(3) {
  animation-delay: 2s;
}

/* Fun Mode Button Enhancements */
[data-mode="fun"] .btn::before {
  content: '🚀';
  margin-right: 5px;
}

[data-mode="fun"] .btn-primary::before {
  content: '⭐';
}

[data-mode="fun"] .btn-secondary::before {
  content: '🎯';
}

/* Fun Mode Icon Animations */
[data-mode="fun"] .feature-icon {
  animation: rotate 20s linear infinite;
}

[data-mode="fun"] .product-icon {
  animation: float 3s ease-in-out infinite;
}

/* Fun Mode Text Effects */
[data-mode="fun"] .section-title {
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #ffd93d);
  background-size: 400% 400%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
}

/* ==========================================
   CURSOR TRAIL ANIMATION (FUN MODE)
   ========================================== */

.cursor-trail {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

[data-mode="fun"] .cursor-trail {
  opacity: 1;
}

.cursor-trail::before {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  animation: trailFade 1s ease-out forwards;
}

@keyframes trailFade {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0);
  }
}

/* ==========================================
   CONFETTI ANIMATION (FUN MODE)
   ========================================== */

.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

[data-mode="fun"] .confetti-container {
  opacity: 1;
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--primary);
  animation: confettiFall 3s ease-out forwards;
}

.confetti-piece:nth-child(odd) {
  background: var(--secondary);
  animation-duration: 2.5s;
}

.confetti-piece:nth-child(3n) {
  background: var(--accent);
  animation-duration: 3.5s;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ==========================================
   PARTICLES ANIMATION
   ========================================== */

.particles {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0.6;
  animation: particleFloat 20s linear infinite;
}

.particle:nth-child(2n) {
  background: var(--secondary);
  animation-duration: 15s;
}

.particle:nth-child(3n) {
  background: var(--accent);
  animation-duration: 25s;
}

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

/* ==========================================
   LOADING ANIMATIONS
   ========================================== */

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: dotBounce 1.4s ease-in-out infinite both;
}

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

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

/* ==========================================
   HOVER EFFECTS
   ========================================== */

.hover-lift {
  transition: transform var(--transition-fast);
}

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

.hover-scale {
  transition: transform var(--transition-fast);
}

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

.hover-glow {
  transition: box-shadow var(--transition-fast);
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.hover-rotate {
  transition: transform var(--transition-fast);
}

.hover-rotate:hover {
  transform: rotate(5deg);
}

/* ==========================================
   SCROLL ANIMATIONS
   ========================================== */

.scroll-fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}

.scroll-fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-slide-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.8s ease-out;
}

.scroll-slide-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-slide-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.8s ease-out;
}

.scroll-slide-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-scale-in {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.8s ease-out;
}

.scroll-scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* ==========================================
   ACCESSIBILITY & REDUCED MOTION
   ========================================== */

@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;
  }
  
  /* Disable fun mode animations if reduced motion is preferred */
  [data-mode="fun"] * {
    animation: none !important;
  }
  
  .cursor-trail,
  .confetti-container {
    display: none !important;
  }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
  * {
    animation: none !important;
    transition: none !important;
  }
  
  .cursor-trail,
  .confetti-container,
  .particles {
    display: none !important;
  }
}

/* ==========================================
   UTILITY ANIMATION CLASSES
   ========================================== */

.animate-bounce {
  animation: bounce 1s infinite;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.animate-ping {
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

.animate-wiggle {
  animation: wiggle 1s ease-in-out;
}

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

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

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

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

.animate-rainbow {
  animation: rainbow 3s linear infinite;
}

/* ==========================================
   PERFORMANCE OPTIMIZATIONS
   ========================================== */

/* GPU acceleration for animations */
.gpu-accelerated {
  transform: translateZ(0);
  will-change: transform;
}

/* Optimize animations for 60fps */
.smooth-animation {
  animation-fill-mode: both;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Contain layout shifts */
.contain-layout {
  contain: layout;
}

.contain-style {
  contain: style;
}

.contain-paint {
  contain: paint;
}

/* ==========================================
   DARK MODE ANIMATION ADJUSTMENTS
   ========================================== */

[data-theme="dark"] .cursor-trail::before {
  background: var(--primary);
  box-shadow: 0 0 6px var(--primary);
}

[data-theme="dark"] .particle {
  opacity: 0.4;
}

[data-theme="dark"] .loading-spinner {
  border-color: var(--border-color);
  border-top-color: var(--primary);
}

[data-theme="dark"] .hover-glow:hover {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
}

[data-theme="gold"] .cursor-trail::before {
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
}

[data-theme="gold"] .particle {
  opacity: 0.6;
  box-shadow: 0 0 4px var(--primary);
}

[data-theme="gold"] .loading-spinner {
  border-color: var(--border-color);
  border-top-color: var(--primary);
}

[data-theme="gold"] .hover-glow:hover {
  box-shadow: 0 0 20px rgba(204, 153, 51, 0.8), 0 0 40px rgba(204, 153, 51, 0.4);
}

/* Gold theme special effects */
[data-theme="gold"] .hero-char {
  text-shadow: 0 0 20px rgba(204, 153, 51, 0.8), 0 0 40px rgba(204, 153, 51, 0.4);
}

[data-theme="gold"] .btn-primary {
  box-shadow: 0 0 20px rgba(204, 153, 51, 0.3);
}

[data-theme="gold"] .btn-primary:hover {
  box-shadow: 0 0 30px rgba(204, 153, 51, 0.6), 0 0 60px rgba(204, 153, 51, 0.3);
}

[data-theme="gold"] .product-card:hover,
[data-theme="gold"] .feature-card:hover {
  box-shadow: var(--shadow-xl), 0 0 20px rgba(204, 153, 51, 0.3);
}