/**
 * Standardized Form Validation and System Feedback Styles.
 *
 * @package Fyeen
 */

/* Input Field Validation States */
.form-field--invalid,
.form-control.form-field--invalid,
input.input-text.form-field--invalid,
select.form-field--invalid,
textarea.form-field--invalid,
.woocommerce-invalid input.input-text,
.woocommerce-invalid select,
.woocommerce-invalid textarea {
	border-color: #dc2626 !important;
	box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.15) !important;
}

.form-field--valid,
.form-control.form-field--valid,
input.input-text.form-field--valid,
select.form-field--valid,
textarea.form-field--valid {
	border-color: #16a34a !important;
	box-shadow: 0 0 0 0.2rem rgba(22, 163, 74, 0.12) !important;
}

/* Error Messages */
.form-error-message {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	margin-top: 0.35rem;
	color: #dc2626;
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.3;
}

.form-error-message::before {
	content: "";
	display: inline-block;
	width: 14px;
	height: 14px;
	flex-shrink: 0;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23dc2626' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
}

/* Success Messages & Alerts */
.form-success-message {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.75rem 1rem;
	margin-bottom: 1rem;
	border-radius: 0.5rem;
	background-color: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: #15803d;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.4;
}

.form-success-message__content {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.form-success-message__content::before {
	content: "";
	display: inline-block;
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%2315803d' stroke-width='2.2' viewBox='0 0 24 24'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E");
}

.form-success-message__close {
	background: none;
	border: none;
	padding: 0;
	color: #15803d;
	font-size: 1.15rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0.7;
	transition: opacity 0.15s ease;
}

.form-success-message__close:hover {
	opacity: 1;
}

/* Submit Button Loading States */
.btn--loading,
.button.btn--loading {
	position: relative;
	pointer-events: none !important;
	opacity: 0.85 !important;
	cursor: not-allowed !important;
	color: transparent !important;
}

.btn--loading::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 1.15rem;
	height: 1.15rem;
	margin-top: -0.575rem;
	margin-left: -0.575rem;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: fyeen-spin 0.65s linear infinite;
}

.btn-outline-primary.btn--loading::after,
.btn-secondary.btn--loading::after {
	border-color: rgba(26, 35, 126, 0.3);
	border-top-color: #1a237e;
}

@keyframes fyeen-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Field level helper text */
.form-help-text {
	font-size: 0.78rem;
	color: #64748b;
	margin-top: 0.25rem;
}
