/* ===== Toast Animations ===== */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

/* ===== Process Button Pulse ===== */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.5); }
  70% { box-shadow: 0 0 0 12px rgba(167, 139, 250, 0); }
  100% { box-shadow: 0 0 0 0 rgba(167, 139, 250, 0); }
}

.btn--process.pulse {
  animation: pulse 0.6s ease;
}

/* ===== Typewriter Output ===== */
@keyframes typewriter-cursor {
  0%, 100% { border-right-color: var(--text-code); }
  50% { border-right-color: transparent; }
}

.typewriter {
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ===== Step Fade In ===== */
@keyframes stepFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-card {
  opacity: 0;
  animation: stepFadeIn 0.3s ease forwards;
}

.step-card:nth-child(1) { animation-delay: 0ms; }
.step-card:nth-child(2) { animation-delay: 200ms; }
.step-card:nth-child(3) { animation-delay: 400ms; }
.step-card:nth-child(4) { animation-delay: 600ms; }
.step-card:nth-child(5) { animation-delay: 800ms; }
.step-card:nth-child(6) { animation-delay: 1000ms; }

/* ===== Cipher Card Glow ===== */
@keyframes glowPurple {
  0%, 100% { box-shadow: 0 0 20px rgba(167, 139, 250, 0.1); }
  50% { box-shadow: 0 0 30px rgba(167, 139, 250, 0.2); }
}

.panel--input.mode-encode {
  animation: glowGreen 3s ease-in-out infinite;
}

.panel--input.mode-decode {
  animation: glowAmber 3s ease-in-out infinite;
}

.panel--input.mode-hash {
  animation: glowRed 3s ease-in-out infinite;
}

@keyframes glowGreen {
  0%, 100% { box-shadow: 0 0 20px rgba(34, 197, 94, 0.05); }
  50% { box-shadow: 0 0 35px rgba(34, 197, 94, 0.1); }
}

@keyframes glowAmber {
  0%, 100% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.05); }
  50% { box-shadow: 0 0 35px rgba(245, 158, 11, 0.1); }
}

@keyframes glowRed {
  0%, 100% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.05); }
  50% { box-shadow: 0 0 35px rgba(239, 68, 68, 0.1); }
}

/* ===== Compare Column Slide In ===== */
@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); }
}

.compare-column:nth-child(1) { animation: slideInLeft 0.3s ease forwards; }
.compare-column:nth-child(2) { animation: slideInLeft 0.3s ease 0.1s forwards; opacity: 0; }
.compare-column:nth-child(3) { animation: slideInRight 0.3s ease 0.2s forwards; opacity: 0; }

/* ===== Character Transformation Arrow ===== */
@keyframes arrowSlide {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: translateX(0); }
}

.char-map__item .arrow {
  display: inline-block;
  animation: arrowSlide 0.2s ease forwards;
}

/* ===== Mode Toggle Transition ===== */
.mode-btn {
  transition: background 0.3s ease, color 0.3s ease;
}

/* ===== Sidebar Active Transition ===== */
.cipher-item {
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* ===== Content Crossfade ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.panels {
  animation: fadeIn 0.25s ease;
}

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