/**
 * Standard Application Form - Modal & Form Styles
 *
 * @package WDM_Event_Custom_Fields
 */

/* Modal overlay & container */
.wdm-std-app-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.6);
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
}

.wdm-std-app-modal-overlay.wdm-modal-open {
	display: flex;
}

.wdm-std-app-modal {
	background: #fff;
	border-radius: 8px;
	width: 90%;
	max-width: 720px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.wdm-std-app-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 24px;
	border-bottom: 1px solid #e0e0e0;
}

.wdm-std-app-modal-header h3 {
	margin: 0;
	font-size: 1.3em;
}

.wdm-std-app-modal-close {
	background: none;
	border: none;
	font-size: 28px;
	cursor: pointer;
	color: #666;
	line-height: 1;
	padding: 0 4px;
}

.wdm-std-app-modal-close:hover {
	color: #fff;
	padding: 0 5px 5px;
	border-radius: 20px;
	background-color: var(--ast-global-color-8, #ed680a);
	border-color: var(--ast-global-color-8, #ed680a);
}

.wdm-std-app-modal-body {
	padding: 24px;
	overflow-y: auto;
	flex: 1;
}

/* Profile notice */
.wdm-profile-notice {
	background: #fff8e1;
	border-left: 4px solid #ffc107;
	padding: 10px 14px;
	margin-bottom: 20px;
	border-radius: 2px;
}

.wdm-profile-notice p {
	margin: 0;
	font-size: 0.9em;
}

.wdm-profile-notice.wdm-profile-incomplete {
	background: #ffebee;
	border-left-color: #d32f2f;
}

.wdm-profile-notice.wdm-profile-incomplete p {
	color: #c62828;
}

/* Disabled submit button */
.wdm-std-app-modal .wdm-standard-app-submit-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
	background: #90a4ae;
}

/* Form sections (fieldsets) */
.wdm-standard-application-form fieldset.wdm-form-section {
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	padding: 20px 20px 12px;
	margin: 0 0 20px;
	background: #fafafa;
}

.wdm-standard-application-form fieldset.wdm-form-section legend {
	font-size: 1.05em;
	font-weight: 600;
	color: #333;
	padding: 0 8px;
	background: #fafafa;
}

/* Form rows & 2-col layout */
.wdm-standard-application-form .wdm-form-row {
	margin-bottom: 16px;
}

.wdm-standard-application-form .wdm-form-separator {
	border: none;
	border-top: 1px solid #e0e0e0;
	margin: 8px 0 16px;
}

.wdm-standard-application-form .wdm-form-row-2col {
	display: flex;
	gap: 16px;
}

.wdm-standard-application-form .wdm-form-row-2col>.wdm-form-field {
	flex: 1;
}

/* Form fields */
.wdm-standard-application-form .wdm-form-field label {
	display: block;
	margin-bottom: 5px;
	font-weight: 500;
	font-size: 0.92em;
	color: #333;
}

.wdm-standard-application-form .wdm-form-field .required {
	color: #d32f2f;
}

.wdm-standard-application-form .wdm-form-field input[type="text"],
.wdm-standard-application-form .wdm-form-field input[type="email"],
.wdm-standard-application-form .wdm-form-field input[type="file"],
.wdm-standard-application-form .wdm-form-field select,
.wdm-standard-application-form .wdm-form-field textarea {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 0.95em;
	font-family: inherit;
	box-sizing: border-box;
	background: #fff;
	transition: border-color 0.2s;
}

.wdm-standard-application-form .wdm-form-field input:focus,
.wdm-standard-application-form .wdm-form-field select:focus,
.wdm-standard-application-form .wdm-form-field textarea:focus {
	border-color: #1976d2;
	outline: none;
	box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.15);
}

.wdm-standard-application-form .wdm-form-field textarea {
	resize: vertical;
}

.wdm-standard-application-form .wdm-form-field .description {
	font-size: 0.82em;
	color: #777;
	margin-top: 4px;
}

/* Prefilled / locked fields */
.wdm-standard-application-form .wdm-form-field input.wdm-prefilled-field,
.wdm-standard-application-form .wdm-form-field select.wdm-prefilled-field {
	background-color: #f5f5f5;
	color: #666;
	cursor: not-allowed;
}

/* Radio groups */
.wdm-standard-application-form .wdm-radio-group {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 4px;
}

.wdm-standard-application-form .wdm-radio-group label {
	font-weight: 400;
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
}

.wdm-standard-application-form .wdm-radio-group input[type="radio"] {
	width: auto;
	margin: 0;
}

/* Radio card style — selectable card options */
.wdm-standard-application-form .wdm-radio-cards {
	flex-direction: row;
	flex-wrap: wrap;
	gap: 10px;
}

.wdm-standard-application-form .wdm-radio-card {
	border: 2px solid #e0e0e0;
	border-radius: 8px;
	padding: 10px 18px;
	background: #fafafa;
	transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.wdm-standard-application-form .wdm-radio-card:hover {
	border-color: var(--ast-global-color-8, #ed680a);
	background: rgba(237, 104, 10, 0.04);
}

.wdm-standard-application-form .wdm-radio-card:has(input:checked) {
	border-color: var(--ast-global-color-8, #ed680a);
	background: rgba(237, 104, 10, 0.08);
	box-shadow: 0 0 0 3px rgba(237, 104, 10, 0.15);
	font-weight: 500;
}

/* Validation errors */
.wdm-standard-application-form .wdm-field-error label {
	color: #d32f2f;
}

.wdm-standard-application-form .wdm-form-field.wdm-field-error input,
.wdm-standard-application-form .wdm-form-field.wdm-field-error select,
.wdm-standard-application-form .wdm-form-field.wdm-field-error textarea {
	border-color: #d32f2f;
}

/* Submit area */
.wdm-form-submit-modal {
	display: flex;
	gap: 12px;
	align-items: center;
	flex-wrap: wrap;
	padding-top: 8px;
}

.wdm-std-app-modal .wdm-standard-app-submit-btn {
	background: #1976d2;
	color: #fff;
	border: none;
	padding: 10px 24px;
	border-radius: 4px;
	font-size: 0.95em;
	cursor: pointer;
}

.wdm-std-app-modal .wdm-standard-app-submit-btn:hover {
	background: #1565c0;
}

.wdm-std-app-modal .wdm-std-app-draft-btn {
	background: #f0f0f0;
	color: #333;
	border: 1px solid #ccc;
	padding: 10px 20px;
	border-radius: 4px;
	font-size: 0.95em;
	cursor: pointer;
}

.wdm-std-app-modal .wdm-std-app-draft-btn:hover {
	background: #e0e0e0;
}

.wdm-form-spinner {
	display: inline-block;
	width: 20px;
	height: 20px;
	border: 2px solid #ccc;
	border-top-color: #1976d2;
	border-radius: 50%;
	animation: wdm-spin 0.6s linear infinite;
}

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

/* Messages */
.wdm-form-messages {
	margin-top: 12px;
}

.wdm-notice {
	padding: 10px 14px;
	border-radius: 4px;
	font-size: 0.92em;
}

.wdm-notice-success {
	background: #e8f5e9;
	color: #2e7d32;
	border: 1px solid #c8e6c9;
}

.wdm-notice-error {
	background: #ffebee;
	color: #c62828;
	border: 1px solid #ffcdd2;
}

/* Already applied message */
.wdm_already_applied {
	color: #388e3c;
	font-weight: 600;
	font-style: italic;
	max-width: 300px;
	width: max-content;
	white-space: break-spaces;
}

/* Existing file link */
.wdm-existing-file {
	margin: 4px 0;
}

.wdm-existing-file a {
	color: #1976d2;
}

/* Preview mode notice (shown inside the preview modal) */
.wdm-preview-notice {
	background: #fff3cd;
	border: 1px solid #ffc107;
	color: #856404;
	padding: 10px 14px;
	border-radius: 4px;
	margin-bottom: 16px;
	font-size: 0.9em;
}

/* Preview button row (shown below the section toggles) */
.wdm-std-form-preview-wrap {
	margin-top: 12px;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

#wdm-preview-app-form-btn,
.wdm-std-form-preview-btn {
	flex-shrink: 0;
	background-color: var(--ast-global-color-8);
	border-color: var(--ast-global-color-8);
	color: #fff;
	border-radius: 23px;
	padding: 8px 22px;
	font-size: 0.92em;
	cursor: pointer;
	transition: opacity 0.2s;
}

#wdm-preview-app-form-btn:hover,
.wdm-std-form-preview-btn:hover {
	opacity: 0.88;
	color: #fff;
}

/* Close Preview button inside the preview modal */
#wdm-preview-app-modal-close-btn {
	background: transparent;
	color: var(--ast-global-color-8);
	border: 1px solid var(--ast-global-color-8);
	border-radius: 23px;
	padding: 8px 22px;
	font-size: 0.92em;
	cursor: pointer;
	transition: background 0.2s, color 0.2s;
}

#wdm-preview-app-modal-close-btn:hover {
	background: var(--ast-global-color-8);
	color: #fff;
}

/* Responsive */
@media (max-width: 600px) {
	.wdm-std-app-modal {
		width: 96%;
		max-height: 95vh;
	}

	.wdm-std-app-modal-body {
		padding: 16px;
	}

	.wdm-standard-application-form .wdm-form-row-2col {
		flex-direction: column;
		gap: 0;
	}

	.wdm-standard-application-form fieldset.wdm-form-section {
		padding: 14px 12px 8px;
	}
}