/* Digital Background for Software Development Website */
/* Интеграция с существующей системой тем */

/* Используем переменные из darkTheme.css */
:root {
  /* Light Theme Colors - интегрируем с существующими переменными */
  --bg-primary-light: #f8f9fa;
  --bg-secondary-light: #e9ecef;
  --accent-primary-light: #007bff;
  --accent-secondary-light: #6c757d;
  --text-primary-light: #212529;
  --particle-color-light: rgba(0, 123, 255, 0.1);
  
  /* Dark Theme Colors - используем переменные из darkTheme.css */
  --bg-primary-dark: var(--dark-bg, #1a252f);
  --bg-secondary-dark: var(--dark-card, #2c3e50);
  --accent-primary-dark: var(--dark-secondary, #2980b9);
  --accent-secondary-dark: var(--dark-border, #34495e);
  --text-primary-dark: var(--dark-text, #ecf0f1);
  --particle-color-dark: rgba(41, 128, 185, 0.15);
  
  /* Current Theme - defaults to light */
  --bg-primary: var(--bg-primary-light);
  --bg-secondary: var(--bg-secondary-light);
  --accent-primary: var(--accent-primary-light);
  --accent-secondary: var(--accent-secondary-light);
  --text-primary: var(--text-primary-light);
  --particle-color: var(--particle-color-light);
}

/* Интеграция с существующей темной темой */
body.dark-mode {
  --bg-primary: var(--bg-primary-dark);
  --bg-secondary: var(--bg-secondary-dark);
  --accent-primary: var(--accent-primary-dark);
  --accent-secondary: var(--accent-secondary-dark);
  --text-primary: var(--text-primary-dark);
  --particle-color: var(--particle-color-dark);
}

/* Base Body Styles */
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  color: var(--text-primary);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow-x: hidden;
  position: relative;
}

/* Animated Background Elements */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 80%, var(--particle-color) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, var(--particle-color) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, var(--particle-color) 0%, transparent 50%);
  animation: backgroundPulse 8s ease-in-out infinite;
  z-index: -3;
}

/* Binary Code Rain Effect - ИСПРАВЛЕННЫЙ СТИЛЬ */
.binary-rain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  opacity: 0.6;
}

.binary-digit {
  position: absolute;
  color: var(--accent-primary);
  font-family: 'Courier New', monospace;
  font-weight: bold;
  animation: fall linear infinite;
  text-shadow: 0 0 5px currentColor;
  white-space: nowrap;
}

/* Circuit Board Grid */
.circuit-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(var(--accent-secondary) 1px, transparent 1px),
    linear-gradient(90deg, var(--accent-secondary) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.03;
  z-index: -2;
  animation: gridMove 20s linear infinite;
}

/* Floating Code Elements */
.floating-code {
  position: fixed;
  font-family: 'Courier New', monospace;
  color: var(--accent-primary);
  opacity: 0.1;
  z-index: -1;
  pointer-events: none;
}

.code-bracket { animation: float 15s ease-in-out infinite; }
.code-parenthesis { animation: float 18s ease-in-out infinite reverse; }
.code-brace { animation: float 20s ease-in-out infinite; }
.code-tag { animation: float 16s ease-in-out infinite reverse; }

/* Connection Nodes */
.connection-node {
  position: fixed;
  background: var(--accent-primary);
  border-radius: 50%;
  opacity: 0.2;
  z-index: -1;
  animation: nodePulse 4s ease-in-out infinite;
}

/* Data Flow Lines */
.data-flow {
  position: fixed;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
  opacity: 0.1;
  z-index: -1;
  animation: dataFlow 6s linear infinite;
}

/* ОБЯЗАТЕЛЬНО: Убедимся что основной контент поверх фона */
header, .section, footer {
  position: relative;
  z-index: 1;
}

/* Animations */
@keyframes backgroundPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.8; }
}

@keyframes fall {
  to { 
    transform: translateY(100vh); 
  }
}

@keyframes float {
  0%, 100% { 
    transform: translate(0, 0) rotate(0deg); 
  }
  25% { 
    transform: translate(20px, 20px) rotate(5deg); 
  }
  50% { 
    transform: translate(-15px, 30px) rotate(-5deg); 
  }
  75% { 
    transform: translate(10px, -10px) rotate(3deg); 
  }
}

@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(20px, 20px); }
}

@keyframes nodePulse {
  0%, 100% { transform: scale(1); opacity: 0.2; }
  50% { transform: scale(1.3); opacity: 0.4; }
}

@keyframes dataFlow {
  0% { transform: translateX(-100%); opacity: 0; }
  50% { opacity: 0.3; }
  100% { transform: translateX(100%); opacity: 0; }
}

/* Interactive Elements */
.connection-node:hover {
  opacity: 0.6;
  transform: scale(1.5);
  transition: all 0.3s ease;
}

/* Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
  .binary-digit,
  .floating-code,
  .connection-node,
  .data-flow,
  body::before {
    animation: none;
  }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .binary-digit {
    font-size: 10px;
  }
  
  .circuit-grid {
    background-size: 20px 20px;
  }
  
  .floating-code {
    font-size: 8px;
  }
}

/* Убедимся что кнопка переключения темы всегда поверх всего */
.theme-toggle {
  z-index: 1000 !important;
}