/**
 * BlueFunnel frontend styles.
 * Scoped under .bluefunnel-container so it never leaks into the host theme.
 */

.bluefunnel-container {
	--bf-primary: #2563eb;
	--bf-primary-hover: #1d4ed8;
	--bf-text: #101828;
	--bf-text-muted: #667085;
	--bf-border: #d0d5dd;
	--bf-border-focus: #2563eb;
	--bf-bg: #ffffff;
	--bf-bg-subtle: #f9fafb;
	--bf-error: #d92d20;
	--bf-success: #12a150;
	--bf-radius: 10px;
	--bf-radius-sm: 6px;
	--bf-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
	--bf-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	font-family: var(--bf-font);
	color: var(--bf-text);
	max-width: 560px;
	margin: 0 auto;
	box-sizing: border-box;
}

.bluefunnel-container * {
	box-sizing: border-box;
}

.bluefunnel-step {
	display: none;
}

.bluefunnel-step.bluefunnel-step-active {
	display: block;
}

.bluefunnel-funnel-mount:empty {
	display: none;
}

/* ---------- Form fields ---------- */

.bluefunnel-form {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.bluefunnel-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.bluefunnel-field-label {
	font-size: 14px;
	font-weight: 600;
	color: var(--bf-text);
}

.bluefunnel-required {
	color: var(--bf-error);
}

.bluefunnel-field-description {
	font-size: 13px;
	color: var(--bf-text-muted);
	margin: -2px 0 0;
}

.bluefunnel-input,
.bluefunnel-select,
.bluefunnel-textarea {
	width: 100%;
	font-family: inherit;
	font-size: 15px;
	padding: 10px 12px;
	border: 1px solid var(--bf-border);
	border-radius: var(--bf-radius-sm);
	background: var(--bf-bg);
	color: var(--bf-text);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bluefunnel-textarea {
	resize: vertical;
	min-height: 90px;
}

.bluefunnel-input:focus,
.bluefunnel-select:focus,
.bluefunnel-textarea:focus {
	outline: none;
	border-color: var(--bf-border-focus);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.bluefunnel-field[data-field-type="text"].bluefunnel-field-invalid .bluefunnel-input,
.bluefunnel-input:invalid:not(:placeholder-shown):not(:focus) {
	border-color: var(--bf-border);
}

.bluefunnel-subfields {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.bluefunnel-subfield {
	flex: 1 1 160px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.bluefunnel-sublabel {
	font-size: 12px;
	color: var(--bf-text-muted);
}

.bluefunnel-choices {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.bluefunnel-choice {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	cursor: pointer;
}

.bluefunnel-choice input {
	width: 17px;
	height: 17px;
	accent-color: var(--bf-primary);
}

.bluefunnel-field-error {
	font-size: 13px;
	color: var(--bf-error);
	min-height: 0;
}

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

.bluefunnel-form-error {
	font-size: 14px;
	color: var(--bf-error);
	text-align: center;
}

.bluefunnel-form-error:empty {
	display: none;
}

.bluefunnel-hp-wrap {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------- Order bump (inline on the form) ---------- */

.bluefunnel-order-bump {
	margin-top: 4px;
}

.bluefunnel-order-bump-card {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 16px;
	border: 1px dashed var(--bf-border);
	border-radius: var(--bf-radius);
	background: var(--bf-bg-subtle);
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.bluefunnel-order-bump-card:has(.bluefunnel-order-bump-checkbox:checked) {
	border: 1px solid var(--bf-primary);
	background: rgba(37, 99, 235, 0.06);
}

.bluefunnel-order-bump-checkbox {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.bluefunnel-order-bump-check {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	margin-top: 2px;
	border: 2px solid var(--bf-border);
	border-radius: 5px;
	background: var(--bf-bg);
	position: relative;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.bluefunnel-order-bump-checkbox:checked ~ .bluefunnel-order-bump-check {
	background: var(--bf-primary);
	border-color: var(--bf-primary);
}

.bluefunnel-order-bump-checkbox:checked ~ .bluefunnel-order-bump-check::after {
	content: "";
	position: absolute;
	left: 6px;
	top: 2px;
	width: 5px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.bluefunnel-order-bump-checkbox:focus-visible ~ .bluefunnel-order-bump-check {
	outline: 2px solid var(--bf-primary);
	outline-offset: 2px;
}

.bluefunnel-order-bump-image {
	flex-shrink: 0;
	width: 56px;
	height: 56px;
	border-radius: var(--bf-radius-sm);
	object-fit: cover;
}

.bluefunnel-order-bump-body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.bluefunnel-order-bump-headline {
	font-size: 14px;
}

.bluefunnel-order-bump-description {
	font-size: 13px;
	color: var(--bf-text-muted);
}

.bluefunnel-order-bump-price {
	display: flex;
	align-items: baseline;
	gap: 8px;
	font-weight: 700;
	color: var(--bf-primary);
}

.bluefunnel-order-bump-price-original {
	font-size: 13px;
	font-weight: 500;
	color: var(--bf-text-muted);
	text-decoration: line-through;
}

.bluefunnel-order-bump-custom {
	margin-top: 8px;
}

/* Funnel step content pulled in from a WordPress Page instead of the
   built-in offer builder. */
.bluefunnel-offer-page-content {
	text-align: left;
	margin: 8px 0 16px;
}

/* ---------- Buttons ---------- */

.bluefunnel-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	padding: 13px 20px;
	border-radius: var(--bf-radius-sm);
	border: none;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.05s ease;
}

.bluefunnel-btn:active {
	transform: scale(0.99);
}

.bluefunnel-btn-primary {
	background: var(--bf-primary);
	color: #fff;
}

.bluefunnel-btn-primary:hover {
	background: var(--bf-primary-hover);
}

.bluefunnel-btn:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

.bluefunnel-offer-decline {
	display: block;
	width: 100%;
	background: none;
	border: none;
	color: var(--bf-text-muted);
	font-size: 14px;
	text-decoration: underline;
	cursor: pointer;
	padding: 10px;
}

.bluefunnel-offer-decline:hover {
	color: var(--bf-text);
}

/* ---------- Spinner / loading ---------- */

.bluefunnel-spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: bluefunnel-spin 0.7s linear infinite;
}

.bluefunnel-is-submitting .bluefunnel-spinner {
	display: inline-block;
}

.bluefunnel-is-submitting .bluefunnel-btn-text {
	opacity: 0.85;
}

.bluefunnel-spinner-lg {
	width: 28px;
	height: 28px;
	margin: 0 auto 12px;
	border: 3px solid var(--bf-border);
	border-top-color: var(--bf-primary);
	border-radius: 50%;
	animation: bluefunnel-spin 0.8s linear infinite;
}

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

.bluefunnel-loading-step {
	text-align: center;
	padding: 48px 0;
	color: var(--bf-text-muted);
}

/* ---------- Funnel offer step ---------- */

.bluefunnel-offer-step {
	text-align: center;
}

.bluefunnel-offer-card {
	background: var(--bf-bg);
	border: 1px solid var(--bf-border);
	border-radius: var(--bf-radius);
	box-shadow: var(--bf-shadow);
	padding: 28px 24px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

.bluefunnel-offer-image {
	max-width: 100%;
	max-height: 200px;
	border-radius: var(--bf-radius-sm);
	object-fit: cover;
}

.bluefunnel-offer-kicker {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--bf-primary);
}

.bluefunnel-offer-headline {
	font-size: 22px;
	font-weight: 700;
	margin: 0;
	line-height: 1.3;
}

.bluefunnel-offer-description {
	font-size: 15px;
	color: var(--bf-text-muted);
	line-height: 1.5;
}

.bluefunnel-offer-price {
	display: flex;
	align-items: baseline;
	gap: 10px;
	font-size: 26px;
	font-weight: 700;
	margin: 4px 0;
}

.bluefunnel-offer-price-original {
	font-size: 16px;
	font-weight: 500;
	color: var(--bf-text-muted);
	text-decoration: line-through;
}

.bluefunnel-offer-price-current {
	color: var(--bf-primary);
}

.bluefunnel-offer-step .bluefunnel-btn {
	margin-top: 6px;
}

/* ---------- Thank you ---------- */

.bluefunnel-thankyou {
	text-align: center;
	padding: 32px 16px;
}

.bluefunnel-thankyou-icon {
	width: 52px;
	height: 52px;
	line-height: 52px;
	margin: 0 auto 16px;
	border-radius: 50%;
	background: rgba(18, 161, 80, 0.12);
	color: var(--bf-success);
	font-size: 24px;
}

.bluefunnel-thankyou-heading {
	font-size: 24px;
	margin: 0 0 8px;
}

.bluefunnel-thankyou-message {
	color: var(--bf-text-muted);
	font-size: 15px;
	line-height: 1.6;
}

/* ---------- Transitions ---------- */

.bluefunnel-fade-in {
	animation: bluefunnel-fade-in 0.25s ease both;
}

@keyframes bluefunnel-fade-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.bluefunnel-fade-in,
	.bluefunnel-spinner,
	.bluefunnel-spinner-lg {
		animation: none;
	}
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
	.bluefunnel-offer-card {
		padding: 20px 16px;
	}

	.bluefunnel-offer-headline {
		font-size: 19px;
	}

	.bluefunnel-offer-price {
		font-size: 22px;
	}

	.bluefunnel-subfields {
		flex-direction: column;
	}
}

/* ---------- Accessibility ---------- */

.bluefunnel-container a:focus-visible,
.bluefunnel-container button:focus-visible,
.bluefunnel-container input:focus-visible,
.bluefunnel-container select:focus-visible,
.bluefunnel-container textarea:focus-visible {
	outline: 2px solid var(--bf-primary);
	outline-offset: 2px;
}

.bluefunnel-admin-notice {
	padding: 12px 16px;
	background: #fffbeb;
	border: 1px solid #fde68a;
	border-radius: var(--bf-radius-sm);
	color: #92400e;
	font-size: 14px;
}
