/**
 * Kostenfreie Beratung — consultation popup + Gravity Forms styling.
 * Figma node 81:7866. Desktop-first, mobile at the bottom.
 * Namespace: .tl-consult / .tl-gf
 */

/* ---------- Overlay ---------- */
.tl-consult-overlay {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.2s ease;
}
.tl-consult-overlay[hidden] { display: none; }
.tl-consult-overlay.is-open { opacity: 1; }

/* ---------- Modal card ---------- */
.tl-consult {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 24px;                      /* Figma /modal itemSpacing */
	width: 452px;                   /* Figma /modal width */
	max-width: 100%;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	padding: 16px 24px 48px;        /* Figma 16 / 24 / 48 / 24 */
	background: #eaebe6;            /* Figma fill #EAEBE6 */
	border-radius: 4px;            /* Figma r=4 */
	box-shadow: 0 24px 48px rgba(51, 58, 66, 0.18);
	transform: translateY(8px);
	transition: transform 0.2s ease;
}
.tl-consult-overlay.is-open .tl-consult { transform: translateY(0); }

/* Close — light-grey pill with grey X (Figma /modal/close node "close":
   64×28, radius 100, fill #787D84 @10%, 0.5px border #B9BEC5, X #B9BEC5). */
.tl-consult__close {
	position: absolute;            /* out of flow → content sits higher */
	top: 20px;
	right: 24px;                   /* aligns with the modal's 24px side padding */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 28px;
	margin: 0;
	padding: 0;
	background: rgba(120, 125, 132, 0.10);  /* #787D84 @ 10% */
	border: 0.5px solid #b9bec5;            /* color/text/onDark */
	border-radius: 100px;                   /* pill */
	cursor: pointer;
	z-index: 2;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}
.tl-consult__close svg { display: block; width: 14px; height: 14px; }
.tl-consult__close svg path { stroke: #b9bec5; transition: stroke 0.15s ease; }
.tl-consult__close:hover { background: rgba(120, 125, 132, 0.18); border-color: #9aa0a8; }
.tl-consult__close:hover svg path { stroke: #787d84; }

/* Inner column (Figma /modal/modal — 14px header→form).
   Uses an explicit margin, NOT flex `gap`: GF injects a transient 0-height <span>
   after the form on first render and removes it after init; with `gap` that stray
   flex item adds/removes a 14px gap → the modal height (and its centered position)
   jitters on first open. A margin on the form only is immune to stray siblings. */
.tl-consult__inner {
	display: flex;
	flex-direction: column;
}
/* higher specificity than the base `.tl-consult .gform_wrapper { margin: 0 }` reset */
.tl-consult .tl-consult__inner > .gform_wrapper { margin-top: 14px; }

/* hidden must win over the flex display rules below */
.tl-consult__inner[hidden],
.tl-consult__success[hidden] { display: none; }

/* ---------- Success state (Figma 81:7870) ---------- */
.tl-consult__success {
	display: flex;
	flex-direction: column;
	padding: 44px 0 0;              /* clear the absolute close pill (bottom 48) */
}
.tl-consult__success-main {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 24px;                      /* Figma icon → texts */
}
.tl-consult__success-icon svg { display: block; }
.tl-consult__success-texts {
	display: flex;
	flex-direction: column;
	gap: 12px;                      /* Figma title → lines */
}
.tl-consult__success-title {
	margin: 0;
	font-size: 24px;
	line-height: 32.736px;
	font-weight: 600;
	color: #333a42;
}
.tl-consult__success-lines {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.tl-consult__success-text,
.tl-consult__success-note {
	margin: 0;
	font-size: 16px;
	line-height: 21.824px;
	font-weight: 400;
	color: #333a42;
}
/* Optional outlined CTA (Figma button — transparent, 1px #333A42, r30) */
.tl-consult__success-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin-top: 24px;               /* 24 main-gap + 24 = 48 from texts (Figma) */
	padding: 10px 20px;
	font-size: 16px;
	color: #333a42;
	background: transparent;
	border: 1px solid #333a42;
	border-radius: 30px;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease;
}
.tl-consult__success-cta:hover { background: #333a42; color: #eaebe6; }
/* Back-to-page link (Figma — left arrow, bottom-left) */
.tl-consult__success-back {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 48px 0 0;
	padding: 0;
	background: transparent;
	border: 0;
	font-family: inherit;
	font-size: 16px;
	color: #333a42;
	cursor: pointer;
}
.tl-consult__success-back svg { display: block; }
.tl-consult__success-back:hover { opacity: 0.7; }

/* Title block — top inset clears the absolute close pill (top 20 + 28 = 48)
   with a comfortable gap before the heading. */
.tl-consult__text {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 44px 0 0;
}
.tl-consult__title {
	margin: 0;
	font-size: 24px;
	line-height: 32.736px;          /* Figma exact */
	font-weight: 600;
	color: #333a42;
}
.tl-consult__subtitle {
	margin: 0;
	font-size: 16px;
	line-height: 21.824px;          /* Figma exact */
	font-weight: 400;
	color: #333a42;
}

/* ---------- Gravity Forms ---------- */
/* GF's own CSS is disabled (gform_disable_css) — the form is fully styled here
   to match the Figma modal. Markup: div-based orbital wrapper (.gform_wrapper
   > form.tl-gf > .gform_fields > .gfield). */
.tl-consult .gform_wrapper { margin: 0; }
.tl-consult .gform_wrapper form,
.tl-consult .tl-gf { margin: 0; }

/* fields column — override the orbital grid */
.tl-consult .gform_fields {
	display: flex;
	flex-direction: column;
	gap: 16px;                      /* Figma fields itemSpacing */
	grid-template-columns: none;
}
.tl-consult .gfield { margin: 0; padding: 0; border: 0; }

/* label → input (Figma label→input gap 6) */
.tl-consult .gfield_label,
.tl-consult .gfield > .gfield_label {
	display: block;
	margin: 0 0 6px;
	padding: 0;
	font-size: 14px;
	line-height: 1.4;
	font-weight: 400;
	color: #414651;                 /* Figma label fill */
}
/* required: hide GF's "(Required)" text, show a red asterisk (Figma) */
.tl-consult .gfield_required_text { display: none; }
.tl-consult .gfield_label > .gfield_required::after {
	content: "*";
	margin-left: 4px;
	color: #d92d20;
}

.tl-consult .ginput_container { margin-top: 0; }

.tl-consult .gfield input[type="text"],
.tl-consult .gfield input[type="email"],
.tl-consult .gfield select,
.tl-consult .gfield textarea {
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 10px 14px;             /* Figma input padding */
	font-family: inherit;
	font-size: 16px;
	line-height: 24px;              /* Figma */
	color: #333a42;
	background-color: transparent; /* Figma: inputs have no fill → cream card shows through */
	border: 1px solid #d5d7da;
	border-radius: 4px;            /* Figma r=4 */
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tl-consult .gfield input[type="text"],
.tl-consult .gfield input[type="email"],
.tl-consult .gfield select { height: 44px; }     /* Figma input height */

.tl-consult .gfield textarea {
	height: 71px;                   /* Figma textarea height (GF renders rows=10) */
	min-height: 71px;
	padding: 12px 14px;             /* Figma textarea padding */
	line-height: 22px;
	resize: vertical;
}

.tl-consult .gfield input::placeholder,
.tl-consult .gfield textarea::placeholder { color: #717680; }

.tl-consult .gfield input:focus,
.tl-consult .gfield select:focus,
.tl-consult .gfield textarea:focus {
	outline: none;
	border-color: #9aa0a8;         /* soft neutral focus — no black border */
	box-shadow: 0 0 0 3px rgba(51, 58, 66, 0.06);
}

/* Select — custom chevron (Figma chevron-down) */
.tl-consult .gfield select {
	appearance: none;
	-webkit-appearance: none;
	padding-right: 40px;
	background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23333A42' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	cursor: pointer;
}
/* placeholder option greyed */
.tl-consult .gfield select .gf_placeholder,
.tl-consult .gfield select option[value=""] { color: #717680; }

/* Consent checkbox (Figma Checkbox — gap 8, text 14/500 #414651) */
.tl-consult .gfield--type-consent { border: 0; padding: 0; margin: 0; min-width: 0; }
.tl-consult .gfield--type-consent > .gfield_label { display: none; } /* hide the "Datenschutz" legend */
.tl-consult .ginput_container_consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
}
.tl-consult .ginput_container_consent input[type="checkbox"] {
	flex: 0 0 16px;
	width: 16px;
	height: 16px;
	margin: 1px 0 0;
	accent-color: #333a42;
	cursor: pointer;
}
.tl-consult .gfield_consent_label {
	margin: 0;
	font-size: 14px;
	line-height: 20px;
	font-weight: 500;
	color: #414651;
	cursor: pointer;
}
.tl-consult .gfield_consent_label a {
	color: #333a42;
	text-decoration: underline;
}

/* Submit (Figma /buttons — fill #333A42, r=50, text #EAEBE6 + ↘ arrow).
   Footer sits 48px below the consent row (16 flex gap + 32 margin). */
.tl-consult .gform_footer {
	margin: 32px 0 0;
	padding: 0;
	display: block;
}
.tl-consult .tl-gf__submit {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;                      /* Figma button itemSpacing */
	width: 100%;
	height: 44px;
	padding: 10px 20px;
	font-family: inherit;
	font-size: 16px;
	font-weight: 400;
	color: #eaebe6;
	background-color: #333a42;
	border: 0;
	border-radius: 50px;            /* Figma r=50 */
	cursor: pointer;
	transition: background-color 0.15s ease;
}
.tl-consult .tl-gf__submit svg {
	display: block;
	flex: 0 0 auto;
	transition: transform 0.15s ease;
}
.tl-consult .tl-gf__submit:hover { background-color: #2a3038; }
.tl-consult .tl-gf__submit:hover svg { transform: translate(2px, 2px); }

/* GF field-level validation */
.tl-consult .gfield_error input[type="text"],
.tl-consult .gfield_error input[type="email"],
.tl-consult .gfield_error select,
.tl-consult .gfield_error textarea { border-color: #d92d20; }
.tl-consult .gfield_error .ginput_container_consent input[type="checkbox"] {
	accent-color: #d92d20;
	outline: 1px solid #d92d20;
	outline-offset: 1px;
}
.tl-consult .gfield_validation_message,
.tl-consult .validation_message {
	margin-top: 4px;
	padding: 0;
	background: transparent;
	border: 0;
	font-size: 13px;
	font-weight: 400;
	color: #d92d20;
}

/* GF form-level error summary (top banner) */
.tl-consult .gform_validation_errors {
	margin: 0 0 16px;
	padding: 10px 14px;
	background: transparent;
	border: 1px solid #d92d20;
	border-radius: 4px;
	box-shadow: none;
}
.tl-consult .gform_validation_errors > h2,
.tl-consult .gform_submission_error {
	margin: 0;
	font-size: 14px;
	line-height: 1.4;
	font-weight: 500;
	color: #b42318;
}
.tl-consult .gform_validation_errors > h2 .gform-icon { display: none; }

/* AJAX spinner + hidden iframe */
.tl-consult .gform_ajax_spinner { margin-left: 10px; }
.tl-consult iframe.gform_ajax_frame { display: none; width: 0; height: 0; border: 0; }

/* ---------- Gravity Forms — multi-step popup (.tl-gf--steps) ---------- */

/* step indicator eyebrow (Figma "schritt 1 von 2"), above the title */
.tl-consult__step {
	font-size: 14px;
	line-height: 1.4;
	font-weight: 400;
	color: #787d84;
}

/* page footer: page 1 → Weiter pushed right; page 2 → Zurück left + submit right */
.tl-consult .tl-gf--steps .gform_page_footer {
	display: flex;
	align-items: center;
	gap: 16px;
	margin: 32px 0 0;
	padding: 0;
}
.tl-consult .tl-gf--steps .gform_next_button { margin-left: auto; }
.tl-consult .tl-gf--steps .gform_previous_button { margin-right: auto; }

/* Weiter + Einschätzung anfordern — filled pill, content width (not full).
   .tl-gf__next has no base styling (only __submit does), so give it the full
   filled-pill treatment here alongside the width override for both. */
.tl-consult .tl-gf--steps .tl-gf__next,
.tl-consult .tl-gf--steps .tl-gf__submit {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: auto;
	height: 44px;
	padding: 10px 24px;
	font-family: inherit;
	font-size: 16px;
	font-weight: 400;
	color: #eaebe6;
	background-color: #333a42;
	border: 0;
	border-radius: 50px;
	cursor: pointer;
	transition: background-color 0.15s ease;
}
.tl-consult .tl-gf--steps .tl-gf__next svg,
.tl-consult .tl-gf--steps .tl-gf__submit svg {
	display: block;
	flex: 0 0 auto;
	transition: transform 0.15s ease;
}
.tl-consult .tl-gf--steps .tl-gf__next:hover,
.tl-consult .tl-gf--steps .tl-gf__submit:hover { background-color: #2a3038; }
.tl-consult .tl-gf--steps .tl-gf__next:hover svg { transform: translateX(2px); }

/* Zurück — ghost text button with a back arrow */
.tl-consult .tl-gf--steps .tl-gf__prev {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	width: auto;
	height: 44px;
	margin: 0;
	padding: 10px 8px;
	font-family: inherit;
	font-size: 16px;
	font-weight: 400;
	color: #333a42;
	background: transparent;
	border: 0;
	border-radius: 0;
	cursor: pointer;
	box-shadow: none;
	transition: opacity 0.15s ease;
}
.tl-consult .tl-gf--steps .tl-gf__prev svg { display: block; flex: 0 0 auto; }
.tl-consult .tl-gf--steps .tl-gf__prev:hover { opacity: 0.7; background: transparent; }

/* "Worum geht's?" — checkbox choices rendered as chips */
.tl-consult .tl-gf--steps .gfield_checkbox {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.tl-consult .tl-gf--steps .ginput_container_checkbox .gchoice {
	margin: 0;
	padding: 0;
}
.tl-consult .tl-gf--steps .gchoice input[type="checkbox"] {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}
.tl-consult .tl-gf--steps .gchoice label {
	display: inline-block;
	margin: 0;
	padding: 8px 16px;
	font-size: 14px;
	line-height: 20px;
	font-weight: 400;
	color: #414651;
	background: transparent;
	border: 1px solid #d5d7da;
	border-radius: 100px;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.tl-consult .tl-gf--steps .gchoice label:hover { border-color: #9aa0a8; }
.tl-consult .tl-gf--steps .gchoice input[type="checkbox"]:checked + label {
	background: #333a42;
	border-color: #333a42;
	color: #eaebe6;
}
.tl-consult .tl-gf--steps .gchoice input[type="checkbox"]:focus-visible + label {
	outline: 2px solid #9aa0a8;
	outline-offset: 2px;
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
	.tl-consult-overlay { padding: 12px; align-items: flex-start; }
	.tl-consult { padding: 12px 16px 32px; max-height: calc(100vh - 24px); }
	.tl-consult__title { font-size: 21px; line-height: 28px; }
	.tl-consult__subtitle { font-size: 15px; line-height: 20px; }
	.tl-consult__text { padding: 40px 0 0; } /* still clears the close pill (bottom 48) */
}
