/* JFED GMW — Inline Mailchimp mailing-list form + theme-owned modal */

/* ============================================================= *
 * Self-contained modal (no Popup Maker dependency).
 * ============================================================= */

.jfed-ml-modal[hidden] {
	display: none;
}

.jfed-ml-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	font-family: 'Outfit', 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
}

.jfed-ml-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(20, 30, 50, 0.6);
	border: 0;
	padding: 0;
	margin: 0;
	cursor: pointer;
	width: 100%;
	height: 100%;
}

.jfed-ml-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 600px;
	max-height: calc(100vh - 32px);
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
	display: flex;
	flex-direction: column;
	animation: jfed-ml-modal-in 0.18s ease-out;
}

@keyframes jfed-ml-modal-in {
	from { opacity: 0; transform: scale(0.96) translateY(8px); }
	to   { opacity: 1; transform: scale(1) translateY(0); }
}

.jfed-ml-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px 0;
}

.jfed-ml-modal__title {
	margin: 0;
	font-size: 26px;
	font-weight: 700;
	color: #1e3eaf;
	letter-spacing: -0.005em;
}

.jfed-ml-modal__close {
	background: none;
	border: 0;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #6b7280;
	padding: 4px 10px;
	border-radius: 4px;
	transition: background-color 0.12s ease, color 0.12s ease;
}

.jfed-ml-modal__close:hover,
.jfed-ml-modal__close:focus-visible {
	color: #1e3eaf;
	background: rgba(28, 136, 237, 0.08);
	outline: none;
}

.jfed-ml-modal__body {
	padding: 18px 24px 24px;
	overflow-y: auto;
}

body.jfed-ml-modal-open {
	overflow: hidden;
}

@media (max-width: 480px) {
	.jfed-ml-modal { padding: 0; }
	.jfed-ml-modal__dialog {
		max-width: 100%;
		max-height: 100vh;
		border-radius: 0;
		height: 100vh;
	}
	.jfed-ml-modal__title { font-size: 22px; }
}

/* ============================================================= *
 * Inline form
 * ============================================================= */

.jfed-mailing-list-form {
	font-family: 'Outfit', 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
	color: #2e3a4d;
	text-align: left;
	max-width: 560px;
	margin: 0 auto;
}

.jfed-mailing-list-form * {
	box-sizing: border-box;
}

.jfed-ml__intro-text {
	font-size: 16px;
	line-height: 1.5;
	margin: 0 0 18px;
	color: inherit;
}

.jfed-ml__form {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.jfed-ml__field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	border: 0;
	padding: 0;
	margin: 0;
}

.jfed-ml__field > label,
.jfed-ml__interests > legend {
	font-size: 14px;
	font-weight: 600;
	color: #2e3a4d;
	letter-spacing: 0.01em;
}

.jfed-ml__required {
	color: #e85d2c;
	margin-left: 2px;
}

.jfed-ml__field input[type="text"],
.jfed-ml__field input[type="email"],
.jfed-ml__field input[type="tel"] {
	width: 100%;
	height: 44px;
	padding: 0 14px;
	font: inherit;
	font-size: 15px;
	color: #2e3a4d;
	background: #fff;
	border: 1px solid #cdd3da;
	border-radius: 4px;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.jfed-ml__field input::placeholder {
	color: #9aa3b0;
}

.jfed-ml__field input:focus {
	border-color: #1c88ed;
	box-shadow: 0 0 0 3px rgba(28, 136, 237, 0.18);
}

.jfed-ml__field input:invalid:not(:placeholder-shown) {
	border-color: #e85d2c;
}

/* Phone field with country prefix */
.jfed-ml__phone-wrap {
	display: flex;
	align-items: stretch;
	border: 1px solid #cdd3da;
	border-radius: 4px;
	background: #fff;
	overflow: hidden;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.jfed-ml__phone-wrap:focus-within {
	border-color: #1c88ed;
	box-shadow: 0 0 0 3px rgba(28, 136, 237, 0.18);
}

.jfed-ml__phone-prefix {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 0 12px;
	font-size: 15px;
	color: #2e3a4d;
	background: #f4f6f9;
	border-right: 1px solid #cdd3da;
	white-space: nowrap;
}

.jfed-ml__phone-wrap input[type="tel"] {
	flex: 1;
	border: 0;
	border-radius: 0;
	height: 42px;
	background: transparent;
}

.jfed-ml__phone-wrap input[type="tel"]:focus {
	border: 0;
	box-shadow: none;
}

.jfed-ml__sms-legal {
	font-size: 12px;
	line-height: 1.45;
	color: #6b7280;
	margin: 6px 0 0;
}

.jfed-ml__sms-legal a {
	color: #1c88ed;
	text-decoration: underline;
}

/* Interest checkboxes */
.jfed-ml__interests {
	margin-top: 4px;
}

.jfed-ml__interest-list {
	list-style: none;
	margin: 8px 0 0;
	padding: 0;
	display: grid;
	grid-template-columns: 1fr;
	gap: 8px 16px;
}

@media (min-width: 480px) {
	.jfed-ml__interest-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.jfed-ml__interest-list li {
	margin: 0;
	padding: 0;
}

.jfed-ml__interest-list label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	cursor: pointer;
	padding: 6px 4px;
	border-radius: 3px;
	font-size: 14px;
	line-height: 1.35;
	color: #2e3a4d;
	transition: background-color 0.12s ease;
}

.jfed-ml__interest-list label:hover {
	background-color: rgba(28, 136, 237, 0.06);
}

.jfed-ml__interest-list input[type="checkbox"] {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	margin: 1px 0 0;
	accent-color: #1c88ed;
	cursor: pointer;
}

/* Submit button — leverages existing theme .btn .btn--orange */
.jfed-ml__submit {
	margin-top: 4px;
}

.jfed-ml__submit .btn {
	width: 100%;
	min-height: 48px;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: 0.02em;
	cursor: pointer;
}

.jfed-ml__submit .btn[disabled] {
	opacity: 0.7;
	cursor: progress;
}

/* Loader (shown while waiting on the API) */
.jfed-ml__loader[hidden] {
	display: none;
}

.jfed-ml__loader {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 28px 16px;
	gap: 14px;
	text-align: center;
}

.jfed-ml__spinner {
	width: 44px;
	height: 44px;
	border: 4px solid rgba(28, 136, 237, 0.18);
	border-top-color: #1c88ed;
	border-radius: 50%;
	animation: jfed-ml-spin 0.8s linear infinite;
}

@keyframes jfed-ml-spin {
	to { transform: rotate(360deg); }
}

.jfed-ml__loader-text {
	margin: 0;
	font-size: 15px;
	color: #4b5563;
}

/* Loading state — hide the form chrome, show only the spinner */
.jfed-ml__form--loading .jfed-ml__field,
.jfed-ml__form--loading .jfed-ml__interests,
.jfed-ml__form--loading .jfed-ml__submit,
.jfed-ml__form--loading .jfed-ml__status {
	display: none !important;
}

/* Success state — hide everything; status message stands alone, larger */
.jfed-ml__form--success .jfed-ml__field,
.jfed-ml__form--success .jfed-ml__interests,
.jfed-ml__form--success .jfed-ml__submit,
.jfed-ml__form--success .jfed-ml__loader {
	display: none !important;
}

/* Status messages */
.jfed-ml__status {
	font-size: 14px;
	line-height: 1.45;
	min-height: 1px;
}

.jfed-ml__status:empty {
	display: none;
}

.jfed-ml__status--success {
	padding: 12px 14px;
	border-radius: 4px;
	background: #e8f6ec;
	color: #1f6f3b;
	border: 1px solid #b8e0c4;
	margin-top: 4px;
}

.jfed-ml__status--error {
	padding: 12px 14px;
	border-radius: 4px;
	background: #fbeae5;
	color: #a13a1a;
	border: 1px solid #f0c4b6;
	margin-top: 4px;
}

/* Larger, centered success message when shown solo (success state). */
.jfed-ml__form--success .jfed-ml__status--success {
	font-size: 17px;
	line-height: 1.45;
	padding: 28px 16px;
	background: transparent;
	border: 0;
	color: #1f6f3b;
	text-align: center;
	margin: 0;
}

.jfed-ml__form--success .jfed-ml__status--success::before {
	content: "";
	display: block;
	width: 56px;
	height: 56px;
	margin: 0 auto 14px;
	border-radius: 50%;
	background: #4cae5e;
	-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='5 12 10 17 19 8'/></svg>");
	mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='5 12 10 17 19 8'/></svg>");
	-webkit-mask-size: 32px 32px;
	mask-size: 32px 32px;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
}

/* Reduced motion — kill the spin */
@media (prefers-reduced-motion: reduce) {
	.jfed-ml__spinner { animation-duration: 2.5s; }
}

/* When the form lives inside a Popup Maker popup, force readable colors
   regardless of the popup theme background and tighten interior padding. */
.pum .jfed-mailing-list-form,
.pum-content .jfed-mailing-list-form {
	color: #2e3a4d;
	max-width: 100%;
}

.pum .jfed-mailing-list-form .jfed-ml__field > label,
.pum-content .jfed-mailing-list-form .jfed-ml__field > label,
.pum .jfed-mailing-list-form .jfed-ml__interests > legend,
.pum-content .jfed-mailing-list-form .jfed-ml__interests > legend {
	color: #2e3a4d;
}

/* Inside the white footer-cta context (if rendered there) — reverse the
   light-on-dark assumption. */
.footer-cta .jfed-mailing-list-form,
.footer-cta .jfed-mailing-list-form .jfed-ml__field > label,
.footer-cta .jfed-mailing-list-form .jfed-ml__interests > legend,
.footer-cta .jfed-mailing-list-form .jfed-ml__interest-list label {
	color: #fff;
}

.footer-cta .jfed-mailing-list-form .jfed-ml__sms-legal,
.footer-cta .jfed-mailing-list-form .jfed-ml__sms-legal a {
	color: rgba(255, 255, 255, 0.85);
}
