/**
 * Form Plant Pro - Field group / repeater
 *
 * Frames and layout only. The inputs themselves come from the free plugin's
 * field templates and keep its class names, so the form's design settings
 * (class-design-options.php) style them exactly as they style a top-level
 * field. Nothing here sets a colour of its own.
 */

.fplant-pro-group,
.fplant-pro-repeater {
	display: block;
}

/* ------------------------------------------------------------------
 * Rows
 * ---------------------------------------------------------------- */

.fplant-pro-repeater .fplant-pro-rows {
	display: block;
}

.fplant-pro-row {
	position: relative;
	margin: 0 0 0.75em;
	padding: 0.75em 1em;
	border: 1px solid currentColor;
	border-radius: 4px;
	opacity: 0.999; /* keeps the border colour from inheriting text opacity */
}

.fplant-pro-row > .fplant-pro-row-heading {
	padding: 0 0.4em;
	font-size: 0.9em;
	font-weight: 600;
}

.fplant-pro-repeater-footer {
	margin-top: 0.5em;
}

/* ------------------------------------------------------------------
 * Sub fields
 * ---------------------------------------------------------------- */

.fplant-pro-sub {
	margin-bottom: 0.75em;
}

.fplant-pro-sub:last-of-type {
	margin-bottom: 0;
}

.fplant-pro-sub-label {
	display: block;
	margin-bottom: 0.25em;
	font-size: 0.95em;
}

.fplant-pro-sub-description {
	margin-bottom: 0.25em;
	font-size: 0.85em;
	opacity: 0.8;
}

.fplant-pro-sub-error {
	margin-top: 0.25em;
	font-size: 0.85em;
}

/* Stack (default): one sub field per line. */
.fplant-pro-layout-stack .fplant-pro-sub {
	display: block;
}

/* Columns: a grid of 1-4 tracks, with per-sub spans. */
.fplant-pro-layout-columns .fplant-pro-set,
.fplant-pro-layout-columns .fplant-pro-row {
	display: grid;
	grid-template-columns: repeat(var(--fplant-pro-cols, 2), minmax(0, 1fr));
	gap: 0.75em;
}

.fplant-pro-cols-1 { --fplant-pro-cols: 1; }
.fplant-pro-cols-2 { --fplant-pro-cols: 2; }
.fplant-pro-cols-3 { --fplant-pro-cols: 3; }
.fplant-pro-cols-4 { --fplant-pro-cols: 4; }

.fplant-pro-layout-columns .fplant-pro-row > .fplant-pro-row-heading,
.fplant-pro-layout-columns .fplant-pro-row > .fplant-pro-row-actions {
	grid-column: 1 / -1;
}

.fplant-pro-span-2 { grid-column: span 2; }
.fplant-pro-span-3 { grid-column: span 3; }
.fplant-pro-span-4 { grid-column: span 4; }

/* Table: one row per record, one column per sub field. */
.fplant-pro-table {
	width: 100%;
	border-collapse: collapse;
}

.fplant-pro-table th,
.fplant-pro-table td {
	padding: 0.4em 0.5em;
	text-align: left;
	vertical-align: top;
}

.fplant-pro-layout-table .fplant-pro-row {
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
}

.fplant-pro-layout-table .fplant-pro-sub {
	margin-bottom: 0;
}

/* ------------------------------------------------------------------
 * Buttons
 *
 * Deliberately plainer than the submit button: these are secondary controls
 * and should not compete with it.
 * ---------------------------------------------------------------- */

.fplant-pro-add-row,
.fplant-pro-row-button {
	padding: 0.3em 0.8em;
	font-size: 0.9em;
	line-height: 1.4;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: 3px;
	cursor: pointer;
}

.fplant-pro-add-row[disabled],
.fplant-pro-row-button[disabled] {
	opacity: 0.4;
	cursor: not-allowed;
}

.fplant-pro-row-actions {
	display: flex;
	gap: 0.3em;
	margin-top: 0.5em;
}

.fplant-pro-layout-table .fplant-pro-row-actions {
	margin-top: 0;
}

/* ------------------------------------------------------------------
 * Pro-rendered sub fields
 * ---------------------------------------------------------------- */

.fplant-pro-address-part {
	margin-bottom: 0.4em;
}

.fplant-pro-address-sublabel {
	display: block;
	font-size: 0.85em;
	opacity: 0.8;
}

.fplant-pro-postal-split {
	display: flex;
	align-items: center;
	gap: 0.3em;
}

.fplant-pro-postal-part1 { width: 5em; }
.fplant-pro-postal-part2 { width: 6em; }

.fplant-pro-multi.fplant-layout-horizontal {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3em 1em;
}

/* ------------------------------------------------------------------
 * Utility
 * ---------------------------------------------------------------- */

.fplant-pro-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
