/**
 * button-busy.css - The shared busy treatment applied by lib/button-busy.js.
 *
 * Kept deliberately neutral: it inherits the host button's colour, font and
 * shape and only adds a spinner plus the dimming every disabled button in the
 * app already gets. That is what lets one rule set sit under the atlas pill
 * buttons, the clinician toolbar chips and the admin table actions without a
 * per-surface override.
 */

.is-btn-busy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* The button is disabled while busy, but "busy" is not "unavailable" — keep
     it more legible than a plain disabled control so the label stays readable. */
  opacity: 0.75;
  cursor: progress;
  /* ``disabled`` covers real buttons, but the helper is also used on the
     label-wrapping-a-file-input pattern, where only this blocks a second
     click from re-opening the picker mid-upload. */
  pointer-events: none;
}

.btn-busy-spinner {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  /* Transparent top edge is what makes the ring read as spinning. */
  border-top-color: transparent;
  opacity: 0.85;
  animation: btn-busy-spin 0.7s linear infinite;
}

.btn-busy-label {
  /* Long in-progress labels must not wrap a single-line button into two. */
  white-space: nowrap;
}

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

/* Respect a reduced-motion preference: hold the ring still. The dimming, the
   label change and the disabled state still communicate that work is running. */
@media (prefers-reduced-motion: reduce) {
  .btn-busy-spinner { animation: none; }
}
