/* Interruptible & Pooling Services form — form-specific overrides. */

/*
 * Contract Options fieldset:
 * stack the MDQ Change row above the "Other + If Other, specify"
 * row, so the Other checkbox and its free-text field share a single
 * row with no horizontal contention from the MDQ Change checkbox.
 * Mirrors the pooling-points layout below.
 */
.nng-form.interruptible-form [id="contract_options_"] {
	display: flex;
	flex-direction: column;
	gap: var(--nng-gap-sm);
}

.nng-form.interruptible-form [id="contract_options_"] > .form-row {
	flex: 1 1 100%;
	max-width: 100%;
}

/* Each row inside the pooling fieldset spans the full fieldset width
 * so the label text gets the full available column instead of being
 * constrained to its intrinsic checkbox-label width. */
.nng-form.interruptible-form [id="pooling_points_"] > .form-row {
	flex: 1 1 100%;
	max-width: 100%;
}

.nng-form.interruptible-form .interruptible-ti-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
}

.nng-form.interruptible-form .interruptible-ild-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
}

.nng-form.interruptible-form .interruptible-ti-row > .form-row.checkbox-row {
	flex: 0 0 auto;
	margin: 0;
	max-width: max-content;
}

.nng-form.interruptible-form .interruptible-ild-row > .form-row.checkbox-row {
	flex: 0 0 auto;
	margin: 0;
	max-width: max-content;
}

.nng-form.interruptible-form .interruptible-ti-row > .form-row:not(.checkbox-row) {
	flex: 0 1 22rem;
	min-width: 0;
	margin: 0;
}

.nng-form.interruptible-form .interruptible-ild-row > .form-row:not(.checkbox-row) {
	flex: 0 1 22rem;
	min-width: 0;
	margin: 0;
}

.nng-form.interruptible-form .interruptible-ti-row > .form-row:not(.checkbox-row) > input {
	max-width: 22rem;
	width: 100%;
	margin: 0;
}

.nng-form.interruptible-form .interruptible-ild-row > .form-row:not(.checkbox-row) > input {
	max-width: 22rem;
	width: 100%;
	margin: 0;
}

.nng-form.interruptible-form .interruptible-ild-row > .form-note {
	flex-basis: 100%;
	margin: 0;
	padding-top: 0;
}

.nng-form.interruptible-form [id="contract_options_"] > .form-row:last-child {
	display: grid;
	grid-template-columns: auto minmax(18rem, 1fr);
	align-items: center;
	column-gap: 1rem;
	row-gap: 0.5rem;
}

/*
 * MID Pooling Service - Select Pooling Points:
 * stack each option vertically (one per row) only within this form.
 * Targets both the legacy `.checkbox-grid` (checkbox_group renderer)
 * and the manual `#pooling_points_` fieldset that contains the
 * "Other" checkbox + free-text pair inline.
 */
.nng-form.interruptible-form .pooling-points-group .checkbox-grid,
.nng-form.interruptible-form [id="pooling_points_"] {
	display: flex;
	flex-direction: column;
	gap: var(--nng-gap-lg);
}

/* Pooling point labels are reference text, not field labels: render
 * them in normal weight and let long lines wrap with comfortable
 * leading rather than crowding the next checkbox. */
.nng-form.interruptible-form [id="pooling_points_"] .checkbox-label,
.nng-form.interruptible-form [id="pooling_points_"] .checkbox-label span {
	font-weight: 400;
	line-height: 1.5;
	white-space: normal;
}

.nng-form.interruptible-form [id="pooling_points_"] .checkbox-label {
	align-items: flex-start;
	min-height: 0;
	padding-top: 0.25rem;
	padding-bottom: 0.25rem;
	flex: 1 1 100%;
	max-width: 100%;
}

.nng-form.interruptible-form .interruptible-pooling-other-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
}

.nng-form.interruptible-form .interruptible-pooling-other-row > .form-row.checkbox-row {
	flex: 0 0 auto;
	margin: 0;
	max-width: max-content;
}

.nng-form.interruptible-form .interruptible-pooling-other-row > .form-row:not(.checkbox-row) {
	display: grid;
	grid-template-columns: 1rem minmax(0, 22rem);
	align-items: center;
	column-gap: 0.5rem;
	row-gap: 0;
	flex: 0 1 auto;
	min-width: 0;
	margin: 0;
}

.nng-form.interruptible-form .interruptible-pooling-other-row > .form-row:not(.checkbox-row) > label {
	flex: 0 0 1rem;
	max-width: 1rem;
	min-width: 1rem;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	overflow: visible;
	padding-top: 0;
}

.nng-form.interruptible-form .interruptible-pooling-other-row > .form-row:not(.checkbox-row) > input {
	max-width: 22rem;
	width: 100%;
	margin: 0;
}

/* Each row inside the pooling fieldset spans the full fieldset width
 * so the label text gets the full available column instead of being
 * constrained to its intrinsic checkbox-label width. */
.nng-form.interruptible-form .interruptible-pooling-other-row > .form-row:not(.checkbox-row) > .field-error,
.nng-form.interruptible-form [id="contract_options_"] > .form-row > .form-row:not(.checkbox-row) > .field-error {
	grid-column: 1 / -1;
	margin-left: 0;
	padding-left: 1.5rem;
	white-space: normal;
	word-break: normal;
	overflow-wrap: anywhere;
}

/* Pin the "Other" checkbox to its natural width and let the
 * adjacent free-text field flex to fill the rest of the row, so
 * the text input visibly sits next to the checkbox. Placed after
 * the pooling rules above to keep `no-descending-specificity`
 * happy. */
.nng-form.interruptible-form
[id="contract_options_"] > .form-row > .form-row.checkbox-row {
	flex: 0 0 auto;
	margin: 0;
}

.nng-form.interruptible-form
[id="contract_options_"] > .form-row > .form-row:not(.checkbox-row) {
	display: grid;
	grid-template-columns: 1rem minmax(0, 1fr);
	align-items: center;
	column-gap: 0.5rem;
	row-gap: 0;
	flex: 1 1 18rem;
	min-width: 0;
	margin: 0;
}

.nng-form.interruptible-form
[id="contract_options_"] > .form-row > .form-row:not(.checkbox-row) > label {
	flex: 0 0 1rem;
	max-width: 1rem;
	min-width: 1rem;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	overflow: visible;
	padding-top: 0;
}

.nng-form.interruptible-form
[id="contract_options_"] > .form-row > .form-row:not(.checkbox-row) > input {
	max-width: none;
	width: 100%;
	margin: 0;
}

@media (max-width: 720px) {

	.nng-form.interruptible-form .interruptible-ti-row {
		align-items: stretch;
	}

	.nng-form.interruptible-form .interruptible-ild-row {
		align-items: stretch;
	}

	.nng-form.interruptible-form .interruptible-ti-row > .form-row:not(.checkbox-row) {
		flex-basis: 100%;
	}

	.nng-form.interruptible-form .interruptible-ild-row > .form-row:not(.checkbox-row) {
		flex-basis: 100%;
	}

	.nng-form.interruptible-form .interruptible-pooling-other-row {
		align-items: stretch;
	}

	.nng-form.interruptible-form .interruptible-pooling-other-row > .form-row:not(.checkbox-row) {
		grid-template-columns: 1rem minmax(0, 1fr);
		flex-basis: 100%;
	}

	.nng-form.interruptible-form [id="contract_options_"] > .form-row:last-child {
		grid-template-columns: 1fr;
	}
}

/*
 * Shipper / Agent two-column layout: Shipper info in column 1, Agent
 * info in column 2. Collapses to a single column on narrow viewports.
 */
.nng-form.interruptible-form .party-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--nng-gap-lg);
	align-items: start;
}

.nng-form.interruptible-form .party-col {
	display: flex;
	flex-direction: column;
	gap: var(--nng-gap-sm);
	min-width: 0;
}

@media (max-width: 720px) {

	.nng-form.interruptible-form .party-grid {
		grid-template-columns: 1fr;
	}
}
