/* ============================================================
   NEXUS UPLOAD OVERLAY — Premium Pipeline Status Indicator
   A full-screen overlay with animated stages showing
   real-time sync progress.
   ============================================================ */

/* --- Overlay Container --- */
.nx-upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.nx-upload-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* --- Glass Card --- */
.nx-upload-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
  padding: 36px 40px 32px;
  min-width: 420px;
  max-width: 520px;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

.nx-upload-overlay.visible .nx-upload-card {
  transform: translateY(0) scale(1);
}

/* --- Animated Orb --- */
.nx-upload-orb {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  position: relative;
}

.nx-upload-orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--brand-indigo);
  animation: nx-orb-spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.nx-upload-orb-ring:nth-child(2) {
  inset: 6px;
  border-top-color: #7986CB;
  animation-delay: -0.15s;
  animation-duration: 1.6s;
}

.nx-upload-orb-ring:nth-child(3) {
  inset: 12px;
  border-top-color: var(--brand-green);
  animation-delay: -0.3s;
  animation-duration: 2s;
}

.nx-upload-orb-icon {
  position: absolute;
  inset: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  border-radius: 50%;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
}

@keyframes nx-orb-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* --- Title & Subtitle --- */
.nx-upload-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  margin-bottom: 4px;
}

.nx-upload-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 22px;
}

/* --- Pipeline Stages --- */
.nx-pipeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  text-align: left;
  margin-bottom: 22px;
}

.nx-pipeline-stage {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  padding: 0 0 0 0;
  min-height: 42px;
}

/* Vertical connector line */
.nx-pipeline-stage:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: -14px;
  width: 2px;
  background: var(--border);
  transition: background 0.4s ease;
}

.nx-pipeline-stage.done:not(:last-child)::after {
  background: var(--brand-green);
}

.nx-pipeline-stage.active:not(:last-child)::after {
  background: linear-gradient(180deg, var(--brand-indigo) 0%, var(--border) 100%);
}

/* Stage indicator circle */
.nx-stage-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--border);
  background: var(--bg-surface-2);
  color: var(--text-tertiary);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 1;
}

.nx-pipeline-stage.active .nx-stage-dot {
  border-color: var(--brand-indigo);
  background: rgba(90, 103, 216, 0.12);
  color: var(--brand-indigo);
  box-shadow: 0 0 0 4px rgba(90, 103, 216, 0.1);
  animation: nx-dot-pulse 2s ease-in-out infinite;
}

.nx-pipeline-stage.done .nx-stage-dot {
  border-color: var(--brand-green);
  background: var(--brand-green);
  color: #fff;
  box-shadow: none;
  animation: none;
}

.nx-pipeline-stage.error .nx-stage-dot {
  border-color: var(--brand-red);
  background: var(--brand-red);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.15);
  animation: none;
}

@keyframes nx-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(90, 103, 216, 0.10); }
  50% { box-shadow: 0 0 0 8px rgba(90, 103, 216, 0.05); }
}

/* Stage text */
.nx-stage-info {
  flex: 1;
  padding-top: 3px;
}

.nx-stage-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.nx-pipeline-stage.pending .nx-stage-label {
  color: var(--text-tertiary);
}

.nx-pipeline-stage.done .nx-stage-label {
  color: var(--text-secondary);
}

.nx-stage-detail {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.nx-pipeline-stage.active .nx-stage-detail {
  color: #2E7D32;
  font-weight: 500;
}

.nx-pipeline-stage.done .nx-stage-detail {
  color: #34C759;
}

.nx-pipeline-stage.error .nx-stage-detail {
  color: #FF3B30;
}

/* --- Elapsed Timer --- */
.nx-upload-timer {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}

.nx-upload-timer-value {
  color: var(--text-secondary);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* --- Result Summary (shown after completion) --- */
.nx-upload-result {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  display: none;
  text-align: left;
}

.nx-upload-result.show {
  display: block;
  animation: nx-result-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nx-upload-result.success {
  background: #EAF6EC;
  border: 1px solid rgba(46, 125, 50, 0.2);
  color: #2E7D32;
}

.nx-upload-result.error {
  background: #FFEBEE;
  border: 1px solid rgba(198, 40, 40, 0.2);
  color: #C62828;
}

.nx-upload-result.partial {
  background: #FFF3E0;
  border: 1px solid rgba(230, 81, 0, 0.2);
  color: #E65100;
}

@keyframes nx-result-in {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* --- Close Button (shown after completion) --- */
.nx-upload-close {
  margin-top: 14px;
  padding: 8px 28px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--bg-surface-3);
  color: var(--text-primary);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  display: none;
}

.nx-upload-close.show {
  display: inline-block;
  animation: nx-result-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nx-upload-close:hover {
  background: var(--bg-inset);
  border-color: var(--border-strong);
}

/* --- Dark Mode Adjustments --- */
[data-theme="dark"] .nx-upload-overlay {
  background: rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .nx-upload-card {
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] .nx-upload-result.success {
  background: rgba(52, 199, 89, 0.12);
  color: #5AD67D;
}

[data-theme="dark"] .nx-upload-result.error {
  background: rgba(255, 59, 48, 0.12);
  color: #FF6961;
}

[data-theme="dark"] .nx-upload-result.partial {
  background: rgba(255, 149, 0, 0.12);
  color: #FFB347;
}
