/**
 * Abstract Spinner System CSS
 * Styles for all geometric spinner variations
 */

/* ===== BASE SPINNER WRAPPER ===== */
.abstract-spinner-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  animation: fadeIn 0.3s ease-out;
}

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

.abstract-spinner {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Text Styles */
.spinner-primary-text {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--neutral-800, #1f2937);
  margin: 0;
  text-align: center;
  letter-spacing: -0.025em;
}

.spinner-secondary-text {
  font-size: 0.875rem;
  color: var(--neutral-600, #4b5563);
  text-align: center;
  max-width: 400px;
  line-height: 1.5;
  opacity: 0.8;
}

/* ===== QUANTUM MORPH SPINNER ===== */
.abstract-spinner-quantum-morph {
  perspective: 1000px;
}

.quantum-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
}

.quantum-ring-1 {
  width: 100%;
  height: 100%;
  border-color: rgba(59, 130, 246, 0.3);
  animation: quantumRotate 4s linear infinite, quantumMorph 2s ease-in-out infinite;
}

.quantum-ring-2 {
  width: 80%;
  height: 80%;
  top: 10%;
  left: 10%;
  border-color: rgba(168, 85, 247, 0.3);
  animation: quantumRotate 3s linear infinite reverse, quantumMorph 2s ease-in-out infinite 0.5s;
}

.quantum-ring-3 {
  width: 60%;
  height: 60%;
  top: 20%;
  left: 20%;
  border-color: rgba(236, 72, 153, 0.3);
  animation: quantumRotate 2s linear infinite, quantumMorph 2s ease-in-out infinite 1s;
}

.quantum-ring-4 {
  width: 40%;
  height: 40%;
  top: 30%;
  left: 30%;
  border-color: rgba(34, 197, 94, 0.3);
  animation: quantumRotate 1.5s linear infinite reverse, quantumMorph 2s ease-in-out infinite 1.5s;
}

.quantum-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: linear-gradient(135deg, #3b82f6, #a855f7);
  border-radius: 50%;
  top: -2px;
  left: calc(50% - 2px);
  transform-origin: center 60px;
  animation: particleOrbit 3s linear infinite;
  animation-delay: calc(var(--particle-index) * 0.375s);
  box-shadow: 0 0 6px rgba(168, 85, 247, 0.6);
}

.quantum-core {
  position: absolute;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.8), rgba(168, 85, 247, 0.6));
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: quantumPulse 2s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

@keyframes quantumRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes quantumMorph {
  0%, 100% { 
    transform: scale(1) rotateX(0deg);
    border-width: 2px;
  }
  50% { 
    transform: scale(1.1) rotateX(180deg);
    border-width: 3px;
  }
}

@keyframes particleOrbit {
  from { transform: rotate(0deg) translateX(50px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(50px) rotate(-360deg); }
}

@keyframes quantumPulse {
  0%, 100% { 
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.8;
  }
  50% { 
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 1;
  }
}

/* ===== HEXAGON PULSE SPINNER ===== */
.abstract-spinner-hexagon-pulse {
  transform-style: preserve-3d;
}

.hexagon-shape {
  position: relative;
  width: 100%;
  height: 100%;
  animation: hexagonRotate 8s linear infinite;
}

.hexagon-vertex {
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(calc(var(--vertex-index) * 60deg)) translateY(-50px);
  animation: vertexPulse 2s ease-in-out infinite;
  animation-delay: calc(var(--vertex-index) * 0.1s);
}

.vertex-dot {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.7);
  animation: dotGlow 2s ease-in-out infinite;
  animation-delay: calc(var(--vertex-index) * 0.1s);
}

.hexagon-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hexagon-line {
  position: absolute;
  width: 2px;
  height: 50px;
  background: linear-gradient(to bottom, transparent, rgba(6, 182, 212, 0.6), transparent);
  top: 50%;
  left: 50%;
  transform-origin: center top;
  transform: translate(-50%, 0) rotate(calc(var(--line-index) * 60deg));
  animation: lineFlow 1.5s linear infinite;
  animation-delay: calc(var(--line-index) * 0.25s);
}

@keyframes hexagonRotate {
  from { transform: rotateZ(0deg) rotateX(25deg); }
  to { transform: rotateZ(360deg) rotateX(25deg); }
}

@keyframes vertexPulse {
  0%, 100% { transform: translate(-50%, -50%) rotate(calc(var(--vertex-index) * 60deg)) translateY(-50px) scale(1); }
  50% { transform: translate(-50%, -50%) rotate(calc(var(--vertex-index) * 60deg)) translateY(-55px) scale(1.2); }
}

@keyframes dotGlow {
  0%, 100% { 
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.7);
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 0 20px rgba(59, 130, 246, 1);
    transform: scale(1.1);
  }
}

@keyframes lineFlow {
  0% { opacity: 0; transform: translate(-50%, 0) rotate(calc(var(--line-index) * 60deg)) scaleY(0); }
  50% { opacity: 1; transform: translate(-50%, 0) rotate(calc(var(--line-index) * 60deg)) scaleY(1); }
  100% { opacity: 0; transform: translate(-50%, 0) rotate(calc(var(--line-index) * 60deg)) scaleY(0); }
}

/* ===== CUBE FOLD SPINNER ===== */
.abstract-spinner-cube-fold {
  perspective: 600px;
  transform-style: preserve-3d;
}

.cube-3d {
  width: 70px;
  height: 70px;
  position: relative;
  transform-style: preserve-3d;
  animation: cubeRotate 4s linear infinite, cubeFold 2s ease-in-out infinite;
}

.cube-face {
  position: absolute;
  width: 70px;
  height: 70px;
  border: 2px solid rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.1);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  padding: 4px;
}

.cube-grid {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
  border-radius: 2px;
  animation: gridPulse 2s ease-in-out infinite;
  animation-delay: calc(var(--grid-index, 0) * 0.1s);
}

.cube-face-front { transform: translateZ(35px); }
.cube-face-back { transform: translateZ(-35px) rotateY(180deg); }
.cube-face-right { transform: rotateY(90deg) translateZ(35px); }
.cube-face-left { transform: rotateY(-90deg) translateZ(35px); }
.cube-face-top { transform: rotateX(90deg) translateZ(35px); }
.cube-face-bottom { transform: rotateX(-90deg) translateZ(35px); }

@keyframes cubeRotate {
  from { transform: rotateX(0deg) rotateY(0deg); }
  to { transform: rotateX(360deg) rotateY(360deg); }
}

@keyframes cubeFold {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.1) rotateX(90deg); }
  50% { transform: scale(0.9) rotateY(90deg); }
  75% { transform: scale(1.1) rotateZ(90deg); }
}

@keyframes gridPulse {
  0%, 100% { 
    opacity: 0.5;
    transform: scale(1);
  }
  50% { 
    opacity: 1;
    transform: scale(0.9);
  }
}

/* ===== DNA HELIX SPINNER ===== */
.abstract-spinner-dna-helix {
  transform-style: preserve-3d;
  perspective: 500px;
}

.dna-helix {
  width: 100%;
  height: 100%;
  position: relative;
  transform: rotateX(-20deg);
  animation: helixRotate 4s linear infinite;
}

.dna-pair {
  position: absolute;
  width: 100%;
  height: 8px;
  top: calc(var(--pair-index) * 8.33%);
  transform-style: preserve-3d;
  animation: pairRotate 2s linear infinite;
  animation-delay: calc(var(--pair-index) * -0.167s);
}

.dna-strand {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  top: 0;
}

.dna-strand-1 {
  left: 20px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.8);
}

.dna-strand-2 {
  right: 20px;
  background: linear-gradient(135deg, #ec4899, #a855f7);
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.8);
}

.dna-connection {
  position: absolute;
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.4), rgba(236, 72, 153, 0.4));
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
}

@keyframes helixRotate {
  from { transform: rotateX(-20deg) rotateY(0deg); }
  to { transform: rotateX(-20deg) rotateY(360deg); }
}

@keyframes pairRotate {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(360deg); }
}

/* ===== NEURAL NETWORK SPINNER ===== */
.abstract-spinner-neural-network {
  transform-style: preserve-3d;
}

.neural-network {
  width: 100%;
  height: 100%;
  position: relative;
  animation: networkPulse 3s ease-in-out infinite;
}

.neural-node {
  position: absolute;
  width: 16px;
  height: 16px;
  background: radial-gradient(circle, #8b5cf6, #6366f1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: nodePulse 2s ease-in-out infinite;
  animation-delay: calc(var(--node-index) * 0.2s);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.7);
}

.neural-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px solid rgba(139, 92, 246, 0.4);
  border-radius: 50%;
  animation: neuralPulseOut 2s ease-out infinite;
  animation-delay: calc(var(--node-index) * 0.2s);
}

.neural-synapse {
  position: absolute;
  width: 2px;
  background: linear-gradient(to right, transparent, rgba(139, 92, 246, 0.6), transparent);
  transform-origin: center;
  animation: synapseFlow 1.5s linear infinite;
  animation-delay: calc(var(--synapse-index) * 0.2s);
}

/* Define synapse connections */
.neural-synapse:nth-child(7) { height: 30%; top: 20%; left: 50%; transform: translateX(-50%) rotate(135deg); }
.neural-synapse:nth-child(8) { height: 30%; top: 20%; left: 50%; transform: translateX(-50%) rotate(45deg); }
.neural-synapse:nth-child(9) { height: 30%; top: 50%; left: 20%; transform: translateY(-50%) rotate(135deg); }
.neural-synapse:nth-child(10) { height: 30%; top: 50%; right: 20%; transform: translateY(-50%) rotate(45deg); }
.neural-synapse:nth-child(11) { height: 30%; bottom: 20%; left: 35%; transform: rotate(90deg); }
.neural-synapse:nth-child(12) { height: 30%; bottom: 20%; right: 35%; transform: rotate(90deg); }
.neural-synapse:nth-child(13) { height: 45%; top: 35%; left: 35%; transform: rotate(45deg); }
.neural-synapse:nth-child(14) { height: 45%; top: 35%; right: 35%; transform: rotate(135deg); }

@keyframes networkPulse {
  0%, 100% { transform: scale(1) rotateZ(0deg); }
  50% { transform: scale(1.05) rotateZ(5deg); }
}

@keyframes nodePulse {
  0%, 100% { 
    transform: translate(-50%, -50%) scale(1);
    filter: brightness(1);
  }
  50% { 
    transform: translate(-50%, -50%) scale(1.2);
    filter: brightness(1.3);
  }
}

@keyframes neuralPulseOut {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

@keyframes synapseFlow {
  0% { opacity: 0; background-size: 0% 2px; }
  50% { opacity: 1; background-size: 100% 2px; }
  100% { opacity: 0; background-size: 0% 2px; }
}

/* ===== FRACTAL BLOOM SPINNER ===== */
.abstract-spinner-fractal-bloom {
  transform-style: preserve-3d;
}

.fractal-bloom {
  width: 100%;
  height: 100%;
  position: relative;
  animation: fractalRotate 10s linear infinite;
}

.fractal-center {
  position: absolute;
  width: 12px;
  height: 12px;
  background: radial-gradient(circle, #f59e0b, #ef4444);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.8);
  animation: fractalCenterPulse 2s ease-in-out infinite;
}

.fractal-branch {
  position: absolute;
  background: linear-gradient(to right, rgba(245, 158, 11, 0.8), transparent);
  transform-origin: left center;
  border-radius: 2px;
}

.fractal-depth-1 {
  width: 40px;
  height: 3px;
  top: 50%;
  left: 50%;
  transform: translate(6px, -1.5px) rotate(calc(var(--branch-index) * 60deg));
  animation: branchGrow 3s ease-in-out infinite;
  animation-delay: calc(var(--branch-index) * 0.1s);
}

.fractal-depth-2 {
  width: 20px;
  height: 2px;
  top: 50%;
  left: 100%;
  transform: translate(0, -1px) rotate(calc((var(--branch-index) % 2) * 60deg - 30deg));
  animation: branchGrow 3s ease-in-out infinite;
  animation-delay: calc(var(--branch-index) * 0.15s + 0.5s);
}

.fractal-depth-3 {
  width: 10px;
  height: 1px;
  top: 50%;
  left: 100%;
  transform: translate(0, -0.5px) rotate(calc((var(--branch-index) % 2) * 60deg - 30deg));
  animation: branchGrow 3s ease-in-out infinite;
  animation-delay: calc(var(--branch-index) * 0.2s + 1s);
}

@keyframes fractalRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes fractalCenterPulse {
  0%, 100% { 
    transform: translate(-50%, -50%) scale(1);
    filter: brightness(1);
  }
  50% { 
    transform: translate(-50%, -50%) scale(1.3);
    filter: brightness(1.3);
  }
}

@keyframes branchGrow {
  0%, 100% { 
    transform: translate(var(--translate-x, 6px), var(--translate-y, -1.5px)) 
               rotate(calc(var(--branch-index) * 60deg + var(--rotation-offset, 0deg))) 
               scaleX(0.8);
    opacity: 0.6;
  }
  50% { 
    transform: translate(var(--translate-x, 6px), var(--translate-y, -1.5px)) 
               rotate(calc(var(--branch-index) * 60deg + var(--rotation-offset, 0deg))) 
               scaleX(1.2);
    opacity: 1;
  }
}

/* ===== WAVE INTERFERENCE SPINNER ===== */
.abstract-spinner-wave-interference {
  overflow: hidden;
  border-radius: 50%;
}

.wave-field {
  width: 100%;
  height: 100%;
  position: relative;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.05), transparent);
}

.wave-source {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.wave-source-1 {
  top: 20%;
  left: 35%;
  animation: sourceMove1 4s ease-in-out infinite;
}

.wave-source-2 {
  top: 60%;
  right: 30%;
  animation: sourceMove2 5s ease-in-out infinite;
}

.wave-source-3 {
  bottom: 25%;
  left: 50%;
  animation: sourceMove3 3s ease-in-out infinite;
}

.wave-ring {
  position: absolute;
  border: 2px solid rgba(6, 182, 212, 0.4);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: waveExpand 2s linear infinite;
  animation-delay: calc(var(--wave-index) * 0.5s);
}

.wave-interference-pattern {
  position: absolute;
  width: 100%;
  height: 100%;
  background: 
    repeating-radial-gradient(circle at 30% 40%, 
      transparent, 
      transparent 10px, 
      rgba(6, 182, 212, 0.1) 10px, 
      rgba(6, 182, 212, 0.1) 11px),
    repeating-radial-gradient(circle at 70% 60%, 
      transparent, 
      transparent 10px, 
      rgba(59, 130, 246, 0.1) 10px, 
      rgba(59, 130, 246, 0.1) 11px);
  animation: interferenceShift 8s linear infinite;
  mix-blend-mode: multiply;
}

@keyframes sourceMove1 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(10px, -10px); }
}

@keyframes sourceMove2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-15px, 5px); }
}

@keyframes sourceMove3 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(5px, 15px); }
}

@keyframes waveExpand {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    width: 200px;
    height: 200px;
    opacity: 0;
  }
}

@keyframes interferenceShift {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== CRYSTAL LATTICE SPINNER ===== */
.abstract-spinner-crystal-lattice {
  transform-style: preserve-3d;
  perspective: 600px;
}

.crystal-lattice {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: latticeRotate 8s linear infinite;
}

.crystal-node {
  position: absolute;
  width: 12px;
  height: 12px;
  top: 50%;
  left: 50%;
  transform-style: preserve-3d;
  transform: 
    translate(-50%, -50%) 
    translateX(calc(var(--node-x) * 30px)) 
    translateY(calc(var(--node-y) * 30px)) 
    translateZ(calc(var(--node-z) * 30px));
  animation: nodeFloat 3s ease-in-out infinite;
  animation-delay: calc(var(--node-index) * 0.1s);
}

.crystal-inner {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  border-radius: 2px;
  box-shadow: 
    0 0 10px rgba(16, 185, 129, 0.8),
    inset 0 0 10px rgba(6, 182, 212, 0.4);
  animation: crystalGlow 2s ease-in-out infinite;
  animation-delay: calc(var(--node-index) * 0.1s);
}

.crystal-center {
  position: absolute;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, #06b6d4, #10b981);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 3px;
  box-shadow: 
    0 0 20px rgba(6, 182, 212, 1),
    inset 0 0 10px rgba(16, 185, 129, 0.6);
  animation: centerCrystalPulse 2s ease-in-out infinite;
}

@keyframes latticeRotate {
  from { transform: rotateX(-30deg) rotateY(0deg); }
  to { transform: rotateX(-30deg) rotateY(360deg); }
}

@keyframes nodeFloat {
  0%, 100% {
    transform: 
      translate(-50%, -50%) 
      translateX(calc(var(--node-x) * 30px)) 
      translateY(calc(var(--node-y) * 30px)) 
      translateZ(calc(var(--node-z) * 30px));
  }
  50% {
    transform: 
      translate(-50%, -50%) 
      translateX(calc(var(--node-x) * 35px)) 
      translateY(calc(var(--node-y) * 35px)) 
      translateZ(calc(var(--node-z) * 35px));
  }
}

@keyframes crystalGlow {
  0%, 100% {
    transform: rotate(45deg) scale(1);
    filter: brightness(1);
  }
  50% {
    transform: rotate(45deg) scale(1.1);
    filter: brightness(1.3);
  }
}

@keyframes centerCrystalPulse {
  0%, 100% {
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
    filter: brightness(1);
  }
  50% {
    transform: translate(-50%, -50%) rotate(90deg) scale(1.2);
    filter: brightness(1.5);
  }
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
  .abstract-spinner {
    width: 80px;
    height: 80px;
  }
  
  .spinner-primary-text {
    font-size: 1rem;
  }
  
  .spinner-secondary-text {
    font-size: 0.813rem;
    max-width: 300px;
  }
  
  /* Adjust specific spinner sizes */
  .cube-3d {
    width: 50px;
    height: 50px;
  }
  
  .cube-face {
    width: 50px;
    height: 50px;
  }
  
  .cube-face-front { transform: translateZ(25px); }
  .cube-face-back { transform: translateZ(-25px) rotateY(180deg); }
  .cube-face-right { transform: rotateY(90deg) translateZ(25px); }
  .cube-face-left { transform: rotateY(-90deg) translateZ(25px); }
  .cube-face-top { transform: rotateX(90deg) translateZ(25px); }
  .cube-face-bottom { transform: rotateX(-90deg) translateZ(25px); }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
  .abstract-spinner {
    filter: contrast(1.2);
  }
  
  .spinner-primary-text {
    color: #000;
  }
  
  .spinner-secondary-text {
    color: #333;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .abstract-spinner * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
} 