/* Journey Form Builder — front-end styles */

/* Containers: never allow the form to widen the page (important on RTL + mobile). */
.jfb-widget,
.jfb-form-wrap,
.jfb-form,
.jfb-fields {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

.jfb-widget {
	overflow-x: hidden;
	overflow-x: clip;
}

.jfb-form {
	--jfb-gap: 18px;
	position: relative;
	display: flex;
	flex-direction: column;
	margin-left: auto;
	margin-right: auto;
}

.jfb-title {
	margin: 0 0 8px;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.jfb-desc {
	margin: 0 0 18px;
	font-size: 15px;
	line-height: 1.5;
	overflow-wrap: anywhere;
}

/* Fields grid */
.jfb-fields {
	display: flex;
	flex-wrap: wrap;
	gap: var(--jfb-gap);
	margin-bottom: var(--jfb-gap);
}

.jfb-field {
	display: flex;
	flex-direction: column;
	min-width: 0;
	max-width: 100%;
	box-sizing: border-box;
}

.jfb-w-100 { flex: 0 0 100%; }
.jfb-w-50  { flex: 0 0 calc(50% - (var(--jfb-gap) / 2)); }
.jfb-w-33  { flex: 0 0 calc(33.3333% - (var(--jfb-gap) * 2 / 3)); }
.jfb-w-25  { flex: 0 0 calc(25% - (var(--jfb-gap) * 3 / 4)); }

/* Label position */
.jfb-form[data-jfb-label-pos="inline"] .jfb-field {
	flex-direction: row;
	align-items: center;
	gap: 10px;
}
.jfb-form[data-jfb-label-pos="inline"] .jfb-label { margin-bottom: 0; flex: 0 0 auto; }
.jfb-form[data-jfb-label-pos="inline"] .jfb-input,
.jfb-form[data-jfb-label-pos="inline"] .jfb-textarea,
.jfb-form[data-jfb-label-pos="inline"] .jfb-select { flex: 1; min-width: 0; }
.jfb-form[data-jfb-label-pos="hidden"] .jfb-label { display: none; }

.jfb-label {
	margin-bottom: 6px;
	font-size: 15px;
	font-weight: 600;
	overflow-wrap: anywhere;
}
.jfb-req { color: #c62828; }

/* Inputs */
.jfb-input,
.jfb-textarea,
.jfb-select {
	display: block;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
	padding: 12px 14px;
	font-size: 15px;
	line-height: 1.4;
	color: #333;
	background-color: #fff;
	border: 1px solid #d9d9d9;
	border-radius: 8px;
	outline: none;
	transition: border-color .2s ease, box-shadow .2s ease;
}
.jfb-textarea { resize: vertical; min-height: 110px; }
.jfb-select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, #999 50%), linear-gradient(135deg, #999 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 36px; }

/* Choices */
.jfb-choices {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-top: 4px;
	min-width: 0;
}
.jfb-choice {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 15px;
	line-height: 1.4;
	cursor: pointer;
	overflow-wrap: anywhere;
}
.jfb-choice input { margin-top: 3px; flex: 0 0 auto; }
.jfb-consent { align-items: flex-start; }

/* File */
.jfb-file {
	padding: 10px;
	border: 1px dashed #c9c9c9;
	border-radius: 8px;
	background: #fafafa;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
	font-size: 14px;
}

/* Rating */
.jfb-rating { display: inline-flex; flex-wrap: wrap; gap: 2px; }
.jfb-star {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 26px;
	line-height: 1;
	padding: 0 2px;
	color: #d5d5d5;
	transition: color .15s ease, transform .1s ease;
}
.jfb-star.jfb-star-hover,
.jfb-star.jfb-star-active { color: #f5b301; }
.jfb-star:hover { transform: scale(1.15); }

/* Heading / divider */
.jfb-heading {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	padding-top: 6px;
}
.jfb-heading-text {
	font-size: 17px;
	font-weight: 700;
	white-space: normal;
	overflow-wrap: anywhere;
}
.jfb-heading::after {
	content: "";
	flex: 1 1 40px;
	height: 1px;
	background: #e0e0e0;
}

.jfb-help {
	margin-top: 6px;
	font-size: 13px;
	opacity: .75;
	overflow-wrap: anywhere;
}

/* Actions + submit */
.jfb-actions { display: flex; max-width: 100%; }
.jfb-submit {
	display: inline-block;
	max-width: 100%;
	cursor: pointer;
	padding: 14px 32px;
	font-size: 16px;
	font-weight: 600;
	color: #fff;
	background-color: #1d3b53;
	border: none;
	border-radius: 8px;
	transition: opacity .2s ease, background-color .2s ease;
}
.jfb-submit[disabled] { opacity: .7; cursor: default; }

/* Messages */
.jfb-message {
	display: none;
	margin-bottom: 16px;
	padding: 12px 14px;
	border-radius: 8px;
	font-size: 15px;
	overflow-wrap: anywhere;
}
.jfb-message.jfb-success { display: block; background-color: #e8f5e9; color: #2e7d32; }
.jfb-message.jfb-error { display: block; background-color: #fdecea; color: #c62828; }

/* Honeypot: visually hidden without negative offsets (negative offsets break RTL/mobile width). */
.jfb-hp {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	clip-path: inset(50%) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Responsive: stack on small screens */
@media (max-width: 767px) {
	.jfb-w-50,
	.jfb-w-33,
	.jfb-w-25 { flex: 0 0 100%; }

	.jfb-form[data-jfb-label-pos="inline"] .jfb-field {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}
	.jfb-form[data-jfb-label-pos="inline"] .jfb-label { margin-bottom: 6px; }

	.jfb-input,
	.jfb-textarea,
	.jfb-select,
	.jfb-file {
		font-size: 16px; /* prevents iOS auto-zoom on focus */
	}

	.jfb-actions,
	.jfb-submit { width: 100%; }
	.jfb-submit { text-align: center; }
}
