/* One way of saving an Admin settings page, and the status beside each page (GitHub issue 203, part 1d;
   docs/adr/0077 and docs/adr/0078; public/js/app/settings-save.js, settings-checklist.js). Sizes are the tokens'
   (public/tokens.css); colors the page's own, so light and dark both follow them. */

/* Save at the top right of the page header: "Saved", grayed out, until something changes; then "Unsaved changes",
   Discard and Save. */
.settings-save-own { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:var(--space-100); margin-left:auto; }
.settings-save-controls { display:inline-flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:var(--space-100); }
/* In a header pages share (Admin settings' frame), only the open page's Save shows: the others are hidden, and their
   own display mustn't bring them back. */
.settings-save-controls[hidden], .settings-save-controls [hidden] { display:none !important; }
.settings-save-state { display:inline-flex; align-items:center; gap:var(--space-75); color:var(--warn-ink); font-size:var(--text-sm); font-weight:var(--weight-semibold); }
.settings-save-state::before { content:''; width:var(--space-100); height:var(--space-100); border-radius:var(--radius-round); background:var(--saffron); }
.settings-save-controls .settings-save-button { min-height:var(--control-height); margin:0; padding:var(--space-100) var(--space-250); }
.settings-save-controls .settings-save-button:disabled { cursor:default; }
.settings-save-controls .settings-save-button.is-saved, .settings-save-controls .settings-save-button.is-saved:hover { border:var(--control-border-width) solid var(--line); background:var(--surface-2); color:var(--muted); box-shadow:none; }
.settings-save-controls .settings-save-discard { min-height:var(--control-height); }
.settings-view-only { display:inline-flex; align-items:center; padding:var(--space-50) var(--space-150); border:var(--control-border-width) solid var(--line); border-radius:var(--radius-pill); background:var(--surface-2); color:var(--ink-2); font-size:var(--text-xs); font-weight:var(--weight-semibold); }
/* A page with no header of its own gets a row for Save. */
.settings-save-head { display:flex; justify-content:flex-end; margin:0 0 var(--space-200); }
/* Save stays in view: pinned under the top bar, at the right of the page, while the header is scrolled away. */
.settings-save-controls.is-floating { position:fixed; z-index:var(--z-page); margin-top:var(--space-100); padding:var(--space-75) var(--space-75) var(--space-75) var(--space-150); border:var(--control-border-width) solid var(--line); border-radius:var(--radius-lg); background:var(--surface); box-shadow:var(--shadow-pop, var(--shadow)); }
.settings-save-controls.is-floating:not(.has-changes) { padding-left:var(--space-75); }
/* With nothing to save there is nothing to keep in view: a pinned "Saved" (or "View only") only covered the page's
   right edge, such as Single sign-on's Copy button (GitHub issue 203, 1e). It comes back with the first change. */
.settings-save-controls.is-floating:not(.has-changes) { display:none; }

/* Under the header: why a save was refused, in red; who saved a newer version, with the two ways on. */
.settings-save-message { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-150); margin:0 0 var(--space-200); padding:var(--space-150) var(--space-200); border:var(--control-border-width) solid var(--line); border-radius:var(--radius-lg); }
.settings-save-message[hidden] { display:none; }
.settings-save-message p { flex:1 1 24rem; margin:0; font-size:var(--text-md); line-height:var(--leading-normal); }
.settings-save-message.is-error { border-color:color-mix(in srgb, var(--bad) 45%, var(--line)); background:var(--bad-soft); color:var(--bad); }
.settings-save-message.is-conflict { border-color:var(--saffron); background:var(--saffron-pale); color:var(--ink); }
.settings-save-message-actions { display:flex; flex-wrap:wrap; gap:var(--space-100); }
.settings-save-message-actions[hidden] { display:none; }

/* A status beside a page in Admin settings: a word or two from the server, in the tone it says. */
.settings-chip { display:inline-flex; align-items:center; gap:var(--space-50); max-width:100%; padding:var(--space-25) var(--space-100); border-radius:var(--radius-pill); background:var(--surface-2); color:var(--ink-2); font-size:var(--text-xs); font-weight:var(--weight-semibold); white-space:normal; overflow:hidden; overflow-wrap:break-word; vertical-align:middle; }
.settings-chip::before { content:''; flex:0 0 auto; width:var(--space-75); height:var(--space-75); border-radius:var(--radius-round); background:var(--muted); }
.settings-chip.is-ok { background:var(--good-soft, var(--spruce-pale)); color:var(--good, var(--spruce)); }
.settings-chip.is-ok::before { background:var(--good, var(--spruce)); }
.settings-chip.is-warn { background:var(--saffron-pale); color:var(--warn-ink); }
.settings-chip.is-warn::before { background:var(--saffron); }
.settings-chip.is-bad { background:var(--bad-soft); color:var(--bad); }
.settings-chip.is-bad::before { background:var(--bad); }
.settings-items > button .settings-chip { margin-left:auto; margin-right:var(--space-100); }

/* A step of a setup checklist that waits for another: what it waits for, and a way there. */
.settings-checklist-steps li.is-blocked .settings-checklist-copy b { color:var(--ink-2); }
.settings-checklist-steps li.is-blocked .settings-checklist-mark { border-style:dashed; }
.settings-checklist-waits { display:block; margin-top:var(--space-50); color:var(--warn-ink); font-size:var(--text-xs); font-weight:var(--weight-semibold); }

@media (max-width:700px) {
  .settings-save-own { margin-left:0; justify-content:flex-start; }
  .settings-save-controls.is-floating { left:var(--space-200); right:var(--space-200) !important; justify-content:flex-end; }
}
