/* ================================================================
   MYD SERVER — Animations CSS
   ================================================================ */

/* ── Sakura canvas ─────────────────────────────────────────────── */
#sakura-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ── Entrance animations ───────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Continuous animations ─────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 10px rgba(60, 200, 230, 0.2); }
  50% { box-shadow: 0 0 25px rgba(60, 200, 230, 0.5); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes wave {
  0% { transform: rotate(0deg); }
  15% { transform: rotate(14deg); }
  30% { transform: rotate(-8deg); }
  40% { transform: rotate(14deg); }
  50% { transform: rotate(-4deg); }
  60% { transform: rotate(10deg); }
  70% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

/* ── Loading skeleton ──────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--border) 25%,
    rgba(60, 200, 230, 0.1) 50%,
    var(--border) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

/* ── Loading dots (server status) ─────────────────────────────── */
.loading-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.loading-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--muted);
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Notification toast ────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.2rem;
  backdrop-filter: blur(16px);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 250px;
  max-width: 380px;
  pointer-events: all;
  animation: toastIn 0.35s ease forwards;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}
.toast.hide {
  animation: toastOut 0.35s ease forwards;
}
.toast.success { border-color: rgba(93, 219, 158, 0.4); }
.toast.error   { border-color: rgba(232, 68, 90, 0.4); }
.toast.info    { border-color: var(--border2); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(30px); }
}

/* ── Page transition ───────────────────────────────────────────── */
.page-enter {
  animation: fadeInUp 0.5s ease forwards;
}

/* ── Staggered reveal for grid items ───────────────────────────── */
.features-grid .reveal:nth-child(1),
.plans-grid .reveal:nth-child(1),
.stats-grid .reveal:nth-child(1),
.news-grid .reveal:nth-child(1) { transition-delay: 0s; }
.features-grid .reveal:nth-child(2),
.plans-grid .reveal:nth-child(2),
.news-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.features-grid .reveal:nth-child(3),
.plans-grid .reveal:nth-child(3),
.news-grid .reveal:nth-child(3) { transition-delay: 0.16s; }
.features-grid .reveal:nth-child(4),
.news-grid .reveal:nth-child(4) { transition-delay: 0.24s; }
.features-grid .reveal:nth-child(5),
.news-grid .reveal:nth-child(5) { transition-delay: 0.32s; }
.features-grid .reveal:nth-child(6),
.news-grid .reveal:nth-child(6) { transition-delay: 0.4s; }

/* ── Gradient border animation ─────────────────────────────────── */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.animated-border {
  background: linear-gradient(90deg, var(--blue), var(--cyan), var(--green), var(--sakura), var(--blue));
  background-size: 200% auto;
  animation: gradientShift 3s linear infinite;
}

/* ── Hero animations ───────────────────────────────────────────── */
.hero-badge { animation-delay: 0.1s; }
.hero-ring  { animation-delay: 0.2s; }
.hero-title { animation: fadeInUp 0.6s ease 0.3s both; }
.hero-sub   { animation: fadeInUp 0.6s ease 0.5s both; }
.hero-btns  { animation: fadeInUp 0.6s ease 0.7s both; }

/* ── Button loading state ──────────────────────────────────────── */
.btn.loading {
  pointer-events: none;
  opacity: 0.8;
}
.btn.loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Reduced motion ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #sakura-canvas { display: none; }
}
