/* ============================================================
   Branching Form Builder — Frontend Form Styles
   ============================================================ */

/* ── Container ──────────────────────────────────────────────── */
.bfb-form-container {
	max-width: 620px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
	position: relative;
}

/* ── Progress bar ───────────────────────────────────────────── */
.bfb-progress-wrap {
	height: 6px;
	background: #e5e7eb;
	border-radius: 99px;
	overflow: hidden;
	margin-bottom: 6px;
}

.bfb-progress-bar {
	height: 100%;
	background: linear-gradient(90deg, #ff6e4e, #ff9070);
	border-radius: 99px;
	transition: width 0.4s ease;
}

.bfb-progress-pct {
	text-align: right;
	font-size: 0.78rem;
	font-weight: 700;
	color: #ff6e4e;
	margin-bottom: 24px;
	letter-spacing: 0.02em;
}

/* ── Question area ──────────────────────────────────────────── */
.bfb-question-area {
	min-height: 180px;
	position: relative;
}

.bfb-question {
	animation: bfbSlideIn 0.3s ease both;
}

@keyframes bfbSlideIn {
	from { opacity: 0; transform: translateX(24px); }
	to   { opacity: 1; transform: translateX(0); }
}

.bfb-question.bfb-slide-back {
	animation: bfbSlideBack 0.3s ease both;
}

@keyframes bfbSlideBack {
	from { opacity: 0; transform: translateX(-24px); }
	to   { opacity: 1; transform: translateX(0); }
}

/* ── Question text ──────────────────────────────────────────── */
.bfb-question-text {
	font-size: 1.35rem;
	font-weight: 600;
	line-height: 1.4;
	margin: 0 0 24px;
	color: #111827;
}

/* ── Radio options ──────────────────────────────────────────── */
.bfb-options-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.bfb-option {
	display: block;
}

.bfb-option label {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 18px;
	border: 2px solid #d1d5db;
	border-radius: 8px;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s;
	font-size: 1rem;
	color: #374151;
	user-select: none;
}

.bfb-option label:hover {
	border-color: #ff6e4e;
	background: #fff5f3;
}

.bfb-option input[type="radio"] {
	width: 18px;
	height: 18px;
	accent-color: #ff6e4e;
	flex-shrink: 0;
}

.bfb-option input[type="radio"]:checked + span,
.bfb-option.bfb-option--selected label {
	border-color: #ff6e4e;
	background: #fff5f3;
	color: #c94c2a;
	font-weight: 500;
}

.bfb-option input[type="radio"]:checked ~ .bfb-option-label {
	color: #c94c2a;
}

/* ── Text / email / phone inputs ────────────────────────────── */
.bfb-text-input {
	width: 100%;
	padding: 14px 16px;
	font-size: 1rem;
	border: 2px solid #d1d5db;
	border-radius: 8px;
	outline: none;
	transition: border-color 0.15s;
	box-sizing: border-box;
	color: #111827;
}

.bfb-text-input:focus {
	border-color: #ff6e4e;
	box-shadow: 0 0 0 3px rgba(255, 110, 78, 0.18);
}

/* ── Navigation ─────────────────────────────────────────────── */
.bfb-nav {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 28px;
	gap: 12px;
}

.bfb-btn {
	padding: 12px 28px;
	border: none;
	border-radius: 6px;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, opacity 0.15s, transform 0.1s;
}

.bfb-btn:active {
	transform: scale(0.97);
}

.bfb-btn--next {
	background: #ff6e4e;
	color: #fff;
	margin-left: auto;
}

.bfb-btn--next:hover:not(:disabled) {
	background: #e55a3a;
}

.bfb-btn--next:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.bfb-btn--back {
	background: transparent;
	color: #6b7280;
	border: 2px solid #d1d5db;
}

.bfb-btn--back:hover {
	border-color: #9ca3af;
	color: #374151;
}

/* ── Loading overlay ────────────────────────────────────────── */
.bfb-overlay {
	position: absolute;
	inset: 0;
	background: rgba(255,255,255,0.75);
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	z-index: 10;
}

.bfb-spinner {
	width: 36px;
	height: 36px;
	border: 4px solid #e5e7eb;
	border-top-color: #ff6e4e;
	border-radius: 50%;
	animation: bfbSpin 0.7s linear infinite;
	display: block;
}

@keyframes bfbSpin {
	to { transform: rotate(360deg); }
}

/* ── Error message ──────────────────────────────────────────── */
.bfb-error {
	margin-top: 16px;
	padding: 12px 16px;
	background: #fef2f2;
	border: 1px solid #fca5a5;
	border-radius: 6px;
	color: #991b1b;
	font-size: 0.925rem;
}

/* ── Utility ────────────────────────────────────────────────── */
.bfb-hidden {
	display: none !important;
}

/* ── Completion message ─────────────────────────────────────── */
.bfb-complete {
	text-align: center;
	padding: 40px 0;
}

.bfb-complete h2 {
	font-size: 1.5rem;
	color: #111827;
	margin-bottom: 8px;
}

.bfb-complete p {
	color: #6b7280;
}

/* ── Validation error on field ──────────────────────────────── */
.bfb-field-error {
	color: #dc2626;
	font-size: 0.875rem;
	margin-top: 6px;
}

/* ── Contact capture step ───────────────────────────────────── */
.bfb-contact-fields {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.bfb-contact-name-row {
	display: flex;
	gap: 12px;
}

.bfb-contact-name-row .bfb-text-input {
	flex: 1;
	min-width: 0;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
	.bfb-question-text {
		font-size: 1.1rem;
	}

	.bfb-btn {
		padding: 11px 20px;
		font-size: 0.95rem;
	}

	.bfb-contact-name-row {
		flex-direction: column;
	}
}
