/* ===================================
   AniFind - Animations & JJK Effects
   =================================== */

/* ===================================
   Domain Expansion Animation
   =================================== */

.domain-expansion {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.95), rgba(5, 5, 17, 0.98));
  backdrop-filter: blur(10px);
}

.domain-expansion.active {
  display: flex;
  animation: domainActivate 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.domain-circle {
  position: absolute;
  width: 600px;
  height: 600px;
  border: 3px solid var(--accent-teal);
  border-radius: 50%;
  box-shadow: 
    0 0 40px rgba(48, 231, 194, 0.8),
    inset 0 0 40px rgba(48, 231, 194, 0.4);
  animation: domainPulse 2s ease-in-out infinite;
}

@keyframes domainPulse {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.1) rotate(180deg);
    opacity: 1;
  }
}

.domain-circle::before,
.domain-circle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--accent-teal);
}

.domain-circle::before {
  width: 400px;
  height: 400px;
  animation: domainRing 3s linear infinite;
}

.domain-circle::after {
  width: 200px;
  height: 200px;
  animation: domainRing 2s linear infinite reverse;
}

@keyframes domainRing {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
    opacity: 0.6;
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
    opacity: 1;
  }
}

.domain-symbols {
  position: absolute;
  width: 600px;
  height: 600px;
  animation: symbolsRotate 20s linear infinite;
}

.domain-symbols span {
  position: absolute;
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent-teal);
  text-shadow: 0 0 20px rgba(48, 231, 194, 0.8);
  animation: symbolFloat 3s ease-in-out infinite;
}

.domain-symbols span:nth-child(1) {
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  animation-delay: 0s;
}

.domain-symbols span:nth-child(2) {
  top: 50%;
  right: 10%;
  transform: translateY(-50%);
  animation-delay: 0.5s;
}

.domain-symbols span:nth-child(3) {
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  animation-delay: 1s;
}

.domain-symbols span:nth-child(4) {
  top: 50%;
  left: 10%;
  transform: translateY(-50%);
  animation-delay: 1.5s;
}

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

@keyframes symbolFloat {
  0%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0.8;
  }
  50% {
    transform: translateY(-20px) scale(1.1);
    opacity: 1;
  }
}

.domain-text {
  position: relative;
  z-index: 1;
  font-size: 2.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-strong), var(--accent-teal));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite, textGlow 2s ease-in-out infinite;
  text-shadow: 0 0 40px rgba(48, 231, 194, 0.6);
}

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

@keyframes textGlow {
  0%, 100% {
    filter: drop-shadow(0 0 10px rgba(48, 231, 194, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(48, 231, 194, 0.8));
  }
}

/* ===================================
   Cursed Energy Particles
   =================================== */

.cursed-particle {
  position: fixed;
  width: 4px;
  height: 4px;
  background: var(--accent-teal);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(48, 231, 194, 0.8);
  animation: particleFloat 3s ease-in-out infinite;
  z-index: 10;
}

@keyframes particleFloat {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-100vh) translateX(calc(var(--drift) * 50px));
    opacity: 0;
  }
}

/* ===================================
   Card Animations
   =================================== */

.card-enter {
  animation: cardEnter 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) backwards;
}

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

/* Stagger animation for multiple cards */
.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.2s; }
.card:nth-child(5) { animation-delay: 0.25s; }
.card:nth-child(6) { animation-delay: 0.3s; }
.card:nth-child(7) { animation-delay: 0.35s; }
.card:nth-child(8) { animation-delay: 0.4s; }
.card:nth-child(9) { animation-delay: 0.45s; }

/* ===================================
   Loading Bar Animation (JJK Style)
   =================================== */

.loading-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(8, 10, 22, 0.8);
  z-index: 9998;
  overflow: hidden;
  display: none;
}

.loading-bar-container.active {
  display: block;
}

.loading-bar {
  height: 100%;
  background: linear-gradient(90deg, 
    var(--accent-teal) 0%, 
    var(--accent) 50%, 
    var(--accent-teal) 100%);
  background-size: 200% 100%;
  box-shadow: 0 0 10px rgba(48, 231, 194, 0.8);
  animation: loadingProgress 2s ease-in-out, loadingShimmer 1.5s linear infinite;
  transform-origin: left;
}

@keyframes loadingProgress {
  0% {
    transform: scaleX(0);
  }
  100% {
    transform: scaleX(1);
  }
}

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

/* ===================================
   Hover Effects & Interactions
   =================================== */

.btn-save.saving,
.btn-remove.removing {
  animation: buttonPulse 0.6s ease-in-out;
}

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

/* ===================================
   Ripple Effect
   =================================== */

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(48, 231, 194, 0.4);
  transform: scale(0);
  animation: rippleEffect 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleEffect {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ===================================
   Shake Animation (for errors)
   =================================== */

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

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* ===================================
   Success Checkmark Animation
   =================================== */

.success-check {
  animation: successBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes successBounce {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* ===================================
   Scroll Animations
   =================================== */

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

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

/* ===================================
   Smooth Scrolling Performance
   =================================== */

.results-container {
  overflow-anchor: none;
}

/* Hardware acceleration for smooth animations */
.card,
.btn,
.modal-content,
.domain-expansion {
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* ===================================
   Reduce Motion (Accessibility)
   =================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .domain-expansion {
    animation: none;
  }
  
  .cursed-particle {
    display: none;
  }
}
