/* JARVIS-style optimized background */
#jarvis-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: 
    radial-gradient(circle at 20% 30%, rgba(0, 212, 255, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(79, 195, 247, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at center, #0a0f1c 0%, #000508 50%, #000000 100%);
  overflow: hidden;
  will-change: transform;
  animation: background-pulse 30s ease-in-out infinite;
  contain: layout style paint;
  isolation: isolate;
}

@keyframes background-pulse {
  0%, 100% { filter: brightness(1) hue-rotate(0deg); }
  25% { filter: brightness(1.1) hue-rotate(5deg); }
  50% { filter: brightness(0.95) hue-rotate(-3deg); }
  75% { filter: brightness(1.05) hue-rotate(2deg); }
}

/* Optimized particle system */
.particle {
  position: absolute;
  background: #4fc3f7;
  border-radius: 50%;
  opacity: 0.4;
  will-change: transform, opacity;
  pointer-events: none;
}

/* Reduced keyframe complexity */
@keyframes float {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.4;
  }
  50% {
    transform: translate3d(10px, -15px, 0) scale(1.1);
    opacity: 0.7;
  }
}

/* Optimized circuit lines */
.circuit-line {
  position: absolute;
  background: linear-gradient(90deg, transparent, #4fc3f7, transparent);
  height: 1px;
  opacity: 0.2;
  will-change: transform;
  pointer-events: none;
}

.circuit-line.vertical {
  width: 1px;
  height: 80px;
  background: linear-gradient(0deg, transparent, #4fc3f7, transparent);
}

@keyframes circuit-flow {
  0% {
    transform: translate3d(-100%, 0, 0);
    opacity: 0;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    transform: translate3d(100vw, 0, 0);
    opacity: 0;
  }
}

@keyframes circuit-flow-vertical {
  0% {
    transform: translate3d(0, -100%, 0);
    opacity: 0;
  }
  50% {
    opacity: 0.4;
  }
  100% {
    transform: translate3d(0, 100vh, 0);
    opacity: 0;
  }
}

/* Simplified grid overlay */
.hex-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 50% 50%, #4fc3f7 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 195, 247, 0.02) 1px, transparent 1px),
    linear-gradient(0deg, rgba(79, 195, 247, 0.02) 1px, transparent 1px);
  background-size: 80px 80px, 40px 40px, 40px 40px;
  opacity: 0.08;
  animation: grid-pulse 12s ease-in-out infinite;
  will-change: opacity;
}

@keyframes grid-pulse {
  0%, 100% { opacity: 0.08; }
  25% { opacity: 0.15; transform: scale(1.001); }
  50% { opacity: 0.12; }
  75% { opacity: 0.18; transform: scale(0.999); }
}

/* AI Radar Effect - Optimized */
.radar-sweep {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300px;
  height: 300px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(79, 195, 247, 0.2);
  border-radius: 50%;
  opacity: 0.3;
  will-change: transform;
  contain: layout style paint;
}

.radar-sweep::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  width: 2px;
  height: 150px;
  background: linear-gradient(to bottom, #4fc3f7, transparent);
  transform-origin: bottom center;
  animation: radar-rotation 8s linear infinite;
  will-change: transform;
  contain: layout style paint;
}

.radar-sweep::after {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  border: 1px solid rgba(79, 195, 247, 0.1);
  border-radius: 50%;
  animation: radar-ping 4s ease-out infinite;
  will-change: transform, opacity;
  contain: layout style paint;
}

@keyframes radar-rotation {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes radar-ping {
  0% {
    transform: scale(1);
    opacity: 0.3;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* Coding Matrix Effect - Slower and more random */
.matrix-code {
  position: absolute;
  color: #4fc3f7;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  opacity: 0.3;
  animation: matrix-fall 15s linear infinite;
  pointer-events: none;
  white-space: nowrap;
}

@keyframes matrix-fall {
  0% {
    transform: translateY(-100vh) translateX(0px);
    opacity: 0;
  }
  10% {
    opacity: 0.3;
  }
  90% {
    opacity: 0.1;
  }
  100% {
    transform: translateY(100vh) translateX(var(--random-x, 0px));
    opacity: 0;
  }
}

/* Hexagonal Tech Pattern */
.tech-hexagon {
  position: absolute;
  width: 60px;
  height: 34px;
  background: linear-gradient(30deg, transparent 35%, rgba(79, 195, 247, 0.1) 35%, rgba(79, 195, 247, 0.1) 65%, transparent 65%);
  opacity: 0.1;
  animation: hex-glow 6s ease-in-out infinite;
}

.tech-hexagon::before,
.tech-hexagon::after {
  content: '';
  position: absolute;
  width: 0;
  border-left: 30px solid transparent;
  border-right: 30px solid transparent;
}

.tech-hexagon::before {
  bottom: 100%;
  border-bottom: 17px solid rgba(79, 195, 247, 0.1);
}

.tech-hexagon::after {
  top: 100%;
  border-top: 17px solid rgba(79, 195, 247, 0.1);
}

@keyframes hex-glow {
  0%, 100% { opacity: 0.1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(1.1); }
}

/* Optimized scanning lines */
.scan-line {
  position: absolute;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #4fc3f7, transparent);
  opacity: 0.3;
  animation: scan 8s linear infinite;
  will-change: transform;
  pointer-events: none;
}

@keyframes scan {
  0% {
    transform: translate3d(0, -2px, 0);
    opacity: 0;
  }
  10%, 90% {
    opacity: 0.6;
  }
  100% {
    transform: translate3d(0, 100vh, 0);
    opacity: 0;
  }
}

/* Simplified neural connections */
.neural-connection {
  position: absolute;
  background: #4fc3f7;
  height: 1px;
  opacity: 0.15;
  transform-origin: left center;
  animation: neural-pulse 4s ease-in-out infinite;
  will-change: opacity;
  pointer-events: none;
}

@keyframes neural-pulse {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.4; }
}

/* Optimized data streams - Slower */
.data-stream {
  position: absolute;
  width: 1px;
  height: 15px;
  background: linear-gradient(0deg, transparent, #4fc3f7, transparent);
  opacity: 0.5;
  animation: data-flow 8s linear infinite;
  will-change: transform;
  pointer-events: none;
}

@keyframes data-flow {
  0% {
    transform: translate3d(0, -100vh, 0);
    opacity: 0;
  }
  10%, 90% {
    opacity: 0.5;
  }
  100% {
    transform: translate3d(var(--stream-drift, 0px), 100vh, 0);
    opacity: 0;
  }
}

/* AI Pulse Rings */
.ai-pulse-ring {
  position: absolute;
  border: 1px solid rgba(79, 195, 247, 0.3);
  border-radius: 50%;
  animation: ai-pulse 4s ease-out infinite;
  pointer-events: none;
}

@keyframes ai-pulse {
  0% {
    transform: scale(0.1);
    opacity: 0.8;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Digital Glitch Lines */
.glitch-line {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, #00ff41, #4fc3f7, transparent);
  opacity: 0.4;
  animation: glitch-sweep 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes glitch-sweep {
  0%, 100% {
    transform: translateX(-100vw) skewX(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
    transform: translateX(-50vw) skewX(-5deg);
  }
  50% {
    opacity: 0.8;
    transform: translateX(0) skewX(2deg);
  }
  90% {
    opacity: 0.4;
    transform: translateX(100vw) skewX(-3deg);
  }
}

/* Binary Rain Effect - Slower and more random */
.binary-digit {
  position: absolute;
  color: rgba(79, 195, 247, 0.4);
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  animation: binary-fall 12s linear infinite;
  pointer-events: none;
}

@keyframes binary-fall {
  0% {
    transform: translateY(-100vh) translateX(0px);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.2;
  }
  100% {
    transform: translateY(100vh) translateX(var(--random-drift, 0px));
    opacity: 0;
  }
}

/* Energy Orbs */
.energy-orb {
  position: absolute;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, #4fc3f7, rgba(79, 195, 247, 0.3));
  border-radius: 50%;
  animation: orb-float 8s ease-in-out infinite;
  pointer-events: none;
  box-shadow: 0 0 20px rgba(79, 195, 247, 0.5);
}

@keyframes orb-float {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.6;
  }
  25% {
    transform: translate3d(20px, -30px, 0) scale(1.2);
    opacity: 1;
  }
  50% {
    transform: translate3d(-15px, -60px, 0) scale(0.8);
    opacity: 0.8;
  }
  75% {
    transform: translate3d(25px, -30px, 0) scale(1.1);
    opacity: 0.9;
  }
}

/* Simplified holographic effect */
.hologram-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    45deg,
    transparent 49%,
    rgba(79, 195, 247, 0.02) 50%,
    transparent 51%
  );
  background-size: 40px 40px;
  animation: hologram-shift 15s linear infinite;
  will-change: background-position;
  pointer-events: none;
}

@keyframes hologram-shift {
  0% { background-position: 0 0; }
  100% { background-position: 40px 40px; }
}

/* Performance optimizations */
.performance-layer {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
  contain: layout style paint;
  will-change: transform, opacity;
}

/* Container optimizations */
#particles-container,
#circuits-container,
#neural-container,
#data-streams-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  contain: layout style paint;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .particle,
  .circuit-line,
  .scan-line,
  .neural-connection,
  .data-stream,
  .matrix-code,
  .binary-digit,
  .energy-orb,
  .glitch-line,
  .ai-pulse-ring,
  .tech-hexagon {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  
  .hex-grid,
  .hologram-layer,
  .radar-sweep,
  .radar-sweep::before,
  .radar-sweep::after,
  #jarvis-background {
    animation: none !important;
  }
}


/* ===== PAGE ENTRY ANIMATION ===== */
.container > * {
  opacity: 0;
  transform: translateY(20px);
  will-change: opacity, transform;
}
body.loaded .container > * {
  animation: fadeInUp 0.3s ease-out both;
}
body.loaded .container > header { animation-delay: 0.05s; }
body.loaded .container > main { animation-delay: 0.1s; }
body.loaded .container > footer { animation-delay: 0.15s; }

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

/* ===== SIDEBAR ENTRY ANIMATION ===== */
/* Eliminat - nu mai există history-list în sidebar */

/* ===== SIDEBAR CONTAINER ENTRY ===== */
/* Dezactivat pentru Motion.js animație */
/*
.sidebar {
  opacity: 0;
  transform: translateX(-100%);
  will-change: transform, opacity;
}
body.loaded .sidebar {
  animation: slideInSidebarContainer 0.5s ease-out both;
  animation-delay: 0.1s;
}
@keyframes slideInSidebarContainer {
  from {
    opacity: 0;
    transform: translateX(-100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
*/
