/**
 * Renters Forms – uniwersalne style formularzy.
 * Odwzorowują wygląd formularzy CF7 w popupie kontaktowym motywu adrespect.
 * Kolory i font biorą wartości z motywu (--color-primary, --color-secondary,
 * --font-family-primary) z fallbackami, więc działają też poza adrespect.
 */

.renters-form {
	--rf-font: var(--font-family-primary, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
	--rf-primary: var(--color-primary, #FFA06A);
	--rf-secondary: var(--color-secondary, #511E26);
	--rf-text: var(--black-100, #24201E);
	--rf-muted: var(--Gray, #504D4B);
	--rf-border: var(--black-20, #D3D2D2);
	--rf-placeholder: var(--black-40, #A7A6A5);
	--rf-error: #f42727;
	--rf-success: #54ac68;
	--rf-radius-pill: 1111.1rem;
	--rf-radius-area: 2.4rem;
	--rf-control-height: 4.8rem;
	--rf-gap: 1.6rem; /* zmierzone w popupie CF7: label.mb-16 */

	position: relative;
	display: block;
	width: 100%;
	font-family: var(--rf-font);
	font-size: 1.4rem;
	line-height: 150%;
	color: var(--rf-text);
}

.renters-form *,
.renters-form *::before,
.renters-form *::after {
	box-sizing: border-box;
}

.renters-form__fields {
	display: flex;
	flex-direction: column;
	gap: var(--rf-gap);
}

.renters-form__field {
	margin: 0;
	min-width: 0;
}

.renters-form__field--hidden {
	display: none;
}

/* Jak w popupie CF7: 2.4rem pod przełącznikami radio i przed przyciskiem */
.renters-form__field--radio {
	margin-bottom: 0.8rem;
}

.renters-form__field--submit {
	margin-top: 0.8rem;
}

/* Etykieta nad polem */
.renters-form__label {
	display: block;
	margin: 0 0 0.4rem;
	font-size: 1.4rem;
	font-weight: 400;
	line-height: 150%;
	color: var(--rf-text);
}

.renters-form__optional {
	color: inherit;
}

/* Pola tekstowe, select, data, Google Maps */
.renters-form__input {
	display: block;
	width: 100%;
	height: var(--rf-control-height);
	margin: 0;
	padding: 0 1.6rem;
	border: 1px solid var(--rf-border);
	border-radius: var(--rf-radius-pill);
	background-color: #fff;
	color: var(--rf-text);
	font-family: var(--rf-font);
	font-size: 1.4rem;
	font-weight: 400;
	line-height: 150%;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 0.2s ease-in-out;
}

.renters-form__input::placeholder {
	color: var(--rf-placeholder);
	opacity: 1;
	font-weight: 400;
}

.renters-form__input:hover,
.renters-form__input:focus {
	border-color: var(--rf-primary);
}

/* Fokus jak w motywie adrespect: obrys 2px w kolorze primary */
.renters-form__input:focus-visible {
	border-color: var(--rf-primary);
	outline: 2px solid var(--rf-primary);
	outline-offset: 0;
}

.renters-form__field.is-invalid .renters-form__input,
.renters-form__field.is-invalid gmp-place-autocomplete,
.renters-form__field.is-invalid .renters-form__radio,
.renters-form__field.is-invalid .renters-form__checkbox input {
	border-color: var(--rf-error);
}

/* Textarea – większy promień, jak w CF7 */
.renters-form__textarea {
	height: auto;
	min-height: 14.2rem;
	padding: 2.4rem;
	border-radius: var(--rf-radius-area);
	resize: vertical;
}

/* Select – własna strzałka */
.renters-form__select {
	padding-right: 4.4rem;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%2324201E' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 1.6rem center;
	background-size: 1.6rem;
	cursor: pointer;
}

.renters-form__select:invalid,
.renters-form__select option[value=""] {
	color: var(--rf-placeholder);
}

/* Data / czas – ukryj natywny placeholder na iOS, ujednolić wysokość */
.renters-form__input[type="date"],
.renters-form__input[type="time"] {
	line-height: var(--rf-control-height);
	padding-top: 0;
	padding-bottom: 0;
}

.renters-form__input[type="date"]::-webkit-calendar-picker-indicator,
.renters-form__input[type="time"]::-webkit-calendar-picker-indicator {
	cursor: pointer;
	opacity: 0.6;
}

/* Google Maps – widżet <gmp-place-autocomplete> podmienia input; nadajemy mu pigułkę */
.renters-form gmp-place-autocomplete {
	display: block;
	width: 100%;
	height: var(--rf-control-height);
	border: 1px solid var(--rf-border);
	border-radius: var(--rf-radius-pill);
	background-color: #fff;
	box-sizing: border-box;
	color-scheme: light;
	font-family: var(--rf-font);
	font-size: 1.4rem;
	transition: border-color 0.2s ease-in-out;
}

/* Widżet dziedziczy klasy inputu (skrypt motywu je kopiuje) – zerujemy padding hosta */
.renters-form gmp-place-autocomplete.renters-form__input {
	padding: 0;
}

.renters-form gmp-place-autocomplete:hover {
	border-color: var(--rf-primary);
}

.renters-form gmp-place-autocomplete:focus-within {
	border-color: var(--rf-primary);
	outline: 2px solid var(--rf-primary);
	outline-offset: 0;
}

/* Radio – pigułkowe przełączniki, jak "Mam apartament / lub / Planuję zakup" */
.renters-form__fieldset {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}

.renters-form__fieldset > .renters-form__label {
	padding: 0;
}

.renters-form__radios {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1.6rem;
}

.renters-form__radio {
	position: relative;
	display: flex;
	flex: 1 0 0;
	min-width: 0;
	height: var(--rf-control-height);
	padding: 1rem 1.6rem;
	justify-content: center;
	align-items: center;
	gap: 1rem;
	border: 1px solid var(--rf-border);
	border-radius: var(--rf-radius-pill);
	background: #fff;
	color: var(--rf-text);
	font-size: 1.422rem;
	font-weight: 400;
	line-height: 150%;
	text-align: center;
	cursor: pointer;
	user-select: none;
	transition: border-color 0.2s ease-in-out, background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.renters-form__radio input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	opacity: 0;
	pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
	.renters-form__radio:hover {
		border-color: var(--rf-primary);
	}
}

.renters-form__radio:has(input:checked) {
	background: var(--rf-secondary);
	border-color: var(--rf-secondary);
	color: #fff;
}

.renters-form__radio:has(input:focus-visible) {
	outline: 2px solid var(--rf-primary);
	outline-offset: 2px;
}

/* Separator "lub" między dwiema opcjami */
.renters-form__radio-sep {
	flex: 0 0 auto;
	color: var(--rf-text);
	font-size: 1.4rem;
}

/* Więcej niż dwie opcje – pigułki układają się w wiersze o naturalnej szerokości */
.renters-form__radios--many .renters-form__radio {
	flex: 0 1 auto;
	min-width: 12rem;
}

/* Checkbox – kwadrat 24px z ptaszkiem */
.renters-form__checkbox {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: 0.8rem;
	margin: 0;
	color: var(--rf-muted);
	font-size: 1.4rem;
	font-weight: 400;
	line-height: 150%;
	cursor: pointer;
}

.renters-form__checkbox input {
	flex: 0 0 auto;
	width: 2.4rem;
	height: 2.4rem;
	margin: 0;
	padding: 0;
	aspect-ratio: 1 / 1;
	border: 1px solid var(--rf-placeholder);
	border-radius: 0.4rem;
	background: #fff;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
	position: relative;
	transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.renters-form__checkbox input:checked {
	background-color: var(--rf-primary);
	border-color: var(--rf-primary);
}

.renters-form__checkbox input:checked::after {
	content: "";
	position: absolute;
	top: 45%;
	left: 50%;
	width: 0.6rem;
	height: 1.2rem;
	border-right: 2px solid #fff;
	border-bottom: 2px solid #fff;
	transform: translate(-50%, -50%) rotate(45deg);
}

.renters-form__checkbox input:focus-visible {
	outline: 2px solid var(--rf-primary);
	outline-offset: 2px;
}

.renters-form__checkbox a {
	color: inherit;
	text-decoration: underline;
}

/* Przycisk wysyłki – pomarańczowa pigułka bez ramki, pełna szerokość */
.renters-form__submit {
	display: flex;
	width: 100%;
	height: var(--rf-control-height);
	margin: 0;
	padding: 1.1rem 4rem 1.2rem;
	justify-content: center;
	align-items: center;
	gap: 0.4rem;
	border: 0;
	border-radius: var(--rf-radius-pill);
	background: var(--rf-primary);
	color: #fff;
	font-family: var(--rf-font);
	font-size: 1.5rem;
	font-weight: 500;
	line-height: 120%;
	letter-spacing: -0.018rem;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.renters-form__submit:hover,
.renters-form__submit:focus-visible {
	background-color: var(--rf-secondary);
	color: #fff;
}

.renters-form__submit:disabled {
	opacity: 0.6;
	cursor: wait;
}

.renters-form__actions {
	margin-top: 2.4rem;
}

/* Komunikaty (pod przyszłą wysyłkę) */
.renters-form__error {
	display: block;
	margin-top: 0.4rem;
	color: var(--rf-error);
	font-size: 1.4rem;
	font-weight: 400;
	line-height: 1.3;
}

.renters-form__message {
	margin-top: var(--rf-gap);
	text-align: center;
	font-size: 1.4rem;
	line-height: 150%;
}

.renters-form__message--error {
	color: var(--rf-error);
}

.renters-form__message--success {
	color: var(--rf-success);
}

/* Wariant: dwa pola obok siebie – klasa "rf-half" na polu w kreatorze */
@media (min-width: 768px) {
	.renters-form__fields {
		flex-direction: row;
		flex-wrap: wrap;
	}

	.renters-form__field {
		flex: 1 1 100%;
	}

	.renters-form__field.rf-half {
		flex: 1 1 calc(50% - var(--rf-gap) / 2);
	}
}

/* Wysyłka */
.renters-form__hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	opacity: 0;
}

.renters-form {
	position: relative;
}

.renters-form.is-submitting .renters-form__submit {
	cursor: progress;
}

/* Nakładka ładowania na czas wysyłki – jak loader formularzy CF7 w motywach (.form__loader). */
.renters-form.is-submitting::before,
.renters-form.is-submitting::after {
	content: "";
	position: absolute;
	z-index: 2;
}

.renters-form.is-submitting::before {
	top: -5%;
	left: -5%;
	width: 110%;
	height: 110%;
	border-radius: 1.6rem;
	background: rgba(255, 160, 106, 0.5);
	cursor: progress;
}

.renters-form.is-submitting::after {
	top: 50%;
	left: 50%;
	width: 2.4rem;
	height: 2.4rem;
	margin: -1.2rem 0 0 -1.2rem;
	border: 0.2rem solid transparent;
	border-top-color: var(--rf-text);
	border-radius: 50%;
	animation: rf-spin 1s linear infinite;
}

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

.renters-form.is-submitted .renters-form__fields,
.renters-form.is-submitted .renters-form__actions,
.renters-form.is-submitted .renters-form__message {
	display: none;
}

/* Komunikat sukcesu – ramka jak „Dziękujemy!” formularzy CF7 w motywach (.popup__thank-you). */
.renters-form__success {
	padding: 2.4rem;
	border: 2px solid var(--rf-primary);
	border-radius: 1.6rem;
	text-align: center;
	color: var(--rf-text);
}

.renters-form__success-title,
.renters-form__success-text {
	margin: 0;
	padding: 0;
}

.renters-form__success-title {
	font-size: 2.563rem;
	font-weight: 700;
	line-height: 1.1;
	color: var(--rf-secondary);
}

.renters-form__success-title + .renters-form__success-text {
	margin-top: 1.2rem;
}

.renters-form__success-text {
	font-size: 1.6rem;
	line-height: 150%;
}

@media (min-width: 768px) {
	.renters-form__success-title {
		font-size: 2.843rem;
		line-height: 1.3;
	}
}

@media (min-width: 1024px) {
	.renters-form__success-title {
		font-size: 3.79rem;
	}
}

.renters-form__success[hidden] {
	display: none;
}

/* Pole ukryte warunkiem „pokaż tylko gdy” (data-show-if) – nadpisuje ewentualne display motywu. */
.renters-form__field[hidden] {
	display: none !important;
}
