/*
 * Federation Manager — the control furniture both sides share (1.28.0).
 *
 * MOVED here from `public/assets/css/federations.css`, not copied. Until 039
 * the administrator's screens had the weakest version of every control on the
 * site: raw markup in a textarea where a commissioner had a formatting toolbar,
 * and a box asking for an attachment's database number where a commissioner had
 * a picture chooser. Fixing that means wp-admin renders the same controls, and
 * the same controls need the same rules.
 *
 * A COPY WOULD DRIFT. That is the whole reason this file exists, and it is the
 * same reasoning that put the drag furniture in `fedman-sortable.css`.
 *
 * Every rule keeps its `.fedman-fx` root, so it reaches nothing outside the
 * wrapper each side puts around its own markup. The four custom properties
 * (`--fedman-accent`, `--fedman-border`, `--fedman-muted`, `--fedman-surface`)
 * are NOT defined here: the front end already defines them in its own colours
 * and the admin defines them in admin greys.
 */

.fedman-fx .fedman-fx-field {
	display: block;
	margin: 0 0 1.1rem;
}

.fedman-fx .fedman-fx-field > label,
.fedman-fx .fedman-fx-field > legend {
	display: block;
	margin: 0 0 0.3rem;
	font-size: 0.85rem;
	font-weight: 600;
}

.fedman-fx .fedman-fx-field input[type="text"],
.fedman-fx .fedman-fx-field input[type="number"],
.fedman-fx .fedman-fx-field textarea,
.fedman-fx .fedman-fx-field select {
	width: 100%;
	max-width: 34rem;
	padding: 0.45rem 0.6rem;
	border: 1px solid var(--fedman-border);
	border-radius: 3px;
	background: transparent;
	color: inherit;
	font-family: inherit;
	font-size: 0.9rem;
}

.fedman-fx .fedman-fx-field-inline input[type="number"] {
	max-width: 9rem;
}

.fedman-fx .fedman-fx-check {
	display: block;
	margin: 0 0 0.3rem;
	font-size: 0.88rem;
	font-weight: 400;
}

.fedman-fx .fedman-fx-hint {
	display: block;
	margin: 0.3rem 0 0;
	font-size: 0.78rem;
	color: var(--fedman-muted);
}

.fedman-fx .fedman-fx-submit {
	margin: 0 0 0.6rem;
}

.fedman-fx .fedman-fx-editor {
	display: block;
	margin: 0 0 0.75rem;
}

.fedman-fx .fedman-fx-editor .wp-editor-container {
	border: 1px solid var(--fedman-border);
}

.fedman-fx .fedman-fx-upload {
	display: flex;
	gap: 0.8rem;
	align-items: center;
	flex-wrap: wrap;
}

.fedman-fx .fedman-fx-image-preview {
	width: 72px;
	height: 72px;
	border: 1px solid var(--fedman-border);
	border-radius: 3px;
	/* Whole image, not a square cut out of it — the preview has to show what
	   was actually uploaded, or it is not a preview. */
	object-fit: contain;
}

.fedman-fx .fedman-fx-image-empty {
	display: flex;
	width: 72px;
	height: 72px;
	padding: 0.3rem;
	align-items: center;
	justify-content: center;
	border: 1px dashed var(--fedman-border);
	border-radius: 3px;
	font-size: 0.7rem;
	line-height: 1.2;
	text-align: center;
	color: var(--fedman-muted);
}

.fedman-fx .fedman-fx-upload input[type="file"] {
	flex: 1 1 14rem;
	max-width: 26rem;
	font-size: 0.82rem;
	color: inherit;
}

/*
 * "or paste a link to one" (1.21.0).
 *
 * Inside `.fedman-fx-upload`, which is a wrapping flex row, so the link takes a
 * line of its own under the file button rather than competing with it for width.
 * It is the second way into one field, not a second field, and reads that way.
 */
.fedman-fx label.fedman-fx-imagelink {
	display: flex;
	flex: 1 1 100%;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem;
	margin: 0.2rem 0 0;
	font-size: 0.8rem;
	color: var(--fedman-muted);
}

.fedman-fx label.fedman-fx-imagelink input[type="url"] {
	flex: 1 1 16rem;
	max-width: 30rem;
	padding: 0.35rem 0.5rem;
	border: 1px solid var(--fedman-border);
	border-radius: 3px;
	background: transparent;
	color: inherit;
	font-family: inherit;
	font-size: 0.82rem;
}

/*
 * The picture control's preview slot (1.28.0).
 *
 * The preview is swapped by script when somebody picks from the media library,
 * so it needs a container the script can write into — the <img> itself is
 * replaced, and replacing an element that IS the flex item loses its place in
 * the row. `inline-flex` rather than `block` so the slot is exactly as wide as
 * the 72px preview inside it and the file box still sits beside it.
 */
.fedman-fx .fedman-fx-image-slot {
	display: inline-flex;
	flex: 0 0 auto;
}

/*
 * The media library button (1.28.0), on Federation Manager's admin screens
 * only — D267: an office-holder has no `upload_files`, so the modal this opens
 * would refuse them, and their panel does not draw it.
 */
.fedman-fx .fedman-fx-mediapick {
	flex: 0 0 auto;
}

/*
 * Moved here in 1.28.0 with the Fed Staff panel itself: the administrator's
 * Fed Staff tab is now the SAME panel a commissioner sees, from the same
 * template, so it needs the same card, the same buttons and the same states.
 * Each side supplies its own `--fedman-accent`, which is what makes one file
 * paint a federation-red button on the site and a WordPress-blue one in
 * wp-admin without a second copy of the rule.
 */

/*
 * The manage panel's rows, which reuse the store panel's field furniture.
 *
 * Each is now a bordered card inside a sort slot rather than a run of rows with
 * dividers between them — the Page Tabs lesson, which learnt it the hard way:
 * a `:last-child` divider rule inside a per-row wrapper matches every row.
 */
.fedman-fx form.fedman-fx-staff-row {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 1.1rem 1.25rem;
	border: 1px solid var(--fedman-border);
	border-radius: 4px;
	background: var(--fedman-surface);
}

/*
 * A staff card's short fields, two to a line.
 *
 * `auto-fit` rather than a fixed `1fr 1fr`, so the Order field can vanish — the
 * script hides it once dragging works — and the line closes up to two columns
 * instead of leaving a third empty one.
 */
.fedman-fx .fedman-fx-staff-fields {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
	gap: 0 1.5rem;
	align-items: start;
}

/*
 * Inside the card the shared 34rem cap is wrong twice over: it is narrower than
 * a grid column on a wide screen, which strands the input against the left of
 * its own cell, and it is what made the biography half-width. The column (and
 * for the biography, the card) decides the width here.
 */
.fedman-fx .fedman-fx-staff-fields .fedman-fx-field input[type="text"],
.fedman-fx .fedman-fx-staff-fields .fedman-fx-field input[type="number"],
.fedman-fx .fedman-fx-form .fedman-fx-field.is-full textarea {
	max-width: none;
}

.fedman-fx .fedman-fx-staff-fields .fedman-fx-field.is-narrow input[type="number"] {
	max-width: 7rem;
}

.fedman-fx fieldset.fedman-fx-sideswitch {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.35rem 1rem;
	margin: 0 0 1.1rem;
	padding: 0;
	border: 0;
}

/* The two radios sit on one line; the note about narrow screens goes below. */
.fedman-fx fieldset.fedman-fx-sideswitch > legend {
	flex: 1 0 100%;
}

.fedman-fx fieldset.fedman-fx-sideswitch > .fedman-fx-check {
	margin: 0;
}

.fedman-fx fieldset.fedman-fx-sideswitch > .fedman-fx-hint {
	flex: 1 0 100%;
	margin-top: 0.2rem;
}

.fedman-fx fieldset.fedman-fx-sideswitch legend {
	margin: 0;
	padding: 0;
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}


.fedman-fx .fedman-fx-btn {
	display: inline-block;
	padding: 0.5rem 1rem;
	border-radius: 3px;
	background: var(--fedman-accent-fill, var(--fedman-accent));
	color: var(--fedman-on-accent);
	font-size: 0.85rem;
	font-weight: 600;
	text-decoration: none;
}

.fedman-fx .fedman-fx-btn:hover,
.fedman-fx .fedman-fx-btn:focus {
	color: var(--fedman-on-accent);
	filter: brightness(1.12);
}


.fedman-fx .fedman-fx-btn.is-quiet {
	background: transparent;
	border: 1px solid var(--fedman-border);
	color: inherit;
}

.fedman-fx .fedman-fx-btn.is-quiet:hover,
.fedman-fx .fedman-fx-btn.is-quiet:focus {
	border-color: var(--fedman-accent);
	color: inherit;
}

.fedman-fx .fedman-fx-state {
	margin: 0;
	font-size: 0.9rem;
	color: var(--fedman-muted);
}

.fedman-fx .fedman-fx-state.is-blocked {
	color: var(--fedman-danger);
}


.fedman-fx .fedman-fx-block {
	margin: 0 0 2rem;
}

.fedman-fx .fedman-fx-block > h3 {
	margin: 0 0 0.75rem;
	font-size: 1rem;
	text-transform: uppercase;
	letter-spacing: 0.07em;
}


.fedman-fx .fedman-fx-fieldset {
	margin: 0 0 1.6rem;
	padding: 1rem 1.1rem 0.4rem;
	border: 1px solid var(--fedman-border);
	border-radius: 4px;
	background: var(--fedman-surface);
}

.fedman-fx .fedman-fx-fieldset > h4 {
	margin: 0 0 0.9rem;
	font-size: 0.95rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--fedman-muted);
}

.fedman-fx .fedman-fx-hint-block {
	max-width: 46rem;
	margin: 0 0 0.8rem;
}

