/* CWHost FormsPro - form styling.
   Colors, corner roundness and font come from the Settings page
   (they are added as CSS variables on .cwfp-form-wrap). */

.cwfp-form-wrap {
	margin: 1.5em 0;
	font-family: var(--cwfp-font, inherit);
}

.cwfp-form-wrap *,
.cwfp-form-wrap *::before,
.cwfp-form-wrap *::after {
	box-sizing: border-box;
}

.cwfp-form .cwfp-field {
	margin: 0 0 1.25em;
}

.cwfp-form .cwfp-label {
	display: block;
	margin: 0 0 0.35em;
	padding: 0;
	font-weight: 600;
}

.cwfp-form .cwfp-required {
	color: var(--cwfp-error, #b32d2e);
}

.cwfp-form fieldset {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.cwfp-form input[type="text"],
.cwfp-form input[type="email"],
.cwfp-form input[type="tel"],
.cwfp-form input[type="number"],
.cwfp-form input[type="date"],
.cwfp-form input[type="file"],
.cwfp-form select,
.cwfp-form textarea {
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0.65em 0.8em;
	font: inherit;
	line-height: 1.4;
	color: inherit;
	background: #fff;
	border: 1px solid var(--cwfp-field-border, #8c8f94);
	border-radius: var(--cwfp-field-radius, 4px);
}

.cwfp-form textarea {
	min-height: 8em;
	resize: vertical;
}

.cwfp-form input:focus,
.cwfp-form select:focus,
.cwfp-form textarea:focus,
.cwfp-form .cwfp-submit:focus {
	outline: 2px solid var(--cwfp-button-bg, #2271b1);
	outline-offset: 1px;
}

.cwfp-form .cwfp-choice {
	display: flex;
	align-items: center;
	gap: 0.5em;
	margin: 0.35em 0;
	font-weight: 400;
	cursor: pointer;
}

.cwfp-form .cwfp-choice input {
	flex: none;
	width: auto;
	margin: 0;
}

.cwfp-form .cwfp-help {
	margin-top: 0.35em;
	font-size: 0.875em;
	opacity: 0.8;
}

.cwfp-form .cwfp-error {
	margin-top: 0.35em;
	font-size: 0.875em;
	color: var(--cwfp-error, #b32d2e);
}

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

.cwfp-form .cwfp-field.has-error input,
.cwfp-form .cwfp-field.has-error select,
.cwfp-form .cwfp-field.has-error textarea {
	border-color: var(--cwfp-error, #b32d2e);
}

.cwfp-form .cwfp-submit {
	padding: 0.7em 1.6em;
	font: inherit;
	font-weight: 600;
	color: var(--cwfp-button-text, #fff);
	background: var(--cwfp-button-bg, #2271b1);
	border: 0;
	border-radius: var(--cwfp-button-radius, 4px);
	cursor: pointer;
}

.cwfp-form .cwfp-submit:hover {
	filter: brightness(0.92);
}

.cwfp-form .cwfp-submit[disabled] {
	opacity: 0.6;
	cursor: wait;
}

.cwfp-form .cwfp-messages:empty {
	display: none;
}

.cwfp-form .cwfp-messages {
	margin: 0 0 1em;
	padding: 0.8em 1em;
	border-radius: var(--cwfp-field-radius, 4px);
}

.cwfp-form .cwfp-messages.is-success {
	color: #1e4620;
	background: #edfaef;
	border: 1px solid #68b36b;
}

.cwfp-form .cwfp-messages.is-error {
	color: #8a1f20;
	background: #fcf0f1;
	border: 1px solid #d63638;
}

/* After a successful send, only the thank-you message stays visible. */
.cwfp-form.is-submitted > *:not(.cwfp-messages) {
	display: none;
}

/* Anti-spam trap field: invisible to people, but still in the page for bots to find. */
.cwfp-form .cwfp-hp {
	position: absolute !important;
	left: -9999px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

.cwfp-form .cwfp-captcha {
	margin: 0 0 1.25em;
}

.cwfp-form .cwfp-consent {
	align-items: flex-start;
}

.cwfp-form .cwfp-consent input {
	margin-top: 0.3em;
}

/* ---------- Phase 6: logic, pages, repeater, signature, save and resume ---------- */

/* The "hidden" attribute and fields switched off by conditional logic must win over theme styles. */
.cwfp-form [hidden],
.cwfp-form .cwfp-logic-hidden {
	display: none !important;
}

.cwfp-form .cwfp-progress {
	margin: 0 0 1.25em;
}

.cwfp-form .cwfp-progress-text {
	margin: 0 0 0.4em;
	font-size: 0.875em;
	font-weight: 600;
}

.cwfp-form .cwfp-progress-bar {
	height: 6px;
	overflow: hidden;
	background: rgba(0, 0, 0, 0.12);
	border-radius: 3px;
}

.cwfp-form .cwfp-progress-bar span {
	display: block;
	width: 0;
	height: 100%;
	background: var(--cwfp-button-bg, #2271b1);
	transition: width 0.25s ease;
}

.cwfp-form .cwfp-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6em;
}

.cwfp-form .cwfp-next,
.cwfp-form .cwfp-back,
.cwfp-form .cwfp-repeater-add,
.cwfp-form .cwfp-save-send,
.cwfp-form .cwfp-signature-clear {
	padding: 0.6em 1.3em;
	font: inherit;
	font-weight: 600;
	color: var(--cwfp-button-text, #fff);
	background: var(--cwfp-button-bg, #2271b1);
	border: 0;
	border-radius: var(--cwfp-button-radius, 4px);
	cursor: pointer;
}

.cwfp-form .cwfp-back,
.cwfp-form .cwfp-repeater-add,
.cwfp-form .cwfp-signature-clear,
.cwfp-form .cwfp-save-cancel {
	color: inherit;
	background: transparent;
	border: 1px solid var(--cwfp-field-border, #8c8f94);
}

.cwfp-form .cwfp-next:focus,
.cwfp-form .cwfp-back:focus,
.cwfp-form .cwfp-repeater-add:focus,
.cwfp-form .cwfp-repeater-remove:focus,
.cwfp-form .cwfp-signature-clear:focus,
.cwfp-form .cwfp-save-link:focus,
.cwfp-form .cwfp-save-send:focus,
.cwfp-form .cwfp-save-cancel:focus {
	outline: 2px solid var(--cwfp-button-bg, #2271b1);
	outline-offset: 1px;
}

.cwfp-form button[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Repeating rows */
.cwfp-form .cwfp-repeater-head,
.cwfp-form .cwfp-repeater-row {
	display: grid;
	grid-template-columns: repeat(var(--cwfp-cols, 1), minmax(0, 1fr)) 2.4em;
	gap: 0.5em;
	align-items: center;
}

.cwfp-form .cwfp-repeater-head {
	margin: 0 0 0.3em;
	font-size: 0.85em;
	font-weight: 600;
}

.cwfp-form .cwfp-repeater-row {
	margin: 0 0 0.5em;
}

.cwfp-form .cwfp-repeater-remove {
	padding: 0;
	font-size: 1.4em;
	line-height: 1;
	color: var(--cwfp-error, #b32d2e);
	background: transparent;
	border: 0;
	cursor: pointer;
}

.cwfp-form .cwfp-repeater-add {
	margin-top: 0.3em;
}

@media (max-width: 520px) {
	.cwfp-form .cwfp-repeater-head {
		display: none;
	}

	.cwfp-form .cwfp-repeater-row {
		grid-template-columns: 1fr 2.4em;
		padding: 0.6em;
		border: 1px solid rgba(0, 0, 0, 0.15);
		border-radius: var(--cwfp-field-radius, 4px);
	}

	.cwfp-form .cwfp-repeater-row input {
		grid-column: 1;
	}

	.cwfp-form .cwfp-repeater-remove {
		grid-column: 2;
		grid-row: 1;
	}
}

/* Signature */
.cwfp-form .cwfp-signature-pad {
	display: block;
	width: 100%;
	height: 160px;
	background: #fff;
	border: 1px solid var(--cwfp-field-border, #8c8f94);
	border-radius: var(--cwfp-field-radius, 4px);
	cursor: crosshair;
	touch-action: none;
}

.cwfp-form .cwfp-signature-clear {
	margin-top: 0.5em;
}

.cwfp-form .cwfp-field.has-error .cwfp-signature-pad {
	border-color: var(--cwfp-error, #b32d2e);
}

/* Save and continue later */
.cwfp-form .cwfp-save {
	margin-top: 1em;
}

.cwfp-form .cwfp-save-link {
	padding: 0;
	font: inherit;
	color: inherit;
	text-decoration: underline;
	background: none;
	border: 0;
	cursor: pointer;
}

.cwfp-form .cwfp-save-panel {
	margin-top: 0.6em;
	padding: 0.9em;
	border: 1px solid rgba(0, 0, 0, 0.15);
	border-radius: var(--cwfp-field-radius, 4px);
}

.cwfp-form .cwfp-save-label {
	display: block;
	margin: 0 0 0.6em;
	font-weight: 600;
}

.cwfp-form .cwfp-save-label input {
	margin-top: 0.3em;
	font-weight: 400;
}

.cwfp-form .cwfp-save-note {
	margin-top: 0.6em;
	font-size: 0.9em;
}

.cwfp-form .cwfp-save-note.is-success {
	color: #1e4620;
}

.cwfp-form .cwfp-save-note.is-error {
	color: var(--cwfp-error, #b32d2e);
}

/* ---------- Phase 7: calculation ---------- */
.cwfp-form .cwfp-calc-output {
	display: block;
	padding: 0.55em 0.75em;
	font-weight: 700;
	background: rgba(0, 0, 0, 0.04);
	border: 1px solid var(--cwfp-field-border, #8c8f94);
	border-radius: var(--cwfp-field-radius, 4px);
	min-height: 1.5em;
}

/* Views (tables of entries) */
.cwfp-view-scroll { overflow-x: auto; }
.cwfp-view-table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.cwfp-view-table th, .cwfp-view-table td { text-align: left; padding: .5em .7em; border-bottom: 1px solid rgba(0,0,0,.12); vertical-align: top; }
.cwfp-view-search { margin: 0 0 1em; }
.cwfp-view-pages .cwfp-view-page { display: inline-block; padding: .2em .6em; margin-right: .2em; border: 1px solid rgba(0,0,0,.2); border-radius: 3px; text-decoration: none; }
.cwfp-view-pages .current { font-weight: 700; background: rgba(0,0,0,.06); }
.cwfp-view-notice { padding: 10px 14px; margin: 10px 0; border: 1px solid rgba(0,0,0,.2); }
@media (max-width: 600px) {
	.cwfp-view-table thead { position: absolute; left: -9999px; }
	.cwfp-view-table tr { display: block; margin-bottom: 1em; border: 1px solid rgba(0,0,0,.12); }
	.cwfp-view-table td { display: block; border-bottom: 0; }
	.cwfp-view-table td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; }
}

.cwfp-notice-pay { padding: 10px 14px; margin: 10px 0; border: 1px solid rgba(0,0,0,.2); }
