/* ===================================
   ANIMATIONS & MICRO-INTERACTIONS
   =================================== */

/* ===================================
   PAGE LOAD ANIMATIONS
   =================================== */

.fade-in {
  animation: fadeIn 0.5s ease;
}

.fade-in-up {
  animation: fadeInUp 0.6s ease;
}

.fade-in-down {
  animation: fadeInDown 0.6s ease;
}

.slide-in-left {
  animation: slideInLeft 0.5s ease;
}

.slide-in-right {
  animation: slideInRight 0.5s ease;
}

@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 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);
  }
}

/* Stagger Delays */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }

/* ===================================
   HOVER ANIMATIONS
   =================================== */

.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

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

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

.hover-scale-sm:hover {
  transform: scale(1.02);
}

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

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

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

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(20, 184, 166, 0.4);
}

/* ===================================
   PULSE & BOUNCE
   =================================== */

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

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

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

@keyframes pulseRing {
  0% {
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.7);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(20, 184, 166, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0);
  }
}

.bounce {
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(-5%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

.bounce-slow {
  animation: bounceSlow 3s ease-in-out infinite;
}

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

/* ===================================
   WIGGLE & SHAKE
   =================================== */

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

@keyframes wiggle {
  0%, 100% {
    transform: rotate(-3deg);
  }
  50% {
    transform: rotate(3deg);
  }
}

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

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

/* ===================================
   SPIN & ROTATE
   =================================== */

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

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

.spin-slow {
  animation: spin 3s linear infinite;
}

/* ===================================
   PROGRESS & LOADING
   =================================== */

.progress-fill {
  animation: progressFill 1.5s ease-out forwards;
}

@keyframes progressFill {
  from {
    width: 0%;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--border) 0%,
    var(--background) 50%,
    var(--border) 100%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
}

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

/* ===================================
   NUMBER COUNT UP
   =================================== */

.count-up {
  animation: countUp 1.5s ease-out forwards;
}

@keyframes countUp {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===================================
   RIPPLE EFFECT
   =================================== */

.ripple {
  position: relative;
  overflow: hidden;
}

.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;
}

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

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

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

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

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

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

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

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

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

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

/* ===================================
   SUCCESS CHECKMARK
   =================================== */

.checkmark-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: checkmarkCircle 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

@keyframes checkmarkCircle {
  to {
    stroke-dashoffset: 0;
  }
}

.checkmark {
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: checkmark 0.3s 0.3s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

@keyframes checkmark {
  to {
    stroke-dashoffset: 0;
  }
}

/* ===================================
   GRADIENT ANIMATION
   =================================== */

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

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

/* ===================================
   FLOAT ANIMATION
   =================================== */

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

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

/* ===================================
   HEARTBEAT
   =================================== */

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

@keyframes heartbeat {
  0%, 100% {
    transform: scale(1);
  }
  10%, 30% {
    transform: scale(1.1);
  }
  20%, 40% {
    transform: scale(1);
  }
}

/* ===================================
   ATTENTION SEEKER
   =================================== */

.attention {
  animation: attention 2s ease-in-out infinite;
}

@keyframes attention {
  0%, 100% {
    transform: scale(1);
  }
  10%, 20% {
    transform: scale(1.1) rotate(-5deg);
  }
  15% {
    transform: scale(1.1) rotate(5deg);
  }
}

/* ===================================
   FLIP
   =================================== */

.flip {
  animation: flip 0.6s ease;
}

@keyframes flip {
  0% {
    transform: perspective(400px) rotateY(0);
  }
  100% {
    transform: perspective(400px) rotateY(360deg);
  }
}

/* ===================================
   SLIDE DOWN (for dropdowns)
   =================================== */

.slide-down {
  animation: slideDown 0.3s ease;
}

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

/* ===================================
   SLIDE UP (for modals)
   =================================== */

.slide-up {
  animation: slideUp 0.3s ease;
}

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

/* ===================================
   ZOOM IN
   =================================== */

.zoom-in {
  animation: zoomIn 0.3s ease;
}

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

/* ===================================
   BLINK
   =================================== */

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

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ===================================
   TYPING INDICATOR
   =================================== */

.typing-dot {
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* ===================================
   LANGUAGE WORD ROTATION ANIMATION
   =================================== */

.language-animator-glow {
  position: relative;
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--space-2xl) 0;
}

.language-animator {
  position: relative;
  width: 100%;
  height: 160px;
  display: block;
}

.language-word {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  text-align: center;
  font-size: 8rem;
  font-weight: 900;
  background: linear-gradient(135deg, #14b8a6 0%, #0891b2 50%, #ff6b6b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  line-height: 1.2;
  opacity: 0;
  animation: wordCycle 20s infinite;
  pointer-events: none;
}

/* Stagger each word by 2 seconds */
.language-word:nth-child(1) { animation-delay: 0s; }
.language-word:nth-child(2) { animation-delay: 2s; }
.language-word:nth-child(3) { animation-delay: 4s; }
.language-word:nth-child(4) { animation-delay: 6s; }
.language-word:nth-child(5) { animation-delay: 8s; }
.language-word:nth-child(6) { animation-delay: 10s; }
.language-word:nth-child(7) { animation-delay: 12s; }
.language-word:nth-child(8) { animation-delay: 14s; }
.language-word:nth-child(9) { animation-delay: 16s; }
.language-word:nth-child(10) { animation-delay: 18s; }

@keyframes wordCycle {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }
  5% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  10% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  15% {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
  100% {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
}

/* Glowing background effect */
.language-animator-glow::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.15) 0%, rgba(255, 107, 107, 0.1) 40%, transparent 70%);
  border-radius: 50%;
  filter: blur(40px);
  animation: glowPulse 4s ease-in-out infinite;
  z-index: 0;
  pointer-events: none;
}

.language-animator {
  position: relative;
  z-index: 1;
}

@keyframes glowPulse {
  0%, 100% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

/* ===================================
   FIRE ANIMATION FOR STREAK TRACKER
   =================================== */

.streak-fire-container {
  position: relative;
  width: 120px;
  height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Fire Emoji Container */
.fire-emoji {
  font-size: 5rem;
  line-height: 1;
  display: block;
  position: relative;
  z-index: 2;
}

/* Active Fire Animation */
.fire-emoji.active {
  animation: fireFlicker 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255, 107, 107, 0.6)) 
          drop-shadow(0 0 40px rgba(255, 138, 101, 0.4));
}

@keyframes fireFlicker {
  0%, 100% {
    transform: scale(1) translateY(0);
    filter: drop-shadow(0 0 20px rgba(255, 107, 107, 0.6)) 
            drop-shadow(0 0 40px rgba(255, 138, 101, 0.4))
            brightness(1);
  }
  25% {
    transform: scale(1.05) translateY(-3px);
    filter: drop-shadow(0 0 25px rgba(255, 107, 107, 0.8)) 
            drop-shadow(0 0 50px rgba(255, 138, 101, 0.5))
            brightness(1.1);
  }
  50% {
    transform: scale(0.98) translateY(2px);
    filter: drop-shadow(0 0 15px rgba(255, 107, 107, 0.5)) 
            drop-shadow(0 0 35px rgba(255, 138, 101, 0.3))
            brightness(0.95);
  }
  75% {
    transform: scale(1.03) translateY(-2px);
    filter: drop-shadow(0 0 22px rgba(255, 107, 107, 0.7)) 
            drop-shadow(0 0 45px rgba(255, 138, 101, 0.45))
            brightness(1.05);
  }
}

/* Dead Fire (No Streak) */
.fire-emoji.dead {
  filter: grayscale(100%) brightness(0.6);
  opacity: 0.5;
}

/* Glow Effect Behind Fire */
.fire-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(255, 107, 107, 0.3) 0%, rgba(255, 138, 101, 0.2) 40%, transparent 70%);
  border-radius: 50%;
  filter: blur(20px);
  z-index: 1;
  pointer-events: none;
  opacity: 0;
}

.fire-glow.active {
  opacity: 1;
  animation: fireGlowPulse 2s ease-in-out infinite;
}

@keyframes fireGlowPulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
}

/* Streak Stats */
.streak-stats {
  text-align: center;
  margin-top: var(--space-sm);
}

.streak-number {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  display: block;
  margin-bottom: var(--space-xs);
}

.streak-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ===================================
   REDUCED MOTION OVERRIDES
   =================================== */

@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;
  }
  
  .pulse,
  .bounce,
  .wiggle,
  .spin,
  .float,
  .heartbeat,
  .attention,
  .blink,
  .fire-emoji.active,
  .fire-glow.active {
    animation: none !important;
  }
  
  /* For reduced motion, show only the first word */
  .language-word {
    animation: none !important;
    opacity: 0 !important;
  }
  
  .language-word:nth-child(1) {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
  }
}

