/* ================================================
   NIDUSOFT - Animations & Effects
   ================================================ */

/* ===== PARTICLES CANVAS ===== */
#particles-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ===== GLITCH EFFECT ===== */
.glitch {
  position: relative;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.glitch::before {
  animation: glitch1 3s infinite;
  color: #00d4ff;
  clip-path: polygon(0 30%, 100% 30%, 100% 50%, 0 50%);
  transform: translateX(-2px);
}
.glitch::after {
  animation: glitch2 3s infinite;
  color: #0066ff;
  clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%);
  transform: translateX(2px);
}
@keyframes glitch1 {
  0%, 90%, 100% { transform: translateX(-2px); opacity: 0; }
  92%, 94%, 96%, 98% { opacity: 0.6; }
  91% { transform: translateX(-4px); }
  93% { transform: translateX(4px); }
  95% { transform: translateX(-3px); }
  97% { transform: translateX(3px); }
  99% { transform: translateX(-2px); }
}
@keyframes glitch2 {
  0%, 90%, 100% { transform: translateX(2px); opacity: 0; }
  92%, 94%, 96%, 98% { opacity: 0.6; }
  91% { transform: translateX(4px); }
  93% { transform: translateX(-4px); }
  95% { transform: translateX(3px); }
  97% { transform: translateX(-3px); }
  99% { transform: translateX(2px); }
}

/* ===== TYPING EFFECT ===== */
.typed-cursor {
  display: inline-block;
  width: 3px;
  height: 1em;
  background: #00d4ff;
  margin-left: 4px;
  vertical-align: middle;
  animation: blink 0.8s step-end infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

/* ===== NEON GLOW ===== */
.neon-text {
  text-shadow:
    0 0 10px rgba(0,212,255,0.8),
    0 0 20px rgba(0,212,255,0.5),
    0 0 40px rgba(0,212,255,0.3),
    0 0 80px rgba(0,212,255,0.1);
}
.neon-border {
  box-shadow:
    0 0 5px rgba(0,212,255,0.5),
    0 0 20px rgba(0,212,255,0.3),
    inset 0 0 5px rgba(0,212,255,0.1);
}

/* ===== PULSE ANIMATIONS ===== */
@keyframes pulse-ring {
  0% { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}
.pulse-ring {
  position: relative;
}
.pulse-ring::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 2px solid rgba(0,212,255,0.5);
  animation: pulse-ring 2s ease-out infinite;
}

/* ===== SHIMMER EFFECT ===== */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}
.shimmer {
  background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.04) 50%, transparent 75%);
  background-size: 1000px 100%;
  animation: shimmer 3s infinite;
}

/* ===== BORDER BEAM ===== */
@keyframes border-beam {
  100% { offset-distance: 100%; }
}
.border-beam-wrapper {
  position: relative;
  overflow: hidden;
}
.border-beam-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--beam-angle, 0deg), transparent 0%, #00d4ff 20%, transparent 40%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: border-rotate 4s linear infinite;
}
@keyframes border-rotate {
  from { --beam-angle: 0deg; }
  to { --beam-angle: 360deg; }
}

/* ===== 3D FLIP CARD ===== */
.flip-card {
  perspective: 1000px;
  cursor: pointer;
}
.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}
.flip-card:hover .flip-card-inner { transform: rotateY(180deg); }
.flip-card-front, .flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: inherit;
}
.flip-card-back { transform: rotateY(180deg); }

/* ===== TILT EFFECT (via JS) ===== */
.tilt {
  transform-style: preserve-3d;
  transform: perspective(1000px);
  transition: transform 0.15s ease;
}
.tilt-content {
  transform: translateZ(40px);
}

/* ===== ORBIT ANIMATION ===== */
@keyframes orbit {
  from { transform: rotate(0deg) translateX(80px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(80px) rotate(-360deg); }
}
.orbit-item { animation: orbit 6s linear infinite; }

/* ===== WAVE ANIMATION ===== */
@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
  60%, 100% { transform: rotate(0deg); }
}
.wave { animation: wave 2.5s linear infinite; display: inline-block; }

/* ===== GRADIENT MOVE ===== */
@keyframes gradient-move {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.gradient-animate {
  background-size: 200% 200%;
  animation: gradient-move 6s ease infinite;
}

/* ===== COUNT UP ANIMATION ===== */
.count-up { transition: all 0.1s ease; }

/* ===== STAGGER ANIMATIONS ===== */
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 100ms; }
.stagger-children > *:nth-child(3) { animation-delay: 200ms; }
.stagger-children > *:nth-child(4) { animation-delay: 300ms; }
.stagger-children > *:nth-child(5) { animation-delay: 400ms; }
.stagger-children > *:nth-child(6) { animation-delay: 500ms; }
.stagger-children > *:nth-child(7) { animation-delay: 600ms; }
.stagger-children > *:nth-child(8) { animation-delay: 700ms; }

/* ===== AI NODES ANIMATION ===== */
.ai-node {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0,212,255,0.7);
  animation: ai-pulse 3s ease-in-out infinite;
}
@keyframes ai-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
}
.ai-line {
  position: absolute;
  background: linear-gradient(90deg, transparent, rgba(0,212,255,0.3), transparent);
  height: 1px;
  animation: ai-flow 4s ease-in-out infinite;
}
@keyframes ai-flow {
  0% { opacity: 0; transform: scaleX(0); }
  50% { opacity: 1; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(0); }
}

/* ===== HOVER CARD EFFECT ===== */
.hover-lift {
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s ease;
}
.hover-lift:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 25px 60px rgba(0,0,0,0.5);
}

/* ===== SCAN LINE EFFECT ===== */
.scanline {
  position: relative;
  overflow: hidden;
}
.scanline::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(transparent, rgba(0,212,255,0.08), transparent);
  animation: scan 4s linear infinite;
}
@keyframes scan {
  0% { top: -5%; }
  100% { top: 105%; }
}

/* ===== CIRCUIT PATTERN ===== */
.circuit-bg {
  position: relative;
}
.circuit-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(0,212,255,0.08) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
}

/* ===== RIPPLE EFFECT ===== */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}
.ripple-effect {
  position: absolute;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transform: translate(-50%, -50%);
  animation: ripple-anim 0.6s ease-out;
  pointer-events: none;
}
@keyframes ripple-anim {
  to { width: 300px; height: 300px; opacity: 0; }
}

/* ===== ROTATING GRADIENT BORDER ===== */
.rotating-border {
  position: relative;
  border-radius: 16px;
}
.rotating-border::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: conic-gradient(from 0deg, #00d4ff, #0066ff, #7c3aed, #00d4ff);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
  animation: border-spin 4s linear infinite;
}
.rotating-border:hover::before { opacity: 1; }
@keyframes border-spin { to { transform: rotate(360deg); } }

/* ===== SCROLL PROGRESS BAR ===== */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #00d4ff, #0066ff);
  z-index: 99999;
  transition: width 0.1s ease;
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 10px rgba(0,212,255,0.5);
}

/* ===== BACK TO TOP ===== */
#back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #00d4ff, #0066ff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,102,255,0.4);
}
#back-to-top.visible { opacity: 1; transform: translateY(0); }
#back-to-top:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(0,102,255,0.5); }

/* ===== CHAT WIDGET BUTTON ===== */
#chat-widget {
  position: fixed;
  bottom: 90px;
  right: 32px;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #7c3aed, #0066ff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(124,58,237,0.4);
  transition: all 0.3s ease;
  animation: chat-bounce 4s ease-in-out infinite;
}
#chat-widget:hover { transform: scale(1.1); }
@keyframes chat-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.02); }
}
.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid var(--bg-dark);
  animation: ai-pulse 2s ease infinite;
}
