/* ============================================
   CmdVault — Animations & Transitions
   ============================================ */

/* --- Glow Pulse --- */
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(0, 229, 255, 0.15); }
  50%      { box-shadow: 0 0 20px rgba(0, 229, 255, 0.3), 0 0 40px rgba(0, 229, 255, 0.1); }
}

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

/* --- Fade Slide In (for cards) --- */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-slide-in {
  animation: fadeSlideIn 0.4s ease forwards;
}

/* Staggered card entrance */
.commands-grid .cmd-card:nth-child(1)  { animation-delay: 0.02s; }
.commands-grid .cmd-card:nth-child(2)  { animation-delay: 0.06s; }
.commands-grid .cmd-card:nth-child(3)  { animation-delay: 0.10s; }
.commands-grid .cmd-card:nth-child(4)  { animation-delay: 0.14s; }
.commands-grid .cmd-card:nth-child(5)  { animation-delay: 0.18s; }
.commands-grid .cmd-card:nth-child(6)  { animation-delay: 0.22s; }
.commands-grid .cmd-card:nth-child(7)  { animation-delay: 0.26s; }
.commands-grid .cmd-card:nth-child(8)  { animation-delay: 0.30s; }
.commands-grid .cmd-card:nth-child(9)  { animation-delay: 0.34s; }
.commands-grid .cmd-card:nth-child(10) { animation-delay: 0.38s; }

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

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

[dir="rtl"] .toast {
  animation-name: toastSlideInRtl;
}

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

.toast-enter {
  animation: toastSlideIn 0.35s ease forwards;
}

.toast-exit {
  animation: toastSlideOut 0.3s ease forwards;
}

/* --- Typewriter Cursor --- */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

.typewriter-cursor::after {
  content: '▌';
  color: var(--accent-cyan);
  animation: blink 1s step-end infinite;
  margin-left: 2px;
}

/* --- Scanline Sweep --- */
@keyframes scanlineSweep {
  0%   { top: -100%; }
  100% { top: 200%; }
}

.scanline-effect {
  position: relative;
  overflow: hidden;
}

.scanline-effect::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(0, 229, 255, 0.05),
    transparent
  );
  animation: scanlineSweep 4s linear infinite;
  pointer-events: none;
}

/* --- Neon Flicker (for logo) --- */
@keyframes neonFlicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    text-shadow:
      0 0 4px rgba(0, 229, 255, 0.4),
      0 0 11px rgba(0, 229, 255, 0.3),
      0 0 19px rgba(0, 229, 255, 0.2);
  }
  20%, 24%, 55% {
    text-shadow: none;
  }
}

.neon-text {
  animation: neonFlicker 4s infinite;
}

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

.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(0, 229, 255, 0.15) 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10);
  opacity: 0;
  transition: transform 0.5s, opacity 0.8s;
}

.ripple:active::after {
  transform: scale(0);
  opacity: 0.4;
  transition: 0s;
}

/* --- Floating Particles (for background) --- */
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.3; }
  50%      { transform: translateY(-20px) rotate(180deg); opacity: 0.6; }
}

.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-particles .particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--accent-cyan);
  border-radius: 50%;
  opacity: 0.2;
  animation: float 6s ease-in-out infinite;
}

.bg-particles .particle:nth-child(2) { animation-delay: 1s; animation-duration: 8s; left: 20%; top: 30%; }
.bg-particles .particle:nth-child(3) { animation-delay: 2s; animation-duration: 7s; left: 50%; top: 60%; }
.bg-particles .particle:nth-child(4) { animation-delay: 3s; animation-duration: 9s; left: 70%; top: 20%; }
.bg-particles .particle:nth-child(5) { animation-delay: 0.5s; animation-duration: 10s; left: 85%; top: 75%; }
.bg-particles .particle:nth-child(6) { animation-delay: 1.5s; animation-duration: 6s; left: 35%; top: 85%; }
.bg-particles .particle:nth-child(7) { animation-delay: 4s; animation-duration: 11s; left: 60%; top: 45%; }
.bg-particles .particle:nth-child(8) { animation-delay: 2.5s; animation-duration: 8.5s; left: 10%; top: 55%; }

/* --- Modal Entrance --- */
@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-enter {
  animation: modalSlideUp 0.3s ease forwards;
}

/* --- Pulse Ring (for copy button feedback) --- */
@keyframes pulseRing {
  0% {
    box-shadow: 0 0 0 0 rgba(57, 255, 20, 0.4);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(57, 255, 20, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(57, 255, 20, 0);
  }
}

.pulse-ring {
  animation: pulseRing 0.6s ease-out;
}

/* --- Sidebar Item Hover Slide --- */
.sidebar-nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 2px;
  background: var(--accent-cyan);
  transform: scaleY(0);
  transition: transform var(--transition-fast);
}

[dir="rtl"] .sidebar-nav-item::before {
  left: auto;
  right: 0;
}

.sidebar-nav-item:hover::before,
.sidebar-nav-item.active::before {
  transform: scaleY(1);
}

/* --- Loading Spinner --- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* --- HUD Watcher Animations --- */
@keyframes hudPopIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes hudFadeOut {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.05);
  }
}

@keyframes shrink {
  from { width: 100%; }
  to   { width: 0%; }
}

/* --- Grid Lines Background --- */
.grid-bg {
  background-image:
    linear-gradient(rgba(0, 229, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}
