/* ============================================
   ENGLISH M3AYA — Animations
   ============================================ */

/* --- Keyframes --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

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

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

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

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

@keyframes successPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

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

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

@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 progressGlow {
  0%, 100% { box-shadow: 0 0 5px rgba(212, 175, 55, 0.3); }
  50% { box-shadow: 0 0 15px rgba(212, 175, 55, 0.6); }
}

/* --- Animation Classes --- */
.animate-fade-in {
  animation: fadeIn var(--transition-slow) forwards;
}

.animate-fade-in-up {
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-in-down {
  animation: fadeInDown 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-slide-left {
  animation: slideInLeft 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-slide-right {
  animation: slideInRight 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease-out;
}

.animate-bounce-in {
  animation: bounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

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

/* --- Staggered Children --- */
.stagger-children > * {
  opacity: 0;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.04s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.08s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.12s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.16s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.20s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.24s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.28s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.32s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.36s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.40s; }
.stagger-children > *:nth-child(11) { animation-delay: 0.44s; }
.stagger-children > *:nth-child(12) { animation-delay: 0.48s; }
.stagger-children > *:nth-child(13) { animation-delay: 0.52s; }
.stagger-children > *:nth-child(14) { animation-delay: 0.56s; }
.stagger-children > *:nth-child(15) { animation-delay: 0.60s; }
.stagger-children > *:nth-child(16) { animation-delay: 0.64s; }
.stagger-children > *:nth-child(17) { animation-delay: 0.68s; }
.stagger-children > *:nth-child(18) { animation-delay: 0.72s; }
.stagger-children > *:nth-child(19) { animation-delay: 0.76s; }
.stagger-children > *:nth-child(20) { animation-delay: 0.80s; }

/* --- Skeleton Loading --- */
.skeleton {
  background: var(--color-border);
  animation: skeletonPulse 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
  width: 80%;
}

.skeleton-title {
  height: 20px;
  margin-bottom: var(--space-3);
  width: 60%;
}

.skeleton-image {
  aspect-ratio: 16/9;
  width: 100%;
}

/* --- Page Transition --- */
.page-enter {
  animation: pageFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: opacity;
}

@keyframes pageFadeIn {
  from {
    opacity: 0.2;
  }
  to {
    opacity: 1;
  }
}

/* --- Scroll Reveal Observer --- */
.reveal-on-scroll {
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity;
}

.reveal-on-scroll.in-view {
  opacity: 1;
}

/* --- Hover microinteractions --- */
.hover-lift {
  transition: transform var(--transition-slow), box-shadow var(--transition-slow), border-color var(--transition);
  will-change: transform, box-shadow;
}
.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.03);
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

/* --- Success checkmark animation --- */
.success-checkmark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  animation: bounceIn 0.5s ease-out;
}

/* --- Progress ring glow --- */
.progress-glow {
  animation: progressGlow 2s ease-in-out infinite;
}

/* --- Tooltip --- */
.tooltip {
  position: relative;
}
.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--color-primary-dark);
  color: white;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  pointer-events: none;
  z-index: 100;
}
.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

[data-theme="dark"] .tooltip::after {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}
