/* ═══════════════════════════════════════════════════════════════════
   sm-loader.css — Loader da marca SMsys (substitui a "rodinha")
   Os 4 quadradinhos da logo, só em linhas (sem preenchimento): eles
   se afastam, "dançam" trocando de canto e se recompõem no símbolo.
   Uso:  <span class="sm-loader"></span>            (44px)
         <span class="sm-loader sm-loader--sm"></span>   (22px)
         <span class="sm-loader sm-loader--xs"></span>   (14px, em botões)
         <span class="sm-loader sm-loader--lg"></span>   (72px)
   O SVG é injetado por /components/sm-loader.js. Cores sobrescrevíveis
   com --sm-loader-a (azul) e --sm-loader-b (laranja); .sm-loader--mono
   usa currentColor nos 4 (ex.: dentro de botão escuro).
   ═══════════════════════════════════════════════════════════════════ */
.sm-loader {
  --sm-loader-a: #0E4372;
  --sm-loader-b: #E9792A;
  --sm-loader-size: 44px;
  --sm-loader-sw: 5;
  display: inline-block; flex: none;
  width: var(--sm-loader-size); height: var(--sm-loader-size);
  vertical-align: middle; line-height: 0;
}
.sm-loader--lg { --sm-loader-size: 72px; --sm-loader-sw: 4.5; }
.sm-loader--sm { --sm-loader-size: 22px; --sm-loader-sw: 8; }
.sm-loader--xs { --sm-loader-size: 14px; --sm-loader-sw: 10; }
.sm-loader--mono { --sm-loader-a: currentColor; --sm-loader-b: currentColor; }

.sm-loader svg { width: 100%; height: 100%; overflow: visible; display: block; }
.sm-loader .sq {
  fill: none; stroke: var(--sm-loader-a);
  stroke-width: var(--sm-loader-sw); stroke-linejoin: round;
  transform-box: fill-box; transform-origin: center;
  animation: sm-loader-dance 2.6s infinite;
}
.sm-loader .sq4 { stroke: var(--sm-loader-b); }

/* dx/dy: para onde o quadrado se afasta · nx/ny: canto seguinte (passo de 55) */
.sm-loader .sq1 { --dx: -1; --dy: -1; --nx: 55;  --ny: 0;   --r: -50; }
.sm-loader .sq2 { --dx:  1; --dy: -1; --nx: 0;   --ny: 55;  --r:  50; }
.sm-loader .sq3 { --dx: -1; --dy:  1; --nx: 0;   --ny: -55; --r:  50; }
.sm-loader .sq4 { --dx:  1; --dy:  1; --nx: -55; --ny: 0;   --r: -50; }

@keyframes sm-loader-dance {
  0%, 8%   { transform: translate(0, 0) rotate(0) scale(1);
             animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  26%      { transform: translate(calc(var(--dx) * 18px), calc(var(--dy) * 18px)) rotate(calc(var(--r) * 1deg)) scale(.8);
             animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  44%, 52% { transform: translate(calc(var(--nx) * 1px), calc(var(--ny) * 1px)) rotate(90deg) scale(1);
             animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  70%      { transform: translate(calc((var(--nx) + var(--dx) * 18) * 1px), calc((var(--ny) + var(--dy) * 18) * 1px)) rotate(calc(90deg + var(--r) * 1deg)) scale(.8);
             animation-timing-function: cubic-bezier(.65, 0, .35, 1); }
  90%, 100%{ transform: translate(0, 0) rotate(180deg) scale(1); }
}

/* Tela/área de carregamento: loader + texto, centralizados */
.sm-loader-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: var(--sm-t2, #475569);
  font: 500 13px/1.4 var(--sm-font, system-ui, 'Segoe UI', sans-serif);
}

/* Botão ocupado (SmUI.busy): o loader entra no lugar da rodinha antiga */
.sm-busy > .sm-loader { margin-left: 6px; }
.sm-busy.sm-busy--loader::after { content: none; animation: none; border: 0; width: 0; height: 0; margin: 0; }

/* Movimento reduzido: símbolo parado e composto */
@media (prefers-reduced-motion: reduce) {
  .sm-loader .sq { animation: none !important; }
}
