/* Form Base Styles - Structural CSS Only */

/* All visual styles (colors, borders, padding, fonts) are applied dynamically via PHP from Customize settings */

/* Base wrapper structure */
.auto-form-builder-wrapper {
	width: 100%;
	margin: 0 auto;
	position: relative;
	box-sizing: border-box;
	overflow: visible; /* Changed from hidden to prevent cutoff */
	display: block;
	clear: both;

	/* border-radius and box-shadow applied dynamically from form Customize settings */
}

.auto-form-builder-wrapper * {
	box-sizing: border-box;
}

/* Form field structure */
.auto-form-builder-wrapper .form-field {
	width: 100%;
	max-width: 100%;
	overflow: visible; /* Changed to visible to prevent dropdown clipping */
	clear: both;

	/* margin-bottom will be set dynamically from fieldSpacing */
}

/* Form layout structures */
.auto-form-builder-wrapper .auto-form-builder-form {
	position: relative;
	z-index: 1;
	width: 100%;
	clear: both;
	overflow: visible; /* Changed to visible to prevent dropdown clipping */
}

/* Clearfix for form layout without using overflow: hidden */
.auto-form-builder-wrapper .auto-form-builder-form::after {
	content: "";
	display: table;
	clear: both;
}

/* Additional clearfix for form fields */
.auto-form-builder-wrapper .form-field::after {
	content: "";
	display: table;
	clear: both;
}

/* Two-column layout structure */
.auto-form-builder-wrapper .auto-form-builder-form.two-column {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}

.auto-form-builder-wrapper .auto-form-builder-form.two-column .submit-wrapper {
	grid-column: 1 / -1;
}

@media (width <= 768px) {
	.auto-form-builder-wrapper .auto-form-builder-form.two-column {
		grid-template-columns: 1fr;
	}
}

/* Inline layout structure */
.auto-form-builder-wrapper .auto-form-builder-form.inline {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	align-items: flex-end;
}

.auto-form-builder-wrapper .auto-form-builder-form.inline .form-field {
	flex: 1 1 200px;
	margin-bottom: 0;
}

.auto-form-builder-wrapper .auto-form-builder-form.inline .submit-wrapper {
	flex: 0 0 auto;
	margin-top: 0;
}

@media (width <= 768px) {
	.auto-form-builder-wrapper .auto-form-builder-form.inline {
		flex-direction: column;
	}

	.auto-form-builder-wrapper .auto-form-builder-form.inline .form-field {
		margin-bottom: 0; /* will be overridden dynamically from fieldSpacing */
	}
}

/* Label structure */
.auto-form-builder-wrapper .form-field label {
	display: block;
	margin-bottom: 8px;

	/* All visual styles (font-weight, color, font-size, font-family) set dynamically */
}

/* Input field structure */
.auto-form-builder-wrapper .form-field input[type="text"],
.auto-form-builder-wrapper .form-field input[type="email"],
.auto-form-builder-wrapper .form-field input[type="number"],
.auto-form-builder-wrapper .form-field input[type="tel"],
.auto-form-builder-wrapper .form-field input[type="date"],
.auto-form-builder-wrapper .form-field input[type="search"],
.auto-form-builder-wrapper .form-field input[type="url"],
.auto-form-builder-wrapper .form-field input[type="password"],
.auto-form-builder-wrapper .form-field .date-field-container input.date-input,
.auto-form-builder-wrapper .form-field textarea,
.auto-form-builder-wrapper .form-field select {
	width: 100%;
	max-width: 100%;
	transition: all 0.3s ease;
	box-sizing: border-box;

	/* All visual styles (padding, border, border-radius, font-size, color, background, box-shadow, font-family) set dynamically */
}

/* Textarea field structure - ensure rows attribute works */
.auto-form-builder-wrapper .form-field textarea {
	height: auto;
	min-height: auto;
	resize: vertical;
	line-height: 1.5;
}

/* Select field structure - normalize appearance */
.auto-form-builder-wrapper .form-field select {
	appearance: none;
	padding-right: 30px; /* space for arrow */
	background-image: none;
}

/* Search and URL input normalization - normalize sizing while preserving functionality */
.auto-form-builder-wrapper .form-field input[type="search"] {
	/* Only normalize box-sizing and dimensions, preserve search functionality */
	box-sizing: border-box;
}

.auto-form-builder-wrapper .form-field input[type="url"] {
	/* Only normalize box-sizing and dimensions, preserve URL functionality */
	box-sizing: border-box;
}

/* Multiple select structure */
.auto-form-builder-wrapper .form-field select.multiple-select {
	width: 100%;
	max-width: 100%;
	transition: all 0.3s ease;
	box-sizing: border-box;
	appearance: none;
	padding-right: 30px; /* space for arrow */
	background-image: none;

	/* Only hide the text display */
	color: transparent !important;

	/* All visual styles set dynamically */
}

/* Select field height consistency */
.auto-form-builder-wrapper .form-field select:not(.multiple-select) {
	height: 42px !important;
	line-height: 1;
}

/* Multiple select wrapper structure */
.auto-form-builder-wrapper .multi-select-overlay-wrapper {
	position: relative !important;
	width: 100% !important;
}

/* Text overlay for multiple select structure */
.auto-form-builder-wrapper .selected-values-overlay {
	position: absolute !important;
	inset: 1px 30px 1px 1px !important;
	display: flex !important;
	align-items: center !important;
	pointer-events: none !important;
	padding: 0 13px !important;
	line-height: 1 !important;
	overflow: hidden !important;
	text-overflow: ellipsis !important;
	white-space: nowrap !important;
	z-index: 10 !important;

	/* All visual styles (background, font-size, color, font-family, border-radius) set dynamically */
}

/* Dropdown arrow for multiple select */
.auto-form-builder-wrapper .multi-select-overlay-wrapper::after {
	content: "?" !important;
	position: absolute !important;
	right: 12px !important;
	top: 50% !important;
	transform: translateY(-50%) !important;
	font-size: 12px !important;
	color: #666 !important;
	pointer-events: none !important;
	z-index: 3 !important;
}

/* Focus state structure - visual styles set dynamically */
.auto-form-builder-wrapper .form-field input[type="text"]:focus,
.auto-form-builder-wrapper .form-field input[type="email"]:focus,
.auto-form-builder-wrapper .form-field input[type="number"]:focus,
.auto-form-builder-wrapper .form-field input[type="tel"]:focus,
.auto-form-builder-wrapper .form-field input[type="date"]:focus,
.auto-form-builder-wrapper .form-field input[type="search"]:focus,
.auto-form-builder-wrapper .form-field input[type="url"]:focus,
.auto-form-builder-wrapper .form-field input[type="password"]:focus,
.auto-form-builder-wrapper .form-field .date-field-container input.date-input:focus,
.auto-form-builder-wrapper .form-field textarea:focus,
.auto-form-builder-wrapper .form-field select:focus {
	outline: none;

	/* border-color and box-shadow set dynamically */
}

/* Field description structure */
.auto-form-builder-wrapper .form-field .field-description {
	font-size: 14px;
	color: #666;
	margin-top: 5px;
}

/* Required field indicator */
.auto-form-builder-wrapper .form-field.required label::after {
	content: " *";
	color: #f03e3e;
}

/* Submit button structure */
.auto-form-builder-wrapper .submit-button {
	border: none;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s ease;

	/* All visual styles (background-color, color, border-radius, padding, width, font-family) set dynamically */
}

/* Submit wrapper structure */
.auto-form-builder-wrapper .submit-wrapper {
	display: block; /* text-align and margin-top set dynamically */
}

/* Field width variations */
.auto-form-builder-wrapper .form-field.field-width-half {
	width: 48%;
	display: inline-block;
	margin-right: 2%;
}

.auto-form-builder-wrapper .form-field.field-width-third {
	width: 31%;
	display: inline-block;
	margin-right: 2%;
}

.auto-form-builder-wrapper .form-field.field-width-two-thirds {
	width: 65%;
	display: inline-block;
	margin-right: 2%;
}

/* Success message structure */
.auto-form-builder-success {
	background-color: #d3f9d8;
	border-left: 4px solid #37b24d;
	color: #2b8a3e;
	padding: 15px;
	margin-bottom: 20px;
	border-radius: 4px;
}

/* Background overlay structure */
.auto-form-builder-wrapper::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 0;

	/* border-radius and background-color applied dynamically from form Customize settings */
}
