/* ============================================
   MAPA MENTAL MAKER - Animations
   ============================================ */

/* --- Keyframes --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes scaleOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.8);
  }
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes slideOutLeft {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

@keyframes drawLine {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}

/* --- Utility Classes --- */
.anim-fade-in {
  animation: fadeIn var(--transition-smooth) forwards;
}

.anim-scale-in {
  animation: scaleIn 300ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.anim-slide-in-up {
  animation: slideInUp var(--transition-smooth) forwards;
}

.anim-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

.anim-spin {
  animation: spin 1s linear infinite;
}

/* --- Connection draw animation --- */
.connection-animate {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawLine 400ms ease-out forwards;
}

/* --- Stagger delays (para templates) --- */
.stagger-1 { animation-delay: 0ms; }
.stagger-2 { animation-delay: 80ms; }
.stagger-3 { animation-delay: 160ms; }
.stagger-4 { animation-delay: 240ms; }
.stagger-5 { animation-delay: 320ms; }
.stagger-6 { animation-delay: 400ms; }
.stagger-7 { animation-delay: 480ms; }
.stagger-8 { animation-delay: 560ms; }

/* --- Save indicator animation --- */
@keyframes savePulse {
  0% { background-color: var(--accent-orange); }
  50% { background-color: var(--accent-orange); opacity: 0.5; }
  100% { background-color: var(--accent-green); }
}

.save-pulse {
  animation: savePulse 800ms ease forwards;
}

/* --- Node highlight flash --- */
@keyframes highlightFlash {
  0% { box-shadow: var(--shadow-glow-blue); }
  50% { box-shadow: 0 0 0 6px rgba(79, 140, 255, 0.3); }
  100% { box-shadow: var(--shadow-glow-blue); }
}

.highlight-flash {
  animation: highlightFlash 600ms ease;
}

/* --- Toast progress bar --- */
.toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.3;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transform-origin: left;
}

/* --- Export option hover effects --- */
.export-option {
  transition: all var(--transition-smooth);
}

.export-option:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

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

  .connection-animate {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
    animation: none;
  }
}
