/* Lead Consent Gate — front-end modal (theme-aligned defaults via CSS variables). */

.lcg-modal {
	--lcg-header: #28944c;
	--lcg-header-text: #ffffff;
	--lcg-button: #f16522;
	--lcg-button-text: #ffffff;
	--lcg-link: #28944c;
	--lcg-modal-bg: #f1f8f1;
	--lcg-text: #1a1a1a;
	--lcg-border: #b8ccb8;
	--lcg-check-txn: #c62828;
	--lcg-check-mkt: #2e7d32;
	--lcg-check-legal: #1565c0;
	--lcg-card: #ffffff;
	--lcg-muted: #5c6560;
}

body.lcg-modal-open {
	overflow: hidden;
}

/* Inline embed (shortcode): same variables and form chrome as the modal dialog. */
.lcg-inline {
	max-width: 760px;
	margin: 1.5rem auto;
	width: 100%;
	box-sizing: border-box;
	font-family: inherit;
	color: var(--lcg-text);
}

.lcg-inline__card {
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
	background: var(--lcg-modal-bg);
	border-radius: 12px;
	box-shadow:
		0 4px 6px rgba(0, 0, 0, 0.04),
		0 12px 28px rgba(17, 40, 24, 0.1);
	border: 1px solid rgba(40, 148, 76, 0.2);
}

.lcg-inline .lcg-modal__header {
	border-radius: 12px 12px 0 0;
}

.lcg-inline .lcg-modal__form {
	min-height: 0;
}

.lcg-modal__backdrop {
	position: fixed;
	inset: 0;
	background: rgba(17, 40, 24, 0.55);
	backdrop-filter: blur(2px);
	/* Above most theme sticky headers / builder UI (often ~1e5). */
	z-index: 999999;
}

.lcg-modal__dialog {
	position: fixed;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(100% - 2rem, 760px);
	max-height: min(96vh, 900px);
	max-height: min(96dvh, 900px);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	min-height: 0;
	z-index: 1000000;
	background: var(--lcg-modal-bg);
	border-radius: 12px;
	box-shadow:
		0 4px 6px rgba(0, 0, 0, 0.04),
		0 24px 48px rgba(17, 40, 24, 0.18);
	font-family: inherit;
	color: var(--lcg-text);
	border: 1px solid rgba(40, 148, 76, 0.2);
}

/* Form fills dialog below header; body scrolls, footer stays put (no cut-off button). */
.lcg-modal__form {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	margin: 0;
}

.lcg-modal__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	flex-shrink: 0;
	background: var(--lcg-header);
	color: var(--lcg-header-text);
	padding: 1rem 1.15rem 1rem 1.25rem;
	margin: 0;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
	overflow: visible;
}

/* Explicit color: theme heading rules (e.g. Divi h2) override inherited header color. */
.lcg-modal .lcg-modal__header .lcg-modal__title {
	margin: 0;
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0.01em;
	color: var(--lcg-header-text) !important;
	text-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
	flex: 1;
	min-width: 0;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.lcg-modal__header .lcg-modal__close {
	margin-top: 0.05rem;
}

.lcg-modal__close {
	appearance: none;
	border: 0;
	background: rgba(0, 0, 0, 0.08);
	color: var(--lcg-header-text);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	width: 2.25rem;
	height: 2.25rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	flex-shrink: 0;
	transition: background 0.15s ease;
}

.lcg-modal__close:hover,
.lcg-modal__close:focus-visible {
	background: rgba(0, 0, 0, 0.14);
	outline: 2px solid var(--lcg-header-text);
	outline-offset: 2px;
}

.lcg-modal__body {
	padding: 1.25rem 1.35rem 1rem;
	overflow-y: auto;
	flex: 1;
	min-height: 0;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	/* Subtle scroll when needed; avoid heavy OS scrollbar in the modal chrome. */
	scrollbar-width: thin;
	scrollbar-color: rgba(40, 148, 76, 0.35) transparent;
}

.lcg-modal__body::-webkit-scrollbar {
	width: 5px;
}

.lcg-modal__body::-webkit-scrollbar-track {
	background: transparent;
}

.lcg-modal__body::-webkit-scrollbar-thumb {
	background: rgba(40, 148, 76, 0.35);
	border-radius: 999px;
}

.lcg-modal__footer {
	flex-shrink: 0;
	padding: 0 1.35rem 1.25rem;
	background: var(--lcg-modal-bg);
	border-top: 1px solid rgba(40, 148, 76, 0.12);
	box-shadow: 0 -8px 16px rgba(241, 248, 241, 0.9);
}

/*
 * Small screens: avoid translate(-50%, -50%) + max-height (clips top/bottom on iOS).
 * Pin to safe viewport insets so header/title and scroll area stay fully visible.
 */
@media screen and (max-width: 600px) {
	.lcg-modal__dialog {
		left: max(0.75rem, env(safe-area-inset-left, 0px));
		right: max(0.75rem, env(safe-area-inset-right, 0px));
		width: auto;
		top: max(0.5rem, env(safe-area-inset-top, 0px));
		bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
		transform: none;
		max-height: none;
		border-radius: 10px;
	}

	.lcg-modal .lcg-modal__header .lcg-modal__title {
		font-size: 1.1rem;
		line-height: 1.45;
	}

	.lcg-modal__body {
		padding-left: 1rem;
		padding-right: 1rem;
	}

	.lcg-modal__footer {
		padding-left: 1rem;
		padding-right: 1rem;
		padding-bottom: 1rem;
	}
}

.lcg-form__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem 1rem;
	align-items: start;
}

@media (max-width: 480px) {
	.lcg-form__grid {
		grid-template-columns: 1fr;
	}
}

.lcg-field {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	margin: 0;
	gap: 0.4rem;
	min-width: 0;
}

.lcg-field__label {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--lcg-text);
	line-height: 1.3;
	letter-spacing: 0.01em;
}

/* Required indicator in labels and consent copy: (*) */
.lcg-required-mark {
	color: #c62828;
	font-weight: 700;
	white-space: nowrap;
}

.lcg-required-legend {
	margin: 0 0 0.65rem;
	padding: 0;
	font-size: 0.8125rem;
	line-height: 1.45;
	color: var(--lcg-muted);
	text-align: left;
}

.lcg-required-legend .lcg-required-mark {
	margin: 0 0.15em;
}

.lcg-field input {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
	padding: 0.95rem 1rem;
	min-height: 3.25rem;
	border: 1px solid var(--lcg-border);
	border-radius: 8px;
	background: var(--lcg-card);
	font: inherit;
	font-size: 1.05rem;
	color: var(--lcg-text);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lcg-field input::placeholder {
	color: #8a938e;
}

.lcg-field input:hover {
	border-color: rgba(40, 148, 76, 0.45);
}

.lcg-field input:focus {
	outline: none;
	border-color: var(--lcg-header);
	box-shadow: 0 0 0 3px rgba(40, 148, 76, 0.2);
}

.lcg-hint {
	font-size: 0.8125rem;
	color: var(--lcg-muted);
	margin: 0.15rem 0 0;
	line-height: 1.4;
}

.lcg-form-error {
	color: #b00020;
	font-size: 0.9rem;
	margin: 0 0 1rem;
	padding: 0.65rem 0.85rem;
	background: #ffebee;
	border: 1px solid #ffcdd2;
	border-radius: 8px;
}

.lcg-field-error {
	color: #b00020;
	font-size: 0.8125rem;
	font-weight: 500;
	margin: 0.35rem 0 0;
	line-height: 1.35;
}

.lcg-check-group {
	margin: 0;
}

.lcg-consent + .lcg-check-group {
	margin-top: 0.85rem;
}

.lcg-consent {
	position: relative;
	margin: 1rem 0 0;
}

.lcg-consent--sms {
	display: flex;
	gap: 0.75rem;
	align-items: stretch;
	padding: 0.25rem 0;
}

.lcg-consent__rail {
	width: 4px;
	flex-shrink: 0;
	background: linear-gradient(180deg, var(--lcg-header) 0%, rgba(40, 148, 76, 0.55) 100%);
	border-radius: 4px;
	margin: 0.2rem 0 0.35rem;
}

.lcg-consent__inner {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
}

.lcg-check {
	display: flex;
	gap: 0.65rem;
	align-items: flex-start;
	cursor: pointer;
	font-size: 0.8125rem;
	line-height: 1.45;
	margin: 0;
	padding: 0.75rem 0.85rem 0.75rem 0.85rem;
	background: var(--lcg-card);
	border-radius: 10px;
	border: 1px solid rgba(0, 0, 0, 0.07);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.lcg-check:hover {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.lcg-check--transactional {
	border-left: 4px solid var(--lcg-check-txn);
	background: linear-gradient(90deg, rgba(198, 40, 40, 0.06) 0%, var(--lcg-card) 12%);
}

.lcg-check--marketing {
	border-left: 4px solid var(--lcg-check-mkt);
	background: linear-gradient(90deg, rgba(46, 125, 50, 0.07) 0%, var(--lcg-card) 12%);
}

.lcg-check--legal {
	border-left: 4px solid var(--lcg-check-legal);
	background: linear-gradient(90deg, rgba(21, 101, 192, 0.06) 0%, var(--lcg-card) 12%);
}

.lcg-check input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}

.lcg-check__box {
	flex-shrink: 0;
	width: 1.2rem;
	height: 1.2rem;
	margin-top: 0.12rem;
	border: 2px solid #8a9a90;
	border-radius: 4px;
	background: #fff;
	position: relative;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.lcg-check input:focus-visible + .lcg-check__box {
	outline: 2px solid var(--lcg-header);
	outline-offset: 2px;
}

.lcg-check input:checked + .lcg-check__box {
	background: var(--lcg-header);
	border-color: var(--lcg-header);
}

.lcg-check input:checked + .lcg-check__box::after {
	content: "";
	position: absolute;
	left: 4px;
	top: 1px;
	width: 4px;
	height: 9px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.lcg-check__text {
	flex: 1;
	color: #2d3330;
}

.lcg-check__text a {
	color: var(--lcg-link);
	text-decoration: underline;
	text-underline-offset: 2px;
	font-weight: 600;
}

.lcg-check__text a:hover {
	filter: brightness(0.92);
}

.lcg-check__text strong {
	font-weight: 700;
	color: #1a1f1c;
}

.lcg-form__actions {
	margin: 0;
	padding: 0.35rem 0 0;
	text-align: center;
}

.lcg-modal .lcg-submit {
	appearance: none;
	border: 0;
	border-radius: 8px;
	background: var(--lcg-button);
	color: var(--lcg-button-text) !important;
	font: inherit;
	font-weight: 700;
	font-size: 1rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 0.95rem 2.75rem;
	cursor: pointer;
	min-width: 220px;
	box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
	transition: filter 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.lcg-modal .lcg-submit:hover,
.lcg-modal .lcg-submit:focus-visible {
	filter: brightness(1.06);
	box-shadow: 0 4px 12px rgba(241, 101, 34, 0.35);
	outline: none;
}

.lcg-modal .lcg-submit:focus-visible {
	outline: 2px solid var(--lcg-header);
	outline-offset: 3px;
}

.lcg-modal .lcg-submit:active {
	transform: translateY(1px);
}

.lcg-modal .lcg-submit:disabled {
	opacity: 0.65;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

.lcg-inline .lcg-submit {
	appearance: none;
	border: 0;
	border-radius: 8px;
	background: var(--lcg-button);
	color: var(--lcg-button-text) !important;
	font: inherit;
	font-weight: 700;
	font-size: 1rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 0.95rem 2.75rem;
	cursor: pointer;
	min-width: 220px;
	box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
	transition: filter 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.lcg-inline .lcg-submit:hover,
.lcg-inline .lcg-submit:focus-visible {
	filter: brightness(1.06);
	box-shadow: 0 4px 12px rgba(241, 101, 34, 0.35);
	outline: none;
}

.lcg-inline .lcg-submit:focus-visible {
	outline: 2px solid var(--lcg-header);
	outline-offset: 3px;
}

.lcg-inline .lcg-submit:active {
	transform: translateY(1px);
}

.lcg-inline .lcg-submit:disabled {
	opacity: 0.65;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	width: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	word-wrap: normal !important;
}
