/**
 * Daycare Waitlist Manager — front-end wizard styles.
 *
 * Mobile-first, theme-agnostic. Brand colors are injected as the CSS custom
 * properties --dwm-primary and --dwm-accent via wp_add_inline_style.
 */

.dwm-wizard {
	--dwm-primary: #2563eb;
	--dwm-accent: #16a34a;
	--dwm-radius: 16px;
	--dwm-border: #e2e8f0;
	--dwm-text: #1e293b;
	--dwm-muted: #64748b;

	/* Appearance variables (overridable from the backend Form Appearance tab). */
	--dwm-field-border: #e2e8f0;
	--dwm-field-border-width: 1.5px;
	--dwm-field-radius: 10px;
	--dwm-field-bg: #ffffff;
	--dwm-card-shadow: 0 10px 40px -12px rgba(15, 23, 42, .18);
	--dwm-card-border: #eef2f7;

	max-width: 780px;
	margin: 0 auto;
	padding: 2.25rem 2.25rem 2rem;
	background: #fff;
	border: 1px solid var(--dwm-card-border);
	border-radius: var(--dwm-radius);
	box-shadow: var(--dwm-card-shadow);
	color: var(--dwm-text);
	font-size: 16px;
	line-height: 1.5;
}

.dwm-wizard *,
.dwm-wizard *::before,
.dwm-wizard *::after {
	box-sizing: border-box;
}

/*
 * Robust hiding. The browser default for [hidden] is display:none, but many
 * themes set display on semantic elements (e.g. section{display:block}), which
 * overrides it. Force it within the wizard so only the active step shows.
 */
.dwm-wizard [hidden] {
	display: none !important;
}

/* Step visibility is class-driven so it is theme-proof and works before JS. */
.dwm-wizard .dwm-step {
	display: none;
}

.dwm-wizard .dwm-step.is-active {
	display: block;
	animation: dwm-fade .25s ease;
}

@keyframes dwm-fade {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.dwm-wizard__header {
	text-align: center;
	margin-bottom: 1.5rem;
}

.dwm-wizard__title {
	margin: 0 0 .25rem;
	font-size: 1.6rem;
}

.dwm-wizard__subtitle {
	margin: 0;
	color: var(--dwm-muted);
}

/* Progress bar */
.dwm-progress {
	margin: 1.5rem 0;
}

.dwm-progress__bar {
	position: relative;
	height: 6px;
	background: var(--dwm-border);
	border-radius: 999px;
	overflow: hidden;
}

.dwm-progress__fill {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	background: var(--dwm-primary);
	border-radius: 999px;
	transition: width .35s ease;
}

.dwm-progress__steps {
	display: flex;
	justify-content: space-between;
	list-style: none;
	margin: .75rem 0 0;
	padding: 0;
}

.dwm-progress__step {
	flex: 1;
	text-align: center;
	font-size: .8rem;
	color: var(--dwm-muted);
}

.dwm-progress__dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin: 0 auto .25rem;
	border-radius: 50%;
	background: var(--dwm-border);
	color: var(--dwm-muted);
	font-weight: 600;
	transition: background .25s ease, color .25s ease;
}

.dwm-progress__label {
	display: block;
}

.dwm-progress__step.is-active .dwm-progress__dot {
	background: var(--dwm-primary);
	color: #fff;
}

.dwm-progress__step.is-done .dwm-progress__dot {
	background: var(--dwm-accent);
	color: #fff;
}

.dwm-progress__step.is-active .dwm-progress__label {
	color: var(--dwm-text);
	font-weight: 600;
}

/* Status / live region */
.dwm-wizard__status {
	min-height: 1.25rem;
	text-align: center;
	color: var(--dwm-accent);
	font-size: .85rem;
}

/* Form layout */
.dwm-step__title {
	margin: 0 0 .5rem;
	font-size: 1.2rem;
}

.dwm-step__hint {
	margin: 0 0 1rem;
	color: var(--dwm-muted);
	font-size: .9rem;
}

.dwm-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1.15rem 1.25rem;
}

.dwm-field {
	display: flex;
	flex-direction: column;
}

.dwm-field--full {
	grid-column: 1 / -1;
}

.dwm-field label {
	font-weight: 600;
	font-size: .9rem;
	margin-bottom: .35rem;
}

.dwm-field input,
.dwm-field select,
.dwm-field textarea {
	width: 100%;
	min-height: 52px;
	padding: .9rem 1rem;
	border: var(--dwm-field-border-width) solid var(--dwm-field-border);
	border-radius: var(--dwm-field-radius);
	font: inherit;
	font-size: 1rem;
	color: inherit;
	background: var(--dwm-field-bg);
	transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.dwm-field textarea {
	min-height: 96px;
	resize: vertical;
}

.dwm-field select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 1rem center;
	padding-right: 2.5rem;
	cursor: pointer;
}

.dwm-field input::placeholder,
.dwm-field textarea::placeholder {
	color: #94a3b8;
}

.dwm-field input:hover,
.dwm-field select:hover,
.dwm-field textarea:hover {
	border-color: #cbd5e1;
}

.dwm-field input:focus,
.dwm-field select:focus,
.dwm-field textarea:focus {
	outline: none;
	border-color: var(--dwm-primary);
	background: #fff;
	box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.dwm-field input.dwm-invalid,
.dwm-field select.dwm-invalid {
	border-color: #dc2626;
}

.dwm-field__help {
	margin: .35rem 0 0;
	font-size: .8rem;
	color: var(--dwm-muted);
}

.dwm-req {
	color: #dc2626;
}

.dwm-error {
	color: #dc2626;
	font-size: .8rem;
	margin-top: .25rem;
	min-height: 1rem;
}

.dwm-age {
	display: inline-block;
	padding: .6rem .7rem;
	background: #f1f5f9;
	border-radius: 8px;
	font-weight: 600;
}

.dwm-file-name {
	margin-top: .35rem;
	font-size: .85rem;
	color: var(--dwm-accent);
}

/* Checkboxes */
.dwm-check label {
	flex-direction: row;
	display: flex;
	align-items: flex-start;
	gap: .5rem;
	font-weight: 400;
}

.dwm-check input {
	width: auto;
	margin-top: .2rem;
}

/* Honeypot */
.dwm-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Navigation */
.dwm-wizard__nav {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	margin-top: 1.5rem;
}

.dwm-wizard__nav .dwm-btn:only-child {
	margin-left: auto;
}

.dwm-btn {
	appearance: none;
	border: none;
	border-radius: 10px;
	padding: .95rem 1.8rem;
	min-height: 52px;
	font: inherit;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	transition: filter .2s ease, transform .05s ease, box-shadow .2s ease;
}

.dwm-btn--primary {
	box-shadow: 0 6px 16px -6px var(--dwm-primary);
}

.dwm-btn--primary:hover {
	filter: brightness(1.05);
}

.dwm-btn:active {
	transform: translateY(1px);
}

.dwm-btn--primary {
	background: var(--dwm-primary);
	color: #fff;
	margin-left: auto;
}

.dwm-btn--ghost {
	background: transparent;
	color: var(--dwm-muted);
	border: 1px solid var(--dwm-border);
}

.dwm-btn:disabled {
	opacity: .6;
	cursor: not-allowed;
}

/* Success */
.dwm-success {
	text-align: center;
	padding: 2.5rem 1rem;
}

.dwm-success__icon {
	width: 64px;
	height: 64px;
	margin: 0 auto 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--dwm-accent);
	color: #fff;
	font-size: 2rem;
}

.dwm-success__title {
	margin: 0 0 .5rem;
}

.dwm-success__message {
	color: var(--dwm-muted);
	max-width: 480px;
	margin: 0 auto;
}

/* Responsive */
@media (max-width: 560px) {
	.dwm-grid {
		grid-template-columns: 1fr;
	}

	.dwm-progress__label {
		display: none;
	}

	.dwm-wizard__title {
		font-size: 1.35rem;
	}
}

/*
 * --------------------------------------------------------------------------
 * Theme compatibility layer (Enfold and other high-specificity themes).
 *
 * Enfold scopes most of its CSS under the #top ID selector (e.g. #top input),
 * and an ID beats class-based rules, so it can override the wizard's field
 * sizing and force short, fixed-height inputs. These rules re-assert the
 * critical presentation with !important, but only inside .dwm-wizard, so the
 * rest of the site is untouched.
 * --------------------------------------------------------------------------
 */
#dwm-wizard .dwm-field input,
#dwm-wizard .dwm-field select,
#dwm-wizard .dwm-field textarea {
	box-sizing: border-box !important;
	width: 100% !important;
	height: auto !important;
	min-height: 52px !important;
	margin: 0 !important;
	padding: .9rem 1rem !important;
	border: var(--dwm-field-border-width) solid var(--dwm-field-border) !important;
	border-radius: var(--dwm-field-radius) !important;
	background-color: var(--dwm-field-bg) !important;
	color: var(--dwm-text) !important;
	font-size: 1rem !important;
	line-height: 1.4 !important;
	box-shadow: none !important;
	text-transform: none !important;
}

#dwm-wizard .dwm-field textarea {
	min-height: 96px !important;
	padding: .9rem 1rem !important;
}

#dwm-wizard .dwm-field select {
	padding-right: 2.5rem !important;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
	background-repeat: no-repeat !important;
	background-position: right 1rem center !important;
}

#dwm-wizard .dwm-field input:focus,
#dwm-wizard .dwm-field select:focus,
#dwm-wizard .dwm-field textarea:focus {
	border-color: var(--dwm-primary) !important;
	box-shadow: 0 0 0 4px rgba(37, 99, 235, .12) !important;
}

/*
 * Custom, theme-proof checkboxes and radios. Enfold hides native checkboxes
 * and injects its own styled replacements, which conflicts with plugin markup.
 * We visually hide the native input (it stays functional and accessible via the
 * wrapping label) and render our own box/dot that reflects :checked state.
 */
#dwm-wizard .dwm-checkbox,
#dwm-wizard .dwm-radio {
	display: inline-flex !important;
	align-items: flex-start;
	gap: .6rem;
	cursor: pointer;
	font-weight: 400;
	position: relative;
	margin: 0 !important;
}

#dwm-wizard .dwm-checkbox {
	display: flex !important;
}

#dwm-wizard .dwm-checkbox input[type="checkbox"],
#dwm-wizard .dwm-radio input[type="radio"] {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	min-height: 0 !important;
	opacity: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	pointer-events: none !important;
	clip: rect(0 0 0 0);
}

#dwm-wizard .dwm-checkbox__box {
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	margin-top: 1px;
	border: 2px solid var(--dwm-field-border);
	border-radius: 6px;
	background: #fff;
	position: relative;
	transition: background .15s ease, border-color .15s ease;
}

#dwm-wizard .dwm-checkbox input:checked ~ .dwm-checkbox__box {
	background: var(--dwm-primary);
	border-color: var(--dwm-primary);
}

#dwm-wizard .dwm-checkbox input:checked ~ .dwm-checkbox__box::after {
	content: "";
	position: absolute;
	left: 8px;
	top: 3px;
	width: 6px;
	height: 12px;
	border: solid #fff;
	border-width: 0 3px 3px 0;
	transform: rotate(45deg);
}

#dwm-wizard .dwm-checkbox input:focus ~ .dwm-checkbox__box,
#dwm-wizard .dwm-radio input:focus ~ .dwm-radio__box {
	box-shadow: 0 0 0 4px rgba(37, 99, 235, .18);
}

#dwm-wizard .dwm-checkbox__text,
#dwm-wizard .dwm-radio__text {
	flex: 1;
	line-height: 1.45;
}

/* Yes/No radio toggle for the medical step */
#dwm-wizard .dwm-toggle {
	display: flex;
	gap: .6rem;
	margin: .4rem 0 .25rem;
}

#dwm-wizard .dwm-radio {
	align-items: center;
	border: 1.5px solid var(--dwm-field-border);
	border-radius: 999px;
	padding: .5rem 1rem;
	background: #fff;
	transition: border-color .15s ease, background .15s ease;
}

#dwm-wizard .dwm-radio__box {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	border: 2px solid var(--dwm-field-border);
	border-radius: 50%;
	position: relative;
}

#dwm-wizard .dwm-radio input:checked ~ .dwm-radio__box {
	border-color: var(--dwm-primary);
}

#dwm-wizard .dwm-radio input:checked ~ .dwm-radio__box::after {
	content: "";
	position: absolute;
	left: 3px;
	top: 3px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--dwm-primary);
}

#dwm-wizard .dwm-radio input:checked ~ .dwm-radio__text {
	color: var(--dwm-primary);
	font-weight: 600;
}

#dwm-wizard .dwm-conditional__question {
	font-weight: 600;
}

#dwm-wizard .dwm-conditional__field {
	margin-top: .5rem;
}

/* Keep the wizard's step hiding authoritative against any theme. */
#dwm-wizard .dwm-step {
	display: none !important;
}

#dwm-wizard .dwm-step.is-active {
	display: block !important;
}

/* Re-assert the buttons so Enfold's link/button resets do not flatten them. */
#dwm-wizard .dwm-btn {
	min-height: 52px !important;
	width: auto !important;
	border-radius: 10px !important;
	font-size: 1rem !important;
	line-height: 1.2 !important;
	text-decoration: none !important;
	text-transform: none !important;
	text-shadow: none !important;
}

#dwm-wizard .dwm-btn--primary {
	background: var(--dwm-primary) !important;
	color: #fff !important;
	border: none !important;
}
