/*
 * Eenergy CF7 forms (.ee-form)
 *
 * Layout and styling for Contact Form 7 forms whose template is wrapped in
 * <div class="ee-form">. First used by the Referrals form; the reminder
 * sign-up, new owner and expiring fire forms share the same field pattern.
 *
 * Mobile first: single column, then a two-column field grid from 576px and
 * side-by-side panels from 992px.
 */

.ee-form {
	--ee-green: #2e7d1e;
	--ee-green-dark: #1f5e12;
	--ee-green-tint: #eef6ea;
	--ee-ink: #222;
	--ee-muted: #555;
	--ee-border: #cfd6cb;
	--ee-radius: 10px;

	color: var(--ee-ink);
	font-size: 1rem;
}

.ee-form p {
	margin: 0;
}

/* Bootstrap's reboot leaves fieldsets unstyled; keep them that way. */
.ee-form fieldset {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.ee-form legend {
	font-size: 1rem;
	font-weight: 600;
	margin-bottom: 0.5rem;
}

.ee-form__req {
	color: var(--ee-muted);
	font-weight: 400;
	font-size: 0.875em;
}

/* ---- Referral type choice: two selectable tiles ---- */

.ee-form__choice {
	margin-bottom: 1.5rem !important;
}

.ee-form__choice legend {
	font-size: 1.25rem;
}

.ee-form__choice .wpcf7-radio {
	display: grid;
	gap: 0.75rem;
}

.ee-form__choice .wpcf7-list-item {
	margin: 0;
}

.ee-form__choice .wpcf7-list-item label {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 0;
	padding: 0.875rem 1rem;
	border: 2px solid var(--ee-border);
	border-radius: var(--ee-radius);
	background: #fff;
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.15s, background-color 0.15s;
}

.ee-form__choice .wpcf7-list-item label:hover {
	border-color: var(--ee-green);
}

.ee-form__choice .wpcf7-list-item label:has(input:checked) {
	border-color: var(--ee-green);
	background: var(--ee-green-tint);
}

/* ---- Panels (referrer / referred) ---- */

.ee-form__cols {
	display: grid;
	gap: 1.5rem;
}

.ee-form__panel {
	padding: 1.25rem;
	border: 1px solid var(--ee-border);
	border-radius: var(--ee-radius);
	background: #fff;
}

.ee-form__panel h3 {
	margin: 0 0 1rem;
	padding-bottom: 0.625rem;
	border-bottom: 3px solid var(--ee-green);
	color: var(--ee-green);
	font-size: 1.25rem;
	font-weight: 700;
}

.ee-form__panel h3 span {
	color: var(--ee-muted);
	font-size: 0.875rem;
	font-weight: 400;
}

/* ---- Text fields ---- */

.ee-form__grid {
	display: grid;
	gap: 1rem;
}

.ee-form__grid label {
	display: block;
	margin: 0;
}

.ee-form__label {
	display: block;
	margin-bottom: 0.375rem;
	font-size: 0.9375rem;
	font-weight: 600;
}

.ee-form .wpcf7-form-control-wrap {
	display: block;
}

/* Overrides energy.css (.form-control is 52px, 14px text, faint border). */
.ee-form input.form-control {
	width: 100%;
	height: 48px !important;
	padding: 0.5rem 0.875rem;
	border: 1px solid var(--ee-border);
	border-radius: 6px;
	font-size: 1rem;
}

.ee-form input.form-control::placeholder {
	color: #6b6b6b !important;
}

.ee-form input.form-control:focus {
	border-color: var(--ee-green);
	box-shadow: 0 0 0 3px rgba(46, 125, 30, 0.25) !important;
	outline: 0;
}

/* ---- Checkboxes and the reminder method radios ---- */

.ee-form__options {
	display: grid;
	gap: 1rem;
	margin-top: 1.25rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--ee-border);
}

/*
 * The parent theme's script adds .form-control to every CF7 control,
 * including checkbox groups, which gives them a 52px bordered box.
 */
.ee-form .wpcf7-checkbox.form-control {
	display: block;
	height: auto !important;
	padding: 0;
	border: 0;
	background: none;
}

.ee-form .wpcf7-list-item {
	margin: 0;
}

.ee-form .wpcf7-checkbox label,
.ee-form__options .wpcf7-radio label {
	display: flex;
	align-items: flex-start;
	gap: 0.625rem;
	margin: 0;
	cursor: pointer;
	line-height: 1.4;
}

.ee-form input[type="checkbox"],
.ee-form input[type="radio"] {
	flex: 0 0 auto;
	width: 1.25rem;
	height: 1.25rem;
	margin: 0.05rem 0 0;
	accent-color: var(--ee-green);
}

.ee-form__options .wpcf7-radio {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
}

.ee-form__options legend {
	font-size: 0.9375rem;
}

.ee-form input:focus-visible {
	outline: 3px solid var(--ee-green);
	outline-offset: 2px;
}

/* ---- Submit ---- */

.ee-form__submit {
	position: relative;
	margin-top: 1.5rem !important;
}

/* Overrides energy.css (#7fa832 fails contrast with white text). */
.ee-form .wpcf7-submit.btn.btn-primary {
	width: 100%;
	min-height: 52px;
	padding: 0.75rem 2rem;
	border: 0 !important;
	border-radius: 999px;
	background: var(--ee-green) !important;
	color: #fff;
	font-size: 1.0625rem;
	font-weight: 700;
}

.ee-form .wpcf7-submit.btn.btn-primary:hover,
.ee-form .wpcf7-submit.btn.btn-primary:focus-visible {
	background: var(--ee-green-dark) !important;
}

.ee-form .wpcf7-submit.btn.btn-primary:focus-visible {
	outline: 3px solid var(--ee-green-dark);
	outline-offset: 3px;
}

.ee-form .wpcf7-spinner {
	vertical-align: middle;
}

/* ---- Validation and response messages ---- */

.ee-form .wpcf7-not-valid-tip {
	margin-top: 0.25rem;
	color: #b3261e;
	font-size: 0.875rem;
}

.ee-form input.wpcf7-not-valid {
	border-color: #b3261e;
}

/* Beats CF7's own .wpcf7 form .wpcf7-response-output margin. */
.wpcf7 form .ee-form ~ .wpcf7-response-output {
	margin: 1.5rem 0 0;
	padding: 0.875rem 1rem;
	border-radius: 6px;
}

/* ---- Larger screens ---- */

@media (min-width: 576px) {
	.ee-form__choice .wpcf7-radio {
		grid-template-columns: 1fr 1fr;
	}

	.ee-form__grid {
		grid-template-columns: 1fr 1fr;
	}

	.ee-form__full {
		grid-column: 1 / -1;
	}

	.ee-form__panel {
		padding: 1.5rem;
	}

	.ee-form .wpcf7-submit.btn.btn-primary {
		width: auto;
	}
}

@media (min-width: 992px) {
	.ee-form__cols {
		grid-template-columns: 1fr 1fr;
		align-items: start;
	}

	.ee-form__panel {
		padding: 2rem;
	}
}
