/**
 * Public form styles for TN 39 Form Builder.
 *
 * @package Top_Form_Builder
 */

.tn-39-form-wrapper {
	max-width: 100%;
	margin: 20px 0;
}

.tn-39-form-form {
	display: grid;
	grid-template-columns: repeat(12, 1fr);
	gap: 20px;
}

.form-field {
	grid-column: span 12;
	margin-bottom: 0;
}

.form-field.tn39-col-50 {
	grid-column: span 6;
}

.form-field.tn39-col-33 {
	grid-column: span 4;
}

.form-field label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
	color: #333;
}

.form-field .required {
	color: #d63638;
	margin-left: 3px;
}

.form-control {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
	font-size: 14px;
	line-height: 1.5;
	transition: border-color 0.2s;
}

.form-control:focus {
	outline: none;
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

.form-control:focus::placeholder {
	color: transparent;
}

.form-control:focus::-webkit-input-placeholder {
	color: transparent;
}

.form-control:required {
	border-left: 3px solid #2271b1;
}

textarea.form-control {
	resize: vertical;
	min-height: 100px;
}

select.form-control {
	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='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 12px;
	padding-right: 35px;
	appearance: none;
}

.radio-group,
.checkbox-group {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.radio-label,
.checkbox-label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: normal;
	cursor: pointer;
}

.radio-label input[type="radio"],
.checkbox-label input[type="checkbox"] {
	width: auto;
	margin: 0;
	cursor: pointer;
}

.form-field-html {
	padding: 15px;
	background: #f9f9f9;
	border: 1px solid #dcdcde;
	border-radius: 4px;
}

.form-field-submit {
	margin-top: 10px;
	display: flex;
	justify-content: flex-start;
}

.tn-39-form-submit-button {
	background: #2271b1;
	color: #fff;
	border: none;
	padding: 12px 24px;
	font-size: 16px;
	font-weight: 600;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.2s;
}

.tn-39-form-submit-button:hover {
	background: #135e96;
}

/* Submit button styling is handled by .tn-39-form-submit-button */

.tn-39-form-submit-button:disabled {
	background: #8c8f94;
	cursor: not-allowed;
}

.tn-39-form-message {
	grid-column: 1 / -1;
	padding: 12px 15px;
	border-radius: 4px;
	margin: 0 0 15px 0;
}

.tn-39-form-message.success {
	background: #00a32a;
	color: #fff;
}

.tn-39-form-message.error {
	background: #d63638;
	color: #fff;
}

.help-text {
	display: block;
	margin-top: 5px;
	font-size: 13px;
	color: #646970;
}

.privacy-policy-label .tn39-privacy-link {
	color: var(--tn39-privacy-link-color, #2271b1);
	text-decoration: underline;
	cursor: pointer;
}

.privacy-policy-label .tn39-privacy-link:hover,
.privacy-policy-label .tn39-privacy-link:focus {
	text-decoration: none;
}

.form-field-recaptcha {
	margin: 20px 0;
}

.form-field-honeypot {
	position: absolute;
	left: -9999px;
	visibility: hidden;
}

.math-captcha-wrapper {
	margin-bottom: 20px;
}

.math-captcha-input {
	max-width: 160px;
}

.tn39-math-captcha-row {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	padding: 0;
	background: transparent;
	border: none;
	border-radius: 0;
}

.tn39-math-captcha-prompt {
	font-weight: 600;
	color: #111;
}

.tn39-math-captcha-question {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
	font-weight: 700;
	color: #2271b1;
}

.google-recaptcha-wrapper {
	margin: 20px 0;
}

.tn39-recaptcha-prompt {
	margin-bottom: 8px;
	font-weight: 600;
	color: #333;
}

.recaptcha-v3-badge {
	margin-top: 10px;
	font-size: 11px;
	color: #646970;
}

/* Responsive */
@media screen and (max-width: 768px) {
	.tn-39-form-form {
		gap: 15px;
	}

	.form-field {
		grid-column: span 12;
	}

	.form-control {
		font-size: 16px; /* Prevents zoom on iOS */
	}
}

/* Accessibility */
.form-control:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.tn-39-form-submit-button:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* Print styles */
@media print {
	.tn-39-form-form {
		display: none;
	}
}
