/* EVILLAGE Form Builder - front */

.evfb-hp {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.evfb-field {
	margin-bottom: 16px;
	/* Blocksy maluje tlo pol (takze :focus) wlasnymi zmiennymi - podmieniamy je. */
	--theme-form-field-background-initial-color: var(--evfb-field-bg, #F3F5F8);
	--theme-form-field-background-focus-color: var(--evfb-field-bg, #F3F5F8);
	--theme-form-field-border-initial-color: var(--evfb-border-color, #8c8f94);
}

.evfb-label {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
	color: var(--evfb-label-color, inherit);
}

/* Plywajaca etykieta. Padding miesci podniesiony podpis nad borderem.
   Obie pozycje maja ten sam top. Ruch jest na transform: przejscie top/bottom
   miedzy auto a dlugoscia jest dyskretne i etykieta przeskakuje. */
.evfb-floating {
	--evfb-float-gap: calc(0.75rem * 1.2 + 4px);
	--evfb-label-inset: 8px;
	position: relative;
	padding-top: var(--evfb-float-gap);
}

.evfb-floating .evfb-floating-label {
	position: absolute;
	left: 10px;
	top: calc(var(--evfb-float-gap) + var(--evfb-label-inset));
	bottom: auto;
	margin: 0;
	font-weight: 400;
	font-size: 1rem;
	line-height: 1.2;
	color: var(--evfb-label-color, #50575e);
	pointer-events: none;
	transform: translateY(0);
	transition:
		transform 0.15s ease,
		font-size 0.15s ease,
		color 0.15s ease;
	background: transparent;
	padding: 0 2px;
	z-index: 1;
}

/* Etykieta nad polem: focus (poza select) albo wypelnione (.evfb-floating-up). */
.evfb-floating .evfb-floating-label.evfb-floating-up,
.evfb-floating:not(.evfb-type-select):focus-within .evfb-floating-label {
	transform: translateY(calc(-1 * (var(--evfb-float-gap) + var(--evfb-label-inset))));
	font-size: 0.75rem;
	color: var(--evfb-label-up-color, #035f00);
	background: transparent;
}

/* Prefiks jest osobnym kawalkiem. Etykieta plywa nad samym numerem. */
.evfb-phone-prefix {
	width: 4.5rem;
	justify-content: center;
}

.evfb-floating.evfb-type-tel .evfb-floating-label,
.evfb-floating.evfb-type-tel .evfb-floating-label.evfb-floating-up {
	left: calc(4.5rem + 8px + 12px);
}

/* Etykieta przy bledzie walidacji (dowolny typ pola). Na dole: osobny kolor. */
.evfb-field.evfb-has-error .evfb-floating-label {
	color: var(--evfb-error-label-down-color, var(--evfb-error-label-color, var(--evfb-error-color, #d63638)));
}

.evfb-field.evfb-has-error .evfb-label:not(.evfb-floating-label),
.evfb-field.evfb-has-error.evfb-floating .evfb-floating-label.evfb-floating-up,
.evfb-field.evfb-has-error.evfb-floating:not(.evfb-type-select):focus-within .evfb-floating-label {
	color: var(--evfb-error-label-color, var(--evfb-error-color, #d63638));
}

/* Pusty kalendarz maluje "dd.mm.rrrr" na etykiecie. Znika, dopoki pole jest puste i bez fokusu. */
.evfb-floating.evfb-type-date:not(:focus-within):not(:has(.evfb-floating-up)) input[type='date']::-webkit-datetime-edit,
.evfb-floating.evfb-type-date:not(:focus-within):not(:has(.evfb-floating-up)) input[type='date']::-webkit-datetime-edit-fields-wrapper,
.evfb-floating.evfb-type-date:not(:focus-within):not(:has(.evfb-floating-up)) input[type='date']::-webkit-datetime-edit-text,
.evfb-floating.evfb-type-date:not(:focus-within):not(:has(.evfb-floating-up)) input[type='date']::-webkit-datetime-edit-day-field,
.evfb-floating.evfb-type-date:not(:focus-within):not(:has(.evfb-floating-up)) input[type='date']::-webkit-datetime-edit-month-field,
.evfb-floating.evfb-type-date:not(:focus-within):not(:has(.evfb-floating-up)) input[type='date']::-webkit-datetime-edit-year-field {
	color: transparent;
}

/* Firefox nie ma pseudo-elementow ::-webkit-datetime-edit - ukrywamy tekst "dd.mm.rrrr" kolorem pola. */
@supports (-moz-appearance: none) {
	.evfb-floating.evfb-type-date:not(:focus-within):not(:has(.evfb-floating-up)) input[type='date'] {
		color: transparent;
	}
}

.evfb-required {
	color: #b32d2e;
}

/* Ukryte wizualnie, dostepne dla czytnika ekranu. Nie zalezy od CSS motywu. */
.evfb-form .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	white-space: nowrap;
	word-wrap: normal;
}

/* Grupa radio/checkbox: fieldset bez ramki, widoczna legenda wyglada jak etykieta pola. */
.evfb-options {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.evfb-options > .evfb-legend {
	float: none;
	width: 100%;
	padding: 0;
}

.evfb-noscript {
	margin: 0 0 8px;
	color: #b32d2e;
}

.evfb-field input[type='text'],
.evfb-field input[type='email'],
.evfb-field input[type='tel'],
.evfb-field input[type='url'],
.evfb-field input[type='number'],
.evfb-field input[type='date'],
.evfb-field textarea,
.evfb-field select {
	box-sizing: border-box;
	width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--evfb-border-color, #8c8f94);
	border-radius: 4px;
	font-size: 1rem;
	background-color: var(--evfb-field-bg, #F3F5F8);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
	
}

/* Widoczny focus dla pol */
.evfb-field input[type='text']:focus-visible,
.evfb-field input[type='email']:focus-visible,
.evfb-field input[type='tel']:focus-visible,
.evfb-field input[type='url']:focus-visible,
.evfb-field input[type='number']:focus-visible,
.evfb-field input[type='date']:focus-visible,
.evfb-field textarea:focus-visible,
.evfb-field select:focus-visible,
.evfb-consent input:focus-visible,
.evfb-options input:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 1px;
}

.evfb-options .evfb-option {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-weight: 400;
	margin: 4px 0;
	padding: 10px 2px;
	cursor: pointer;
}

/* Dotyk: kontrolki min. 24px (WCAG 2.5.8), czytelny stan zaznaczenia */
.evfb-options input[type='checkbox'],
.evfb-options input[type='radio'] {
	width: 1.5em;
	height: 1.5em;
	flex-shrink: 0;
	accent-color: #2271b1;
}

/* Zgoda (RODO) - inline, checkbox i tekst obok siebie */
.evfb-consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-weight: 400;
	cursor: pointer;
}

.evfb-consent input[type='checkbox'] {
	margin-top: 4px;
	width: 1.5em;
	height: 1.5em;
	flex-shrink: 0;
	accent-color: #2271b1;
}

.evfb-consent-text {
	flex: 1;
	font-size: 85%;
	color: var(--evfb-consent-color, inherit);
}

@media (prefers-color-scheme: dark) {
	.evfb-consent-text {
		color: var(--evfb-consent-color, #fff);
	}
}

.evfb-consent a {
	word-break: break-word;
	color: var(--evfb-consent-link-color, inherit);
}

/* Tekst zgody przy bledzie i po poprawieniu */
.evfb-field.evfb-has-error .evfb-consent-text {
	color: var(--evfb-error-label-color, var(--evfb-error-color, #d63638));
}

.evfb-field.evfb-is-fixed .evfb-consent-text {
	color: var(--evfb-fixed-label-color, #00a32a);
}

.evfb-submit {
	width: 100%;
	padding: 10px 24px;
	min-height: 44px;
	font-size: 1rem;
	cursor: pointer;
}

/* Dotyk: eliminuje opoznienie 300ms i double-tap zoom */
.evfb-submit,
.evfb-option,
.evfb-consent {
	touch-action: manipulation;
}

.evfb-submit:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.evfb-submit:disabled {
	opacity: 0.65;
	cursor: progress;
}

.evfb-phone {
	display: flex;
	align-items: stretch;
	gap: 8px;
}

.evfb-phone-prefix {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 4.5rem;
	padding: 0 8px;
	border: 1px solid var(--evfb-border-color, #8c8f94);
	border-radius: 4px;
	box-sizing: border-box;
	flex: 0 0 auto;
	background: var(--evfb-field-bg, #fff);
	color: #1d2327;
}

.evfb-field .evfb-phone input[type='tel'] {
	width: auto;
	flex: 1 1 auto;
	min-width: 0;
}

/* Widoczna maska pola (JS): telefon i e-mail */
.evfb-mask-box {
	position: relative;
	display: block;
}

.evfb-phone-input {
	display: flex;
	flex: 1 1 auto;
	min-width: 0;
}

.evfb-field .evfb-phone-input input[type='tel'] {
	width: 100%;
}

.evfb-mask {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	box-sizing: border-box;
	pointer-events: none;
	white-space: pre;
	overflow: hidden;
	color: var(--evfb-label-color, #8c8f94);
	opacity: 0.6;
}

.evfb-mask-typed {
	visibility: hidden;
}

.evfb-has-error .evfb-phone-prefix {
	border-color: var(--evfb-error-border-color, var(--evfb-error-color, #d63638));
}

.evfb-captcha {
	margin-bottom: 14px;
	max-width: 100%;
	overflow-x: auto;
}

.evfb-errors {
	background: var(--evfb-error-bg, #fcf0f1);
	border-left: 4px solid var(--evfb-error-color, #d63638);
	padding: 10px 14px;
	margin-bottom: 14px;
}

/* Potwierdzenie poprawienia bledow (JS) */
.evfb-fixed-notice {
	background: var(--evfb-fixed-bg, #edfaef);
	border-left: 4px solid var(--evfb-fixed-border-color, #00a32a);
	color: var(--evfb-fixed-text-color, #1d2327);
	padding: 10px 14px;
	margin-bottom: 14px;
}

/* Przycisk "Wyslij" po poprawieniu bledow: powolne mruganie w petli (do klikniecia) */
.evfb-submit.evfb-submit-ready {
	animation: evfbSubmitBlink 1.6s ease-in-out infinite;
}

@keyframes evfbSubmitBlink {
	0%,
	100% {
		filter: none;
	}
	50% {
		filter: brightness(1.35);
	}
}

@media (prefers-reduced-motion: reduce) {
	.evfb-submit.evfb-submit-ready {
		animation: none;
		outline: 2px solid var(--evfb-fixed-border-color, #00a32a);
		outline-offset: 2px;
	}
}

.evfb-success {
	background: #edfaef;
	border-left: 4px solid #00a32a;
	padding: 10px 14px;
	margin-bottom: 14px;
}

.evfb-errors:focus,
.evfb-success:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* Wskaznik postepu zgloszenia */

.evfb-progress {
	margin-bottom: 14px;
}

.evfb-progress-bar {
	height: 6px;
	background: #dcdcde;
	border-radius: 3px;
	overflow: hidden;
}

.evfb-progress-fill {
	display: block;
	height: 100%;
	width: 0;
	background: #2271b1;
	border-radius: 3px;
	transition: width 0.35s ease;
}

.evfb-progress-warn {
	display: block;
	margin-top: 4px;
	font-size: 0.875rem;
	font-weight: 600;
	color: #8a4b00;
}

.evfb-progress[data-state='done'] .evfb-progress-fill {
	background: #00a32a;
}

.evfb-progress[data-state='error'] .evfb-progress-fill {
	background: var(--evfb-error-color, #d63638);
}

.evfb-progress-text {
	display: block;
	margin-top: 6px;
	font-size: 0.875rem;
	color: #50575e;
}

/* Walidacja inline */

.evfb-field-error {
	color: var(--evfb-error-color, #d63638);
	background: var(--evfb-error-bg, #fcf0f1);
	font-size: 0.85rem;
	margin-top: 4px;
	padding: 4px 8px;
	border-radius: 4px;
}

.evfb-field-error:empty {
	display: none;
}

.evfb-has-error input[type='text'],
.evfb-has-error input[type='email'],
.evfb-has-error input[type='tel'],
.evfb-has-error input[type='url'],
.evfb-has-error input[type='number'],
.evfb-has-error input[type='date'],
.evfb-has-error textarea,
.evfb-has-error select {
	border: 1px solid var(--evfb-error-border-color, var(--evfb-error-color, #d63638));
}

/* Zgoda (consent) i klauzula RODO: checkbox w <label.evfb-consent> - outline zamiast border */
.evfb-has-error .evfb-consent input[type='checkbox'],
.evfb-has-error .evfb-options input {
	outline: 2px solid var(--evfb-error-border-color, var(--evfb-error-color, #d63638));
 	outline-offset: 1px;
}

/* Puls pol z bledem po kazdym kliknieciu "Wyslij" (.evfb-pulse ustawia JS) */
.evfb-has-error.evfb-pulse input:not([type='checkbox']):not([type='radio']):not([type='hidden']),
.evfb-has-error.evfb-pulse textarea,
.evfb-has-error.evfb-pulse select,
.evfb-has-error.evfb-pulse .evfb-phone-prefix {
	animation: evfbErrorPulse 0.5s ease-out 2;
}

.evfb-has-error.evfb-pulse .evfb-options,
.evfb-has-error.evfb-pulse .evfb-consent {
	animation: evfbErrorShake 0.4s ease-in-out 1;
}

@keyframes evfbErrorPulse {
	0% {
		box-shadow: 0 0 0 0 color-mix(in srgb, var(--evfb-error-border-color, var(--evfb-error-color, #d63638)) 60%, transparent);
	}
	100% {
		box-shadow: 0 0 0 8px color-mix(in srgb, var(--evfb-error-border-color, var(--evfb-error-color, #d63638)) 0%, transparent);
	}
}

@keyframes evfbErrorShake {
	0%,
	100% {
		transform: translateX(0);
	}
	25% {
		transform: translateX(-4px);
	}
	75% {
		transform: translateX(4px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.evfb-has-error.evfb-pulse input,
	.evfb-has-error.evfb-pulse textarea,
	.evfb-has-error.evfb-pulse select,
	.evfb-has-error.evfb-pulse .evfb-phone-prefix,
	.evfb-has-error.evfb-pulse .evfb-options,
	.evfb-has-error.evfb-pulse .evfb-consent {
		animation: none;
	}
}

/* Blad poprawiony przez uzytkownika (.evfb-is-fixed ustawia JS) */
.evfb-is-fixed input[type='text'],
.evfb-is-fixed input[type='email'],
.evfb-is-fixed input[type='tel'],
.evfb-is-fixed input[type='url'],
.evfb-is-fixed input[type='number'],
.evfb-is-fixed input[type='date'],
.evfb-is-fixed textarea,
.evfb-is-fixed select,
.evfb-is-fixed .evfb-phone-prefix {
	border: 1px solid var(--evfb-fixed-border-color, #00a32a);
}

.evfb-is-fixed .evfb-consent input[type='checkbox'],
.evfb-is-fixed .evfb-options input {
	outline: 2px solid var(--evfb-fixed-border-color, #00a32a);
	outline-offset: 1px;
}

.evfb-field.evfb-is-fixed .evfb-label,
.evfb-field.evfb-is-fixed .evfb-floating-label,
.evfb-field.evfb-is-fixed.evfb-floating .evfb-floating-label.evfb-floating-up,
.evfb-field.evfb-is-fixed.evfb-floating:focus-within .evfb-floating-label {
	color: var(--evfb-fixed-label-color, #00a32a);
}

/* Animacja wygaszania formularza po sukcesie */
.evfb-form.evfb-fading {
	transition: opacity 0.3s ease;
	opacity: 0;
}

/* Responsywnosc - waskie ekrany */
@media (max-width: 600px) {
	.evfb-floating {
		--evfb-label-inset: 12px;
	}
	.evfb-floating .evfb-floating-label {
		font-size: 16px;
	}
	.evfb-floating .evfb-floating-label.evfb-floating-up,
	.evfb-floating:not(.evfb-type-select):focus-within .evfb-floating-label {
		font-size: 0.7rem;
	}
	/* iOS: font >= 16px zapobiega auto-zoom przy focusie; padding daje ~44px wysokosci */
	.evfb-field input[type='text'],
	.evfb-field input[type='email'],
	.evfb-field input[type='tel'],
	.evfb-field input[type='url'],
	.evfb-field input[type='number'],
	.evfb-field input[type='date'],
	.evfb-field textarea,
	.evfb-field select {
		font-size: 16px;
		padding: 12px 10px;
	}
	.evfb-field-error {
		font-size: 0.9rem;
	}
	.evfb-progress-text {
		font-size: 0.9rem;
	}
	.evfb-submit {
		width: 100%;
	}
}

/* Respektuj preferencje uzytkownika - brak animacji */
@media (prefers-reduced-motion: reduce) {
	.evfb-floating .evfb-floating-label,
	.evfb-progress-fill,
	.evfb-form.evfb-fading {
		transition: none;
	}
}

/* Autouzupelnienie czesto nie odpala input. Animacja startuje check() etykiety. */
@keyframes evfbOnAutoFillStart {
	from {
		opacity: 1;
	}
	to {
		opacity: 1;
	}
}

/* Autofill przegladarki naklada wlasne tlo - zakrywamy je wewnętrznym cieniem w kolorze pola. */
.evfb-field input:-webkit-autofill,
.evfb-field input:-webkit-autofill:hover,
.evfb-field input:-webkit-autofill:focus {
	-webkit-box-shadow: 0 0 0 1000px var(--evfb-field-bg, #F3F5F8) inset, 0 1px 2px rgba(0, 0, 0, 0.08);
	box-shadow: 0 0 0 1000px var(--evfb-field-bg, #F3F5F8) inset, 0 1px 2px rgba(0, 0, 0, 0.08);
	-webkit-text-fill-color: #1d2327;
	caret-color: #1d2327;
}

.evfb-floating input:-webkit-autofill {
	animation-name: evfbOnAutoFillStart;
	animation-duration: 0.01s;
}
