/* ==========================================================================
   LearnToday Advanced Animation System
   Creative 마이크로 인터랙션 & 시각적 피드백
   ========================================================================== */

/* ==========================================================================
   🎬 Core Animation Keyframes Library
   ========================================================================== */

/* Fade Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

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

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

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

/* Scale Animations */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

/* Rotate Animations */
@keyframes rotateIn {
  from {
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
  }
  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

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

/* Bounce Animations */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes bounceHorizontal {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(10px);
  }
}

/* Slide Animations */
@keyframes slideInUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

/* Zoom Animations */
@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 1;
  }
  to {
    transform: scale(1);
  }
}

@keyframes zoomOut {
  from {
    transform: scale(1);
  }
  50% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: scale(0);
  }
}

/* Flip Animations */
@keyframes flipInX {
  from {
    transform: perspective(800px) rotateX(-90deg);
    opacity: 0;
  }
  to {
    transform: perspective(800px) rotateX(0deg);
    opacity: 1;
  }
}

@keyframes flipInY {
  from {
    transform: perspective(800px) rotateY(-90deg);
    opacity: 0;
  }
  to {
    transform: perspective(800px) rotateY(0deg);
    opacity: 1;
  }
}

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

@keyframes wiggle {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-5deg);
  }
  75% {
    transform: rotate(5deg);
  }
}

/* Glow & Shimmer */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.8), 0 0 30px rgba(255, 107, 107, 0.6);
  }
}

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

/* Typing Effect */
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

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

/* Gradient Animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

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

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

/* Progress Bar */
@keyframes progressLoad {
  from {
    width: 0%;
  }
  to {
    width: 100%;
  }
}

/* ==========================================================================
   🎯 Animation Utility Classes
   ========================================================================== */

/* Fade In Series */
.animate-fade-in {
  animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-fade-in-up {
  animation: fadeInUp 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-fade-in-down {
  animation: fadeInDown 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-fade-in-left {
  animation: fadeInLeft 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-fade-in-right {
  animation: fadeInRight 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scale Series */
.animate-scale-in {
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.animate-scale-pulse {
  animation: scalePulse 1.5s ease-in-out infinite;
}

/* Bounce Series */
.animate-bounce-in {
  animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.animate-bounce-horizontal {
  animation: bounceHorizontal 1s ease-in-out infinite;
}

/* Slide Series */
.animate-slide-in-up {
  animation: slideInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-slide-in-down {
  animation: slideInDown 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-slide-in-left {
  animation: slideInLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-slide-in-right {
  animation: slideInRight 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Zoom Series */
.animate-zoom-in {
  animation: zoomIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-zoom-out {
  animation: zoomOut 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Flip Series */
.animate-flip-in-x {
  animation: flipInX 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-flip-in-y {
  animation: flipInY 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Rotate Series */
.animate-rotate-in {
  animation: rotateIn 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Special Effects */
.animate-shake {
  animation: shake 0.8s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

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

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

.animate-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

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

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

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

/* ==========================================================================
   ⏱️ Animation Duration Modifiers
   ========================================================================== */

.duration-75 { animation-duration: 75ms !important; }
.duration-100 { animation-duration: 100ms !important; }
.duration-150 { animation-duration: 150ms !important; }
.duration-200 { animation-duration: 200ms !important; }
.duration-300 { animation-duration: 300ms !important; }
.duration-500 { animation-duration: 500ms !important; }
.duration-700 { animation-duration: 700ms !important; }
.duration-1000 { animation-duration: 1000ms !important; }
.duration-1500 { animation-duration: 1500ms !important; }
.duration-2000 { animation-duration: 2000ms !important; }

/* ==========================================================================
   ⏰ Animation Delay System - Stagger Effects
   ========================================================================== */

.delay-75 { animation-delay: 75ms !important; }
.delay-100 { animation-delay: 100ms !important; }
.delay-150 { animation-delay: 150ms !important; }
.delay-200 { animation-delay: 200ms !important; }
.delay-300 { animation-delay: 300ms !important; }
.delay-500 { animation-delay: 500ms !important; }
.delay-700 { animation-delay: 700ms !important; }
.delay-1000 { animation-delay: 1000ms !important; }

/* Stagger delays for grid items */
.stagger-1:nth-child(1) { animation-delay: 0ms; }
.stagger-1:nth-child(2) { animation-delay: 100ms; }
.stagger-1:nth-child(3) { animation-delay: 200ms; }
.stagger-1:nth-child(4) { animation-delay: 300ms; }
.stagger-1:nth-child(5) { animation-delay: 400ms; }
.stagger-1:nth-child(6) { animation-delay: 500ms; }
.stagger-1:nth-child(7) { animation-delay: 600ms; }
.stagger-1:nth-child(8) { animation-delay: 700ms; }
.stagger-1:nth-child(9) { animation-delay: 800ms; }

.stagger-2:nth-child(1) { animation-delay: 0ms; }
.stagger-2:nth-child(2) { animation-delay: 150ms; }
.stagger-2:nth-child(3) { animation-delay: 300ms; }
.stagger-2:nth-child(4) { animation-delay: 450ms; }
.stagger-2:nth-child(5) { animation-delay: 600ms; }
.stagger-2:nth-child(6) { animation-delay: 750ms; }

/* ==========================================================================
   🔄 Animation Iteration & Fill Mode
   ========================================================================== */

.animate-once { animation-iteration-count: 1 !important; }
.animate-twice { animation-iteration-count: 2 !important; }
.animate-infinite { animation-iteration-count: infinite !important; }

.fill-forwards { animation-fill-mode: forwards !important; }
.fill-backwards { animation-fill-mode: backwards !important; }
.fill-both { animation-fill-mode: both !important; }

/* ==========================================================================
   🎭 Hover-Triggered Animations
   ========================================================================== */

.hover-lift {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.hover-grow {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.hover-shrink {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hover-shrink:hover {
  transform: scale(0.95);
}

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

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

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

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

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

.hover-shimmer:hover {
  animation: shimmer 1.5s linear infinite;
}

/* ==========================================================================
   🎨 Scroll-Triggered Animations (for use with IntersectionObserver)
   ========================================================================== */

.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.scroll-reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.scroll-scale {
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* ==========================================================================
   💫 Parallax Effect Utilities
   ========================================================================== */

.parallax-slow {
  transition: transform 0.1s ease-out;
}

.parallax-medium {
  transition: transform 0.15s ease-out;
}

.parallax-fast {
  transition: transform 0.05s ease-out;
}

/* ==========================================================================
   🎪 Loading & Skeleton Animations
   ========================================================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    #f0f0f0 0%,
    #e0e0e0 50%,
    #f0f0f0 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

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

.loading-dots {
  display: inline-flex;
  gap: 0.5rem;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: bounce 1.4s infinite ease-in-out;
}

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

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

.loading-pulse {
  animation: scalePulse 2s ease-in-out infinite;
}

/* ==========================================================================
   🎯 3D Transform Effects
   ========================================================================== */

.tilt-3d {
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

.tilt-3d:hover {
  transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

.card-3d {
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-3d:hover {
  transform: perspective(1000px) rotateY(10deg) translateZ(20px);
}

/* ==========================================================================
   🌊 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;
}

/* ==========================================================================
   ♿ 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-reveal,
  .scroll-reveal-left,
  .scroll-reveal-right,
  .scroll-scale {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   🎬 Page Transition Animations
   ========================================================================== */

.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-transition-exit {
  opacity: 1;
  transform: translateY(0);
}

.page-transition-exit-active {
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.6, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.6, 1);
}

/* ==========================================================================
   🎨 Text Animation Effects
   ========================================================================== */

.text-gradient-animate {
  background: linear-gradient(
    90deg,
    #FF6B6B 0%,
    #4A5FE6 25%,
    #00D9FF 50%,
    #4A5FE6 75%,
    #FF6B6B 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s linear infinite;
}

.text-reveal {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid;
  animation: typing 3s steps(40) 1s, blink 0.75s step-end infinite;
}

/* ==========================================================================
   🎪 Micro-interactions
   ========================================================================== */

.button-press {
  transition: transform 0.1s ease;
}

.button-press:active {
  transform: scale(0.95);
}

.magnetic-hover {
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Will be controlled by JavaScript for true magnetic effect */
