/* v1.304 FEEDBACK + LIVE — busy buttons, shake, reveal, pop-ups, changed figures and the live chip
   (assets/js/sr-feedback.js). Uses the kit's motion tokens (--sr-ease-out, --sr-dur-*, assets/css/sr/tokens.css);
   the fallbacks are the same values, for screens that do not load the kit (customer portal, sign-in, documents).
   Transform and opacity only; "reduce motion" keeps the messages and marks without movement. */

/* ---- press: screens without the kit's .sr-btn (portal, documents) — zero specificity, so a page's own :active wins */
:where(.pp-btn, .btn, button[type="submit"], input[type="submit"]):where(:not(.au-btn):not(.sr-btn)) {
  transition: transform var(--sr-dur-fast, 120ms) var(--sr-ease-out, cubic-bezier(0.23, 1, 0.32, 1)), opacity var(--sr-dur-fast, 120ms) ease;
}
:where(button[type="submit"], input[type="submit"]):where(:not(.au-btn):not(.sr-btn):not(.pp-btn)):active { transform: scale(0.97); }

/* ---- busy: sent, waiting for the answer ---- */
.sr-is-busy[aria-busy="true"] { pointer-events: none; cursor: progress; opacity: 0.8; }
button.sr-is-busy[aria-busy="true"]:not(.au-btn):not(.is-busy)::after {
  content: ""; display: inline-block; vertical-align: -0.14em; width: 0.95em; height: 0.95em; margin-left: 0.5em;
  border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; opacity: 0.85;
  animation: sr-fb-spin 700ms linear infinite;
}
@keyframes sr-fb-spin { to { transform: rotate(360deg); } }

/* ---- not accepted: one short shake ---- */
.sr-fb-shake { animation: sr-fb-shake 300ms cubic-bezier(0.77, 0, 0.175, 1) 1; }
@keyframes sr-fb-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
[aria-invalid="true"]:not(.sr-input):not(.sr-select):not(.sr-textarea) { border-color: var(--sr-danger-ink, #b42318) !important; }

/* ---- [data-sr-reveal] block: settles in from just above, leaves the same way ---- */
.sr-reveal { transition: opacity var(--sr-dur-enter, 180ms) var(--sr-ease-out, cubic-bezier(0.23, 1, 0.32, 1)), transform var(--sr-dur-enter, 180ms) var(--sr-ease-out, cubic-bezier(0.23, 1, 0.32, 1)); }
.sr-reveal.sr-reveal--from { opacity: 0; transform: translateY(-4px); }

/* ---- pop-ups on screens without the kit's stack: transitions, so they can be interrupted ---- */
.sr-fb-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 9000; display: flex; flex-direction: column-reverse; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.sr-fb-toast {
  pointer-events: auto; background: #fff; color: #10272b; border: 1px solid #dde5e7; border-left: 4px solid var(--sr-info-ink, #0b6b73);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 40, 48, 0.14); padding: 12px 16px; font: 500 0.92rem/1.4 inherit;
  transition: opacity 200ms var(--sr-ease-out, cubic-bezier(0.23, 1, 0.32, 1)), transform 200ms var(--sr-ease-out, cubic-bezier(0.23, 1, 0.32, 1));
}
.sr-fb-toast.is-hidden { opacity: 0; transform: translateY(8px) scale(0.98); }
.sr-fb-toast--success { border-left-color: var(--sr-success-ink, #1e7a45); }
.sr-fb-toast--danger { border-left-color: var(--sr-danger-ink, #b42318); }
.sr-fb-toast--warning { border-left-color: var(--sr-warning-ink, #b54708); }
@media (max-width: 720px) { .sr-fb-toasts { left: 8px; right: 8px; width: auto; bottom: calc(8px + var(--sr-bottom-bar, 0px) + env(safe-area-inset-bottom)); } }

/* ---- figures ---- */
.sr-kpi__value, .sr-stat__value, .rp-figure { font-variant-numeric: tabular-nums; }
.sr-kpi__delta { display: block; font-size: var(--sr-size-sm, 0.8rem); font-weight: 600; color: var(--sr-text-soft, #4a5d61); }
[data-sr-changed="up"] .sr-kpi__delta { color: var(--sr-success-ink, #1e7a45); }
[data-sr-changed="down"] .sr-kpi__delta { color: var(--sr-danger-ink, #b42318); }
/* the glow is a ring on its own layer that fades out (opacity only) */
[data-sr-changed] { position: relative; }
[data-sr-changed]::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 3px var(--sr-teal-400, #3fa7ae); opacity: 0;
  animation: sr-fb-glow 1600ms var(--sr-ease-out, cubic-bezier(0.23, 1, 0.32, 1)) 1;
}
@keyframes sr-fb-glow { from { opacity: 0.55; } to { opacity: 0; } }

/* ---- live regions: a quick cross-fade when a list or card is swapped for its newer version ---- */
[data-sr-live-region] { transition: opacity var(--sr-dur-base, 200ms) var(--sr-ease-out, cubic-bezier(0.23, 1, 0.32, 1)); }
[data-sr-live-region].sr-live-swap { opacity: 0.35; }

/* ---- live chip ---- */
.sr-live { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--sr-line, #dde5e7); background: var(--sr-surface, #fff); color: var(--sr-text-soft, #4a5d61);
  font-size: var(--sr-size-sm, 0.8rem); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sr-live--float { position: fixed; left: 16px; bottom: calc(16px + var(--sr-bottom-bar, 0px)); z-index: 8000; box-shadow: 0 4px 12px rgba(0, 40, 48, 0.1); }
/* v1.325.1 LAYERS: in the FieldApp the chip joins the status dock (includes/gps_indicator.php), which wraps, instead of
   floating on its own over the dock and the tab bar. --sr-bottom-bar: the height of a bottom bar, when there is one. */
#fieldStatusDock > .sr-live { pointer-events: auto; box-shadow: 0 4px 12px rgba(0, 40, 48, 0.1); }
.sr-live__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sr-success-ink, #1e7a45); }
.sr-live[data-state="on"] .sr-live__dot { animation: sr-fb-breathe 2400ms ease-in-out infinite; }
.sr-live[data-state="wait"] .sr-live__dot { background: var(--sr-warning-ink, #b54708); }
.sr-live[data-state="off"] .sr-live__dot { background: var(--sr-text-soft, #4a5d61); }
@keyframes sr-fb-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  .sr-btn:active, :where(button[type="submit"], input[type="submit"]):active { transform: none; }
  button.sr-is-busy[aria-busy="true"]:not(.au-btn):not(.is-busy)::after { animation: none; border-right-color: currentColor; opacity: 0.45; }
  .sr-fb-shake { animation: none; outline: 2px solid var(--sr-danger-ink, #b42318); outline-offset: 2px; }
  .sr-reveal, .sr-fb-toast { transition: opacity 150ms ease; }
  .sr-reveal.sr-reveal--from, .sr-fb-toast.is-hidden { transform: none; }
  [data-sr-changed]::after { animation: none; opacity: 0.4; }
  .sr-live[data-state="on"] .sr-live__dot { animation: none; }
}
@media print { .sr-fb-toasts, .sr-kpi__delta, .sr-live { display: none !important; } }
