/* Sistema de botoes do app (esboco aprovado "Botoes: um sistema so para o app inteiro").
   Carregado por ultimo no index.html, so reveste as classes que ja existem (.button-primary,
   -secondary, -ghost, -danger-ghost, .icon-button): nenhum id, evento ou data-* muda.
   Papeis: um principal (cheio) por tela; secundario (contorno); discreto (so texto); perigo.
   Cores seguem --loop-primary, entao o tema da empresa (applyCompanyTheme) continua valendo. */

.button,
.icon-button {
  min-height: 44px;
  border-radius: 12px;
  font-weight: 800;
  line-height: 1.1;
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease, transform 150ms ease;
  -webkit-tap-highlight-color: transparent;
}

.button:active:not(:disabled),
.icon-button:active:not(:disabled) {
  transform: translateY(1px);
}

/* Foco de teclado: anel amarelo bem visivel, igual em todos os tipos. */
.button:focus-visible,
.icon-button:focus-visible {
  outline: 3px solid #ffbe00;
  outline-offset: 3px;
  box-shadow: none;
}

/* Principal: roxo cheio, sem o brilho que passava por cima no hover. */
.button-primary,
.theme-active .button-primary {
  border-color: transparent;
  background: linear-gradient(180deg, color-mix(in srgb, var(--loop-primary) 84%, #ffffff), var(--loop-primary));
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 18px rgba(var(--loop-primary-rgb), 0.25);
}

.button-primary::after {
  display: none;
}

.button-primary:hover:not(:disabled),
.theme-active .button-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--loop-primary), color-mix(in srgb, var(--loop-primary) 80%, #000000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 12px 24px rgba(var(--loop-primary-rgb), 0.32);
}

.button-primary:active:not(:disabled) {
  background: color-mix(in srgb, var(--loop-primary) 78%, #000000);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* Secundario: contorno, fundo branco. */
.button-secondary,
.theme-active .button-secondary {
  border-color: rgba(var(--loop-primary-rgb), 0.28);
  background: #ffffff;
  color: var(--loop-primary);
  box-shadow: none;
}

.button-secondary:hover:not(:disabled) {
  border-color: rgba(var(--loop-primary-rgb), 0.5);
  background: color-mix(in srgb, var(--loop-primary) 6%, #ffffff);
  box-shadow: none;
}

.button-secondary:active:not(:disabled) {
  background: color-mix(in srgb, var(--loop-primary) 12%, #ffffff);
}

/* Discreto: so texto, ganha fundo leve no hover. */
.button-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--loop-primary);
}

.button-ghost:hover:not(:disabled) {
  background: rgba(var(--loop-primary-rgb), 0.07);
}

.button-ghost:active:not(:disabled) {
  background: rgba(var(--loop-primary-rgb), 0.13);
}

/* Perigo: contorno vermelho; cheio so no hover. */
.button-danger-ghost {
  border-color: rgba(180, 35, 24, 0.3);
  background: #ffffff;
  color: #b42318;
}

.button-danger-ghost:hover:not(:disabled) {
  border-color: #b42318;
  background: #fef3f2;
}

.icon-button {
  border-color: rgba(var(--loop-primary-rgb), 0.18);
}

.icon-button:hover:not(:disabled) {
  border-color: rgba(var(--loop-primary-rgb), 0.4);
  background: color-mix(in srgb, var(--loop-primary) 6%, #ffffff);
}

/* Desabilitado: cinza-lilas e sem sombra. Antes era o proprio roxo com opacidade, que parecia
   clicavel. Botao "ocupado" (withBusyButton tambem desabilita) mantem a cor do tipo com o spinner. */
.button:disabled:not(.is-busy):not(.is-loading),
.button[aria-disabled="true"],
.icon-button:disabled:not(.is-busy):not(.is-loading) {
  border-color: transparent;
  background: #eee9f3;
  color: #9a90a3;
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
  transform: none;
}

.button.is-busy,
.button.is-loading,
.icon-button.is-busy {
  opacity: 0.88;
  cursor: wait;
  transform: none;
}

.button-small {
  min-height: 36px;
  border-radius: 10px;
  padding-inline: 14px;
  font-size: 13.5px;
}

@media (prefers-reduced-motion: reduce) {
  .button,
  .icon-button {
    transition: none;
  }

  .button:hover,
  .button:active:not(:disabled),
  .icon-button:hover,
  .icon-button:active:not(:disabled) {
    transform: none;
  }
}
