/* ==========================================================================
   Contact Popup (global modal triggered by [data-popup-trigger])
   ========================================================================== */

.sl-contact-popup {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.sl-contact-popup[hidden] {
	display: none;
}

.sl-contact-popup__overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(10, 51, 45, 0.85);
	cursor: pointer;
}

.sl-contact-popup__dialog {
	position: relative;
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	background-color: var(--sl-color-white);
	border-radius: 4px;
	padding: 48px 40px 40px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.sl-contact-popup__close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 36px;
	height: 36px;
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--sl-color-green);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 4px;
	transition: background-color 0.2s ease;
}

.sl-contact-popup__close:hover,
.sl-contact-popup__close:focus-visible {
	background-color: rgba(10, 51, 45, 0.08);
	outline: none;
}

.sl-contact-popup__headline {
	color: var(--sl-color-green);
	margin: 0 0 24px;
}

/* --------------------------------------------------------------------------
   Form
   -------------------------------------------------------------------------- */

.sl-popup-form {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.sl-popup-form__row {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.sl-popup-form__row--2col {
	flex-direction: row;
	gap: 16px;
}

.sl-popup-form__row--2col > .sl-popup-form__field {
	flex: 1 1 0%;
	min-width: 0;
}

.sl-popup-form__row--submit {
	flex-direction: row;
	align-items: center;
	justify-content: space-between;
	margin-top: 8px;
	gap: 16px;
	flex-wrap: wrap;
}

.sl-popup-form__field {
	position: relative;
}

/* Input wrap & input */
.sl-popup-form__input-wrap {
	position: relative;
}

.sl-popup-form__input {
	display: block;
	width: 100%;
	height: 50px;
	padding: 13px 16px;
	font-family: var(--sl-font-secondary);
	font-size: 16px;
	font-weight: 400;
	line-height: 1.1;
	color: var(--sl-color-black);
	background-color: transparent;
	border: 1px solid rgba(10, 51, 45, 0.3);
	border-radius: 4px;
	outline: none;
	transition: border-color 0.2s ease;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

.sl-popup-form__textarea {
	height: 140px;
	min-height: 100px;
	line-height: 1.6;
	resize: vertical;
}

.sl-popup-form__input:focus {
	border-color: var(--sl-color-green);
}

.sl-popup-form__field.has-error .sl-popup-form__input {
	border-color: var(--sl-color-failure);
}

/* Floating Label */
.sl-popup-form__label {
	position: absolute;
	top: 50%;
	left: 16px;
	transform: translateY(-50%);
	font-family: var(--sl-font-secondary);
	font-size: 16px;
	font-weight: 700;
	color: var(--sl-color-black);
	pointer-events: none;
	transition: all 0.2s ease;
	line-height: 1;
}

.sl-popup-form__input-wrap--textarea .sl-popup-form__label {
	top: 20px;
	transform: none;
}

.sl-popup-form__input:focus + .sl-popup-form__label,
.sl-popup-form__input:not(:placeholder-shown) + .sl-popup-form__label {
	top: -7px;
	left: 7px;
	transform: none;
	font-size: 12px;
	font-weight: 700;
	color: var(--sl-color-green);
	background-color: var(--sl-color-white);
	padding: 0 8px;
}

.sl-popup-form__field.has-error .sl-popup-form__input:focus + .sl-popup-form__label,
.sl-popup-form__field.has-error .sl-popup-form__input:not(:placeholder-shown) + .sl-popup-form__label {
	color: var(--sl-color-failure);
}

/* Error message */
.sl-popup-form__error {
	margin-top: 6px;
	font-size: 13px;
	color: var(--sl-color-failure);
}

.sl-popup-form__general-error {
	padding: 12px 16px;
	border-radius: 4px;
	background-color: rgba(201, 65, 88, 0.1);
	color: var(--sl-color-failure);
	font-size: 14px;
}

/* DSGVO Checkbox */
.sl-popup-form__field--checkbox {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.sl-popup-form__checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	cursor: pointer;
}

.sl-popup-form__checkbox {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.sl-popup-form__checkbox-custom {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	margin-top: 2px;
	border: 1px solid rgba(10, 51, 45, 0.3);
	border-radius: 3px;
	background-color: var(--sl-color-white);
	color: transparent;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
}

.sl-popup-form__checkbox:checked + .sl-popup-form__checkbox-custom {
	background-color: var(--sl-color-green);
	border-color: var(--sl-color-green);
	color: var(--sl-color-white);
}

.sl-popup-form__field.has-error .sl-popup-form__checkbox-custom {
	border-color: var(--sl-color-failure);
}

.sl-popup-form__checkbox-text {
	color: var(--sl-color-black);
	line-height: 1.5;
}

.sl-popup-form__checkbox-text a {
	color: var(--sl-color-green);
}

/* Honeypot — visually hidden */
.sl-popup-form__hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Submit */
.sl-popup-form__required-note {
	color: var(--sl-color-black);
}

.sl-popup-form__submit[aria-busy="true"] {
	opacity: 0.6;
	pointer-events: none;
}

/* --------------------------------------------------------------------------
   Success state
   -------------------------------------------------------------------------- */

.sl-popup-form__success {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 16px;
	padding: 24px 0;
}

/* Override display:flex/block on elements that need to toggle via [hidden]. */
.sl-popup-form[hidden],
.sl-popup-form__success[hidden],
.sl-popup-form__row[hidden],
.sl-popup-form__error[hidden],
.sl-popup-form__general-error[hidden] {
	display: none;
}

.sl-popup-form__success-icon {
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background-color: rgba(77, 161, 103, 0.15);
	color: var(--sl-color-okay);
	display: flex;
	align-items: center;
	justify-content: center;
}

.sl-popup-form__success-headline {
	color: var(--sl-color-green);
	margin: 0;
}

.sl-popup-form__success-copy {
	color: var(--sl-color-black);
	margin: 0 0 8px;
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 767px) {
	.sl-contact-popup {
		padding: 0;
	}

	.sl-contact-popup__dialog {
		max-width: none;
		max-height: 100vh;
		border-radius: 0;
		padding: 56px 22px 32px;
	}

	.sl-popup-form__row--2col {
		flex-direction: column;
		gap: 20px;
	}

	.sl-popup-form__row--submit {
		flex-direction: column-reverse;
		align-items: stretch;
	}

	.sl-popup-form__submit {
		width: 100%;
		justify-content: center;
	}
}

/* Body scroll lock */
body.sl-popup-open {
	overflow: hidden;
}
