/* Form Manager Frontend Styles */

.cfm-form-wrapper {
	max-width: 800px;
	margin: 0 auto;
}

/* Messages */
.cfm-message {
	padding: 15px 20px;
	margin-bottom: 20px;
	border-radius: 4px;
	border-left: 4px solid;
}

.cfm-message.cfm-success {
	background-color: #d4edda;
	border-left-color: #28a745;
	color: #155724;
}

.cfm-message.cfm-error {
	background-color: #f8d7da;
	border-left-color: #dc3545;
	color: #721c24;
}

/* Form Title */
.cfm-form-title {
	margin-bottom: 25px;
}

/* Form Layout */
.cfm-form {
	/* Inherit from theme */
}

.cfm-fields-container {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	align-items: stretch;
}

.cfm-field {
	flex: 1 1 100%;
	min-width: 0;
	margin-bottom: 0;
}

.cfm-field.cfm-full {
	flex: 1 1 100%;
}

.cfm-field.cfm-half {
	flex: 1 1 calc(50% - 10px);
	max-width: calc(50% - 10px);
	min-width: 250px;
}

/* Group/Fieldset styling */
.cfm-group {
	flex: 1 1 100%;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 20px;
	margin: 0;
}

.cfm-group legend {
	font-weight: 600;
	font-size: 1.4em;
	padding: 0 10px 0 0;
	color: #333;
}

.cfm-group .cfm-fields-container {
	margin-top: 10px;
}

/* Responsive: Stack half fields on mobile */
@media (max-width: 600px) {
	.cfm-field.cfm-half {
		flex: 1 1 100%;
		max-width: 100%;
	}
}

/* Form Fields */
.cfm-form label {
	display: block;
	margin-bottom: 5px;
	font-weight: 600;
}

.cfm-required {
	color: #dc3545;
	margin-left: 2px;
}

.cfm-form input[type="text"],
.cfm-form input[type="email"],
.cfm-form textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: inherit;
	font-family: inherit;
	box-sizing: border-box;
}

.cfm-form input[type="text"]:focus,
.cfm-form input[type="email"]:focus,
.cfm-form textarea:focus {
	outline: none;
	border-color: #007bff;
	box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.cfm-help {
	margin: 5px 0 0;
	font-size: 0.9em;
	color: #6c757d;
}

/* File Drop Zone */
.cfm-file-drop-zone {
	position: relative;
	border: 2px dashed #ccc;
	border-radius: 6px;
	padding: 30px 20px;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.2s, background-color 0.2s;
	background-color: #fafafa;
	min-height: 220px;
	display: flex;
	flex-direction: column;
}

.cfm-file-drop-zone:hover,
.cfm-file-drop-zone.cfm-drag-over {
	border-color: #007bff;
	background-color: #f0f7ff;
}

.cfm-file-drop-zone.cfm-drag-over {
	border-style: solid;
}

/* Hide the native file input but keep it accessible */
.cfm-file-input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
	z-index: 1;
}

.cfm-file-drop-ui {
	pointer-events: none;
	min-height: 120px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	flex-shrink: 0;
}

.cfm-file-icon {
	width: 40px;
	height: 40px;
	color: #999;
	margin-bottom: 10px;
}

.cfm-file-drop-text {
	margin: 0 0 5px;
	color: #555;
	font-size: 1em;
}

.cfm-file-browse {
	color: #007bff;
	text-decoration: underline;
}

/* File list */
.cfm-file-list {
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
	text-align: left;
	position: relative;
	z-index: 2; /* Above the invisible file input overlay */
}

.cfm-file-list li {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 10px;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	margin-top: 6px;
	font-size: 0.9em;
}

.cfm-file-list .cfm-file-name {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	margin-right: 10px;
}

.cfm-file-remove {
	background: none;
	border: none;
	cursor: pointer;
	color: #dc3545;
	font-size: 1.2em;
	padding: 4px 8px;
	min-width: 30px;
	min-height: 30px;
	line-height: 1;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cfm-file-remove:hover {
	color: #a71d2a;
}

.cfm-file-error {
	color: #dc3545;
	font-size: 0.85em;
	margin-top: 5px;
	display: none;
}

.cfm-file-error.cfm-visible {
	display: block;
}

/* Submit Button - Divi inheritance */
.cfm-form > .cfm-field:has(.cfm-submit) {
	margin-top: 20px;
}

.cfm-submit {
	/* Inherit Divi button colors via CSS custom properties with fallbacks */
	background-color: var(--et_accent_color, #007bff);
	color: var(--et-button-font-color, #fff);
	padding: 0.3em 1em;
	border: 2px solid var(--et_accent_color, #007bff);
	border-radius: 3px;
	font-size: 1em;
	font-weight: 600;
	font-family: inherit;
	letter-spacing: 1px;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
	display: inline-block;
}

.cfm-submit:hover {
	background-color: transparent;
	color: var(--et_accent_color, #007bff);
	border-color: var(--et_accent_color, #007bff);
}

/* Turnstile */
.cf-turnstile {
	margin: 10px 0;
}
