/**
 * Liquick Ultra-Modern Fintech Aesthetics
 * Advanced background effects for crypto/fintech application
 * Supports both dark and light themes
 */

/* ======================================
 * Global Page Background Foundation
 * ====================================== */

.main-content {
  position: relative;
  min-height: 100vh;
}

/* Base aesthetic layer - applied to body */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -3;
  pointer-events: none;
  background: 
    /* Subtle noise texture for depth */
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E"),
    var(--bg-primary);
  opacity: 0.03;
}

/* ======================================
 * Gradient Mesh Background System
 * ====================================== */

.fintech-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
}

/* Primary gradient orbs - Dark theme */
.fintech-bg::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 80vmax;
  height: 80vmax;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 255, 136, 0.08) 0%,
    rgba(0, 255, 136, 0.03) 30%,
    transparent 70%
  );
  animation: meshFloat 30s ease-in-out infinite;
  filter: blur(60px);
  /* Promote to own compositing layer so blur+animation stays off the main thread */
  will-change: transform;
  transform: translateZ(0);
}

.fintech-bg::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -15%;
  width: 70vmax;
  height: 70vmax;
  background: radial-gradient(
    ellipse at center,
    rgba(124, 58, 237, 0.06) 0%,
    rgba(124, 58, 237, 0.02) 30%,
    transparent 70%
  );
  animation: meshFloat 25s ease-in-out infinite reverse;
  filter: blur(80px);
  /* Promote to own compositing layer */
  will-change: transform;
  transform: translateZ(0);
}

/* Accent orb for additional depth */
.fintech-bg-accent {
  position: fixed;
  top: 40%;
  left: 50%;
  width: 50vmax;
  height: 50vmax;
  background: radial-gradient(
    circle at center,
    rgba(59, 130, 246, 0.04) 0%,
    transparent 60%
  );
  transform: translate(-50%, -50%) translateZ(0);
  animation: meshPulse 20s ease-in-out infinite;
  filter: blur(100px);
  z-index: -2;
  pointer-events: none;
  /* Promote to own compositing layer so blur+animation stays off the main thread */
  will-change: transform, opacity;
}

@keyframes meshFloat {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(5%, 3%) scale(1.05);
  }
  66% {
    transform: translate(-3%, -5%) scale(0.95);
  }
}

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

/* Light theme gradient adjustments */
[data-theme="light"] .fintech-bg::before {
  background: radial-gradient(
    ellipse at center,
    rgba(0, 204, 106, 0.12) 0%,
    rgba(0, 204, 106, 0.04) 30%,
    transparent 70%
  );
}

[data-theme="light"] .fintech-bg::after {
  background: radial-gradient(
    ellipse at center,
    rgba(124, 58, 237, 0.08) 0%,
    rgba(124, 58, 237, 0.03) 30%,
    transparent 70%
  );
}

[data-theme="light"] .fintech-bg-accent {
  background: radial-gradient(
    circle at center,
    rgba(59, 130, 246, 0.06) 0%,
    transparent 60%
  );
}

/* ======================================
 * Blockchain Grid Pattern
 * ====================================== */

.blockchain-grid {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.15;
  background-image: 
    linear-gradient(rgba(0, 255, 136, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 136, 0.02) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 30%, black 10%, transparent 60%);
  -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 30%, black 10%, transparent 60%);
  will-change: opacity;
}

[data-theme="light"] .blockchain-grid {
  background-image: 
    linear-gradient(rgba(0, 100, 50, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 100, 50, 0.03) 1px, transparent 1px);
  opacity: 0.12;
}

/* ======================================
 * Floating Crypto Elements
 * ====================================== */

.crypto-float-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.crypto-float {
  position: absolute;
  opacity: 0;
  animation: cryptoFloat 40s linear infinite;
}

.crypto-float--btc {
  left: 8%;
  animation-delay: 0s;
  animation-duration: 45s;
}

.crypto-float--eth {
  left: 25%;
  animation-delay: -8s;
  animation-duration: 38s;
}

.crypto-float--sol {
  left: 45%;
  animation-delay: -16s;
  animation-duration: 42s;
}

.crypto-float--usdt {
  left: 65%;
  animation-delay: -24s;
  animation-duration: 50s;
}

.crypto-float--bnb {
  left: 82%;
  animation-delay: -32s;
  animation-duration: 36s;
}

.crypto-float--bank {
  left: 92%;
  animation-delay: -40s;
  animation-duration: 55s;
}

.crypto-float svg {
  width: 56px;
  height: 56px;
  filter: blur(0.3px);
  will-change: transform, opacity;
}

@keyframes cryptoFloat {
  0% {
    transform: translateY(110vh) rotate(0deg) scale(0.9);
    opacity: 0;
  }
  5% {
    opacity: 0.12;
  }
  50% {
    opacity: 0.06;
  }
  95% {
    opacity: 0.1;
  }
  100% {
    transform: translateY(-10vh) rotate(180deg) scale(1.1);
    opacity: 0;
  }
}

[data-theme="light"] .crypto-float {
  animation-name: cryptoFloatLight;
}

@keyframes cryptoFloatLight {
  0% {
    transform: translateY(110vh) rotate(0deg) scale(0.9);
    opacity: 0;
  }
  5% {
    opacity: 0.18;
  }
  50% {
    opacity: 0.08;
  }
  95% {
    opacity: 0.14;
  }
  100% {
    transform: translateY(-10vh) rotate(180deg) scale(1.1);
    opacity: 0;
  }
}

/* ======================================
 * Network Connection Lines
 * ====================================== */

/* Network lines hidden - too distracting for content readability */
.network-lines {
  display: none;
}

.network-lines svg {
  display: none;
}

.network-line {
  display: none;
}

.network-node {
  display: none;
}

@keyframes dashMove {
  to {
    stroke-dashoffset: -100;
  }
}

@keyframes nodePulse {
  0%, 100% {
    opacity: 0.3;
    r: 3;
  }
  50% {
    opacity: 0.8;
    r: 5;
  }
}

[data-theme="light"] .network-line {
  stroke: rgba(0, 150, 80, 0.1);
}

[data-theme="light"] .network-node {
  fill: rgba(0, 150, 80, 0.2);
}

/* ======================================
 * Ambient Glow Effects
 * ====================================== */

.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: -2;
  will-change: transform, opacity;
}

.ambient-glow--primary {
  top: 10%;
  right: 5%;
  width: 350px;
  height: 350px;
  background: rgba(0, 255, 136, 0.05);
  animation: glowPulse 12s ease-in-out infinite;
}

.ambient-glow--secondary {
  bottom: 20%;
  left: 10%;
  width: 280px;
  height: 280px;
  background: rgba(124, 58, 237, 0.04);
  animation: glowPulse 15s ease-in-out infinite reverse;
}

.ambient-glow--accent {
  top: 50%;
  left: 50%;
  width: 450px;
  height: 450px;
  background: rgba(59, 130, 246, 0.03);
  transform: translate(-50%, -50%);
  animation: glowPulseCenter 18s ease-in-out infinite;
}

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

.ambient-glow--accent {
  animation: glowPulseCenter 12s ease-in-out infinite;
}

@keyframes glowPulseCenter {
  0%, 100% {
    opacity: 0.3;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1.03);
  }
}

[data-theme="light"] .ambient-glow--primary {
  background: rgba(0, 200, 100, 0.08);
}

[data-theme="light"] .ambient-glow--secondary {
  background: rgba(124, 58, 237, 0.05);
}

[data-theme="light"] .ambient-glow--accent {
  background: rgba(59, 130, 246, 0.04);
}

/* ======================================
 * Glassmorphism Enhancement
 * ====================================== */

.glass-card {
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .glass-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* ======================================
 * Shimmer/Shine Effect for Cards
 * ====================================== */

.card-shimmer {
  position: relative;
  overflow: hidden;
}

.card-shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.03),
    transparent
  );
  transform: skewX(-25deg);
  animation: shimmer 8s infinite;
}

@keyframes shimmer {
  0% {
    left: -150%;
  }
  50%, 100% {
    left: 150%;
  }
}

[data-theme="light"] .card-shimmer::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.5),
    transparent
  );
}

/* ======================================
 * Data Stream Effect (Side decoration)
 * ====================================== */

.data-stream {
  position: fixed;
  top: 0;
  width: 1px;
  height: 100vh;
  z-index: -2;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.4;
}

.data-stream--left {
  left: 2%;
}

.data-stream--right {
  right: 2%;
}

.data-stream::before {
  content: '';
  position: absolute;
  /* Start above the viewport; animation uses transform so no layout recalculation */
  top: -80px;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(0, 255, 136, 0.15),
    transparent
  );
  animation: dataFlow 6s linear infinite;
  /* Use transform instead of top — transform is GPU-composited, top triggers layout */
  will-change: transform, opacity;
}

.data-stream--right::before {
  animation-delay: -3s;
  animation-duration: 7s;
}

@keyframes dataFlow {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  15% {
    opacity: 0.6;
  }
  85% {
    opacity: 0.6;
  }
  100% {
    /* 100vh of travel + 80px element height — GPU transform, zero layout cost */
    transform: translateY(calc(100vh + 80px));
    opacity: 0;
  }
}

[data-theme="light"] .data-stream::before {
  background: linear-gradient(
    180deg,
    transparent,
    rgba(0, 180, 90, 0.2),
    transparent
  );
}

/* ======================================
 * Corner Decorations
 * ====================================== */

.corner-decoration {
  position: fixed;
  width: 180px;
  height: 180px;
  z-index: -2;
  pointer-events: none;
  opacity: 0.25;
}

.corner-decoration--top-left {
  top: 0;
  left: 0;
  background: 
    radial-gradient(circle at 0 0, rgba(0, 255, 136, 0.06) 0%, transparent 50%);
}

.corner-decoration--top-right {
  top: 0;
  right: 0;
  background: 
    radial-gradient(circle at 100% 0, rgba(124, 58, 237, 0.04) 0%, transparent 50%);
}

.corner-decoration--bottom-left {
  bottom: 0;
  left: 0;
  background: 
    radial-gradient(circle at 0 100%, rgba(59, 130, 246, 0.04) 0%, transparent 50%);
}

.corner-decoration--bottom-right {
  bottom: 0;
  right: 0;
  background: 
    radial-gradient(circle at 100% 100%, rgba(0, 255, 136, 0.03) 0%, transparent 50%);
}

[data-theme="light"] .corner-decoration--top-left {
  background: 
    radial-gradient(circle at 0 0, rgba(0, 200, 100, 0.08) 0%, transparent 50%);
}

[data-theme="light"] .corner-decoration--top-right {
  background: 
    radial-gradient(circle at 100% 0, rgba(124, 58, 237, 0.06) 0%, transparent 50%);
}

[data-theme="light"] .corner-decoration--bottom-left {
  background: 
    radial-gradient(circle at 0 100%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
}

[data-theme="light"] .corner-decoration--bottom-right {
  background: 
    radial-gradient(circle at 100% 100%, rgba(0, 200, 100, 0.05) 0%, transparent 50%);
}

/* ======================================
 * Hexagon Pattern Overlay
 * ====================================== */

.hex-pattern {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%2300ff88' fill-opacity='0.02'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 20%, transparent 70%);
}

[data-theme="light"] .hex-pattern {
  opacity: 0.1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%2300994f' fill-opacity='0.03'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ======================================
 * Animated Border Glow for Important Cards
 * ====================================== */

.glow-border {
  position: relative;
}

.glow-border::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    45deg,
    rgba(0, 255, 136, 0.3),
    rgba(124, 58, 237, 0.3),
    rgba(59, 130, 246, 0.3),
    rgba(0, 255, 136, 0.3)
  );
  background-size: 400% 400%;
  border-radius: inherit;
  z-index: -1;
  animation: borderGlow 8s ease infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.glow-border:hover::before {
  opacity: 1;
}

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

/* ======================================
 * Scrollbar Styling (Aesthetic)
 * ====================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--color-primary), var(--color-secondary));
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--color-primary-light), var(--color-secondary-light));
}

/* ======================================
 * Responsive Adjustments
 * ====================================== */

@media (max-width: 768px) {
  /* ── Mobile Performance Optimization ──────────────────────────────
   * The floating crypto icons, blur orbs, and ambient glows all run
   * animations on mobile. On low/mid-range phones this saturates the
   * GPU and main thread, making the entire app unresponsive.
   *
   * Strategy: kill every background animation, remove blur filters,
   * and hide the most expensive decorative layers entirely.
   * The static blockchain grid and corner decorations keep the look
   * without any CPU/GPU cost.
   * ─────────────────────────────────────────────────────────────────── */

  /* 1. Stop ALL background animations — biggest single perf win */
  .fintech-bg::before,
  .fintech-bg::after,
  .fintech-bg-accent,
  .ambient-glow--primary,
  .ambient-glow--secondary,
  .ambient-glow--accent,
  .card-shimmer::before,
  .data-stream::before {
    animation: none;
  }

  /* 2. Remove expensive blur filters on the large orbs —
        blur() on elements this large requires the GPU to redraw
        a massive texture every frame even when not animating */
  .fintech-bg::before,
  .fintech-bg::after {
    filter: none;
    will-change: auto;
    opacity: 0.05;
  }

  .fintech-bg-accent {
    filter: none;
    will-change: auto;
    opacity: 0.03;
  }

  /* 3. Hide the most GPU-intensive decorative elements on mobile */
  .crypto-float-container {
    display: none; /* 6 animated SVGs — biggest single offender */
  }

  .ambient-glow {
    display: none; /* Large blurred circles: expensive even when static */
  }

  .data-stream {
    display: none; /* Data streams not needed on mobile */
  }

  /* 4. Lighten the static grid patterns */
  .blockchain-grid {
    background-size: 40px 40px;
    opacity: 0.08;
  }

  .corner-decoration {
    width: 100px;
    height: 100px;
  }
}

/* ======================================
 * Performance Optimization
 * Reduce animations for users who prefer reduced motion
 * ====================================== */

@media (prefers-reduced-motion: reduce) {
  .fintech-bg::before,
  .fintech-bg::after,
  .fintech-bg-accent,
  .crypto-float,
  .network-line,
  .network-node,
  .ambient-glow,
  .data-stream::before,
  .card-shimmer::before {
    animation: none;
  }
  
  .crypto-float {
    display: none;
  }
}
