/* Indicador de carregamento: logo girando num cartão branco, borda 1 px, sem sombra (DESIGN.md). */
.carregando {
  position: fixed;
  inset: auto var(--space-xl) var(--space-xl) auto; /* canto de baixo, à direita */
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-panel);
  color: var(--text);
  pointer-events: none;
  overflow: visible;
}

.carregando:not(:popover-open) { display: none; }

.carregando-logo {
  width: 28px;
  height: 28px;
  flex: none;
  animation: carregando-gira 1s linear infinite;
}

@keyframes carregando-gira {
  to { transform: rotate(360deg); }
}

.carregando-texto {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

/* Trilho azul claro com um trecho azul da marca correndo: em andamento, sem percentual. */
.carregando-barra {
  position: relative;
  height: 4px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-recess);
}

.carregando-barra i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: 4px;
  background: var(--brand-primary);
  animation: carregando-corre 1.2s ease-in-out infinite;
}

/* Progresso real (etiquetas): o preenchimento acompanha as etapas feitas. */
.carregando-barra.determinada i {
  width: var(--pct);
  animation: none;
  transform: none;
  transition: width 200ms ease-out;
}

@keyframes carregando-corre {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}

@media (max-width: 767px) {
  .carregando { inset: auto 16px 16px auto; }
}

@media (prefers-reduced-motion: reduce) {
  .carregando-logo { animation-duration: 4s; }
  .carregando-barra i { animation-duration: 3s; }
}
