/* ============================================================
   RD Vendora - Animations & Keyframes
   ============================================================ */

/* ---- 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(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

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

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

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

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

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

@keyframes slideOutRight {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

/* ---- Toast Animations ---- */
@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* ---- Modal Animations ---- */
@keyframes modalBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

/* ---- Counter Animation ---- */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Pulse ---- */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

/* ---- Bounce ---- */
@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

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

/* ---- Ripple ---- */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ---- Glow Pulse ---- */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.2);
  }
  50% {
    box-shadow: 0 0 40px rgba(79, 70, 229, 0.4);
  }
}

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

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

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

/* ---- Dot Pulse (loading) ---- */
@keyframes dotPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }
}

/* ---- Draw Line ---- */
@keyframes drawLine {
  from {
    stroke-dashoffset: 1000;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* ---- Reveal Mask ---- */
@keyframes revealMask {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

/* ---- Stagger Children ---- */
@keyframes staggerFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ---- Entrance Animations ---- */
.anim-fade-in {
  animation: fadeIn 0.4s ease forwards;
}

.anim-fade-in-up {
  animation: fadeInUp 0.5s ease forwards;
}

.anim-fade-in-down {
  animation: fadeInDown 0.5s ease forwards;
}

.anim-fade-in-left {
  animation: fadeInLeft 0.5s ease forwards;
}

.anim-fade-in-right {
  animation: fadeInRight 0.5s ease forwards;
}

.anim-scale-in {
  animation: scaleIn 0.3s ease forwards;
}

/* ---- Exit Animations ---- */
.anim-fade-out {
  animation: fadeOut 0.3s ease forwards;
}

.anim-scale-out {
  animation: scaleOut 0.2s ease forwards;
}

/* ---- Continuous Animations ---- */
.anim-pulse {
  animation: pulse 2s ease-in-out infinite;
}

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

.anim-bounce {
  animation: bounce 2s ease infinite;
}

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

.anim-glow-pulse {
  animation: glowPulse 2s ease-in-out infinite;
}

.anim-shake {
  animation: shake 0.5s ease;
}

/* ---- Animation Delays ---- */
.anim-delay-1 { animation-delay: 0.1s; opacity: 0; }
.anim-delay-2 { animation-delay: 0.2s; opacity: 0; }
.anim-delay-3 { animation-delay: 0.3s; opacity: 0; }
.anim-delay-4 { animation-delay: 0.4s; opacity: 0; }
.anim-delay-5 { animation-delay: 0.5s; opacity: 0; }
.anim-delay-6 { animation-delay: 0.6s; opacity: 0; }
.anim-delay-7 { animation-delay: 0.7s; opacity: 0; }
.anim-delay-8 { animation-delay: 0.8s; opacity: 0; }

/* Fix for animation-delay elements - ensure they become visible */
.anim-delay-1, .anim-delay-2, .anim-delay-3, .anim-delay-4,
.anim-delay-5, .anim-delay-6, .anim-delay-7, .anim-delay-8 {
  animation-fill-mode: forwards;
}

/* ---- Stagger Grid Children ---- */
.stagger-children > * {
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.5s; }
.stagger-children > *:nth-child(11) { animation-delay: 0.55s; }
.stagger-children > *:nth-child(12) { animation-delay: 0.6s; }

/* ---- Ripple Button Effect ---- */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  width: 100px;
  height: 100px;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  transform: scale(0);
  pointer-events: none;
}

.btn-ripple:active::after {
  animation: ripple 0.6s ease-out;
  left: var(--ripple-x, 50%);
  top: var(--ripple-y, 50%);
  margin-left: -50px;
  margin-top: -50px;
}

/* ---- Scroll Reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* ---- Loading Dots ---- */
.loading-dots {
  display: inline-flex;
  gap: 4px;
}

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

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

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

/* ---- Shimmer Effect (for loading states) ---- */
.shimmer {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ---- Card Hover Effects ---- */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

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

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

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

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

/* ---- Icon Animations ---- */
.icon-spin-on-hover:hover svg,
.icon-spin-on-hover:hover .icon {
  animation: spin 0.5s ease;
}

.icon-bounce-on-hover:hover svg,
.icon-bounce-on-hover:hover .icon {
  animation: bounce 0.5s ease;
}

/* ---- Progress Ring Animation ---- */
.progress-ring-circle {
  transition: stroke-dashoffset 0.5s ease;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* ---- Notification Badge Pulse ---- */
.badge-pulse {
  position: relative;
}

.badge-pulse::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
  animation: pulse 2s ease-in-out infinite;
}

/* ---- Smooth Page Transitions ---- */
.page-enter {
  animation: fadeIn 0.3s ease forwards;
}

.page-exit {
  animation: fadeOut 0.2s ease forwards;
}

/* ---- Gradient Text Animation ---- */
.gradient-text-animated {
  background: linear-gradient(90deg, #4f46e5, #7c3aed, #ec4899, #4f46e5);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 4s ease infinite;
}

/* ---- Focus Ring Animation ---- */
.focus-ring-animate:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-light);
  animation: glowPulse 2s ease-in-out infinite;
}

/* ---- Drawer Slide ---- */
.drawer-slide-in {
  animation: slideInRight 0.3s ease forwards;
}

.drawer-slide-out {
  animation: slideOutRight 0.3s ease forwards;
}

/* ---- Dropdown Menu Animation ---- */
.dropdown-menu-anim {
  animation: fadeInDown 0.2s ease forwards;
}

/* ---- Tooltip Animation ---- */
.tooltip-anim {
  animation: fadeIn 0.15s ease forwards;
}

/* ---- Image Zoom on Hover ---- */
.img-zoom {
  overflow: hidden;
}

.img-zoom img {
  transition: transform var(--transition-slow);
}

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

/* ---- Underline Hover Effect ---- */
.hover-underline {
  position: relative;
}

.hover-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width var(--transition-base);
}

.hover-underline:hover::after {
  width: 100%;
}

/* ---- Glass Reflection Effect ---- */
.glass-reflection {
  position: relative;
  overflow: hidden;
}

.glass-reflection::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to bottom right,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0) 40%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0) 60%,
    rgba(255,255,255,0) 100%
  );
  transform: rotate(45deg);
  animation: shimmer 3s ease-in-out infinite;
  pointer-events: none;
}

/* ---- Confetti-like Celebration ---- */
@keyframes confetti {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-100px) rotate(720deg);
  }
}

.celebration-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confetti 1s ease-out forwards;
}
