/**
 * My Forms – Frontend Form Styles
 *
 * @package MyForms
 */

.mf-form-wrap {
	--mff-primary: #6366f1;
	--mff-primary-hover: #4f46e5;
	--mff-primary-light: #e0e7ff;
	--mff-danger: #ef4444;
	--mff-success: #10b981;
	--mff-gray-50: #f9fafb;
	--mff-gray-100: #f3f4f6;
	--mff-gray-200: #e5e7eb;
	--mff-gray-300: #d1d5db;
	--mff-gray-600: #4b5563;
	--mff-gray-700: #374151;
	--mff-gray-800: #1f2937;
	--mff-radius: 8px;
	--mff-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
	--mff-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	max-width: 100%;
}

.mf-form-title {
	font-size: 20px;
	font-weight: 700;
	color: var(--mff-gray-800);
	margin: 0 0 8px 0;
	line-height: 1.2;
}

.mf-form-description {
	font-size: 14px;
	color: var(--mff-gray-600);
	margin: 0 0 20px 0;
	line-height: 1.5;
}

/* Messages */
.mf-form-messages {
	margin-bottom: 20px;
}

.mf-form-message {
	padding: 12px 16px;
	border-radius: var(--mff-radius);
	font-size: 14px;
	margin-bottom: 12px;
	line-height: 1.4;
	display: flex;
	align-items: center;
	gap: 8px;
}

.mf-form-message-success {
	background: #ecfdf5;
	border-left: 4px solid var(--mff-success);
	color: #065f46;
}

.mf-form-message-error {
	background: #fef2f2;
	border-left: 4px solid var(--mff-danger);
	color: #991b1b;
}

/* Rows & Layout */
.mf-form {
	display: flex;
	flex-flow: row wrap;
	gap: 16px;
}

.mf-form-row {
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
}

/* Column layouts */
.mf-col-12 {
	width: 100%;
}

.mf-col-6 {
	width: calc(50% - 8px);
}

.mf-col-4 {
	width: calc(33.333% - 10.67px);
}

.mf-col-3 {
	width: calc(25% - 12px);
}

@media (max-width: 600px) {

	.mf-col-6,
	.mf-col-4,
	.mf-col-3 {
		width: 100% !important;
	}
}

/* Custom class layout support */
.mf-half-width {
	width: 48%;
	display: inline-flex;
}

@media (max-width: 600px) {
	.mf-half-width {
		width: 100%;
	}
}

/* Labels */
.mf-label {
	font-size: 14px;
	font-weight: 600;
	color: var(--mff-gray-700);
	margin-bottom: 6px;
	display: inline-block;
}

.mf-required {
	color: var(--mff-danger);
	margin-left: 2px;
}

/* Inputs */
.mf-form-wrap .mf-input,
.mf-form-wrap input[type="text"],
.mf-form-wrap input[type="email"],
.mf-form-wrap input[type="url"],
.mf-form-wrap input[type="tel"],
.mf-form-wrap input[type="number"],
.mf-form-wrap textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 14px;
	border: 1px solid var(--mff-gray-200) !important;
	border-radius: var(--mff-radius) !important;
	font-size: 14px;
	color: var(--mff-gray-800) !important;
	background: #ffffff !important;
	transition: var(--mff-transition);
	outline: none;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.mf-form-wrap .mf-input::placeholder,
.mf-form-wrap input::placeholder,
.mf-form-wrap textarea::placeholder {
	color: var(--mff-gray-600) !important;
	opacity: 0.5 !important;
}

.mf-form-wrap .mf-input:hover,
.mf-form-wrap input[type="text"]:hover,
.mf-form-wrap input[type="email"]:hover,
.mf-form-wrap input[type="url"]:hover,
.mf-form-wrap input[type="tel"]:hover,
.mf-form-wrap input[type="number"]:hover,
.mf-form-wrap textarea:hover {
	border-color: var(--mff-gray-300) !important;
}

.mf-form-wrap .mf-input:focus,
.mf-form-wrap input[type="text"]:focus,
.mf-form-wrap input[type="email"]:focus,
.mf-form-wrap input[type="url"]:focus,
.mf-form-wrap input[type="tel"]:focus,
.mf-form-wrap input[type="number"]:focus,
.mf-form-wrap textarea:focus {
	border-color: var(--mff-primary) !important;
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

.mf-form-wrap .mf-textarea,
.mf-form-wrap textarea {
	min-height: 100px;
	resize: vertical;
}

/* Fieldset */
.mf-fieldset {
	border: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.mf-fieldset legend {
	padding: 0;
	margin-bottom: 8px;
}

.mf-fieldset.mf-layout-horizontal {
	flex-direction: row;
	flex-wrap: wrap;
	gap: 16px;
	align-items: center;
}

.mf-fieldset.mf-layout-horizontal legend {
	width: 100%;
}

/* Radio & Checkbox */
.mf-radio-label,
.mf-checkbox-label {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	color: var(--mff-gray-700);
	cursor: pointer;
	line-height: 1.4;
	user-select: none;
	padding: 4px 0;
}

.mf-radio {
	appearance: none;
	-webkit-appearance: none;
	width: 18px;
	height: 18px;
	border: 1px solid var(--mff-gray-300);
	border-radius: 50%;
	background-color: #ffffff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: relative;
	transition: var(--mff-transition);
	margin: 0;
	cursor: pointer;
	outline: none;
	flex-shrink: 0;
}

.mf-radio:hover {
	border-color: var(--mff-primary);
}

.mf-radio:focus {
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
	border-color: var(--mff-primary);
}

.mf-radio:checked {
	background-color: var(--mff-primary);
	border-color: var(--mff-primary);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E");
	background-size: 100% 100%;
	background-position: center;
	background-repeat: no-repeat;
}

.mf-checkbox {
	appearance: none;
	-webkit-appearance: none;
	width: 18px;
	height: 18px;
	border: 1px solid var(--mff-gray-300);
	border-radius: 4px;
	background-color: #ffffff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	position: relative;
	transition: var(--mff-transition);
	margin: 0;
	cursor: pointer;
	outline: none;
	flex-shrink: 0;
}

.mf-checkbox:hover {
	border-color: var(--mff-primary);
}

.mf-checkbox:focus {
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
	border-color: var(--mff-primary);
}

.mf-checkbox:checked {
	background-color: var(--mff-primary);
	border-color: var(--mff-primary);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='white'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
	background-size: 100% 100%;
	background-position: center;
	background-repeat: no-repeat;
}

/* Custom Select Option Dropdown (ul/li style) */
.mf-custom-select-wrap {
	position: relative;
	width: 100%;
}

.mf-custom-select-trigger {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	box-sizing: border-box;
	padding: 10px 14px;
	border: 1px solid var(--mff-gray-200);
	border-radius: var(--mff-radius);
	font-size: 14px;
	color: var(--mff-gray-800);
	background: #ffffff;
	transition: var(--mff-transition);
	cursor: pointer;
	user-select: none;
	outline: none;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.mf-custom-select-trigger:focus,
.mf-custom-select-wrap.open .mf-custom-select-trigger {
	border-color: var(--mff-primary);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.mf-custom-select-trigger span.dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	color: var(--mff-gray-600);
	transition: var(--mff-transition);
}

.mf-custom-select-wrap.open .mf-custom-select-trigger span.dashicons {
	transform: rotate(180deg);
}

.mf-custom-select-dropdown {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	width: 100%;
	background: #ffffff;
	border: 1px solid var(--mff-gray-200);
	border-radius: var(--mff-radius);
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
	margin: 0;
	padding: 4px 0;
	list-style: none;
	z-index: 100;
	max-height: 240px;
	overflow-y: auto;
	box-sizing: border-box;
}

.mf-custom-select-option {
	padding: 10px 14px;
	font-size: 14px;
	color: var(--mff-gray-800);
	cursor: pointer;
	transition: var(--mff-transition);
}

.mf-custom-select-option:hover {
	background: var(--mff-gray-100);
	color: var(--mff-gray-800);
}

.mf-custom-select-option.active {
	background: var(--mff-primary-light);
	color: var(--mff-primary-hover);
	font-weight: 600;
}

/* Premium Drag & Drop File Upload Dropzone */
.mf-file-upload-wrap {
	width: 100%;
}

.mf-file-upload-dropzone {
	border: 2px dashed var(--mff-gray-300);
	border-radius: var(--mff-radius);
	padding: 24px 20px;
	text-align: center;
	background: var(--mff-gray-50);
	cursor: pointer;
	transition: var(--mff-transition);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.mf-file-upload-dropzone:hover,
.mf-file-upload-dropzone.dragover {
	border-color: var(--mff-primary);
	background: #f5f3ff;
}

.mf-upload-icon {
	font-size: 32px;
	width: 32px;
	height: 32px;
	color: var(--mff-gray-600);
	margin-bottom: 8px;
	transition: var(--mff-transition);
}

.mf-file-upload-dropzone:hover .mf-upload-icon,
.mf-file-upload-dropzone.dragover .mf-upload-icon {
	color: var(--mff-primary);
	transform: translateY(-2px);
}

.mf-upload-text {
	font-size: 14px;
	color: var(--mff-gray-700);
	margin: 0 0 4px 0;
}

.mf-upload-link {
	color: var(--mff-primary);
	font-weight: 600;
	margin-right: 2px;
}

.mf-upload-info {
	font-size: 12px;
	color: var(--mff-gray-600);
	margin: 0;
}

/* Selected File Items List */
.mf-file-list {
	margin-top: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.mf-file-item {
	display: flex;
	align-items: center;
	background: #ffffff;
	border: 1px solid var(--mff-gray-200);
	border-radius: var(--mff-radius);
	padding: 10px 14px;
	gap: 12px;
	animation: mf-fade-in 0.2s ease;
}

@keyframes mf-fade-in {
	from {
		opacity: 0;
		transform: translateY(4px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.mf-file-icon-preview {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	background: var(--mff-gray-100);
	border-radius: 6px;
	color: var(--mff-gray-600);
	overflow: hidden;
}

.mf-file-icon-preview span.dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

.mf-file-details {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	min-width: 0;
}

.mf-file-name {
	font-size: 13px;
	font-weight: 500;
	color: var(--mff-gray-800);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.mf-file-size {
	font-size: 11px;
	color: var(--mff-gray-600);
}

.mf-file-remove {
	font-size: 18px;
	width: 18px;
	height: 18px;
	color: var(--mff-gray-600);
	cursor: pointer;
	transition: var(--mff-transition);
}

.mf-file-remove:hover {
	color: var(--mff-danger);
}

/* Descriptions & Errors */
.mf-field-description {
	font-size: 12px;
	color: var(--mff-gray-600);
	margin: 4px 0 0 0;
}

.mf-error-message {
	font-size: 12px;
	color: var(--mff-danger);
	margin-top: 4px;
	display: none;
	font-weight: 500;
}

.mf-form-row-error .mf-input {
	border-color: var(--mff-danger);
}

.mf-form-row-error .mf-error-message {
	display: block;
}

/* Submit Row */
.mf-submit-row {
	margin-top: 10px;
}

.mf-submit-button {
	background: var(--mff-primary);
	color: #ffffff;
	border: none;
	border-radius: var(--mff-radius);
	padding: 12px 24px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: var(--mff-transition);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	position: relative;
}

.mf-submit-button:hover {
	background: var(--mff-primary-hover);
}

.mf-submit-button:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

/* Spinner */
.mf-btn-spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #ffffff;
	animation: mf-spin 0.8s linear infinite;
}

.mf-submit-button.mf-loading .mf-btn-spinner {
	display: inline-block;
}

@keyframes mf-spin {
	to {
		transform: rotate(360deg);
	}
}

/* datepicker custom override styles */
.flatpickr-calendar {
	font-family: inherit !important;
	border-radius: var(--mff-radius) !important;
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
	border: 1px solid var(--mff-gray-200) !important;
}

.flatpickr-day.selected {
	background: var(--mff-primary) !important;
	border-color: var(--mff-primary) !important;
}

/* HTML Content field */
.mf-html-content {
	font-size: 14px;
	line-height: 1.6;
	color: var(--mff-gray-700);
}

.mf-html-content p {
	margin: 0 0 10px 0;
}

.mf-html-content p:last-child {
	margin-bottom: 0;
}

/* Agreement / Consent field */
.mf-agreement-label {
	display: inline-flex;
	align-items: flex-start;
	gap: 10px;
	cursor: pointer;
	font-size: 14px;
	line-height: 1.5;
	color: var(--mff-gray-700);
}

.mf-agreement-label .mf-agreement-checkbox {
	flex-shrink: 0;
	margin-top: 2px;
}

.mf-agreement-text {
	flex: 1;
}

.mf-agreement-text a {
	color: var(--mff-primary);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.mf-agreement-text a:hover {
	color: var(--mff-primary-hover);
}

.mf-form-row-error .mf-agreement-label {
	color: var(--mff-danger);
}

.mf-form-row-error .mf-agreement-text a {
	color: var(--mff-danger);
}