/* Branike Forms — front-end. Minimal base; inherits theme (Blocksy) typography. */

.bf-form {
	display: flex;
	flex-direction: column;
	gap: var(--bf-gap, 1rem);
	/* One base size so every element (labels, inputs, options) matches. */
	font-size: var(--bf-font-size, 1rem);
	color: var(--bf-text, inherit);
}

/* All in-form text inherits the one base size for consistency. */
.bf-form .bf-label,
.bf-form .bf-choice,
.bf-form .bf-consent,
.bf-form .bf-input {
	font-size: 1em;
}

.bf-field {
	display: flex;
	flex-direction: column;
	gap: var(--bf-field-gap, 0.5rem);
}

.bf-label,
.bf-fieldset > .bf-label {
	font-weight: 600;
	line-height: 1.3;
	color: var(--bf-text, inherit);
}

.bf-req {
	color: var(--bb-color-danger, #c0392b);
}

/* .bf-form prefix raises specificity so our radius/colors win over the theme. */
.bf-form .bf-input {
	width: 100%;
	padding: var(--bf-input-pad, 0.6rem 0.75rem);
	border: 1px solid var(--bf-input-border, var(--bb-color-border, #d0d5dd));
	border-radius: var(--bf-radius, var(--bb-radius, 6px));
	background: var(--bf-input-bg, var(--bb-color-surface, #fff));
	color: var(--bf-input-text, inherit);
	font-family: inherit;
	line-height: 1.5;
	box-sizing: border-box;
}

.bf-form .bf-input::placeholder {
	color: var(--bf-placeholder, #6b7280);
	opacity: 1;
}

/* Calculation display — read-only, emphasized. */
.bf-form .bf-calc {
	font-weight: 700;
	background: rgba( 124, 58, 237, 0.06 );
}

/* Select: give the text room so diacritics / the placeholder aren't clipped. */
.bf-select {
	min-height: 2.9rem;
	line-height: 1.6;
}

/* Cap textarea rounding so text isn't hidden behind a pill curve; more padding. */
.bf-form .bf-textarea {
	resize: vertical;
	min-height: 7rem;
	border-radius: clamp( 0px, var(--bf-radius, 6px), 16px );
	padding-left: 0.95rem;
	padding-right: 0.95rem;
}

.bf-form .bf-input:focus-visible {
	outline: 2px solid var(--bf-accent, #7c3aed);
	outline-offset: 1px;
	border-color: var(--bf-accent, #7c3aed);
}

/* Links inside the form (e.g. consent terms) use the accent. */
.bf-form a {
	color: var(--bf-accent, #7c3aed);
}

.bf-fieldset {
	border: 0;
	padding: 0;
	margin: 0;
}

.bf-choices {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-top: 0.4rem;
}

/* Single-line options: checkbox/radio vertically centered with the label. */
.bf-choice {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 400;
	cursor: pointer;
}

/* Consent can wrap to multiple lines — keep the box on the first line. */
.bf-consent {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	font-weight: 400;
	cursor: pointer;
}

.bf-choice input,
.bf-consent input {
	flex: 0 0 auto;
	margin: 0;
}

.bf-consent input {
	margin-top: 0.2rem;
}

.bf-help {
	font-size: 0.85em;
	opacity: 0.75;
}

.bf-error {
	font-size: 0.85em;
	color: var(--bb-color-danger, #c0392b);
	min-height: 1em;
}

.bf-error:empty {
	display: none;
}

/* Invalid state */
.bf-field--invalid .bf-input,
.bf-field--invalid .bf-choices,
.bf-field--invalid .bf-consent {
	border-color: var(--bb-color-danger, #c0392b);
}

.bf-field--invalid .bf-input {
	box-shadow: 0 0 0 1px var(--bb-color-danger, #c0392b);
}

/* File field — custom UI. Without JS the native input shows normally; once
   enhanced (.is-enhanced) the input becomes screen-reader-only-but-focusable
   and the button + file name take over visually. */
.bf-file-wrap {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
}

.bf-file__btn,
.bf-file__name {
	display: none;
}

.bf-file-wrap.is-enhanced .bf-file {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.bf-file-wrap.is-enhanced .bf-file__btn {
	display: inline-flex;
	align-items: center;
	cursor: pointer;
	flex: 0 0 auto;
}

.bf-file-wrap.is-enhanced .bf-file__name {
	display: inline;
	color: var(--bb-color-text-light, #6b7280);
	font-size: 0.95em;
	word-break: break-word;
}

.bf-file-wrap.is-enhanced.has-file .bf-file__name {
	color: var(--bb-color-text, inherit);
}

/* Focus ring driven by the (visually hidden) native input. */
.bf-file-wrap.is-enhanced:focus-within .bf-file__btn {
	outline: 2px solid var(--bb-color-primary, #6d28d9);
	outline-offset: 2px;
}

/* CAPTCHA (Turnstile widget). Reserve height so the widget never shifts layout (CLS = 0). */
.bf-turnstile {
	margin: 0.5rem 0;
	min-height: 65px;
}

.bf-turnstile--invisible {
	margin: 0;
	min-height: 0;
}

/* Submit */
.bf-form__actions {
	margin-top: 0.25rem;
}

.bf-actions--center {
	text-align: center;
}

.bf-actions--right {
	text-align: right;
}

.bf-form .bf-submit {
	background: var(--bf-accent, #7c3aed);
	border: 1px solid var(--bf-accent, #7c3aed);
	color: #fff;
	padding: 0.6rem 1.4rem;
	border-radius: var(--bf-radius, var(--bb-radius, 6px));
	font-family: inherit;
	font-size: 1em;
	font-weight: 600;
	cursor: pointer;
}

.bf-form .bf-submit--full {
	width: 100%;
}

.bf-form .bf-submit:hover {
	filter: brightness( 0.95 );
}

.bf-submit[aria-busy="true"] {
	opacity: 0.7;
	cursor: progress;
}

/* Result message */
.bf-form__message {
	padding: 0.75rem 1rem;
	border-radius: var(--bb-radius, 6px);
}

.bf-form__message--success {
	background: var(--bb-color-success-bg, #ecfdf3);
	color: var(--bb-color-success, #067647);
}

.bf-form__message--error {
	background: var(--bb-color-danger-bg, #fef3f2);
	color: var(--bb-color-danger, #c0392b);
}

/* Conditional logic / step hiding — override display:flex which beats [hidden]. */
.bf-field[hidden],
.bf-step[hidden] {
	display: none !important;
}

/* Multi-step */
.bf-progress {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	margin-bottom: 1rem;
}

.bf-progress__step {
	flex: 1 1 auto;
	text-align: center;
	padding: 0.45rem 0.6rem;
	border-radius: var(--bf-radius, 6px);
	background: rgba( 0, 0, 0, 0.06 );
	font-size: 0.85em;
	opacity: 0.7;
	border-bottom: 2px solid transparent;
}

.bf-progress__step.is-active {
	opacity: 1;
	font-weight: 600;
	background: transparent;
	color: var(--bf-accent, #7c3aed);
	border-bottom-color: var(--bf-accent, #7c3aed);
}

.bf-step-nav {
	display: flex;
	gap: 0.75rem;
	margin-top: 0.5rem;
}

.bf-form .bf-btn {
	padding: 0.6rem 1.3rem;
	border-radius: var(--bf-radius, var(--bb-radius, 6px));
	border: 1px solid var(--bf-accent, #7c3aed);
	background: transparent;
	color: var(--bf-accent, #7c3aed);
	font-family: inherit;
	font-size: 1em;
	font-weight: 600;
	cursor: pointer;
}

.bf-form .bf-btn--next {
	background: var(--bf-accent, #7c3aed);
	color: #fff;
}

/* Honeypot — visually hidden, still in the DOM for bots. Never display:none. */
.bf-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Invoice link shown after submit when no online pay link is available. */
.bf-invoice-link {
	display: inline-block;
	margin-top: 0.5rem;
	font-weight: 600;
}

/* ── Conversational mode (one question at a time) ───────────────────── */
.bf-form--convo {
	min-height: 12rem;
	position: relative;
}

/* Every field is a full-screen "card"; only the active one shows. */
.bf-form--convo .bf-field {
	display: none;
}

.bf-form--convo .bf-field.bf-screen--active {
	display: flex;
	animation: bf-screen-in 0.28s ease;
}

@keyframes bf-screen-in {
	from { opacity: 0; transform: translateY( 12px ); }
	to   { opacity: 1; transform: none; }
}

@media ( prefers-reduced-motion: reduce ) {
	.bf-form--convo .bf-field.bf-screen--active { animation: none; }
}

/* Large, focused typography for the current question. */
.bf-form--convo .bf-label,
.bf-form--convo .bf-fieldset > .bf-label {
	font-size: 1.5em;
	line-height: 1.25;
	margin-bottom: 0.35rem;
}

.bf-form--convo .bf-input {
	font-size: 1.15em;
	padding: 0.7rem 0.9rem;
}

/* Progress bar + counter. */
.bf-convo-progress {
	height: 4px;
	border-radius: 999px;
	background: rgba( 0, 0, 0, 0.08 );
	overflow: hidden;
	margin-bottom: 0.35rem;
}

.bf-convo-progress__bar {
	display: block;
	height: 100%;
	width: 0;
	background: var(--bf-accent, #7c3aed);
	transition: width 0.3s ease;
}

.bf-convo-counter {
	display: block;
	text-align: right;
	font-size: 0.8em;
	opacity: 0.7;
	margin-bottom: 0.75rem;
}

.bf-convo-nav {
	margin-top: 1rem;
}

/* ── Signature pad ──────────────────────────────────────────────────── */
.bf-sign {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	align-items: flex-start;
	position: relative;
}

/* Placeholder overlay nad plátnom — skryje ho JS pri prvom ťahu (pointer-events:none nesmie blokovať kreslenie). */
.bf-sign__ph {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	max-width: 360px;
	height: 160px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--bf-placeholder, #9ca3af);
	font-size: 0.95em;
	pointer-events: none;
	user-select: none;
}

.bf-sign__canvas {
	width: 100%;
	max-width: 360px;
	height: 160px;
	border: 1px dashed var(--bf-input-border, #d0d5dd);
	border-radius: var(--bf-radius, 6px);
	background: var(--bf-input-bg, #fff);
	touch-action: none;
	cursor: crosshair;
}

.bf-sign__clear {
	padding: 0.3rem 0.9rem;
	font-size: 0.85em;
}

/* ── Access limits: closed notice ─────────────────────────────────────── */
.bf-form--closed {
	padding: 1rem 1.25rem;
	border: 1px solid var(--bf-input-border, #d0d5dd);
	border-radius: var(--bf-radius, 6px);
	background: var(--bf-input-bg, #f7f7fb);
}
.bf-form__closed {
	margin: 0;
	color: var(--bf-text, #1a1a2e);
}

/* ── Save & resume ────────────────────────────────────────────────────── */
.bf-form .bf-btn--save {
	background: transparent;
	border: 1px solid var(--bf-accent, #7C3AED);
	color: var(--bf-accent, #7C3AED);
}
.bf-resume-link {
	display: inline-block;
	margin-top: 0.4rem;
	word-break: break-all;
	color: var(--bf-accent, #7C3AED);
}
.bf-form .bf-btn--copy {
	margin-top: 0.4rem;
	padding: 0.3rem 0.9rem;
	font-size: 0.85em;
}
.bf-resume-emailed {
	margin: 0.5rem 0 0;
	font-size: 0.9em;
	opacity: 0.85;
}
