/*
 * Afsprakenplanner – booking form.
 *
 * Follows the active theme by default: fonts and text colour are inherited and the
 * accent colour comes from the theme palette (theme.json "primary", Blocksy palette 1, …).
 * Customise from Afspraken > Weergave, or override these variables in your theme:
 *
 *   .afp { --afp-accent: #0f766e; --afp-radius: 4px; }
 */

.afp {
	--afp-accent: var(--wp--preset--color--primary, var(--theme-palette-color-1, var(--wp--preset--color--accent-1, var(--wp--preset--color--accent, #2563eb))));
	--afp-on-accent: #fff;
	--afp-text: inherit;
	--afp-surface: transparent;
	--afp-radius: 10px;
	--afp-max-width: 720px;
	--afp-font: inherit;
	--afp-border: rgba(127, 127, 127, 0.28);
	--afp-muted: rgba(127, 127, 127, 0.95);
	--afp-soft: rgba(127, 127, 127, 0.07);
	--afp-accent-soft: rgba(37, 99, 235, 0.12);

	box-sizing: border-box;
	max-width: var(--afp-max-width);
	margin-inline: auto;
	color: var(--afp-text);
	font-family: var(--afp-font);
	line-height: 1.5;
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
	.afp {
		--afp-border: color-mix(in srgb, currentColor 16%, transparent);
		--afp-muted: color-mix(in srgb, currentColor 68%, transparent);
		--afp-soft: color-mix(in srgb, currentColor 4%, transparent);
		--afp-accent-soft: color-mix(in srgb, var(--afp-accent) 12%, transparent);
	}
}

.afp *,
.afp *::before,
.afp *::after {
	box-sizing: inherit;
}

.afp [hidden] {
	display: none !important;
}

.afp--card {
	padding: clamp(20px, 4vw, 36px);
	border: 1px solid var(--afp-border);
	border-radius: calc(var(--afp-radius) * 1.6);
	background: var(--afp-surface);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
}

/* Header */
.afp__header {
	margin-bottom: 1.75rem;
}

.afp__title {
	margin: 0 0 0.4rem;
	font-size: clamp(1.4rem, 3vw, 1.85rem);
	line-height: 1.25;
	color: inherit;
}

.afp__intro {
	margin: 0;
	color: var(--afp-muted);
}

/* Steps */
.afp__form {
	display: grid;
	gap: 2rem;
}

.afp__step {
	margin: 0;
}

.afp__step-title {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin: 0 0 1rem;
	font-size: 1.05rem;
	font-weight: 650;
	color: inherit;
}

.afp__step-num {
	display: inline-grid;
	place-items: center;
	width: 1.75rem;
	height: 1.75rem;
	border-radius: 50%;
	background: var(--afp-accent);
	color: var(--afp-on-accent);
	font-size: 0.85rem;
	font-weight: 700;
}

/* Services */
.afp__services {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
	gap: 0.75rem;
}

.afp__service {
	position: relative;
	display: block;
	cursor: pointer;
}

.afp__service input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.afp__service-body {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	height: 100%;
	padding: 0.9rem 1rem;
	border: 1.5px solid var(--afp-border);
	border-radius: var(--afp-radius);
	background: var(--afp-surface);
	transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.afp__service:hover .afp__service-body {
	border-color: var(--afp-accent);
}

.afp__service input:checked + .afp__service-body {
	border-color: var(--afp-accent);
	background: var(--afp-accent-soft);
	box-shadow: inset 0 0 0 1px var(--afp-accent);
}

.afp__service input:focus-visible + .afp__service-body {
	outline: 2px solid var(--afp-accent);
	outline-offset: 2px;
}

.afp__service-name {
	font-weight: 650;
}

.afp__service-meta {
	font-size: 0.9em;
	color: var(--afp-muted);
	font-variant-numeric: tabular-nums;
}

.afp__service-desc {
	margin-top: 0.25rem;
	font-size: 0.88em;
	color: var(--afp-muted);
}

/* Date & time picker */
.afp__picker {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
	gap: 1.25rem;
	align-items: start;
}

@media (max-width: 640px) {
	.afp__picker {
		grid-template-columns: 1fr;
	}
}

.afp__calendar {
	padding: 0.9rem;
	border: 1px solid var(--afp-border);
	border-radius: var(--afp-radius);
	background: var(--afp-surface);
	transition: opacity 0.15s;
}

.afp__calendar.is-loading {
	opacity: 0.55;
}

.afp__cal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.6rem;
}

.afp__cal-month {
	font-weight: 650;
	text-transform: capitalize;
}

.afp__cal-nav {
	width: 2.1rem;
	height: 2.1rem;
	padding: 0;
	border: 1px solid var(--afp-border);
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font-size: 1.2rem;
	line-height: 1;
	cursor: pointer;
}

.afp__cal-nav:hover:not(:disabled) {
	border-color: var(--afp-accent);
	color: var(--afp-accent);
}

.afp__cal-nav:disabled {
	opacity: 0.3;
	cursor: default;
}

.afp__cal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 0.25rem;
	text-align: center;
}

.afp__cal-weekday {
	padding: 0.25rem 0;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	color: var(--afp-muted);
}

.afp__cal-day {
	aspect-ratio: 1;
	width: 100%;
	padding: 0;
	border: 0;
	border-radius: calc(var(--afp-radius) * 0.8);
	background: var(--afp-accent-soft);
	color: inherit;
	font: inherit;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	cursor: pointer;
	transition: background-color 0.15s, color 0.15s;
}

.afp__cal-day:hover:not(:disabled) {
	background: var(--afp-accent);
	color: var(--afp-on-accent);
}

.afp__cal-day:disabled {
	background: transparent;
	color: var(--afp-muted);
	font-weight: 400;
	opacity: 0.45;
	cursor: default;
}

.afp__cal-day.is-today {
	box-shadow: inset 0 0 0 1.5px var(--afp-border);
}

.afp__cal-day[aria-pressed="true"] {
	background: var(--afp-accent);
	color: var(--afp-on-accent);
}

.afp__times-title {
	margin: 0 0 0.75rem;
	font-weight: 600;
}

.afp__times-title::first-letter {
	text-transform: uppercase;
}

.afp__slots {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
	gap: 0.5rem;
	max-height: 320px;
	overflow-y: auto;
}

.afp__slot {
	padding: 0.6rem 0.4rem;
	border: 1.5px solid var(--afp-border);
	border-radius: var(--afp-radius);
	background: var(--afp-surface);
	color: inherit;
	font: inherit;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	cursor: pointer;
}

.afp__slot:hover {
	border-color: var(--afp-accent);
	color: var(--afp-accent);
}

.afp__slot[aria-pressed="true"] {
	border-color: var(--afp-accent);
	background: var(--afp-accent);
	color: var(--afp-on-accent);
}

/* Fields */
.afp__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 1rem;
}

.afp__field--full {
	grid-column: 1 / -1;
}

.afp__field label {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.92rem;
	font-weight: 600;
}

.afp__field input,
.afp__field textarea {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0.7rem 0.85rem;
	border: 1.5px solid var(--afp-border);
	border-radius: var(--afp-radius);
	background: var(--afp-surface);
	color: inherit;
	font: inherit;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.afp__field input:focus,
.afp__field textarea:focus {
	outline: none;
	border-color: var(--afp-accent);
	box-shadow: 0 0 0 3px var(--afp-accent-soft);
}

.afp__hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* Footer & buttons */
.afp__footer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--afp-border);
}

.afp__summary {
	margin: 0;
	font-weight: 600;
}

.afp__summary::first-letter {
	text-transform: uppercase;
}

.afp__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin-left: auto;
	padding: 0.85rem 1.6rem;
	border: 1.5px solid var(--afp-accent);
	border-radius: var(--afp-radius);
	background: var(--afp-accent);
	color: var(--afp-on-accent);
	font: inherit;
	font-weight: 650;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s, transform 0.05s;
}

.afp__button:hover {
	filter: brightness(1.08);
}

.afp__button:active {
	transform: translateY(1px);
}

.afp__button:disabled {
	opacity: 0.6;
	cursor: wait;
}

.afp__button--ghost {
	background: transparent;
	color: var(--afp-accent);
}

.afp__message:empty {
	display: none;
}

.afp__message {
	padding: 0.8rem 1rem;
	border-radius: var(--afp-radius);
}

.afp__message.is-error {
	background: rgba(220, 38, 38, 0.1);
	color: #b91c1c;
}

.afp__message.is-info {
	background: var(--afp-accent-soft);
}

/* Done / manage */
.afp__done {
	text-align: center;
	padding: 1rem 0;
	outline: none;
}

.afp__done-icon {
	display: inline-grid;
	place-items: center;
	width: 3.5rem;
	height: 3.5rem;
	margin-bottom: 1rem;
	border-radius: 50%;
	background: var(--afp-accent);
	color: var(--afp-on-accent);
	font-size: 1.6rem;
	font-weight: 700;
}

.afp__done-icon.is-cancelled {
	background: var(--afp-muted);
}

.afp__done-title {
	margin: 0 0 0.5rem;
	font-size: 1.4rem;
	color: inherit;
}

.afp__done-text {
	max-width: 460px;
	margin: 0 auto 1.25rem;
	color: var(--afp-muted);
}

.afp__done .afp__button {
	margin: 1.25rem auto 0;
}

.afp__details {
	display: grid;
	margin: 0 0 1.25rem;
	border: 1px solid var(--afp-border);
	border-radius: var(--afp-radius);
	background: var(--afp-soft);
	text-align: left;
}

.afp__details > div {
	display: grid;
	grid-template-columns: 38% 1fr;
	gap: 1rem;
	padding: 0.75rem 1rem;
}

.afp__details > div + div {
	border-top: 1px solid var(--afp-border);
}

.afp__details dt {
	color: var(--afp-muted);
}

.afp__details dd {
	margin: 0;
	font-weight: 600;
}

.afp__details--compact {
	max-width: 420px;
	margin-inline: auto;
	text-align: center;
}

.afp__details--compact > div {
	grid-template-columns: 1fr;
	padding: 0.55rem 1rem;
}

.afp__badge {
	display: inline-block;
	padding: 0.15rem 0.65rem;
	border-radius: 999px;
	font-size: 0.85em;
	background: var(--afp-accent-soft);
}

.afp__badge--pending { background: rgba(245, 158, 11, 0.16); }
.afp__badge--cancelled { background: rgba(220, 38, 38, 0.12); }

.afp__calendar-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin-bottom: 1.25rem;
}

[data-afp-current] .afp__calendar-links {
	justify-content: flex-start;
}

.afp__calendar-links a {
	padding: 0.45rem 0.9rem;
	border: 1px solid var(--afp-border);
	border-radius: 999px;
	color: inherit;
	font-size: 0.92rem;
	font-weight: 600;
	text-decoration: none;
}

.afp__calendar-links a:hover {
	border-color: var(--afp-accent);
	color: var(--afp-accent);
}

.afp__notice {
	padding: 0.9rem 1rem;
	border-left: 4px solid var(--afp-accent);
	border-radius: var(--afp-radius);
	background: var(--afp-soft);
}

.afp__note {
	color: var(--afp-muted);
	font-size: 0.92rem;
}

.afp__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin: 1rem 0 1.5rem;
}

.afp__actions .afp__button {
	margin-left: 0;
}

@media (prefers-reduced-motion: reduce) {
	.afp * {
		transition: none !important;
	}
}
