/*
 * Ercoding Form – layout + wizard (multistep).
 * Cała warstwa wizualna jedzie na tokenach motywu (var(--token, fallback)),
 * więc zmiana brandingu w abstracts/_variables.scss przestawia też formularz.
 * Nigdy nie hardkoduj tu kolorów.
 */
.ercoding-form {
	--ef-gap: var(--space-5, 20px);
	--ef-accent: var(--color-brand, #e2072e);
	--ef-accent-hover: var(--color-brand-hover, #c40628);
	--ef-accent-subtle: var(--color-brand-subtle, #fdeaee);
	--ef-accent-rgb: var(--color-primary-rgb, 226 7 46);
	--ef-ink: var(--text-strong, #23262a);
	--ef-body: var(--text-body, #343534);
	--ef-muted: var(--text-muted, #666766);
	--ef-border: var(--border-subtle, #e3e6ea);
	--ef-border-strong: var(--border-default, #cbd0d6);
	--ef-surface: var(--surface-card, #fff);
	--ef-surface-muted: var(--surface-muted, #eff1f3);
	--ef-radius: var(--radius-sm, 8px);
	--ef-danger: var(--status-danger, #e2072e);
	--ef-font: var(--font-body, system-ui, sans-serif);
	--ef-font-display: var(--font-display, var(--font-heading, system-ui, sans-serif));

	font-family: var(--ef-font);
	color: var(--ef-body);
}

/* Honeypot – całkowicie ukryty */
.ercoding-form__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
}

/* Grid pól */
.ercoding-form__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--ef-gap);
}
.ercoding-form__col--half {
	grid-column: span 1;
}
.ercoding-form__col--full {
	grid-column: span 2;
}

/* ----------------------------- Pola ----------------------------- */

.ercoding-form__field {
	display: flex;
	flex-direction: column;
}

.ercoding-form__label {
	display: block;
	margin-bottom: 6px;
	font-size: var(--text-size-small, 14px);
	font-weight: 600;
	line-height: 1.4;
	color: var(--ef-ink);
}

.ercoding-form__required {
	margin-left: 2px;
	color: var(--ef-accent);
}

.ercoding-form__input,
.ercoding-form__select,
.ercoding-form__textarea,
.ercoding-form__file {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 11px 14px;
	font-family: inherit;
	font-size: var(--text-size-body, 16px);
	line-height: 1.5;
	color: var(--ef-ink);
	background: var(--ef-surface);
	border: 1px solid var(--ef-border-strong);
	border-radius: var(--ef-radius);
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
	appearance: none;
}

.ercoding-form__select {
	padding-right: 40px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666766' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	cursor: pointer;
}

.ercoding-form__input::placeholder,
.ercoding-form__textarea::placeholder {
	color: var(--ef-muted);
	opacity: 1;
}

.ercoding-form__input:hover,
.ercoding-form__select:hover,
.ercoding-form__textarea:hover {
	border-color: var(--ef-muted);
}

.ercoding-form__input:focus-visible,
.ercoding-form__select:focus-visible,
.ercoding-form__textarea:focus-visible,
.ercoding-form__file:focus-visible {
	outline: none;
	border-color: var(--ef-accent);
	box-shadow: var(--focus-ring, 0 0 0 3px rgb(var(--ef-accent-rgb) / 0.28));
}

.ercoding-form__field--invalid .ercoding-form__input,
.ercoding-form__field--invalid .ercoding-form__select,
.ercoding-form__field--invalid .ercoding-form__textarea {
	border-color: var(--ef-danger);
}

.ercoding-form__field--consent.ercoding-form__field--invalid {
	border-color: var(--ef-danger);
}

.ercoding-form__textarea {
	resize: vertical;
	min-height: 7rem;
}

.ercoding-form__file {
	padding: 9px 12px;
	font-size: var(--text-size-small, 14px);
	cursor: pointer;
}

.ercoding-form__error {
	display: block;
	margin-top: 4px;
	font-size: var(--fs-xs, 12px);
	line-height: 1.4;
	min-height: 1.1em;
	color: var(--ef-danger);
}
.ercoding-form__hint {
	display: block;
	margin-top: 4px;
	font-size: var(--fs-xs, 12px);
	color: var(--ef-muted);
}
.ercoding-form__optional {
	font-size: var(--fs-xs, 12px);
	font-weight: 400;
	color: var(--ef-muted);
	margin-left: 4px;
}
.ercoding-form__char-count {
	font-size: var(--fs-xs, 12px);
	font-weight: 400;
	margin-left: 0.5em;
	color: var(--ef-muted);
}

/* Zgoda RODO */
.ercoding-form__field--consent {
	padding: 14px 16px;
	background: var(--ef-surface-muted);
	border: 1px solid var(--ef-border);
	border-radius: var(--ef-radius);
}
.ercoding-form__label--consent {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 0;
	font-weight: 400;
	font-size: var(--text-size-small, 14px);
	line-height: 1.55;
	color: var(--ef-body);
	cursor: pointer;
}
.ercoding-form__checkbox {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	margin: 2px 0 0;
	accent-color: var(--ef-accent);
	cursor: pointer;
}
.ercoding-form__consent-text a {
	color: var(--ef-accent);
	text-decoration: underline;
}
.ercoding-form__consent-text a:hover {
	color: var(--ef-accent-hover);
}

/* ----------------------------- Wizard ----------------------------- */

/* Kroki – pokazuj jeden naraz tylko gdy JS aktywował wizard */
.ercoding-form.is-wizard .ercoding-form__step {
	display: none;
}
.ercoding-form.is-wizard .ercoding-form__step.is-active {
	display: block;
	animation: ef-fade 0.28s var(--ease-out, ease);
}
@keyframes ef-fade {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}
@media (prefers-reduced-motion: reduce) {
	.ercoding-form.is-wizard .ercoding-form__step.is-active {
		animation: none;
	}
}

/* Pasek postępu */
.ercoding-form__progress {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 22px;
}
.ercoding-form__progress:empty {
	display: none;
}
.ercoding-form__progress-dots {
	display: flex;
	gap: 8px;
	flex: 1;
}
.ercoding-form__progress-dot {
	height: 4px;
	flex: 1;
	border-radius: 2px;
	background: var(--ef-border);
	transition: background 0.3s ease;
}
.ercoding-form__progress-dot.is-active,
.ercoding-form__progress-dot.is-done {
	background: var(--ef-accent);
}
.ercoding-form__progress-label {
	font-size: var(--fs-xs, 12px);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--ef-muted);
	white-space: nowrap;
}

/* Tytuł i podpowiedź kroku */
.ercoding-form__step-title {
	margin: 0 0 4px;
	font-family: var(--ef-font-display);
	font-size: var(--fs-xl, 24px);
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.01em;
	color: var(--ef-ink);
}
.ercoding-form__step-hint {
	margin: 0 0 18px;
	font-size: var(--text-size-small, 14px);
	line-height: 1.5;
	color: var(--ef-muted);
}

/* Kafelki „W jakiej sprawie piszesz?" */
.ercoding-form__choices {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}
.ercoding-form__choice {
	display: flex;
	align-items: center;
	gap: 10px;
	text-align: left;
	padding: 15px 18px;
	border: 1px solid var(--ef-border-strong);
	border-radius: var(--ef-radius);
	background: var(--ef-surface);
	color: var(--ef-ink);
	font-family: inherit;
	font-size: var(--text-size-body, 16px);
	font-weight: 600;
	cursor: pointer;
	transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.ercoding-form__choice::before {
	content: '';
	width: 10px;
	height: 10px;
	border-radius: 50%;
	border: 2px solid var(--ef-border-strong);
	flex-shrink: 0;
	transition: border-color 0.18s ease, background 0.18s ease;
}
.ercoding-form__choice:hover {
	border-color: var(--ef-accent);
	transform: translateY(-2px);
	box-shadow: var(--shadow-md, 0 4px 12px rgba(21, 23, 26, 0.08));
}
.ercoding-form__choice:hover::before {
	border-color: var(--ef-accent);
}
.ercoding-form__choice:focus-visible {
	outline: none;
	border-color: var(--ef-accent);
	box-shadow: var(--focus-ring, 0 0 0 3px rgb(var(--ef-accent-rgb) / 0.28));
}
.ercoding-form__choice.is-selected {
	border-color: var(--ef-accent);
	background: var(--ef-accent-subtle);
}
.ercoding-form__choice.is-selected::before {
	border-color: var(--ef-accent);
	background: var(--ef-accent);
	box-shadow: inset 0 0 0 2px var(--ef-surface);
}

/* Nawigacja kroków */
.ercoding-form__nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 22px;
}
.ercoding-form__nav .btn {
	margin-left: auto;
}
.ercoding-form__back {
	border: none;
	background: none;
	padding: 6px 4px;
	font-family: inherit;
	font-size: var(--text-size-small, 14px);
	font-weight: 600;
	color: var(--ef-muted);
	cursor: pointer;
	text-decoration: underline;
	border-radius: var(--ef-radius);
}
.ercoding-form__back:hover {
	color: var(--ef-ink);
}
.ercoding-form__back:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring, 0 0 0 3px rgb(var(--ef-accent-rgb) / 0.28));
}

/* Status */
.ercoding-form__status {
	margin-top: var(--ef-gap);
	font-size: var(--text-size-small, 14px);
	line-height: 1.5;
}
.ercoding-form__status:empty {
	margin-top: 0;
}
.ercoding-form__status[data-type='error'] {
	padding: 12px 14px;
	border: 1px solid var(--ef-danger);
	border-radius: var(--ef-radius);
	background: var(--ef-accent-subtle);
	color: var(--ef-danger);
}
.ercoding-form__status[data-type='success'] {
	padding: 12px 14px;
	border: 1px solid var(--status-success, #1f9d57);
	border-radius: var(--ef-radius);
	color: var(--status-success, #1f9d57);
}

/* Spinner podczas wysyłania */
.ercoding-form--sending .ercoding-form__submit {
	pointer-events: none;
	opacity: 0.7;
}

/* Responsive */
@media (max-width: 640px) {
	.ercoding-form__grid,
	.ercoding-form__choices {
		grid-template-columns: 1fr;
	}
	.ercoding-form__col--half,
	.ercoding-form__col--full {
		grid-column: span 1;
	}
	.ercoding-form__step-title {
		font-size: var(--fs-lg, 20px);
	}
	.ercoding-form__nav .btn {
		flex: 1;
		justify-content: center;
	}
}
