/* ═══════════════════════════════════════════════════════════════════
   APEX CLOUD — Animations & Micro-Interaction Library
   ═══════════════════════════════════════════════════════════════════ */

/* ── ENTRANCE ANIMATIONS ── */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp    { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeDown  { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeLeft  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn   { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
@keyframes scaleSpring { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
@keyframes slideInLeft  { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }

.anim-fade-up    { animation: fadeUp    0.5s cubic-bezier(0.34,1.56,0.64,1) both; }
.anim-fade-in    { animation: fadeIn    0.4s ease both; }
.anim-scale-in   { animation: scaleIn   0.4s cubic-bezier(0.34,1.56,0.64,1) both; }
.anim-slide-left { animation: slideInLeft  0.4s ease both; }
.anim-slide-right{ animation: slideInRight 0.4s ease both; }

.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.10s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.20s; }
.delay-5 { animation-delay: 0.25s; }
.delay-6 { animation-delay: 0.30s; }

/* ── SKELETON LOADER ── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.8s infinite linear;
  border-radius: 6px;
}

/* ── SPIN ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ── LOGIN CARD ENTRANCE ── */
@keyframes loginCardIn {
  0%   { opacity: 0; transform: perspective(1000px) rotateX(4deg) translateY(24px) scale(0.97); }
  100% { opacity: 1; transform: perspective(1000px) rotateX(0deg) translateY(0)    scale(1);    }
}
.login-card-enter { animation: loginCardIn 0.7s cubic-bezier(0.34,1.56,0.64,1) both; }

/* ── GLOW PULSE ── */
@keyframes glow-pulse {
  0%,100% { box-shadow: 0 0 16px rgba(59,130,246,0.3); }
  50%      { box-shadow: 0 0 40px rgba(59,130,246,0.7), 0 0 80px rgba(59,130,246,0.3); }
}
.glow-pulse { animation: glow-pulse 2.5s ease-in-out infinite; }

@keyframes text-glow-pulse {
  0%,100% { text-shadow: 0 0 20px rgba(59,130,246,0.4); }
  50%      { text-shadow: 0 0 40px rgba(59,130,246,0.8), 0 0 80px rgba(59,130,246,0.3); }
}

/* ── FLOAT ── */
@keyframes float-y {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.float { animation: float-y 5s ease-in-out infinite; }

/* ── SCANLINE ── */
@keyframes scan-line {
  0%   { transform: translateX(-100%); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}
.scan-line {
  position: absolute; inset-inline: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.6), transparent);
  animation: scan-line 4s ease-in-out infinite;
  pointer-events: none;
}

/* ── GLITCH TEXT ── */
@keyframes glitch {
  0%,100% { clip-path: none; transform: none; }
  20% { clip-path: polygon(0 20%, 100% 20%, 100% 40%, 0 40%); transform: translate(-2px,2px); }
  40% { clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%); transform: translate(2px,-2px); }
  60% { clip-path: none; transform: none; }
}

/* ── COUNTER ANIMATION ── */
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.counter-anim { animation: countUp 0.4s ease; }

/* ── ACTIVITY ROW INSERT ── */
@keyframes rowInsert {
  from { opacity: 0; transform: translateX(-12px); background: rgba(59,130,246,0.06); }
  to   { opacity: 1; transform: translateX(0);  background: transparent; }
}
.row-insert { animation: rowInsert 0.35s ease; }

/* ── GRADIENT BORDER SPIN ── */
@keyframes border-spin {
  to { --angle: 360deg; }
}

/* ── NEON FLICKER ── */
@keyframes flicker {
  0%,19%,21%,23%,25%,54%,56%,100% { opacity: 1; }
  20%,24%,55% { opacity: 0.6; }
}

/* ── BLINK CURSOR ── */
@keyframes blink { 50% { opacity: 0; } }
.blink { animation: blink 1.2s step-end infinite; }

/* ── METRIC CARD HOVER GLOW ── */
.metric-card {
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s ease, border-color 0.3s ease;
}
.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(59,130,246,0.15), 0 1px 0 rgba(255,255,255,0.08) inset;
}

/* ── STATUS DOT PULSE ── */
@keyframes online-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
.status-online-ring { animation: online-pulse 2s ease-in-out infinite; }

/* ── MODAL BACKDROP BLUR ── */
@keyframes backdropIn {
  from { backdrop-filter: blur(0px); background: rgba(0,0,0,0); }
  to   { backdrop-filter: blur(8px);  background: rgba(0,0,0,0.6); }
}
.modal-backdrop.open { animation: backdropIn 0.25s ease both; }

/* ── GRADIENT BG SHIFT ── */
@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.gradient-animate {
  background-size: 200% 200%;
  animation: gradient-shift 6s ease infinite;
}

/* ── HERO HEADLINE STAGGER ── */
.hero-headline { overflow: hidden; }
.hero-headline span {
  display: inline-block;
  animation: fadeUp 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* ── PARTICLE DRIFT ── */
@keyframes drift {
  0%   { transform: translateY(0)    translateX(0);    opacity: 0.3; }
  50%  { transform: translateY(-30px) translateX(15px);  opacity: 0.7; }
  100% { transform: translateY(0)    translateX(0);    opacity: 0.3; }
}

/* ── INPUT FOCUS RING ── */
.field-input:focus {
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12), 0 1px 0 rgba(255,255,255,0.04) inset;
}

/* ── BTN LOADING SPINNER ── */
.btn-loading {
  position: relative; color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: '';
  position: absolute; inset: 0;
  margin: auto;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── FEATURE CHECK STAGGER ── */
.check-item:nth-child(1) { animation: slideInLeft 0.4s 0.1s both ease; }
.check-item:nth-child(2) { animation: slideInLeft 0.4s 0.17s both ease; }
.check-item:nth-child(3) { animation: slideInLeft 0.4s 0.24s both ease; }
.check-item:nth-child(4) { animation: slideInLeft 0.4s 0.31s both ease; }
.check-item:nth-child(5) { animation: slideInLeft 0.4s 0.38s both ease; }

/* ── SIDEBAR NAV HOVER LINE ── */
.nav-item { position: relative; overflow: hidden; }
.nav-item::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 0 2px 2px 0;
  transition: height 0.25s ease;
}
.nav-item.active::before, .nav-item:hover::before { height: 70%; }

/* ── APEX TYPING CURSOR ── */
.typing-cursor::after { content: '|'; animation: blink 1s step-end infinite; }
