/**
 * استایل ویجت کپچا — یک ردیف فشرده و روشن.
 * ارتفاع ردیف فقط با --jfc-h کنترل می‌شود.
 */

.jfc-captcha {
	--jfc-border: #d0d5dd;
	--jfc-accent: #2563eb;
	--jfc-error: #d92c20;
	--jfc-radius: 8px;
	--jfc-h: 44px;
	--jfc-focus: rgba(37, 99, 235, 0.15);
	--jfc-q-bg: #f3f4f6;
	--jfc-field-bg: #ffffff;
	--jfc-ink: #111827;
	--jfc-muted: #667085;
	--jfc-input-w: 7.5rem;
	color-scheme: light;
	position: relative;
	margin: 0;
	width: fit-content;
	max-width: 100%;
	direction: rtl;
	text-align: right;
	font-family: inherit;
	color: var(--jfc-ink);
	background: transparent;
	box-sizing: border-box;
}

.jfc-captcha *,
.jfc-captcha *::before,
.jfc-captcha *::after {
	box-sizing: border-box;
}

/* کارت فقط ظرف ردیف است؛ بدون پس‌زمینه و سایه. */
.jfc-captcha .jfc-card {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-start;
	gap: 8px;
	width: fit-content;
	max-width: 100%;
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	overflow: visible;
	position: relative;
}

.jfc-captcha .jfc-card::before {
	content: none;
}

/* سربرگ برای صفحه‌خوان می‌ماند و از دید پنهان است. */
.jfc-captcha .jfc-head {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.jfc-captcha .jfc-badge,
.jfc-captcha .jfc-copy,
.jfc-captcha .jfc-title,
.jfc-captcha .jfc-hint {
	margin: 0;
	color: var(--jfc-ink);
}

.jfc-captcha .jfc-question {
	flex: 0 0 auto !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: auto !important;
	max-width: 16rem;
	min-width: 0;
	height: auto;
	min-height: var(--jfc-h);
	margin: 0 !important;
	padding: 8px 14px;
	float: none !important;
	background: var(--jfc-q-bg) !important;
	color: var(--jfc-ink) !important;
	border: 1px solid var(--jfc-border);
	border-radius: var(--jfc-radius);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.35;
	white-space: normal;
	overflow: visible;
	box-sizing: border-box;
}

.jfc-captcha .jfc-q {
	margin: 0;
	min-width: 0;
	max-width: 100%;
	color: var(--jfc-ink);
	overflow: visible;
	white-space: normal;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.jfc-captcha .jfc-q[dir="ltr"] {
	direction: rtl;
	unicode-bidi: isolate;
	text-align: right;
}

.jfc-captcha .jfc-q[dir="rtl"] {
	direction: rtl;
	unicode-bidi: isolate;
	text-align: right;
}

.jfc-captcha .jfc-row {
	flex: 0 0 auto !important;
	display: flex !important;
	flex-wrap: nowrap !important;
	align-items: center;
	gap: 8px;
	width: auto !important;
	max-width: 100%;
	margin: 0 !important;
	padding: 0;
	float: none !important;
}

.jfc-captcha input.jfc-answer,
.jfc-captcha .jfc-answer {
	flex: 0 0 var(--jfc-input-w) !important;
	width: var(--jfc-input-w) !important;
	min-width: var(--jfc-input-w) !important;
	max-width: var(--jfc-input-w) !important;
	height: var(--jfc-h) !important;
	min-height: var(--jfc-h) !important;
	max-height: var(--jfc-h) !important;
	margin: 0 !important;
	padding: 0 12px !important;
	float: none !important;
	background: var(--jfc-field-bg) !important;
	color: var(--jfc-ink) !important;
	border: 1px solid var(--jfc-border) !important;
	border-radius: var(--jfc-radius);
	box-shadow: none !important;
	box-sizing: border-box;
	font-family: inherit;
	font-size: 15px !important;
	font-weight: 400;
	line-height: var(--jfc-h);
	text-align: right;
	outline: 0;
	appearance: none;
	-webkit-appearance: none;
	color-scheme: light;
}

.jfc-captcha .jfc-answer::placeholder {
	color: var(--jfc-muted) !important;
	opacity: 1;
}

.jfc-captcha .jfc-answer:focus,
.jfc-captcha .jfc-answer:focus-visible {
	outline: 0;
	border-color: var(--jfc-accent) !important;
	box-shadow: 0 0 0 3px var(--jfc-focus) !important;
}

.jfc-captcha button.jfc-refresh,
.jfc-captcha .jfc-refresh {
	flex: 0 0 var(--jfc-h) !important;
	display: grid !important;
	place-items: center;
	width: var(--jfc-h) !important;
	min-width: var(--jfc-h) !important;
	max-width: var(--jfc-h) !important;
	height: var(--jfc-h) !important;
	min-height: var(--jfc-h) !important;
	max-height: var(--jfc-h) !important;
	margin: 0 !important;
	padding: 0 !important;
	float: none !important;
	background: var(--jfc-field-bg) !important;
	background-image: none !important;
	color: var(--jfc-muted) !important;
	border: 1px solid var(--jfc-border) !important;
	border-radius: var(--jfc-radius);
	box-shadow: none !important;
	cursor: pointer;
	line-height: 1;
	font-size: inherit;
	text-decoration: none;
	appearance: none;
	-webkit-appearance: none;
	color-scheme: light;
	transition: color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.jfc-captcha .jfc-refresh:hover,
.jfc-captcha .jfc-refresh:focus-visible {
	color: var(--jfc-accent) !important;
	border-color: var(--jfc-accent) !important;
	outline: 0;
	background: var(--jfc-field-bg) !important;
}

.jfc-captcha .jfc-refresh:focus-visible {
	box-shadow: 0 0 0 3px var(--jfc-focus) !important;
}

.jfc-captcha .jfc-refresh svg {
	width: 18px;
	height: 18px;
	display: block;
	pointer-events: none;
}

.jfc-captcha .jfc-status {
	flex: 0 0 100%;
	width: 100%;
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 0;
	font-size: 13px;
	line-height: 1.6;
	font-weight: 400;
	color: var(--jfc-error);
}

.jfc-captcha .jfc-status[hidden] {
	display: none !important;
}

.jfc-captcha .jfc-status.is-open {
	display: block !important;
}

.jfc-captcha .jfc-noscript {
	margin: 0 0 8px;
	padding: 0;
	font-size: 13px;
	line-height: 1.6;
	color: var(--jfc-error);
	background: none;
	border: 0;
}

/* بدون left منفی تا اسکرول افقی صفحه ساخته نشود. */
.jfc-captcha .jfc-hp-wrap {
	position: absolute !important;
	left: 0;
	top: 0;
	width: 1px !important;
	height: 1px !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
	pointer-events: none;
}

.jfc-captcha .jfc-hp {
	position: absolute !important;
	left: 0 !important;
	top: 0 !important;
	width: 1px !important;
	height: 1px !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	clip-path: inset(50%) !important;
	opacity: 0 !important;
	pointer-events: none !important;
	border: 0 !important;
}

.jfc-captcha input[type="hidden"] {
	position: absolute;
	width: 0;
	height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	opacity: 0;
	pointer-events: none;
}

.jfc-captcha.is-error .jfc-answer {
	border-color: var(--jfc-error) !important;
	animation: jfc-shake 0.42s ease;
}

.jfc-captcha.is-error .jfc-status {
	color: var(--jfc-error);
}

.jfc-captcha.is-success .jfc-answer {
	border-color: #067647 !important;
}

.jfc-captcha.is-success .jfc-status {
	color: #067647;
}

@keyframes jfc-shake {
	0%,
	100% {
		transform: translateX(0);
	}
	25% {
		transform: translateX(4px);
	}
	50% {
		transform: translateX(-4px);
	}
	75% {
		transform: translateX(3px);
	}
}

.jfc-captcha.is-loading .jfc-answer,
.jfc-captcha.is-loading .jfc-refresh {
	opacity: 0.65;
	pointer-events: none;
}

.jfc-captcha.is-loading .jfc-question {
	color: transparent !important;
	background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%) !important;
	background-size: 400% 100%;
	animation: jfc-pulse 1.15s ease infinite;
	border-style: solid;
	border-color: var(--jfc-border);
}

@keyframes jfc-pulse {
	0% {
		background-position: 100% 0;
	}
	100% {
		background-position: 0 0;
	}
}

@media (max-width: 360px) {
	.jfc-captcha {
		--jfc-input-w: 6.25rem;
	}

	.jfc-captcha .jfc-question {
		padding: 6px 8px;
		font-size: 14px;
		max-width: 42vw;
	}

	.jfc-captcha input.jfc-answer,
	.jfc-captcha .jfc-answer {
		padding: 0 8px !important;
		font-size: 14px !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	.jfc-captcha.is-error .jfc-answer,
	.jfc-captcha.is-loading .jfc-question {
		animation: none;
	}
}

/* فاصلهٔ ملایم در فرم‌های هسته تا به دکمهٔ ارسال نچسبد. */
.login .jfc-captcha,
#login .jfc-captcha,
.woocommerce-form .jfc-captcha,
.comment-form .jfc-captcha,
.jet-form-builder .jfc-captcha {
	margin: 8px 0 12px;
	width: fit-content;
	max-width: 100%;
}
