/* ==========================================================================
   Booking Form Builder — Frontend Dynamic Form Styles
   Scoped + isolated from theme / Elementor global form styles
   ========================================================================== */

/* ── Isolation layer (beats theme & Elementor specificity) ───────────────── */
.bf-form-wrap.bf-form-isolated {
	isolation: isolate;
	position: relative;
	z-index: 1;
	contain: layout style;
}

/* Neutralize inherited typography & layout from theme/Elementor */
.bf-form-wrap.bf-form-isolated,
.bf-form-wrap.bf-form-isolated .bf-dynamic-form,
.elementor-widget-shortcode .bf-form-wrap.bf-form-isolated,
.elementor-element .bf-form-wrap.bf-form-isolated {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
	line-height: 1.5 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
}

.bf-form-wrap.bf-form-isolated h1,
.bf-form-wrap.bf-form-isolated h2,
.bf-form-wrap.bf-form-isolated h3,
.bf-form-wrap.bf-form-isolated h4,
.bf-form-wrap.bf-form-isolated p,
.bf-form-wrap.bf-form-isolated label,
.bf-form-wrap.bf-form-isolated span,
.bf-form-wrap.bf-form-isolated div {
	font-family: inherit !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}

.bf-form-wrap.bf-form-isolated .bf-dynamic-form {
	margin: 0 !important;
	padding: var(--bf-padding) !important;
	border: none !important;
	box-shadow: none !important;
	background: var(--bf-bg) !important;
}

.bf-form-wrap.bf-form-isolated input:not([type="hidden"]),
.bf-form-wrap.bf-form-isolated textarea,
.bf-form-wrap.bf-form-isolated select {
	display: block !important;
	width: 100% !important;
	max-width: 100% !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 10px 12px !important;
	background: var(--bf-input-bg) !important;
	color: var(--bf-text) !important;
	border: var(--bf-input-border-width) solid var(--bf-input-border) !important;
	border-radius: var(--bf-radius) !important;
	font-size: 1em !important;
	font-family: inherit !important;
	font-weight: 400 !important;
	line-height: 1.5 !important;
	box-shadow: none !important;
	outline: none !important;
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	appearance: none !important;
}

.bf-form-wrap.bf-form-isolated input:focus,
.bf-form-wrap.bf-form-isolated textarea:focus,
.bf-form-wrap.bf-form-isolated select:focus {
	background: var(--bf-input-bg) !important;
	color: var(--bf-text) !important;
	border-color: var(--bf-primary) !important;
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--bf-primary) 20%, transparent) !important;
}

.bf-form-wrap.bf-form-isolated button,
.bf-form-wrap.bf-form-isolated .bf-btn,
.bf-form-wrap.bf-form-isolated input[type="submit"],
.bf-form-wrap.bf-form-isolated input[type="button"] {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: auto !important;
	min-width: 0 !important;
	height: auto !important;
	margin: 0 !important;
	padding: 10px 24px !important;
	font-family: inherit !important;
	font-size: .9em !important;
	font-weight: 600 !important;
	line-height: 1.4 !important;
	text-decoration: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	border-radius: var(--bf-btn-radius) !important;
	cursor: pointer !important;
	box-shadow: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}

.bf-form-wrap.bf-form-isolated .bf-btn-primary,
.bf-form-wrap.bf-form-isolated button.bf-btn-primary {
	background: var(--bf-btn-bg) !important;
	color: var(--bf-btn-text) !important;
	border: 2px solid var(--bf-btn-bg) !important;
}

.bf-form-wrap.bf-form-isolated .bf-btn-secondary,
.bf-form-wrap.bf-form-isolated button.bf-btn-secondary {
	background: transparent !important;
	color: var(--bf-primary) !important;
	border: 2px solid var(--bf-input-border) !important;
}

.bf-form-wrap.bf-form-isolated .bf-label,
.bf-form-wrap.bf-form-isolated .bf-choice-label {
	display: block !important;
	margin: 0 0 6px !important;
	padding: 0 !important;
	font-size: .875em !important;
	font-weight: 600 !important;
	color: var(--bf-label) !important;
}

.bf-form-wrap.bf-form-isolated .bf-radio-label,
.bf-form-wrap.bf-form-isolated .bf-checkbox-label {
	display: flex !important;
	width: 100% !important;
	padding: 8px 12px !important;
	background: var(--bf-input-bg) !important;
	border: var(--bf-input-border-width) solid var(--bf-input-border) !important;
	border-radius: calc(var(--bf-radius) - 2px) !important;
	color: var(--bf-text) !important;
}

.bf-form-wrap.bf-form-isolated .bf-card {
	background: var(--bf-card-bg) !important;
	border: 2px solid var(--bf-card-border) !important;
	color: var(--bf-text) !important;
	box-shadow: none !important;
}

.bf-form-wrap.bf-form-isolated .bf-card:has(input:checked) {
	border-color: var(--bf-card-sel-border) !important;
	background: var(--bf-card-sel-bg) !important;
}

.bf-form-wrap.bf-form-isolated .bf-step-heading,
.bf-form-wrap.bf-form-isolated .bf-heading {
	color: var(--bf-text) !important;
	font-weight: 700 !important;
}

.bf-form-wrap.bf-form-isolated a {
	color: var(--bf-primary);
	text-decoration: underline;
}

.bf-form-wrap.bf-form-isolated * {
	box-sizing: border-box !important;
}

/* ── Base variables & layout ─────────────────────────────────────────────── */
.bf-form-wrap {
	--bf-primary:              #2563eb;
	--bf-bg:                   #ffffff;
	--bf-text:                 #1f2937;
	--bf-label:                #374151;
	--bf-radius:               8px;
	--bf-font-size:            15px;
	--bf-input-bg:             #f9fafb;
	--bf-input-border:         #d1d5db;
	--bf-input-border-width:   1px;
	--bf-btn-bg:               #2563eb;
	--bf-btn-text:             #ffffff;
	--bf-btn-radius:           8px;
	--bf-padding:              24px;
	--bf-gap:                  16px;
	--bf-card-bg:              #f9fafb;
	--bf-card-border:          #d1d5db;
	--bf-card-sel-bg:          #eff6ff;
	--bf-card-sel-border:      #2563eb;
	--bf-form-width:           100%;
	/* Step indicator colours — overridden via inline style for dark context */
	--bf-step-track:           #e5e7eb;
	--bf-step-text:            #6b7280;

	width: var(--bf-form-width);
	margin: 0 auto;
	font-size: var(--bf-font-size);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: var(--bf-text);
}

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

/* ── Progress bar & steps ─────────────────────────────────────────────────── */
.bf-progress-wrap {
	margin-bottom: 28px;
}

.bf-step-indicators {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	width: 100%;
	gap: 0;
	margin-bottom: 12px;
	flex-wrap: nowrap;
}

.bf-step-indicator {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	flex: 0 0 auto;
}

.bf-step-number {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--bf-step-track);
	color: var(--bf-step-text);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	font-weight: 700;
	transition: background .2s, color .2s;
	border: 2px solid transparent;
}

.bf-step-indicator.active .bf-step-number {
	background: var(--bf-primary);
	color: #fff;
	border-color: var(--bf-primary);
}

.bf-step-indicator.done .bf-step-number {
	background: var(--bf-primary);
	color: #fff;
	opacity: .6;
}

.bf-step-label {
	font-size: 11px;
	color: var(--bf-step-text);
	white-space: nowrap;
}

.bf-step-indicator.active .bf-step-label { color: var(--bf-primary); font-weight: 600; }

.bf-step-connector {
	flex: 1 1 auto;
	min-width: 16px;
	width: auto;
	height: 2px;
	background: var(--bf-step-track);
	align-self: center;
	margin-top: 15px; /* align with step number circles */
}

.bf-progress-bar {
	height: 4px;
	background: var(--bf-step-track);
	border-radius: 2px;
	overflow: hidden;
}

.bf-progress-fill {
	height: 100%;
	background: var(--bf-primary);
	border-radius: 2px;
	transition: width .35s ease;
}

/* ── Form & steps ─────────────────────────────────────────────────────────── */
.bf-dynamic-form {
	background: var(--bf-bg);
	padding: var(--bf-padding);
	border-radius: var(--bf-radius);
}

.bf-step-heading {
	font-size: 18px;
	font-weight: 700;
	color: var(--bf-text);
	margin: 0 0 20px;
}

/* ── Field row (grid) ─────────────────────────────────────────────────────── */
.bf-fields-row {
	display: flex;
	flex-wrap: wrap;
	margin: 0 calc(var(--bf-gap) / -2);
}

.bf-field-wrap {
	padding: 0 calc(var(--bf-gap) / 2);
	margin-bottom: var(--bf-gap);
}

/* Width classes */
.bf-w-25  { width: 25%; }
.bf-w-33  { width: 33.333%; }
.bf-w-50  { width: 50%; }
.bf-w-66  { width: 66.666%; }
.bf-w-75  { width: 75%; }
.bf-w-100 { width: 100%; }

@media (max-width: 600px) {
	.bf-w-25,
	.bf-w-33,
	.bf-w-50,
	.bf-w-66,
	.bf-w-75 { width: 100%; }
}

/* ── Labels ───────────────────────────────────────────────────────────────── */
.bf-label {
	display: block;
	font-size: .875em;
	font-weight: 600;
	color: var(--bf-label);
	margin-bottom: 6px;
}

.bf-required { color: #ef4444; margin-left: 2px; }
.bf-help-text { font-size: .8em; color: #6b7280; margin: 4px 0 0; }

.bf-field-error {
	display: block;
	font-size: .8em;
	color: #ef4444;
	margin-top: 4px;
}

/* ── Inputs ───────────────────────────────────────────────────────────────── */
.bf-input {
	display: block;
	width: 100%;
	padding: 10px 12px;
	background: var(--bf-input-bg);
	border: var(--bf-input-border-width) solid var(--bf-input-border);
	border-radius: var(--bf-radius);
	font-size: 1em;
	color: var(--bf-text);
	outline: none;
	transition: border-color .15s, box-shadow .15s;
	font-family: inherit;
	-webkit-appearance: none;
}

.bf-input:focus {
	border-color: var(--bf-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--bf-primary) 20%, transparent);
}

.bf-input.bf-field-invalid {
	border-color: #ef4444;
	box-shadow: 0 0 0 3px rgba(239,68,68,.15);
}

.bf-textarea { resize: vertical; min-height: 100px; }

.bf-select {
	cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 32px;
}

/* ── Radio & Checkbox groups ──────────────────────────────────────────────── */
.bf-choice-label {
	font-size: .875em;
	font-weight: 600;
	color: var(--bf-label);
	margin-bottom: 8px;
}

.bf-radio-group,
.bf-checkbox-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.bf-radio-label,
.bf-checkbox-label {
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	padding: 8px 12px;
	border: var(--bf-input-border-width) solid var(--bf-input-border);
	border-radius: calc(var(--bf-radius) - 2px);
	background: var(--bf-input-bg);
	transition: border-color .15s, background .15s;
	font-size: .9em;
}
.bf-radio-label:hover,
.bf-checkbox-label:hover {
	border-color: var(--bf-primary);
	background: var(--bf-card-sel-bg);
}

.bf-radio-label input,
.bf-checkbox-label input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.bf-radio-label:has(input:checked),
.bf-checkbox-label:has(input:checked) {
	border-color: var(--bf-primary);
	background: var(--bf-card-sel-bg);
}

.bf-radio-custom,
.bf-checkbox-custom {
	width: 18px;
	height: 18px;
	border: 2px solid var(--bf-input-border);
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: border-color .15s, background .15s;
}

.bf-checkbox-custom { border-radius: 4px; }

.bf-radio-label:has(input:checked) .bf-radio-custom {
	border-color: var(--bf-primary);
	background: var(--bf-primary);
	box-shadow: inset 0 0 0 3px white;
}

.bf-checkbox-label:has(input:checked) .bf-checkbox-custom {
	border-color: var(--bf-primary);
	background: var(--bf-primary);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2 7l3.5 3.5L12 3' stroke='white' stroke-width='2.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-size: 12px;
	background-repeat: no-repeat;
	background-position: center;
}

.bf-option-price {
	margin-left: auto;
	font-size: .85em;
	color: var(--bf-primary);
	font-weight: 600;
}

/* ── Card choice ──────────────────────────────────────────────────────────── */
.bf-card-group {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
	gap: 10px;
}

.bf-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 14px 10px;
	background: var(--bf-card-bg);
	border: 2px solid var(--bf-card-border);
	border-radius: var(--bf-radius);
	cursor: pointer;
	text-align: center;
	transition: border-color .15s, background .15s, transform .1s;
	position: relative;
	overflow: hidden;
}

.bf-card:hover {
	border-color: var(--bf-primary);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.bf-card input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.bf-card:has(input:checked) {
	border-color: var(--bf-card-sel-border);
	background: var(--bf-card-sel-bg);
}

.bf-card:has(input:checked)::after {
	content: '✓';
	position: absolute;
	top: 6px;
	right: 8px;
	width: 18px;
	height: 18px;
	background: var(--bf-primary);
	color: white;
	border-radius: 50%;
	font-size: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
}

.bf-card-icon { font-size: 28px; line-height: 1; }
.bf-card-title { font-size: .875em; font-weight: 600; color: var(--bf-text); }
.bf-card-desc { font-size: .75em; color: #6b7280; }
.bf-card-price { font-size: .8em; color: var(--bf-primary); font-weight: 600; }

/* ── Layout elements ──────────────────────────────────────────────────────── */
.bf-heading { margin: 0 0 4px; color: var(--bf-text); }
.bf-paragraph { color: var(--bf-text); opacity: .8; margin: 0; line-height: 1.6; }
.bf-divider { border: none; border-top: 1px solid var(--bf-input-border); margin: 4px 0; }

/* ── Navigation buttons ───────────────────────────────────────────────────── */
.bf-step-nav {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid var(--bf-input-border);
}

.bf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 24px;
	border-radius: var(--bf-btn-radius);
	font-size: .9em;
	font-weight: 600;
	cursor: pointer;
	border: 2px solid transparent;
	transition: background .15s, border-color .15s, transform .1s, opacity .15s;
	font-family: inherit;
	white-space: nowrap;
}

.bf-btn-primary {
	background: var(--bf-btn-bg);
	color: var(--bf-btn-text);
	border-color: var(--bf-btn-bg);
	margin-left: auto;
}
.bf-btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.bf-btn-primary:active { transform: translateY(0); }

.bf-btn-secondary {
	background: transparent;
	color: var(--bf-primary);
	border-color: var(--bf-input-border);
}
.bf-btn-secondary:hover { border-color: var(--bf-primary); background: var(--bf-card-sel-bg); }

.bf-btn:disabled {
	opacity: .5;
	cursor: not-allowed;
	transform: none !important;
}

.bf-btn-loading::after {
	content: '';
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255,255,255,.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: bf-spin .7s linear infinite;
	display: inline-block;
}

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

/* ── Checkout loading overlay ─────────────────────────────────────────────── */
body.bf-checkout-loading-active {
	overflow: hidden;
}

.bf-checkout-loading {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(15, 23, 42, 0.55);
	backdrop-filter: blur(4px);
}

.bf-checkout-loading-box {
	background: #fff;
	border-radius: 14px;
	padding: 36px 40px;
	max-width: 360px;
	width: 100%;
	text-align: center;
	box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
}

.bf-checkout-loading-spinner {
	width: 44px;
	height: 44px;
	margin: 0 auto 20px;
	border: 3px solid #e5e7eb;
	border-top-color: var(--bf-primary, #2563eb);
	border-radius: 50%;
	animation: bf-spin 0.75s linear infinite;
}

.bf-checkout-loading-title {
	margin: 0 0 6px;
	font-size: 17px;
	font-weight: 600;
	color: #111827;
	line-height: 1.35;
}

.bf-checkout-loading-sub {
	margin: 0;
	font-size: 14px;
	color: #6b7280;
	line-height: 1.45;
}

/* ── Success & Error messages ─────────────────────────────────────────────── */
.bf-success-wrap {
	text-align: center;
	padding: 40px 20px;
	background: var(--bf-bg);
	border-radius: var(--bf-radius);
}

.bf-success-icon {
	color: #10b981;
	margin-bottom: 12px;
}

.bf-success-icon svg circle { fill: #10b981; }
.bf-success-icon svg path { stroke: #10b981; }

.bf-success-text {
	font-size: 1.1em;
	color: var(--bf-text);
	margin: 0;
}

.bf-form-error-msg {
	background: #fee2e2;
	color: #b91c1c;
	border: 1px solid #fca5a5;
	border-radius: var(--bf-radius);
	padding: 10px 14px;
	font-size: .875em;
	margin-top: 12px;
}
