@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary, #0A0A0A);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.6s ease;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 48px;
}

.loading-brand-logo {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  border: 1px solid var(--border, #1F1F1F);
  margin-bottom: 16px;
  animation: logo-pulse 3s ease-in-out infinite;
}

@keyframes logo-pulse {
  0%, 100% { box-shadow: 0 0 20px var(--purple-glow, rgba(168,85,247,0.15)); }
  50% { box-shadow: 0 0 40px var(--purple-glow, rgba(168,85,247,0.15)), 0 0 60px var(--purple-glow, rgba(168,85,247,0.1)); }
}

.loading-brand-name {
  font-size: 1.6em;
  font-weight: 800;
  color: var(--purple, #A855F7);
  letter-spacing: -0.5px;
}

.loading-brand-subtitle {
  font-size: 0.85em;
  color: var(--text-dim, #6B7280);
  margin-top: 2px;
}

.loading-spinner-container {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 40px;
}

.loading-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-top-color: var(--purple, #A855F7);
  border-radius: 50%;
  animation: ring-spin 1.2s linear infinite;
}

.loading-ring:nth-child(2) {
  width: 76%;
  height: 76%;
  top: 12%;
  left: 12%;
  border-top-color: var(--purple-light, #C084FC);
  animation-duration: 1.8s;
  animation-direction: reverse;
}

.loading-ring:nth-child(3) {
  width: 52%;
  height: 52%;
  top: 24%;
  left: 24%;
  border-top-color: var(--purple-dim, #7C3AED);
  animation-duration: 2.4s;
}

@keyframes ring-spin {
  to { transform: rotate(360deg); }
}

.loading-progress-section {
  width: 360px;
  max-width: 90vw;
}

.loading-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.loading-phase-text {
  color: var(--text-primary, #F0F0F0);
  font-size: 0.95em;
  font-weight: 600;
  transition: opacity 0.3s ease;
}

.loading-phase-text.transitioning {
  opacity: 0;
}

.loading-percent {
  color: var(--purple, #A855F7);
  font-size: 0.95em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.loading-bar-track {
  width: 100%;
  height: 6px;
  background: var(--border, #1F1F1F);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple-dim, #7C3AED), var(--purple, #A855F7), var(--purple-light, #C084FC));
  border-radius: 3px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.loading-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: bar-shimmer 2s ease-in-out infinite;
}

@keyframes bar-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

.loading-steps {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82em;
  color: var(--text-dim, #6B7280);
  transition: all 0.3s ease;
  padding: 4px 0;
}

.loading-step.active {
  color: var(--text-primary, #F0F0F0);
}

.loading-step.done {
  color: var(--green, #22C55E);
}

.loading-step-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.loading-step-icon .step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim, #6B7280);
  transition: all 0.3s ease;
}

.loading-step.active .step-dot {
  width: 8px;
  height: 8px;
  background: var(--purple, #A855F7);
  box-shadow: 0 0 8px var(--purple-glow, rgba(168,85,247,0.4));
  animation: dot-pulse 1.5s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.loading-step.done .step-dot {
  display: none;
}

.loading-step-check {
  display: none;
  color: var(--green, #22C55E);
}

.loading-step.done .loading-step-check {
  display: block;
}

.loading-subtext {
  color: var(--text-dim, #6B7280);
  font-size: 0.8em;
  margin-top: 32px;
  text-align: center;
}

.loading-waiting-hint {
  color: var(--text-dim, #6B7280);
  font-size: 0.75em;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.5s ease;
  text-align: center;
}

.loading-waiting-hint.visible {
  opacity: 1;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}
