/* =========================================================
   CAROUSEL BACKGROUND ANIMATION EFFECTS
   Particles, Fluid Gradients, Circuit Board, Radial Pulse
   ========================================================= */

/* =========================================================
   1) CAROUSEL BACKGROUND LAYERS CONTAINER
   ========================================================= */
.carousel__background-effects {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

/* =========================================================
   2) PARTICLE SYSTEM
   ========================================================= */
.carousel__particles {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.carousel__particle {
  position: absolute;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat var(--duration, 8s) var(--delay, 0s) infinite ease-in-out;
}

@keyframes particleFloat {
  0% {
    transform: translate(var(--x-start), var(--y-start)) scale(0);
    opacity: 0;
  }
  10% {
    opacity: var(--opacity, 0.6);
  }
  90% {
    opacity: var(--opacity, 0.6);
  }
  100% {
    transform: translate(var(--x-end), var(--y-end)) scale(1);
    opacity: 0;
  }
}

/* =========================================================
   3) FLUID GRADIENT ANIMATION
   ========================================================= */
.carousel__fluid-gradient {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: linear-gradient(
    45deg,
    rgba(31, 140, 255, 0.15) 0%,
    rgba(139, 92, 246, 0.15) 25%,
    rgba(249, 115, 22, 0.15) 50%,
    rgba(16, 185, 129, 0.15) 75%,
    rgba(255, 48, 69, 0.15) 100%
  );
  background-size: 400% 400%;
  animation: fluidGradient 15s ease infinite;
  opacity: 0.4;
  mix-blend-mode: screen;
}

@keyframes fluidGradient {
  0% {
    background-position: 0% 50%;
  }
  25% {
    background-position: 100% 50%;
  }
  50% {
    background-position: 100% 100%;
  }
  75% {
    background-position: 0% 100%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Additional fluid orbs for more dynamic effect */
.carousel__fluid-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  animation: orbFloat var(--duration, 20s) var(--delay, 0s) infinite ease-in-out alternate;
}

.carousel__fluid-orb:nth-child(1) {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(31, 140, 255, 0.6) 0%, transparent 70%);
  top: -250px;
  left: -250px;
  --duration: 18s;
  --delay: 0s;
}

.carousel__fluid-orb:nth-child(2) {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.5) 0%, transparent 70%);
  bottom: -200px;
  right: -200px;
  --duration: 22s;
  --delay: 3s;
}

.carousel__fluid-orb:nth-child(3) {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.4) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  --duration: 25s;
  --delay: 6s;
}

@keyframes orbFloat {
  0% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(100px, -80px) scale(1.1);
  }
  66% {
    transform: translate(-80px, 100px) scale(0.9);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

/* =========================================================
   4) CIRCUIT BOARD / GLOW LINE EFFECT
   ========================================================= */
.carousel__circuit-board {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  opacity: 0.25;
}

.carousel__circuit-line {
  position: absolute;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--line-color, rgba(56, 255, 181, 0.8)) 50%,
    transparent 100%
  );
  animation: circuitPulse var(--duration, 4s) var(--delay, 0s) infinite ease-in-out;
}

/* Horizontal lines */
.carousel__circuit-line--h {
  height: 2px;
  width: 100%;
  left: 0;
}

/* Vertical lines */
.carousel__circuit-line--v {
  width: 2px;
  height: 100%;
  top: 0;
}

@keyframes circuitPulse {
  0%, 100% {
    opacity: 0.2;
    box-shadow: 0 0 5px var(--line-color, rgba(56, 255, 181, 0.5));
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 20px var(--line-color, rgba(56, 255, 181, 0.8)),
                0 0 40px var(--line-color, rgba(56, 255, 181, 0.4));
  }
}

/* Circuit nodes (connection points) */
.carousel__circuit-node {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--node-color, rgba(56, 255, 181, 0.9));
  box-shadow: 0 0 10px var(--node-color, rgba(56, 255, 181, 0.6)),
              0 0 20px var(--node-color, rgba(56, 255, 181, 0.3));
  animation: nodePulse 2s var(--delay, 0s) infinite ease-in-out;
}

@keyframes nodePulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.5);
    opacity: 1;
  }
}

/* =========================================================
   5) RADIAL PULSE / SOFT SPOTLIGHT
   ========================================================= */
.carousel__radial-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}

.carousel__spotlight {
  position: absolute;
  width: 800px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.15) 0%,
    rgba(255, 255, 255, 0.08) 30%,
    rgba(255, 255, 255, 0.02) 60%,
    transparent 100%
  );
  animation: spotlightPulse 8s ease-in-out infinite;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes spotlightPulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.4;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 0.8;
  }
}

/* Multiple pulse rings */
.carousel__pulse-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(56, 255, 181, 0.4);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: pulseRing var(--duration, 3s) var(--delay, 0s) infinite ease-out;
}

@keyframes pulseRing {
  0% {
    width: 50px;
    height: 50px;
    opacity: 1;
  }
  100% {
    width: 600px;
    height: 600px;
    opacity: 0;
  }
}

/* =========================================================
   6) DYNAMIC COLOR SYSTEM (Adapts to active slide)
   ========================================================= */
.carousel__background-effects[data-theme="inkjet"] {
  --primary-glow: rgba(4, 43, 63, 0.8);
  --secondary-glow: rgba(31, 140, 255, 0.6);
}

.carousel__background-effects[data-theme="laser"] {
  --primary-glow: rgba(139, 92, 246, 0.8);
  --secondary-glow: rgba(168, 85, 247, 0.6);
}

.carousel__background-effects[data-theme="thermal"] {
  --primary-glow: rgba(249, 115, 22, 0.8);
  --secondary-glow: rgba(251, 146, 60, 0.6);
}

.carousel__background-effects[data-theme="handheld"] {
  --primary-glow: rgba(16, 185, 129, 0.8);
  --secondary-glow: rgba(52, 211, 153, 0.6);
}

.carousel__background-effects[data-theme="supplies"] {
  --primary-glow: rgba(255, 48, 69, 0.8);
  --secondary-glow: rgba(248, 113, 113, 0.6);
}

/* =========================================================
   7) PERFORMANCE OPTIMIZATIONS
   ========================================================= */
.carousel__background-effects,
.carousel__background-effects * {
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-perspective: 1000px;
  perspective: 1000px;
}

/* =========================================================
   8) RESPONSIVE ADJUSTMENTS
   ========================================================= */
@media (max-width: 992px) {
  .carousel__fluid-orb {
    filter: blur(60px);
  }
  
  .carousel__spotlight {
    width: 600px;
    height: 600px;
  }
  
  /* Reduce particle count on mobile (handled in JS) */
  .carousel__circuit-board {
    opacity: 0.15;
  }
}

@media (max-width: 576px) {
  .carousel__fluid-gradient {
    opacity: 0.3;
  }
  
  .carousel__radial-pulse {
    opacity: 0.4;
  }
  
  .carousel__spotlight {
    width: 400px;
    height: 400px;
  }
}

/* =========================================================
   9) ACCESSIBILITY - RESPECT PREFERS REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .carousel__background-effects * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
