.chosen-container-single .chosen-single {
	padding: 0 1.5rem 0 .75rem;
}

[id=pwp-form] {
	max-width: 95rem;
	display: flex;
	flex-direction: column;
}
:is([id=pwp-form], .pwp-form) {
	:where(label,.label) {
		color: #000;
		font-size: .875rem;
		font-weight: 600;
		display: flex; // Overrides bootstrap
		gap: .25em;
		align-items: center;
		margin-inline: unset;
		margin-block: 0; // Overrides bootstrap
		&.nowrap {
			white-space: nowrap;
		}
		+ * {
			--flow-space: 0.5em;
		}
		+ :where(.description) {
			margin: 0; // override bootstrap
			--flow-space: 0.25em;
		}
	}

	.description {
		+ * {
			--flow-space: .75em;
		}
	}

	:where(.form-group,.conditions-container,.text-field-wrapper) {
		> * + * {
			margin-top: var(--flow-space, .75em);
		}
	}
	input {
		border-radius: 4px;
		font-size: 0.875rem;
		line-height: 1;

		&:not([type=submit]) {
			padding: 0 1.5rem .1em .75rem;
		}

		&:not(.is-invalid):not(:invalid) {
			border-color: var(--color-mid-glare);
		}
		&:disabled {
			background-color: #E9E9E9; // Only colour, allow rest to remain
			position: relative;
			color: var(--color-dark);
			border: 0;
		}
		&:focus {
			outline: 1px solid #0074E7;
			box-shadow: none;
		}
	}

	select {
		font-size: 0.875rem;
		line-height: 2.5;
		border-radius: 4px;
		padding: 0 1.5rem 0 .75rem;
		height: auto;
		border: 1px solid var(--color-mid-glare);
		&:where(:disabled,[inert]) {
			&.conditions-value {
				margin-right: 0 !important;
			}
			opacity: 1;
			width: 100%;
			// height: 40px;
			background-color: #E9E9E9; // Only colour, allow rest to remain
			position: relative;
			color: var(--color-dark);
			border: 0;
		}
		&:where(.is-invalid, :invalid) + .chosen-container .chosen-single {
			border-color: var(--required) !important;
		}
	}

	.condition {
		display: flex;
		gap: 1rem;
		align-items:flex-start;
		> *:not(label) {
			width: min(100%, var(--max-input-width, 30rem ));
		}
		&[hidden] {
			display: none !important;
		}

		.field-wrapper-styles {
			input {
				background-color: white; // only target colour
				border-radius: 4px;
				border-color: var(--color-mid-glare);
				box-shadow: none;
				display: flex;
				align-items: center;

				&::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
					color: #444;
					opacity: .5; /* Firefox */

					@media only screen and (max-width: 600px) {
						font-size: 16px;
					}
				}
				&:where(:disabled,[inert]) {
					background-color: #E9E9E9;
					&::placeholder {
						color: var(--color-dark);
					}
				}

				@media only screen and (max-width: 600px) {
					box-shadow: none;
					border-color: #8c8f94;
					border-radius: 3px;
				}
			}

			@media only screen and (max-width: 600px) {
				margin-right: 0;
				margin-bottom: 10px;
			}
		}

		// Days field wrapper specific styling
		.days-field-wrapper {
			display: flex;
			align-items: center;
			gap: 0.75rem;

			.datepicker-field {
				flex: 1;
				min-width: 150px;
			}

			.equals-sign {
				font-weight: 600;
				font-size: 1.125rem;
				color: var(--color-primary);
				flex-shrink: 0;
			}

			.field-days-number {
				width: 100px;
				flex-shrink: 0;
				text-align: center;
			}

			@media only screen and (max-width: 600px) {
				flex-direction: column;
				gap: 0.5rem;

				.equals-sign {
					display: none;
				}

				.datepicker-field,
				.field-days-number {
					width: 100%;
					min-width: auto;
				}
			}
		}

		+ * {
			--flow-space: 1em;
		}
	}
	:where(
		[data-condition-count="0"] .condition,
		[data-condition-count="1"] .condition
	) {
		.button-conditions-wrapper {
			visibility: hidden;
		}
	}
}

label:has([role="switch"]) {
	display: flex;
	column-gap: .25rem;
	align-items: center;
	cursor: pointer;
}

[type="checkbox"][role="switch"] {
	--height: 1.1875rem;
	--width: 0.8;

	margin: 0;
	padding: 0;
	box-shadow: none;
	appearance: none;
	display: inline-block;
	background-color: #808080;
	height: var(--height);
	width: calc(var(--height) * calc(1 + var(--width)));
	border: 0;
	border-radius: 99em;
	transition: background-color 100ms ease-in-out;

	&::before {
		// Suppress WP default styles
		content: '' !important;
		display: none !important;
	}

	&::after {
		content: "";
		display: block;
		aspect-ratio: 1;
		background-color: var(--color-light, white);
		border: max(2px, 0.125em) solid #808080;
		height: 100%;
		border-radius: 50%;
		box-sizing: border-box;
		transition: translate 100ms ease-in-out;
	}

	&:checked {
		background-color: var(--color-primary);
		&::after {
			border-color: var(--color-primary);
			translate: calc(var(--height) * var(--width)) 0;
		}
	}
}


.button-conditions-wrapper {
	display: flex;
	flex: 0; // Don't grow/shrink

	.remove-condition {
		cursor: pointer;
		display: flex;
		background: none;
		border: 0;
		padding: 0;
		&:disabled {
			opacity: .33;
			filter: grayscale(1);
		}
	}
	button:last-child {
		margin-right: 0;
	}
}

.add-condition {
	color: var(--color-secondary);
	background: none;
	border: none;
	border-radius: 4px;
	padding: .5em;

	&:where(:hover,:focus) {
		color: var(--color-primary);
		cursor: pointer;
		outline: 2px solid var(--color-primary);
	}
	&:focus-visible {
		outline: 2px solid var(--color-primary);
	}
}
.is-invalid ~ .invalid-feedback {
	display: block;
}
.rule-message {
	color: var(--red);
	font-size: 1rem;
}
[id=form-actions] {
	margin-block-start: 1.5rem;
}

@media only screen and (max-width: 992px) {
	.conditions {
		.condition {
			flex-wrap: wrap;
			> :not(label) {
				margin-bottom: 10px;
			}
		}
	}
}
@media only screen and (max-width: 782px) {
	.conditions {
		.condition {
			> :not(label) {
				--max-input-width: 20rem;
			}
		}
	}
}

@media only screen and (max-width: 600px) {
	.conditions {
		.condition {
			> :not(label) {
				--max-input-width: 100%;
			}
		}
	}
}
