/* ========================================
   Animations
   Typing effects, transitions, hover states
   ======================================== */

/* Typing cursor animation */
.typing-cursor {
  display: inline-block;
  width: 10px;
  height: 1em;
  background: var(--text-primary);
  animation: blink 1s step-end infinite;
  vertical-align: middle;
  margin-left: 2px;
}

.typing-cursor.hidden {
  display: none;
}

/* Fade in animation */
.fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

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

/* Slide in from left */
.slide-in-left {
  animation: slideInLeft 0.3s ease-out forwards;
}

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

/* Slide in from bottom */
.slide-in-bottom {
  animation: slideInBottom 0.3s ease-out forwards;
}

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

/* Staggered children animation */
.stagger-children > * {
  opacity: 0;
  animation: fadeIn 0.3s ease-out forwards;
}

.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; }

/* Pulse glow effect */
.pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    text-shadow: 0 0 5px var(--green-glow);
  }
  50% {
    text-shadow: 0 0 10px var(--green-glow), 0 0 20px var(--green-glow);
  }
}

/* Hover scale effect */
.hover-scale {
  transition: transform 0.2s ease;
}

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

/* Hover glow effect */
.hover-glow {
  transition: text-shadow 0.2s ease, box-shadow 0.2s ease;
}

.hover-glow:hover {
  text-shadow: 0 0 10px var(--green-glow), 0 0 20px var(--green-glow);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.2);
}

/* Matrix rain effect (for easter egg) */
.matrix-rain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

.matrix-column {
  position: absolute;
  top: -100%;
  font-size: 16px;
  line-height: 1;
  color: var(--green-bright);
  text-shadow: 0 0 10px var(--green-glow);
  animation: matrixFall linear infinite;
  white-space: nowrap;
}

@keyframes matrixFall {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  75% {
    opacity: 1;
  }
  100% {
    transform: translateY(200vh);
    opacity: 0;
  }
}

/* Boot text animation */
.boot-line {
  opacity: 0;
  animation: bootLine 0.1s ease forwards;
}

@keyframes bootLine {
  to {
    opacity: 1;
  }
}

/* Command executed flash */
.cmd-flash {
  animation: cmdFlash 0.1s ease;
}

@keyframes cmdFlash {
  0% {
    background: rgba(0, 255, 0, 0.1);
  }
  100% {
    background: transparent;
  }
}

/* ASCII art reveal */
.ascii-reveal {
  overflow: hidden;
}

.ascii-reveal > * {
  animation: asciiLine 0.05s ease forwards;
  opacity: 0;
}

@keyframes asciiLine {
  to {
    opacity: 1;
  }
}

/* Loading dots animation */
.loading-dots::after {
  content: '';
  animation: loadingDots 1.5s steps(4, end) infinite;
}

@keyframes loadingDots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
  100% { content: ''; }
}

/* Success checkmark animation */
.success-check {
  display: inline-block;
  color: var(--green-bright);
  animation: checkPop 0.3s ease;
}

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

/* Error shake animation */
.error-shake {
  animation: errorShake 0.4s ease;
}

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

/* Smooth scroll behavior */
.output {
  scroll-behavior: smooth;
}

/* Focus visible styles */
.command-input:focus-visible,
.cmd-btn:focus-visible {
  outline: 2px solid var(--green-medium);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
