/* ===================================
   LEGION OFFENSIVE SECURITY
   Animations Stylesheet
   =================================== */

/* Node Pulse Animation */
@keyframes nodePulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
    box-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent);
  }
  50% {
    transform: scale(1.3);
    opacity: 0.8;
    box-shadow: 0 0 30px var(--accent), 0 0 60px var(--accent);
  }
}

.node {
  animation: nodePulse 2s ease-in-out infinite;
}

/* Ripple Animation */
@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 0.4;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

.node::after {
  animation: ripple 2s ease-out infinite;
}

/* Connection Flow Animation */
@keyframes connectionFlow {
  0% {
    opacity: 0;
    transform: scaleX(0);
  }
  30% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: scaleX(1);
  }
}

.connection-line {
  animation: connectionFlow 2s ease-in-out;
}

/* Scan Move Animation */
@keyframes scanMove {
  0% {
    top: 0%;
    opacity: 0;
  }
  50% {
    opacity: 0.8;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

.scan-line {
  animation: scanMove 3s linear infinite;
}

/* Radar Pulse Animation */
@keyframes radarPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0.3;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

.radar-sweep {
  animation: radarPulse 4s ease-out infinite;
}

.radar-sweep:nth-child(2) {
  animation-delay: 1.3s;
}

.radar-sweep:nth-child(3) {
  animation-delay: 2.6s;
}

/* Grid Pulse Animation */
@keyframes gridPulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.5;
  }
}

.grid-overlay {
  animation: gridPulse 8s ease-in-out infinite;
}

/* Marker Slide Animation */
@keyframes markerSlide {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.threat-marker {
  animation: markerSlide 0.5s ease;
}

/* Popup Fade Animation */
@keyframes popupFade {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.node-popup {
  animation: popupFade 0.3s ease;
}

/* Terminal Fade Animation */
@keyframes terminalFade {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.terminal-line {
  animation: terminalFade 0.4s ease forwards;
}

/* Blink Animation */
@keyframes blink {
  50% {
    opacity: 0;
  }
}

.cursor {
  animation: blink 1s step-end infinite;
}

.terminal-icon {
  animation: blink 1.5s infinite;
}

.popup-header::before {
  animation: blink 1s infinite;
}

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-in {
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
}

/* Slide Up Animation */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-up {
  opacity: 0;
  transform: translateY(20px);
  animation: slideUp 0.8s ease forwards;
}

/* Slide In From Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-left {
  opacity: 0;
  animation: slideInLeft 0.6s ease forwards;
}

/* Slide In From Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-right {
  opacity: 0;
  animation: slideInRight 0.6s ease forwards;
}

/* Scale Up Animation */
@keyframes scaleUp {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.scale-up {
  opacity: 0;
  animation: scaleUp 0.5s ease forwards;
}

/* Glow Pulse Animation */
@keyframes glowPulse {
  0%,
  100% {
    box-shadow: 0 0 5px var(--accent), 0 0 10px var(--accent);
  }
  50% {
    box-shadow: 0 0 20px var(--accent), 0 0 30px var(--accent), 0 0 40px var(--accent);
  }
}

.glow-pulse {
  animation: glowPulse 2s ease-in-out infinite;
}

/* Rotate Animation */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.rotate {
  animation: rotate 2s linear infinite;
}

/* Float Animation */
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.float {
  animation: float 3s ease-in-out infinite;
}

/* Shake Animation */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.shake {
  animation: shake 0.5s ease-in-out;
}

/* Loading Spinner */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  animation: spin 1s linear infinite;
}

/* Gradient Animation */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.gradient-animated {
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

/* Text Glitch Effect */
@keyframes glitch {
  0% {
    text-shadow: 2px 2px var(--accent), -2px -2px #00ffff;
  }
  25% {
    text-shadow: -2px -2px var(--accent), 2px 2px #00ffff;
  }
  50% {
    text-shadow: 2px -2px var(--accent), -2px 2px #00ffff;
  }
  75% {
    text-shadow: -2px 2px var(--accent), 2px -2px #00ffff;
  }
  100% {
    text-shadow: 2px 2px var(--accent), -2px -2px #00ffff;
  }
}

.glitch {
  animation: glitch 0.3s infinite;
}

/* Typing Animation */
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

.typing {
  overflow: hidden;
  white-space: nowrap;
  animation: typing 3s steps(40) forwards;
}

/* Border Trace Animation */
@keyframes borderTrace {
  0% {
    clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
  }
  25% {
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
  }
  50% {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 100% 100%);
  }
  75% {
    clip-path: polygon(100% 100%, 100% 100%, 0 100%, 0 100%);
  }
  100% {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
}

.border-trace::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid var(--accent);
  animation: borderTrace 3s linear infinite;
}

/* Delayed Animations */
.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

.delay-4 {
  animation-delay: 0.4s;
}

.delay-5 {
  animation-delay: 0.5s;
}

.delay-6 {
  animation-delay: 0.6s;
}

/* Stagger Animation Classes */
.stagger-1 {
  animation-delay: calc(0.1s * var(--stagger-index, 1));
}

/* Hover Effects */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(225, 29, 29, 0.2);
}

.hover-glow:hover {
  box-shadow: 0 0 20px var(--accent), 0 0 40px var(--glow);
}

.hover-scale {
  transition: transform 0.3s ease;
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* Scroll Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-left.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-right.active {
  opacity: 1;
  transform: translateX(0);
}

/* Loading States */
.skeleton {
  background: linear-gradient(90deg, var(--panel) 25%, var(--border) 50%, var(--panel) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
