/**
 * @file
 * NP-4042: keep "Save report" buttons from being usable / shown before ready.
 *
 * Until the bcaSaveButtonReady behaviour adds `.save-ready`:
 *
 * - Listing button (`.save-report-action`, hover-revealed empty icon span):
 *   stays transparent + non-interactive so a click made before its handler
 *   attaches is never lost.
 *
 * - Detail-header button (`.report-save-button`): its Flag "Save" label is
 *   delivered via BigPipe *after* the static icon has painted. We hide the
 *   whole button until the label has arrived (see JS) so the icon + label
 *   appear together, and it occupies no space meanwhile (no gap between the
 *   other action buttons). `!important` is required because the standalone
 *   report page nests the button under `.node--type-report .report-detail`,
 *   whose `.report-save-button { display: flex }` rule (specificity 0,3,0)
 *   otherwise outranks the hide and un-hides the half-built button.
 */
.save-report-action:not(.save-ready) {
  opacity: 0;
  pointer-events: none;
  cursor: default;
}

.report-save-button:not(.save-ready) {
  display: none !important;
}

/* Keep the Flag's block-level wrapper inline so the button does not grow in
 * height when the label streams in (the legacy header lacks the Hermes
 * header's own inline-flex rule). */
.report-save-button .flag,
.report-save-button .flag-saved-content {
  display: inline-flex;
  align-items: center;
}

/* The whole button is clickable (a JS proxy forwards icon/padding clicks to
 * the Flag link), so show the pointer cursor across the entire wrapper. */
.report-save-button {
  cursor: pointer;
}

/* While the flag toggles, Drupal's `use-ajax` link injects a progress throbber
 * next to the label, which makes the button grow wider/taller until the
 * response swaps the text back to Save/Unsave. The theme renders that throbber
 * as a 42x42 box (helpers.scss `.ajax-progress.ajax-progress-throbber`,
 * specificity 0,2,0, loaded after this file), so the two-class compound
 * selector below (0,3,0) is required to win and hide it — keeping the button a
 * constant size through the click (it just toggles label + saved state). */
.report-save-button .ajax-progress,
.report-save-button .ajax-progress.ajax-progress-throbber,
.report-save-button .ajax-progress.ajax-progress-fullscreen {
  display: none;
}
