/* =========================================================
   Giel CF7 Validation UX
   ========================================================= */

/* Invalid native CF7 controls */
.wpcf7 form .wpcf7-not-valid:not([type="hidden"]),
.wpcf7 form input.wpcf7-not-valid:not([type="hidden"]),
.wpcf7 form textarea.wpcf7-not-valid,
.wpcf7 form select.wpcf7-not-valid {
	border: 2px solid #d63638 !important;
	background-color: #fffafa !important;
	box-shadow: none !important;
}

/* The CF7 validation message directly below a field */
.wpcf7 form .wpcf7-not-valid-tip {
	margin: 5px 0 0 !important;
	padding: 6px 9px !important;
	border-radius: 5px !important;
	background: #d63638 !important;
	color: #fff !important;
	font-size: 12px !important;
	font-weight: 600 !important;
	line-height: 1.3 !important;
}

/*
 * Some custom CF7 controls (including Giel CF7 Chunked Uploads) keep an
 * empty validation-tip element in the DOM at all times. Keep empty tips
 * completely hidden so they do not become a red bar.
 */
.wpcf7 form .wpcf7-not-valid-tip:empty,
.wpcf7 form .gcf7cu-error:empty {
	display: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: transparent !important;
}

.wpcf7 form .wpcf7-not-valid-tip:not(:empty) {
	display: block !important;
}

/* Custom controls that validate via a hidden input:
   do not paint the whole label/block; only keep a subtle red outline
   on the visible control wrapper when needed. */
@supports selector(.wpcf7-form-control-wrap:has(input[type="hidden"].wpcf7-not-valid)) {
	.wpcf7 form .wpcf7-form-control-wrap:has(input[type="hidden"].wpcf7-not-valid) {
		display: block;
		border-radius: 7px;
		outline: 2px solid #d63638;
		outline-offset: 3px;
	}
}

/* Give auto-scroll some breathing room below sticky site headers */
.wpcf7 form .wpcf7-not-valid,
.wpcf7 form .wpcf7-not-valid-tip,
.wpcf7 form label {
	scroll-margin-top: 125px;
}

/* Main CF7 response: still available, but more noticeable if user reaches it */
.wpcf7 form .wpcf7-response-output {
	margin: 12px 0 0 !important;
	padding: 10px 12px !important;
	border-radius: 6px !important;
	font-size: 13px !important;
	line-height: 1.35 !important;
}

/* Floating validation notice */
#giel-cf7-validation-toast {
	position: fixed;
	top: 12px;
	left: 50%;
	transform: translate(-50%, -16px);
	width: calc(100% - 32px);
	max-width: 480px;
	box-sizing: border-box;
	padding: 12px 16px;
	border-radius: 7px;
	background: #d63638;
	color: #fff;
	text-align: center;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	z-index: 999999;
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
	transition:
		opacity .18s ease,
		transform .18s ease,
		visibility .18s ease;
}

body.admin-bar #giel-cf7-validation-toast {
	top: 46px;
}

#giel-cf7-validation-toast.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
}

/* Small shake cue without making the form obnoxious */
@keyframes giel-cf7-error-pulse {
	0%   { transform: translateX(0); }
	25%  { transform: translateX(-3px); }
	50%  { transform: translateX(3px); }
	75%  { transform: translateX(-2px); }
	100% { transform: translateX(0); }
}

.giel-cf7-first-error {
	animation: giel-cf7-error-pulse .24s ease-in-out 1;
}

@media (prefers-reduced-motion: reduce) {
	#giel-cf7-validation-toast {
		transition: none;
	}

	.giel-cf7-first-error {
		animation: none;
	}

	html {
		scroll-behavior: auto !important;
	}
}
