/**
 * Simple CAPTCHA — scoped to .wpps-simple-captcha-wrap.
 * Inherit host form fonts/colors; avoid form-wide selectors.
 *
 * @package SimpleCaptcha
 */

.wpps-simple-captcha-wrap .wpps-sc-honeypot {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.wpps-simple-captcha-wrap {
	box-sizing: border-box;
	position: relative;
	margin: 0.75rem 0 1rem;
	padding: 0;
	max-width: 100%;
	clear: both;
	font: inherit;
	color: inherit;
	line-height: inherit;
}

.wpps-simple-captcha-wrap *,
.wpps-simple-captcha-wrap *::before,
.wpps-simple-captcha-wrap *::after {
	box-sizing: border-box;
}

/* Labels / text inherit theme */

.wpps-simple-captcha-wrap .wpps-captcha-label {
	display: block;
	margin: 0 0 0.4rem;
	font: inherit;
	color: inherit;
	font-weight: 600;
	line-height: 1.4;
}

/* Math: single line (label is flex so themes cannot force block + wrap) */
.wpps-simple-captcha-wrap.wpps-captcha-math .wpps-captcha-row {
	display: flex;
	flex-direction: row;
	align-items: center;
	flex-wrap: nowrap;
	gap: 0.4rem 0.6rem;
}

.wpps-simple-captcha-wrap.wpps-captcha-math .wpps-captcha-math-line {
	display: flex;
	flex-direction: row;
	align-items: center;
	flex-wrap: nowrap;
	gap: 0.4rem 0.55rem;
	margin: 0;
	font: inherit;
	color: inherit;
	font-weight: 600;
	line-height: 1.4;
	cursor: text;
}

.wpps-simple-captcha-wrap.wpps-captcha-math .wpps-captcha-math-question {
	white-space: nowrap;
}

.wpps-simple-captcha-wrap .wpps-captcha-input {
	width: auto;
	margin: 0;
	padding: 0.4rem 0.55em;
	font: inherit;
	font-size: 1em;
	line-height: 1.4;
	color: inherit;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 2px;
}

.wpps-simple-captcha-wrap.wpps-captcha-math .wpps-captcha-input {
	max-width: 5.5rem;
	width: 5.5rem;
	min-width: 3rem;
	flex: 0 0 auto;
}

/* Text: field matches full column width in common form layouts */
.wpps-simple-captcha-wrap.wpps-captcha-text .wpps-captcha-row {
	display: block;
	width: 100%;
}

.wpps-simple-captcha-wrap.wpps-captcha-text .wpps-captcha-input {
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

/* Image + refresh row */
.wpps-simple-captcha-wrap.wpps-captcha-image .wpps-captcha-image-wrap {
	display: flex;
	align-items: center;
	gap: 0.45rem 0.6rem;
	margin: 0 0 0.5rem;
	flex-wrap: nowrap;
}

.wpps-simple-captcha-wrap.wpps-captcha-image .wpps-captcha-img {
	display: block;
	width: auto;
	height: auto;
	max-width: min(300px, 100%);
	max-height: 64px;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	object-fit: contain;
	image-rendering: crisp-edges;
}

.login .wpps-simple-captcha-wrap.wpps-captcha-image .wpps-captcha-img {
	max-width: min(280px, 100%);
}

/* Default refresh control (host themes often style `button` aggressively) */
.wpps-simple-captcha-wrap.wpps-captcha-image .wpps-captcha-refresh {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	margin: 0;
	padding: 0.1rem 0.35rem;
	width: 2.1rem;
	height: 2.1rem;
	min-width: 0;
	min-height: 0;
	max-width: 2.5rem;
	background: #f0f0f1;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	cursor: pointer;
	font: inherit;
	font-size: 1.05em;
	line-height: 1;
	color: #1d2327;
	box-shadow: none;
}

.wpps-simple-captcha-wrap.wpps-captcha-image .wpps-captcha-refresh:hover {
	background: #dcdcde;
}

/* Elementor: undo builder button styles on refresh */
form.elementor-form .wpps-simple-captcha-wrap .wpps-captcha-refresh,
.elementor-form .wpps-simple-captcha-wrap .wpps-captcha-refresh {
	border-radius: 4px;
	padding: 0.1rem 0.35rem;
	font-family: inherit;
	font-size: 1.05em;
	font-weight: 400;
	text-transform: none;
	letter-spacing: normal;
	line-height: 1;
	border: 1px solid #c3c4c7;
	background: #f0f0f1;
	color: #1d2327;
	min-height: 0;
	width: 2.1rem;
	height: 2.1rem;
}

form.elementor-form .wpps-simple-captcha-wrap .wpps-captcha-refresh::before,
form.elementor-form .wpps-simple-captcha-wrap .wpps-captcha-refresh::after,
.elementor-form .wpps-simple-captcha-wrap .wpps-captcha-refresh::before,
.elementor-form .wpps-simple-captcha-wrap .wpps-captcha-refresh::after {
	content: none !important;
	display: none !important;
}

.wpps-simple-captcha-wrap.wpps-captcha-image .wpps-captcha-row {
	display: block;
	width: 100%;
}

.wpps-simple-captcha-wrap.wpps-captcha-image .wpps-captcha-input {
	width: 100%;
	max-width: 100%;
}

/* ——— Full-width text + inputs on third-party forms ——— */

.woocommerce .wpps-simple-captcha-wrap.wpps-captcha-text .wpps-captcha-input,
.woocommerce .wpps-simple-captcha-wrap.wpps-captcha-image .wpps-captcha-input,
form.woocommerce-form .wpps-simple-captcha-wrap .wpps-captcha-input,
form.woocommerce-form-login .wpps-simple-captcha-wrap .wpps-captcha-input,
form.woocommerce-form-register .wpps-simple-captcha-wrap .wpps-captcha-input {
	width: 100%;
	max-width: 100%;
}

.frm-fluent-form .wpps-simple-captcha-wrap.wpps-captcha-text .wpps-captcha-input,
.frm-fluent-form .wpps-simple-captcha-wrap.wpps-captcha-image .wpps-captcha-input,
form.frm-fluent-form .wpps-simple-captcha-wrap .wpps-captcha-input,
form[action*="fluentform"] .wpps-simple-captcha-wrap .wpps-captcha-input,
form.fluentform .wpps-simple-captcha-wrap .wpps-captcha-input,
.ff-el-form .wpps-simple-captcha-wrap .wpps-captcha-input {
	width: 100% !important;
	max-width: 100% !important;
}

form.elementor-form .wpps-simple-captcha-wrap.wpps-captcha-text .wpps-captcha-input,
form.elementor-form .wpps-simple-captcha-wrap.wpps-captcha-image .wpps-captcha-input,
.elementor-field-type-wpps_simple_captcha .wpps-captcha-input {
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box;
}

/* Basic Forms: match design variables when present */
.wpps-bf-form .wpps-simple-captcha-wrap,
.wpps-bf-form .wpps-simple-captcha-wrap .wpps-captcha-label {
	font-family: var(--wpps-bf-label-font, inherit);
	font-size: var(--wpps-bf-label-fs, inherit);
	font-weight: var(--wpps-bf-label-fw, 600);
	color: var(--wpps-bf-label-color, inherit);
}

.wpps-bf-form .wpps-simple-captcha-wrap .wpps-captcha-input,
.wpps-bf-form .wpps-simple-captcha-wrap .wpps-captcha-math-line,
.wpps-bf-form .wpps-simple-captcha-wrap .wpps-captcha-math-question {
	font-family: var(--wpps-bf-field-font, inherit);
	font-size: var(--wpps-bf-input-fs, 1em);
	font-weight: var(--wpps-bf-field-fw, normal);
	color: var(--wpps-bf-field-color, inherit);
	line-height: var(--wpps-bf-field-lh, 1.4);
}

.wpps-bf-form .wpps-simple-captcha-wrap .wpps-captcha-input {
	width: 100%;
	max-width: 100%;
	border: var(--wpps-bf-input-border, 1px solid #c3c4c7);
	background: var(--wpps-bf-input-bg, #fff);
	border-radius: var(--wpps-bf-input-radius, var(--wpps-bf-radius, 4px));
	padding: var(--wpps-bf-input-pad, 0.5rem 0.75rem);
}

/* Login form (core + Woo) */
.login .wpps-simple-captcha-wrap .wpps-captcha-input,
#loginform .wpps-simple-captcha-wrap .wpps-captcha-input {
	width: 100%;
	max-width: 100%;
}

.login .wpps-simple-captcha-wrap.wpps-captcha-math .wpps-captcha-input,
#loginform .wpps-simple-captcha-wrap.wpps-captcha-math .wpps-captcha-input {
	width: 5.5rem;
	max-width: 6.5rem;
}

.wpps-simple-captcha-elementor-slot {
	min-width: 0;
}

/* Basic Forms: take full row inside flex form layout */
.wpps-bf-form > .wpps-simple-captcha-wrap,
.wpps-bf-form .wpps-simple-captcha-wrap {
	flex: 1 0 100%;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0;
	align-self: stretch;
}

/* Elementor Form widget: field column */
.elementor-widget-form .elementor-field-type-wpps_simple_captcha,
form.elementor-form .elementor-field-type-wpps_simple_captcha,
.elementor-field-group.elementor-field-type-wpps_simple_captcha {
	width: 100% !important;
	max-width: 100%;
}

/* More integrations */
.wpcf7-form .wpps-simple-captcha-wrap.wpps-captcha-text .wpps-captcha-input,
.wpcf7-form .wpps-simple-captcha-wrap.wpps-captcha-image .wpps-captcha-input,
#commentform .wpps-simple-captcha-wrap .wpps-captcha-input,
form.wpforms-validate .wpps-simple-captcha-wrap .wpps-captcha-input,
form.wpforms-form .wpps-simple-captcha-wrap .wpps-captcha-input,
body .gform_wrapper .wpps-simple-captcha-wrap .wpps-captcha-input {
	width: 100% !important;
	max-width: 100% !important;
	box-sizing: border-box;
}
