/* ═════════════════════════════════════════════════════════════════════════════
   LogicFlow — Visual Effects & Animations
   Impressive UI effects, glows, and micro-interactions
   ═════════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables for Effects ──────────────────────────────────────────────── */
:root {
  --glow-primary: 0 0 20px rgba(16, 185, 129, 0.5);
  --glow-secondary: 0 0 20px rgba(6, 182, 212, 0.5);
  --glow-accent: 0 0 20px rgba(124, 58, 237, 0.5);
  --shadow-elevated: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Particle Canvas ────────────────────────────────────────────────────────── */
#particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
}

/* ── Neon Glow Effects ─────────────────────────────────────────────────────── */
.neon-text {
  text-shadow: 
    0 0 5px currentColor,
    0 0 10px currentColor,
    0 0 20px currentColor,
    0 0 40px currentColor;
  animation: neonFlicker 3s ease-in-out infinite alternate;
}

@keyframes neonFlicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.95; }
}

/* ── Component Pulse Animation ──────────────────────────────────────────────── */
@keyframes componentPulse {
  0%, 100% { 
    filter: drop-shadow(0 0 0 var(--pulse-color, #10B981));
    transform: scale(1);
  }
  50% { 
    filter: drop-shadow(0 0 15px var(--pulse-color, #10B981));
    transform: scale(1.02);
  }
}

/* ── Meter Glow Animation ─────────────────────────────────────────────────── */
@keyframes meterGlow {
  0%, 100% { 
    box-shadow: 0 0 0 var(--meter-glow-color, #10B981);
  }
  50% { 
    box-shadow: 0 0 30px var(--meter-glow-color, #10B981);
  }
}

/* ── Magnetic Button Effect ────────────────────────────────────────────────── */
.magnetic-btn {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.magnetic-btn:hover {
  transform: scale(1.05);
}

/* ── 3D Tilt Card Effect ────────────────────────────────────────────────────── */
.tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
  will-change: transform;
}

.tilt-card .card-content {
  transform: translateZ(20px);
}

.tilt-card .card-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: translateZ(1px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.tilt-card:hover .card-shine {
  opacity: 1;
}

/* ── Ripple Effect ──────────────────────────────────────────────────────────── */
.ripple-effect {
  position: relative;
  overflow: hidden;
}

.ripple-effect::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 100px;
  background: radial-gradient(circle, rgba(255,255,255,0.4) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
}

.ripple-effect:active::after {
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(4);
    opacity: 0;
  }
}

/* ── Wire Flow Animation ─────────────────────────────────────────────────────── */
.wire-flow-dot {
  animation: flowAlongWire 1.5s linear infinite;
}

@keyframes flowAlongWire {
  0% { offset-distance: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

/* ── Glow Border Animation ──────────────────────────────────────────────────── */
.glow-border {
  position: relative;
  border-radius: 12px;
}

.glow-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  background: linear-gradient(90deg, #10B981, #06b6d4, #7C3AED, #10B981);
  background-size: 300% 300%;
  z-index: -1;
  animation: glowBorderRotate 3s linear infinite;
  opacity: 0;
  transition: opacity 0.3s;
}

.glow-border:hover::before {
  opacity: 1;
}

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

/* ── Floating Animation ─────────────────────────────────────────────────────── */
.float-animation {
  animation: float 6s ease-in-out infinite;
}

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

/* ── Shimmer Effect for Loading States ──────────────────────────────────────── */
.shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

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

/* ── Success Checkmark Animation ───────────────────────────────────────────── */
.checkmark-animation {
  animation: checkmarkPop 0.5s ease-out forwards;
}

@keyframes checkmarkPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ── Number Counter Animation ──────────────────────────────────────────────── */
.counter-animate {
  display: inline-block;
  animation: counterSlide 0.3s ease-out;
}

@keyframes counterSlide {
  0% {
    transform: translateY(10px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ── Glassmorphism Enhancement ─────────────────────────────────────────────── */
.glass-panel {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.glass-panel-dark {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(51, 65, 85, 0.5);
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.3),
    0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

/* ── Mode Toggle Enhancement ─────────────────────────────────────────────────── */
.mode-btn {
  position: relative;
  overflow: hidden;
}

.mode-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.mode-btn:hover::before {
  left: 100%;
}

.mode-btn.active {
  animation: btnPulse 2s ease-in-out infinite;
}

@keyframes btnPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(26, 86, 219, 0.35); }
  50% { box-shadow: 0 4px 20px rgba(26, 86, 219, 0.5); }
}

/* ── Component Item Enhancements ─────────────────────────────────────────────── */
.component-item {
  position: relative;
  overflow: hidden;
}

.component-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.component-item:hover::before {
  opacity: 1;
}

.component-item:hover svg {
  animation: componentWiggle 0.5s ease-in-out;
}

@keyframes componentWiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

/* ── Chart Container Enhancement ──────────────────────────────────────────────── */
.chart-box-wrap {
  position: relative;
  overflow: hidden;
}

.chart-box-wrap::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(16, 185, 129, 0.1) 25%,
    transparent 50%,
    rgba(6, 182, 212, 0.1) 75%,
    transparent 100%
  );
  animation: chartRotate 10s linear infinite;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: -1;
}

.chart-box-wrap:hover::before {
  opacity: 1;
}

@keyframes chartRotate {
  100% { transform: rotate(360deg); }
}

/* ── Circuit Panel Glow ─────────────────────────────────────────────────────── */
.circuit-panel {
  position: relative;
}

.circuit-panel::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(16,185,129,0.3), rgba(6,182,212,0.3), rgba(124,58,237,0.3));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
  filter: blur(10px);
}

.circuit-panel:hover::after {
  opacity: 1;
}

/* ── Meter Scale Animation ────────────────────────────────────────────────────── */
.meter-fill {
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.meter-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: meterShine 2s infinite;
}

@keyframes meterShine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Scroll Progress Indicator ────────────────────────────────────────────────── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #10B981, #06b6d4, #7C3AED);
  z-index: 10000;
  transform-origin: left;
  transform: scaleX(var(--scroll-progress, 0));
  transition: transform 0.1s;
}

/* ── Responsive Effects ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .tilt-card {
    transform: none !important;
  }
  
  .magnetic-btn {
    transform: none !important;
  }
  
  .float-animation {
    animation: none;
  }
}

/* ── Print Styles ───────────────────────────────────────────────────────────── */
@media print {
  #particle-canvas,
  .glow-border::before,
  .shimmer,
  .mode-btn::before {
    display: none !important;
  }
}
