/* ================================================================
   WebbSocial — Logo-Mark Loader System
   Based on the 3-bar brand mark
   ================================================================ */

/* ── Logo Mark SVG shape as CSS ─────────────────────────────────
   Bar 1: tall left bar
   Bar 2: tall centre bar
   Bar 3: short right bar with rounded bottom-right corner
   ────────────────────────────────────────────────────────────── */

/* ── BASE LOADER ─────────────────────────────────────────────── */
.wb-logo-loader {
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
  height: 28px;
}

.wb-logo-loader .bar {
  border-radius: 3px 3px 2px 2px;
  background: var(--cyan);
  transform-origin: bottom center;
  animation: wbBarPulse 1.1s ease-in-out infinite;
}

/* Bar 1 — tall, left */
.wb-logo-loader .bar:nth-child(1) {
  width: 7px;
  height: 28px;
  animation-delay: 0s;
}
/* Bar 2 — tall, centre */
.wb-logo-loader .bar:nth-child(2) {
  width: 7px;
  height: 28px;
  animation-delay: 0.15s;
}
/* Bar 3 — short, right (matches logo's shorter bar with rounded corner) */
.wb-logo-loader .bar:nth-child(3) {
  width: 7px;
  height: 17px;
  border-radius: 3px 3px 6px 2px; /* rounded bottom-right like the logo */
  animation-delay: 0.3s;
}

@keyframes wbBarPulse {
  0%, 100% { opacity: 1; transform: scaleY(1); }
  40%       { opacity: 0.4; transform: scaleY(0.45); }
  60%       { opacity: 0.55; transform: scaleY(0.6); }
}

/* ── SIZE VARIANTS ───────────────────────────────────────────── */

/* Small — for cards, panels */
.wb-logo-loader.sm {
  height: 20px;
  gap: 3px;
}
.wb-logo-loader.sm .bar:nth-child(1),
.wb-logo-loader.sm .bar:nth-child(2) { width: 5px; height: 20px; }
.wb-logo-loader.sm .bar:nth-child(3) { width: 5px; height: 12px; border-radius: 2px 2px 5px 2px; }

/* Extra small — inline, buttons */
.wb-logo-loader.xs {
  height: 14px;
  gap: 2px;
}
.wb-logo-loader.xs .bar:nth-child(1),
.wb-logo-loader.xs .bar:nth-child(2) { width: 4px; height: 14px; border-radius: 2px; }
.wb-logo-loader.xs .bar:nth-child(3) { width: 4px; height: 9px; border-radius: 2px 2px 4px 2px; }

/* ── LOADING STATE WRAPPER ───────────────────────────────────── */
.wb-loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 48px 24px;
  color: var(--muted2);
  font-size: .78rem;
  font-family: 'DM Mono', monospace;
  letter-spacing: .06em;
}

.wb-loading-state .wb-logo-loader { margin-bottom: 4px; }

/* ── INLINE LOADING (replaces old .spinner in tight spaces) ── */
.wb-spinner-inline {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  vertical-align: middle;
}
.wb-spinner-inline .bar {
  width: 3px;
  background: currentColor;
  border-radius: 2px;
  animation: wbBarPulse 0.9s ease-in-out infinite;
  transform-origin: bottom center;
}
.wb-spinner-inline .bar:nth-child(1) { height: 12px; animation-delay: 0s; }
.wb-spinner-inline .bar:nth-child(2) { height: 12px; animation-delay: 0.12s; }
.wb-spinner-inline .bar:nth-child(3) { height: 7px; border-radius: 2px 2px 4px 2px; animation-delay: 0.24s; }

/* ── SKELETON SHIMMER ────────────────────────────────────────── */
.wb-skeleton {
  background: linear-gradient(
    90deg,
    var(--black3) 25%,
    var(--black4) 50%,
    var(--black3) 75%
  );
  background-size: 200% 100%;
  animation: wbShimmer 1.6s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes wbShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── PAGE OVERLAY LOADER ─────────────────────────────────────── */
/* Used for full page transitions */
.wb-page-loader {
  position: fixed; inset: 0;
  background: var(--black);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
  opacity: 1;
  transition: opacity 0.4s ease;
  pointer-events: all;
}
.wb-page-loader.fade-out { opacity: 0; pointer-events: none; }

.wb-page-loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.wb-page-loader-inner .wb-logo-loader {
  height: 36px;
  gap: 5px;
}
.wb-page-loader-inner .wb-logo-loader .bar:nth-child(1),
.wb-page-loader-inner .wb-logo-loader .bar:nth-child(2) { width: 9px; height: 36px; }
.wb-page-loader-inner .wb-logo-loader .bar:nth-child(3) { width: 9px; height: 22px; }

.wb-page-loader-label {
  font-family: 'DM Mono', monospace;
  font-size: .64rem;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: .16em;
}

/* ── SPLASH SCREEN ───────────────────────────────────────────── */
#wb-splash {
  position: fixed; inset: 0;
  background: #050505;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  gap: 0;
}

.wb-splash-logo {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 28px;
  opacity: 0;
  transform: translateY(12px);
  animation: splashLogoIn 0.6s cubic-bezier(.22,1,.36,1) 0.2s forwards;
}

.wb-splash-logo .sbar {
  background: #ffffff;
  border-radius: 5px 5px 3px 3px;
  transform-origin: bottom center;
}
.wb-splash-logo .sbar:nth-child(1) {
  width: 13px; height: 52px;
  animation: splashBar1 0.7s cubic-bezier(.22,1,.36,1) 0.3s both;
}
.wb-splash-logo .sbar:nth-child(2) {
  width: 13px; height: 52px;
  animation: splashBar1 0.7s cubic-bezier(.22,1,.36,1) 0.42s both;
}
.wb-splash-logo .sbar:nth-child(3) {
  width: 13px; height: 32px;
  border-radius: 5px 5px 10px 3px;
  animation: splashBar1 0.7s cubic-bezier(.22,1,.36,1) 0.54s both;
}

@keyframes splashLogoIn {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes splashBar1 {
  0%   { transform: scaleY(0); opacity: 0; }
  60%  { transform: scaleY(1.08); opacity: 1; }
  100% { transform: scaleY(1); opacity: 1; }
}

.wb-splash-wordmark {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #ffffff;
  opacity: 0;
  animation: splashWordIn 0.5s ease 0.75s forwards;
}
.wb-splash-wordmark span { color: #00e5ff; }

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

.wb-splash-tagline {
  font-family: 'DM Mono', monospace;
  font-size: .58rem;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: .18em;
  margin-top: 8px;
  opacity: 0;
  animation: splashWordIn 0.5s ease 0.95s forwards;
}

.wb-splash-loader-wrap {
  position: absolute;
  bottom: 56px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  opacity: 0;
  animation: splashWordIn 0.4s ease 1.1s forwards;
}

/* Splash exit */
#wb-splash.wb-splash-exit {
  animation: splashExit 0.45s ease forwards;
}
@keyframes splashExit {
  0%   { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04); }
}

/* ── BACKWARD COMPAT: old .spinner → new inline bars ─────────── */
/* Keep .spinner working for any pages not yet migrated */
.spinner {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 20px;
  vertical-align: middle;
}
.spinner::before,
.spinner::after,
.spinner > * { display: none; } /* Hide any inner content */

/* Override: inject bars via pseudo — fallback only */
/* For real migration, pages use .wb-logo-loader directly */

/* ── OFFLINE BANNER ───────────────────────────────────────────── */
#wb-offline-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255,183,3,0.12);
  border-bottom: 1px solid rgba(255,183,3,0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: .78rem;
  font-family: 'DM Mono', monospace;
  color: #ffd44d;
  animation: offlineSlideIn .3s ease forwards;
}
.wb-offline-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ffd44d;
  flex-shrink: 0;
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:.2;} }
.wb-offline-text { flex: 1; }
.wb-offline-retry {
  background: rgba(255,183,3,0.2);
  border: 1px solid rgba(255,183,3,0.4);
  color: #ffd44d;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: .7rem;
  font-family: 'DM Mono', monospace;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
#wb-offline-banner.wb-offline-hide {
  animation: offlineSlideOut .35s ease forwards;
}
@keyframes offlineSlideIn { from{transform:translateY(-100%);opacity:0;} to{transform:translateY(0);opacity:1;} }
@keyframes offlineSlideOut { from{transform:translateY(0);opacity:1;} to{transform:translateY(-100%);opacity:0;} }

/* ── LOADING LABEL ────────────────────────────────────────────── */
.wb-loading-label {
  font-family: 'DM Mono', monospace;
  font-size: .68rem;
  color: var(--muted2);
  letter-spacing: .08em;
}

/* ── PROGRESS OVERLAY ─────────────────────────────────────── */
#wb-progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5,5,5,.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity .25s ease;
}
#wb-progress-overlay.wb-pl-visible { opacity: 1; }
#wb-progress-overlay.wb-pl-done .wb-pl-bar { background: linear-gradient(90deg,#00e5a0,#00bfff); }
#wb-progress-overlay.wb-pl-error .wb-pl-bar { background: linear-gradient(90deg,#ff4d6d,#ff8fa3); }
#wb-progress-overlay.wb-pl-error .wb-pl-glow { background: #ff4d6d; box-shadow: 0 0 12px 4px rgba(255,77,109,.7); }

.wb-pl-inner {
  width: min(480px, calc(100vw - 32px));
  background: var(--black2, #0d0d0d);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 24px 24px 20px;
  box-shadow: 0 32px 64px rgba(0,0,0,.5);
}

.wb-pl-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.wb-pl-logo { flex-shrink: 0; }
.wb-pl-text { flex: 1; min-width: 0; }
.wb-pl-msg {
  font-size: .88rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all .3s ease;
}
.wb-pl-detail {
  font-size: .68rem;
  color: var(--muted2, #666);
  font-family: 'DM Mono', monospace;
  margin-top: 3px;
  transition: all .3s ease;
}
.wb-pl-pct {
  font-size: 1.1rem;
  font-weight: 800;
  font-family: 'DM Mono', monospace;
  color: var(--cyan, #00e5ff);
  flex-shrink: 0;
  min-width: 44px;
  text-align: right;
}

.wb-pl-track {
  position: relative;
  height: 6px;
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  overflow: visible;
  margin-bottom: 16px;
}
.wb-pl-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #00bfff 0%, #00e5ff 50%, #00e5a0 100%);
  transition: width .6s cubic-bezier(.4,0,.2,1);
  width: 0%;
}
.wb-pl-glow {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #00e5ff;
  box-shadow: 0 0 10px 4px rgba(0,229,255,.6);
  transition: left .6s cubic-bezier(.4,0,.2,1);
  left: 0%;
  pointer-events: none;
}

.wb-pl-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  scrollbar-width: none;
}
.wb-pl-steps::-webkit-scrollbar { display: none; }
.wb-pl-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .71rem;
  color: var(--muted2, #666);
  font-family: 'DM Mono', monospace;
  animation: stepFadeIn .25s ease forwards;
}
@keyframes stepFadeIn { from{opacity:0;transform:translateY(4px);} to{opacity:1;transform:none;} }
.wb-pl-step-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  flex-shrink: 0;
  transition: all .2s;
}
.wb-pl-step-dot.active {
  background: var(--cyan, #00e5ff);
  box-shadow: 0 0 6px rgba(0,229,255,.7);
  animation: dotPulse 1s ease-in-out infinite;
}
.wb-pl-step-dot.done  { background: var(--green, #00e5a0); }
.wb-pl-step-dot.error { background: #ff4d6d; box-shadow: 0 0 6px rgba(255,77,109,.7); }
.wb-pl-step-dot.warn  { background: #ffb703; box-shadow: 0 0 6px rgba(255,183,3,.5); }
@keyframes dotPulse { 0%,100%{opacity:1;} 50%{opacity:.4;} }
