/*
 * PREMIUM BACKGROUND GRAPHICS
 * Subtle, Professional, Non-Blocky Backgrounds
 * Enhances visual appeal without overwhelming content
 */

/* ===== ANIMATED GRADIENT MESHES ===== */
.bg-gradient-mesh {
  position: relative;
  overflow: hidden;
}

.bg-gradient-mesh::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(236, 72, 153, 0.05) 0%, transparent 50%);
  animation: gradientMeshMove 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes gradientMeshMove {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  33% {
    transform: translate(10%, -10%) rotate(120deg);
  }
  66% {
    transform: translate(-10%, 10%) rotate(240deg);
  }
}

/* ===== SUBTLE GRID PATTERN ===== */
.bg-grid-subtle {
  position: relative;
}

.bg-grid-subtle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(var(--text-primary) 1px, transparent 1px),
    linear-gradient(90deg, var(--text-primary) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .bg-grid-subtle::before {
  opacity: 0.05;
}

/* ===== FLOATING BLOBS ===== */
.bg-blobs {
  position: relative;
  overflow: hidden;
}

.blob-decoration {
  position: absolute;
  border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  background: linear-gradient(135deg, 
    rgba(59, 130, 246, 0.08), 
    rgba(168, 85, 247, 0.06));
  filter: blur(40px);
  animation: blobFloat 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.blob-decoration:nth-child(1) {
  width: 300px;
  height: 300px;
  top: -100px;
  left: -50px;
  animation-delay: 0s;
}

.blob-decoration:nth-child(2) {
  width: 400px;
  height: 400px;
  bottom: -150px;
  right: -100px;
  animation-delay: 7s;
  background: linear-gradient(135deg, 
    rgba(236, 72, 153, 0.06), 
    rgba(59, 130, 246, 0.08));
}

.blob-decoration:nth-child(3) {
  width: 250px;
  height: 250px;
  top: 50%;
  left: 50%;
  animation-delay: 14s;
  background: linear-gradient(135deg, 
    rgba(168, 85, 247, 0.05), 
    rgba(236, 72, 153, 0.05));
}

@keyframes blobFloat {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
  }
  25% {
    transform: translate(30px, -30px) rotate(90deg);
    border-radius: 60% 40% 30% 70% / 50% 60% 40% 50%;
  }
  50% {
    transform: translate(-20px, 20px) rotate(180deg);
    border-radius: 30% 70% 60% 40% / 60% 40% 50% 60%;
  }
  75% {
    transform: translate(20px, 30px) rotate(270deg);
    border-radius: 70% 30% 40% 60% / 40% 60% 50% 40%;
  }
}

/* ===== DIAGONAL STRIPES (SUBTLE) ===== */
.bg-stripes {
  position: relative;
}

.bg-stripes::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    var(--text-primary) 10px,
    var(--text-primary) 10.5px
  );
  opacity: 0.02;
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .bg-stripes::before {
  opacity: 0.03;
}

/* ===== DOTTED PATTERN ===== */
.bg-dots {
  position: relative;
}

.bg-dots::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(
    circle at center,
    var(--text-primary) 1px,
    transparent 1px
  );
  background-size: 30px 30px;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}

[data-theme="dark"] .bg-dots::before {
  opacity: 0.06;
}

/* ===== WAVE DIVIDERS ===== */
.wave-divider {
  position: absolute;
  width: 100%;
  overflow: hidden;
  line-height: 0;
  pointer-events: none;
}

.wave-divider.top {
  top: 0;
  transform: rotate(180deg);
}

.wave-divider.bottom {
  bottom: 0;
}

.wave-divider svg {
  position: relative;
  display: block;
  width: calc(100% + 1.3px);
  height: 60px;
}

.wave-divider .shape-fill {
  fill: var(--bg-primary);
}

/* Animated wave */
.wave-animated {
  animation: waveMove 10s ease-in-out infinite;
}

@keyframes waveMove {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-25px);
  }
}

/* ===== GLASS MORPHISM LAYERS ===== */
.glass-layer {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .glass-layer {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ===== RADIAL GLOW EFFECTS ===== */
.bg-radial-glow {
  position: relative;
  overflow: hidden;
}

.bg-radial-glow::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 800px;
  height: 800px;
  background: radial-gradient(
    circle,
    rgba(59, 130, 246, 0.1) 0%,
    transparent 70%
  );
  transform: translate(-50%, -50%);
  animation: glowPulse 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes glowPulse {
  0%, 100% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

/* ===== CORNER ACCENTS ===== */
.corner-accent {
  position: relative;
}

.corner-accent::before,
.corner-accent::after {
  content: '';
  position: absolute;
  width: 100px;
  height: 100px;
  border: 2px solid var(--primary-blue);
  opacity: 0.1;
  pointer-events: none;
}

.corner-accent::before {
  top: 0;
  left: 0;
  border-right: none;
  border-bottom: none;
}

.corner-accent::after {
  bottom: 0;
  right: 0;
  border-left: none;
  border-top: none;
}

/* ===== SECTION BACKGROUNDS (ALTERNATING) ===== */
section:nth-child(odd) {
  position: relative;
}

section:nth-child(even) {
  position: relative;
  background: linear-gradient(
    180deg,
    rgba(59, 130, 246, 0.02) 0%,
    transparent 50%,
    rgba(168, 85, 247, 0.02) 100%
  );
}

/* ===== PARTICLE SYSTEM (SUBTLE) ===== */
.bg-particles {
  position: relative;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--primary-blue);
  border-radius: 50%;
  opacity: 0.2;
  pointer-events: none;
  animation: particleFloat 15s linear infinite;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 2s; }
.particle:nth-child(3) { left: 30%; animation-delay: 4s; }
.particle:nth-child(4) { left: 40%; animation-delay: 6s; }
.particle:nth-child(5) { left: 50%; animation-delay: 8s; }
.particle:nth-child(6) { left: 60%; animation-delay: 10s; }
.particle:nth-child(7) { left: 70%; animation-delay: 12s; }
.particle:nth-child(8) { left: 80%; animation-delay: 14s; }
.particle:nth-child(9) { left: 90%; animation-delay: 16s; }

@keyframes particleFloat {
  0% {
    transform: translateY(100vh) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 0.2;
  }
  90% {
    opacity: 0.2;
  }
  100% {
    transform: translateY(-100px) scale(1);
    opacity: 0;
  }
}

/* ===== GRADIENT BORDERS ===== */
.gradient-border-wrapper {
  position: relative;
  padding: 2px;
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.2),
    rgba(168, 85, 247, 0.2),
    rgba(236, 72, 153, 0.2)
  );
  border-radius: 16px;
  background-size: 200% 200%;
  animation: gradientBorderMove 5s ease infinite;
}

.gradient-border-wrapper > * {
  border-radius: 14px;
  background: var(--bg-primary);
}

@keyframes gradientBorderMove {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* ===== LIGHT RAYS ===== */
.bg-light-rays {
  position: relative;
  overflow: hidden;
}

.bg-light-rays::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg at 50% 50%,
    transparent 0deg,
    rgba(59, 130, 246, 0.05) 60deg,
    transparent 120deg,
    rgba(168, 85, 247, 0.05) 180deg,
    transparent 240deg,
    rgba(236, 72, 153, 0.05) 300deg,
    transparent 360deg
  );
  animation: lightRaysRotate 30s linear infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes lightRaysRotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
  /* Simplify backgrounds on mobile */
  .blob-decoration {
    filter: blur(60px);
    opacity: 0.5;
  }

  .wave-divider svg {
    height: 40px;
  }

  .bg-gradient-mesh::before,
  .bg-radial-glow::before,
  .bg-light-rays::before {
    animation-duration: 40s; /* Slower for performance */
  }

  /* Reduce particle count on mobile */
  .particle:nth-child(n+6) {
    display: none;
  }
}

/* ===== DARK MODE ADJUSTMENTS ===== */
[data-theme="dark"] .bg-gradient-mesh::before {
  background: 
    radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(236, 72, 153, 0.08) 0%, transparent 50%);
}

[data-theme="dark"] .blob-decoration {
  filter: blur(50px);
}

[data-theme="dark"] .bg-radial-glow::before {
  background: radial-gradient(
    circle,
    rgba(59, 130, 246, 0.15) 0%,
    transparent 70%
  );
}

/* ===== ENSURE CONTENT IS ABOVE BACKGROUNDS ===== */
section > .container,
section > * {
  position: relative;
  z-index: 1;
}
