/* ============================================================
   BUSINESS DIAGNOSTIC PLATFORM — Animations
   ============================================================ */

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

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

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

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

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(99,102,241,0.2); }
  50%       { box-shadow: 0 0 40px rgba(99,102,241,0.45); }
}

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

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-12px); }
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

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

@keyframes orbitSlow {
  from { transform: rotate(0deg) translateX(180px) rotate(0deg); }
  to   { transform: rotate(360deg) translateX(180px) rotate(-360deg); }
}

/* ---- Animation Utility Classes --------------------------- */
.animate-fade-in      { animation: fadeIn 0.5s var(--transition-base) both; }
.animate-fade-in-up   { animation: fadeInUp 0.6s ease both; }
.animate-fade-in-down { animation: fadeInDown 0.5s ease both; }
.animate-fade-in-left { animation: fadeInLeft 0.5s ease both; }
.animate-fade-in-right{ animation: fadeInRight 0.5s ease both; }
.animate-scale-in     { animation: scaleIn 0.4s var(--transition-spring) both; }
.animate-float        { animation: float 4s ease-in-out infinite; }
.animate-pulse-glow   { animation: pulse-glow 3s ease-in-out infinite; }
.animate-spin         { animation: spin 1s linear infinite; }

/* ---- Stagger delays for children ------------------------- */
.stagger > *:nth-child(1)  { animation-delay: 0ms; }
.stagger > *:nth-child(2)  { animation-delay: 80ms; }
.stagger > *:nth-child(3)  { animation-delay: 160ms; }
.stagger > *:nth-child(4)  { animation-delay: 240ms; }
.stagger > *:nth-child(5)  { animation-delay: 320ms; }
.stagger > *:nth-child(6)  { animation-delay: 400ms; }

/* ---- Scroll-reveal (JS sets .visible) -------------------- */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-32px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(32px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.6s ease, transform 0.6s var(--transition-spring, cubic-bezier(0.34,1.56,0.64,1));
}
.reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* ---- Shimmer skeleton loader ----------------------------- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-elevated) 25%,
    var(--color-bg-hover) 50%,
    var(--color-bg-elevated) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* ---- Gradient text animation ----------------------------- */
.gradient-text {
  background: linear-gradient(
    135deg,
    #6366F1 0%,
    #818CF8 30%,
    #22D3EE 65%,
    #6366F1 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 4s linear infinite;
}

/* ---- Hover lift effect ----------------------------------- */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ---- Mesh gradient background animation ------------------ */
.mesh-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.mesh-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  animation: float 8s ease-in-out infinite;
}

.mesh-blob:nth-child(1) {
  width: 500px;
  height: 500px;
  background: #6366F1;
  top: -10%;
  left: -5%;
  animation-delay: 0s;
}

.mesh-blob:nth-child(2) {
  width: 400px;
  height: 400px;
  background: #22D3EE;
  top: 30%;
  right: -8%;
  animation-delay: -2s;
}

.mesh-blob:nth-child(3) {
  width: 350px;
  height: 350px;
  background: #818CF8;
  bottom: -5%;
  left: 30%;
  animation-delay: -4s;
}

/* ---- Page transition overlay ----------------------------- */
.page-transition {
  position: fixed;
  inset: 0;
  background: var(--color-primary);
  z-index: var(--z-top);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.4s cubic-bezier(0.77, 0, 0.18, 1);
}

.page-transition.entering {
  transform: scaleY(1);
  transform-origin: bottom;
}

.page-transition.exiting {
  transform: scaleY(0);
  transform-origin: top;
}
