/* ════════════════════════════════════════════════════════════════
   STOCKBOY PREMIUM — ENTERPRISE LOADING SYSTEM
   Cinematic Splash Screen · Zero CLS · 60 FPS Mobile · GPU Accelerated
   ════════════════════════════════════════════════════════════════ */

/* ── 1. GLOBAL PAGE LOADER (CINEMATIC BACKGROUND) ── */
.sb-page-loader {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background-color: #050608;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0.6s;
  will-change: opacity;
  overflow: hidden;
}
.sb-page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Animated Aurora Background */
.sb-loader-bg {
  position: absolute;
  inset: -50%;
  z-index: 1;
  background: radial-gradient(ellipse 50% 50% at 50% 50%, rgba(246, 196, 83, 0.08) 0%, transparent 60%);
  animation: loaderAurora 15s ease-in-out infinite alternate;
  pointer-events: none;
}
.sb-loader-noise {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0.2;
  background-image: radial-gradient(rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

@keyframes loaderAurora {
  0% { transform: scale(1) rotate(0deg); opacity: 0.6; }
  100% { transform: scale(1.2) rotate(10deg); opacity: 1; }
}

/* ── 2. PREMIUM LOGO BADGE ── */
.sb-loader-content {
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.sb-loader-badge-container {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
  animation: badgeScaleIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes badgeScaleIn {
  0% { transform: scale(0.85); opacity: 0; filter: blur(10px); }
  100% { transform: scale(1); opacity: 1; filter: blur(0px); }
}

/* The Gold Ring & Glass Effect */
.sb-loader-badge {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(20,24,32,0.9), rgba(5,6,8,0.9));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(246, 196, 83, 0.4);
  box-shadow: 
    inset 0 0 20px rgba(246, 196, 83, 0.1),
    0 0 40px rgba(246, 196, 83, 0.15),
    0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  animation: badgePulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: inset 0 0 20px rgba(246,196,83,0.1), 0 0 40px rgba(246,196,83,0.15), 0 10px 30px rgba(0,0,0,0.5); }
  50% { box-shadow: inset 0 0 20px rgba(246,196,83,0.2), 0 0 60px rgba(246,196,83,0.3), 0 10px 30px rgba(0,0,0,0.5); }
}

/* Perfect Circular Image Crop */
.sb-loader-badge img {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  object-fit: cover;
  overflow: hidden;
  display: block;
}

/* ── 3. 360° SVG PROGRESS RING ── */
.sb-loader-svg {
  position: absolute;
  inset: 0;
  width: 120px;
  height: 120px;
  z-index: 2;
  animation: svgSpin 2s linear infinite;
  transform-origin: center center;
}

.sb-loader-svg circle {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
}

/* The faint background track */
.sb-loader-track {
  stroke: rgba(255,255,255,0.05);
}

/* The animated gold progress head */
.sb-loader-head {
  stroke: url(#goldGradient);
  stroke-dasharray: 90 150;
  stroke-dashoffset: 0;
  animation: svgDash 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(246,196,83,0.6));
}

@keyframes svgSpin {
  100% { transform: rotate(360deg); }
}

@keyframes svgDash {
  0% { stroke-dasharray: 1 200; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 90 150; stroke-dashoffset: -40px; }
  100% { stroke-dasharray: 90 150; stroke-dashoffset: -124px; }
}

/* ── 4. TYPOGRAPHY ── */
.sb-loader-text {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #8A919E;
  margin-top: 1rem;
  opacity: 0;
  animation: textFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
  background: linear-gradient(90deg, #8A919E, #FFFFFF, #8A919E);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textFadeIn 1s forwards 0.5s, textShimmer 3s linear infinite 1.5s;
}

@keyframes textFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes textShimmer {
  to { background-position: 200% center; }
}

/* ── 2. PREMIUM SKELETON SYSTEM (NO DOM SPINNERS) ── */
.sb-skel {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.03) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.03) 75%
  );
  background-size: 200% 100%;
  animation: sbSkelShimmer 1.5s infinite;
  border-radius: 0.25rem;
}
@keyframes sbSkelShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Specific Skeleton Components */
.sb-skel-signal-card {
  background: rgba(16,37,48,0.4);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  height: auto;
  min-height: 180px;
}
.sb-skel-signal-card .sb-skel-header {
  display: flex; justify-content: space-between; margin-bottom: 1rem;
}
.sb-skel-signal-card .sb-skel-ticker { width: 30%; height: 1.2rem; border-radius: 0.25rem; }
.sb-skel-signal-card .sb-skel-badge { width: 15%; height: 1.2rem; border-radius: 0.25rem; }
.sb-skel-signal-card .sb-skel-body {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem;
}
.sb-skel-signal-card .sb-skel-cell { height: 3rem; border-radius: 8px; }
.sb-skel-signal-card .sb-skel-footer { height: 1.5rem; border-radius: 0.25rem; width: 60%; }

.sb-skel-profile {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem;
}
.sb-skel-avatar { width: 64px; height: 64px; border-radius: 50%; }
.sb-skel-lines { flex: 1; }
.sb-skel-line-1 { width: 40%; height: 1.2rem; margin-bottom: 0.5rem; }
.sb-skel-line-2 { width: 25%; height: 0.8rem; }

.sb-skel-chart {
  width: 100%;
  height: 250px;
  border-radius: 16px;
  margin-bottom: 1rem;
}

/* ── 3. BUTTON LOADING STATES ── */
.btn-loading {
  position: relative !important;
  color: transparent !important;
  pointer-events: none !important;
  transition: all 0.2s ease !important;
}
.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  margin-top: -10px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sbLoaderSpin 1s linear infinite;
}
