/*
 * Advanced Page Loading Effects Library
 * Sophisticated loading animations including DNA helix, quantum particles,
 * molecular assembly, and next-generation progress indicators
 * Created for enhanced user experience during page transitions
 */

/* ===== DNA HELIX LOADING EFFECTS ===== */

/* DNA Helix Loader */
.dna-helix-loader {
  position: relative;
  width: 100px;
  height: 150px;
  margin: 2rem auto;
  perspective: 1000px;
}

.dna-helix-strand {
  position: absolute;
  width: 100%;
  height: 100%;
  animation: dnaHelixRotate 2s linear infinite;
  transform-style: preserve-3d;
}

.dna-helix-strand:nth-child(2) {
  animation-delay: -1s;
}

.dna-helix-base {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #4ecdc4;
  border-radius: 50%;
  left: 50%;
  transform-origin: 0 0;
  box-shadow: 0 0 10px currentColor;
}

.dna-helix-base:nth-child(odd) {
  background: #ff6b35;
}

.dna-helix-base:nth-child(1) { top: 0%; transform: translateX(-50%) rotateY(0deg) translateZ(30px); }
.dna-helix-base:nth-child(2) { top: 12.5%; transform: translateX(-50%) rotateY(45deg) translateZ(30px); }
.dna-helix-base:nth-child(3) { top: 25%; transform: translateX(-50%) rotateY(90deg) translateZ(30px); }
.dna-helix-base:nth-child(4) { top: 37.5%; transform: translateX(-50%) rotateY(135deg) translateZ(30px); }
.dna-helix-base:nth-child(5) { top: 50%; transform: translateX(-50%) rotateY(180deg) translateZ(30px); }
.dna-helix-base:nth-child(6) { top: 62.5%; transform: translateX(-50%) rotateY(225deg) translateZ(30px); }
.dna-helix-base:nth-child(7) { top: 75%; transform: translateX(-50%) rotateY(270deg) translateZ(30px); }
.dna-helix-base:nth-child(8) { top: 87.5%; transform: translateX(-50%) rotateY(315deg) translateZ(30px); }

@keyframes dnaHelixRotate {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}

.dna-loading-text {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #666;
  animation: dnaTextPulse 1.5s ease-in-out infinite;
}

@keyframes dnaTextPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ===== QUANTUM PARTICLE EFFECTS ===== */

/* Quantum Particle Loader */
.quantum-loader {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 2rem auto;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(33, 150, 243, 0.1), transparent);
}

.quantum-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #2196f3;
  border-radius: 50%;
  box-shadow: 0 0 15px currentColor;
}

.quantum-particle:nth-child(1) {
  animation: quantumOrbit1 3s linear infinite;
}

.quantum-particle:nth-child(2) {
  animation: quantumOrbit2 2.5s linear infinite;
  background: #ff5722;
}

.quantum-particle:nth-child(3) {
  animation: quantumOrbit3 3.5s linear infinite;
  background: #4caf50;
}

.quantum-particle:nth-child(4) {
  animation: quantumOrbit4 2s linear infinite;
  background: #ff9800;
}

@keyframes quantumOrbit1 {
  0% {
    transform: rotate(0deg) translateX(60px) rotate(0deg);
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    transform: rotate(360deg) translateX(60px) rotate(-360deg);
    opacity: 1;
  }
}

@keyframes quantumOrbit2 {
  0% {
    transform: rotate(90deg) translateX(80px) rotate(-90deg);
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    transform: rotate(450deg) translateX(80px) rotate(-450deg);
    opacity: 1;
  }
}

@keyframes quantumOrbit3 {
  0% {
    transform: rotate(180deg) translateX(70px) rotate(-180deg);
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    transform: rotate(540deg) translateX(70px) rotate(-540deg);
    opacity: 1;
  }
}

@keyframes quantumOrbit4 {
  0% {
    transform: rotate(270deg) translateX(50px) rotate(-270deg);
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    transform: rotate(630deg) translateX(50px) rotate(-630deg);
    opacity: 1;
  }
}

.quantum-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, #fff, #e3f2fd);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 30px rgba(33, 150, 243, 0.8);
  animation: quantumCorePulse 2s ease-in-out infinite;
}

@keyframes quantumCorePulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 30px rgba(33, 150, 243, 0.8);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 0 50px rgba(33, 150, 243, 1);
  }
}

/* ===== MOLECULAR ASSEMBLY EFFECTS ===== */

/* Molecular Assembly Loader */
.molecular-assembly {
  position: relative;
  width: 250px;
  height: 200px;
  margin: 2rem auto;
}

.molecule-part {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  animation-duration: 3s;
  animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation-iteration-count: infinite;
}

.molecule-part:nth-child(1) {
  background: #f44336;
  top: 20px;
  left: 20px;
  animation-name: moleculeAssemble1;
  animation-delay: 0s;
}

.molecule-part:nth-child(2) {
  background: #2196f3;
  top: 20px;
  right: 20px;
  animation-name: moleculeAssemble2;
  animation-delay: 0.5s;
}

.molecule-part:nth-child(3) {
  background: #4caf50;
  bottom: 20px;
  left: 20px;
  animation-name: moleculeAssemble3;
  animation-delay: 1s;
}

.molecule-part:nth-child(4) {
  background: #ff9800;
  bottom: 20px;
  right: 20px;
  animation-name: moleculeAssemble4;
  animation-delay: 1.5s;
}

.molecule-part:nth-child(5) {
  background: #9c27b0;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-name: moleculeCenter;
  animation-delay: 2s;
}

@keyframes moleculeAssemble1 {
  0%, 70% {
    transform: translate(0, 0) scale(1);
  }
  85% {
    transform: translate(95px, 65px) scale(0.8);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

@keyframes moleculeAssemble2 {
  0%, 70% {
    transform: translate(0, 0) scale(1);
  }
  85% {
    transform: translate(-95px, 65px) scale(0.8);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

@keyframes moleculeAssemble3 {
  0%, 70% {
    transform: translate(0, 0) scale(1);
  }
  85% {
    transform: translate(95px, -65px) scale(0.8);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

@keyframes moleculeAssemble4 {
  0%, 70% {
    transform: translate(0, 0) scale(1);
  }
  85% {
    transform: translate(-95px, -65px) scale(0.8);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

@keyframes moleculeCenter {
  0%, 70% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  85% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0.3;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.molecular-bond {
  position: absolute;
  background: #666;
  height: 2px;
  opacity: 0;
  animation: bondForm 3s ease-in-out infinite;
}

.bond-1 {
  top: 35px;
  left: 50px;
  width: 70px;
  transform: rotate(30deg);
  animation-delay: 2.2s;
}

.bond-2 {
  top: 85px;
  right: 50px;
  width: 70px;
  transform: rotate(-30deg);
  animation-delay: 2.4s;
}

@keyframes bondForm {
  0%, 73% {
    opacity: 0;
    transform: scale(0) rotate(var(--rotation, 0deg));
  }
  85% {
    opacity: 1;
    transform: scale(1) rotate(var(--rotation, 0deg));
  }
  100% {
    opacity: 0;
    transform: scale(0) rotate(var(--rotation, 0deg));
  }
}

/* ===== ADVANCED PROGRESS INDICATORS ===== */

/* Neural Network Progress */
.neural-progress {
  position: relative;
  width: 300px;
  height: 100px;
  margin: 2rem auto;
  background: linear-gradient(90deg, #e3f2fd 0%, #bbdefb 50%, #90caf9 100%);
  border-radius: 50px;
  overflow: hidden;
}

.neural-wave {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(33, 150, 243, 0.3) 25%, 
    rgba(33, 150, 243, 0.6) 50%, 
    rgba(33, 150, 243, 0.3) 75%, 
    transparent 100%);
  animation: neuralWave 2s ease-in-out infinite;
}

@keyframes neuralWave {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.neural-nodes {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 2px;
  transform: translateY(-50%);
}

.neural-node {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #2196f3;
  border-radius: 50%;
  top: -5px;
  animation: neuralNodePulse 1.5s ease-in-out infinite;
}

.neural-node:nth-child(1) {
  left: 10%;
  animation-delay: 0s;
}

.neural-node:nth-child(2) {
  left: 30%;
  animation-delay: 0.2s;
}

.neural-node:nth-child(3) {
  left: 50%;
  animation-delay: 0.4s;
}

.neural-node:nth-child(4) {
  left: 70%;
  animation-delay: 0.6s;
}

.neural-node:nth-child(5) {
  left: 90%;
  animation-delay: 0.8s;
}

@keyframes neuralNodePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.7);
  }
  50% {
    transform: scale(1.3);
    box-shadow: 0 0 0 10px rgba(33, 150, 243, 0);
  }
}

/* Holographic Progress Ring */
.holographic-progress {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 2rem auto;
}

.holo-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 4px solid transparent;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #ff6b35, #f7931e, #4ecdc4, #45b7d1, #ff6b35);
  background-clip: padding-box;
  animation: holoRotate 3s linear infinite;
}

.holo-ring::before {
  content: '';
  position: absolute;
  inset: -4px;
  background: conic-gradient(from 0deg, #ff6b35, #f7931e, #4ecdc4, #45b7d1, #ff6b35);
  border-radius: 50%;
  z-index: -1;
  filter: blur(8px);
}

.holo-ring::after {
  content: '';
  position: absolute;
  inset: 4px;
  background: #1a1a1a;
  border-radius: 50%;
  z-index: 1;
}

@keyframes holoRotate {
  0% {
    transform: rotate(0deg);
    filter: hue-rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
    filter: hue-rotate(360deg);
  }
}

.holo-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  color: #fff;
  font-weight: bold;
  font-size: 1.2rem;
  animation: holoTextGlow 2s ease-in-out infinite;
}

@keyframes holoTextGlow {
  0%, 100% {
    text-shadow: 0 0 10px rgba(255, 107, 53, 0.8);
  }
  50% {
    text-shadow: 0 0 20px rgba(255, 107, 53, 1), 0 0 30px rgba(76, 205, 196, 0.8);
  }
}

/* Particle Stream Progress */
.particle-stream-progress {
  position: relative;
  width: 400px;
  height: 60px;
  margin: 2rem auto;
  background: linear-gradient(90deg, #1a1a1a, #2d2d2d);
  border-radius: 30px;
  overflow: hidden;
  border: 2px solid #333;
}

.particle-stream {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.stream-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #4ecdc4;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
  animation: streamFlow 2s linear infinite;
}

.stream-particle:nth-child(1) {
  top: 20%;
  animation-delay: 0s;
}

.stream-particle:nth-child(2) {
  top: 40%;
  animation-delay: 0.2s;
  background: #ff6b35;
}

.stream-particle:nth-child(3) {
  top: 60%;
  animation-delay: 0.4s;
  background: #45b7d1;
}

.stream-particle:nth-child(4) {
  top: 80%;
  animation-delay: 0.6s;
  background: #f7931e;
}

@keyframes streamFlow {
  0% {
    left: -10px;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    left: calc(100% + 10px);
    opacity: 0;
  }
}

/* ===== LOADING OVERLAY EFFECTS ===== */

/* Full Page Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(26, 26, 26, 0.95), rgba(45, 45, 45, 0.95));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(10px);
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-title {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 2rem;
  background: linear-gradient(45deg, #ff6b35, #f7931e, #4ecdc4, #45b7d1);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: loadingTitleShimmer 3s ease-in-out infinite;
}

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

.loading-subtitle {
  font-size: 1rem;
  opacity: 0.8;
  margin-top: 1rem;
  animation: loadingSubtitleFade 2s ease-in-out infinite;
}

@keyframes loadingSubtitleFade {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 768px) {
  .quantum-loader {
    width: 150px;
    height: 150px;
  }
  
  .molecular-assembly {
    width: 200px;
    height: 150px;
  }
  
  .neural-progress {
    width: 250px;
    height: 80px;
  }
  
  .particle-stream-progress {
    width: 300px;
    height: 50px;
  }
  
  .loading-title {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .dna-helix-loader {
    width: 80px;
    height: 120px;
  }
  
  .holographic-progress {
    width: 120px;
    height: 120px;
  }
  
  .neural-progress {
    width: 200px;
    height: 60px;
  }
  
  .particle-stream-progress {
    width: 250px;
    height: 40px;
  }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

@media (prefers-reduced-motion: reduce) {
  .dna-helix-strand,
  .quantum-particle,
  .quantum-core,
  .molecule-part,
  .molecular-bond,
  .neural-wave,
  .neural-node,
  .holo-ring,
  .stream-particle,
  .loading-title,
  .loading-subtitle {
    animation: none;
  }
}

/* GPU acceleration */
.dna-helix-strand,
.quantum-particle,
.molecule-part,
.neural-wave,
.holo-ring,
.stream-particle {
  will-change: transform;
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */

.loading-overlay {
  color-scheme: dark;
}

@media (prefers-contrast: high) {
  .neural-progress,
  .particle-stream-progress {
    border: 2px solid currentColor;
  }
  
  .loading-overlay {
    background: rgba(0, 0, 0, 0.9);
  }
}

/* ===== UTILITY CLASSES ===== */

.loading-fade-in {
  animation: loadingFadeIn 0.8s ease-out forwards;
}

@keyframes loadingFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.loading-fade-out {
  animation: loadingFadeOut 0.5s ease-in forwards;
}

@keyframes loadingFadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

.loading-pulse {
  animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}