/* ============================================================
   Hospito — booking engine
   ------------------------------------------------------------
   The appointment wizard: doctor picker, date strip, slot grid,
   patient details, fee and payment choice.

   This lives in its own stylesheet, and the Booking Engine
   widget declares it through get_style_depends(). It used to sit
   in doctors.css, which is only enqueued on doctor and service
   pages — so the booking page itself loaded none of it and the
   form rendered as raw browser fieldsets.
   ============================================================ */

/* ------------------------------------------------------------
   Booking engine
   ------------------------------------------------------------ */

.hos-booking {
	--hos-booking-accent: var(--hospito-primary);
	background: #fff;
	border: 1px solid var(--hospito-border);
	border-radius: var(--hospito-radius-xl);
	box-shadow: var(--hospito-shadow-card);
	padding: clamp(1.5rem, 1rem + 2.2vw, 2.75rem);
	position: relative;
}

.hos-booking.is-loading {
	opacity: 0.7;
	pointer-events: none;
}

/* One step at a time, on a card narrow enough to read as a single task. */
.hos-booking--wizard {
	max-width: 676px;
	margin-inline: auto;
}

.hos-booking__steps {
	display: grid;
	gap: var(--hos-space-8);
}

.hos-booking__step {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

/* Only once JavaScript has taken over does a step hide. Without it every step
   stays on screen and the form still submits. */
.hos-booking.is-stepped .hos-booking__step {
	display: none;
}

.hos-booking.is-stepped .hos-booking__step.is-current {
	display: block;
}

.hos-booking__progress {
	display: flex;
	gap: 6px;
	margin-bottom: var(--hos-space-4);
}

.hos-booking__progress span {
	flex: 1;
	height: 4px;
	border-radius: 4px;
	background: var(--hospito-border);
	transition: background var(--hospito-transition);
}

.hos-booking__progress span.is-on {
	background: var(--hos-booking-accent);
}

.hos-booking__stepcount {
	font-size: var(--hospito-font-xs);
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--hospito-muted);
	margin: 0 0 var(--hos-space-5);
}

.hos-booking:not(.is-stepped) .hos-booking__progress,
.hos-booking:not(.is-stepped) .hos-booking__stepcount,
.hos-booking:not(.is-stepped) .hos-booking__back,
.hos-booking:not(.is-stepped) .hos-booking__next {
	display: none;
}

/* What they have chosen so far, carried down the flow. */
.hos-booking__summary {
	list-style: none;
	margin: 0 0 var(--hos-space-5);
	padding: var(--hos-space-3) var(--hos-space-4);
	display: flex;
	flex-wrap: wrap;
	gap: var(--hos-space-2) var(--hos-space-5);
	background: var(--hospito-background-tint);
	border: 1px solid var(--hospito-border-soft);
	border-radius: var(--hospito-radius-sm);
}

.hos-booking__summary li {
	display: flex;
	align-items: baseline;
	gap: var(--hos-space-2);
	margin: 0;
	font-size: var(--hospito-font-xs);
}

.hos-booking__summary span {
	color: var(--hospito-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.hos-booking__summary strong {
	font-size: var(--hospito-font-sm);
	color: var(--hospito-heading);
}

.hos-booking__summary.is-final {
	justify-content: center;
	margin-bottom: 0;
}

.hos-booking__label {
	font-size: var(--hospito-font-h4);
	font-weight: 700;
	color: var(--hospito-heading);
	margin: 0 0 var(--hos-space-4);
	padding: 0;
}

/* Navigation */
.hos-booking__nav {
	display: flex;
	flex-wrap: wrap;
	gap: var(--hos-space-3);
	margin-top: var(--hos-space-6);
}

.hos-booking__nav > * {
	flex: 1 1 auto;
}

.hos-booking__back {
	flex: 0 0 auto;
}

.hos-booking__nav [hidden] {
	display: none !important;
}

/* Confirmation */
.hos-booking.is-sent .hos-booking__steps,
.hos-booking.is-sent .hos-booking__nav,
.hos-booking.is-sent .hos-booking__progress,
.hos-booking.is-sent .hos-booking__stepcount,
.hos-booking.is-sent > .hos-booking__summary {
	display: none !important;
}

.hos-booking__done {
	text-align: center;
	padding: var(--hos-space-4) 0;
}

.hos-booking__done:focus {
	outline: none;
}

.hos-booking__done-icon {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	display: inline-grid;
	place-items: center;
	background: var(--hospito-primary-light);
	color: var(--hospito-primary);
	font-size: 1.25rem;
	margin-bottom: var(--hos-space-4);
}

.hos-booking__done h3 {
	margin: 0 0 var(--hos-space-3);
}

.hos-booking__done p {
	margin: 0 0 var(--hos-space-5);
	font-size: var(--hospito-font-sm);
}

.hos-booking__hint {
	font-size: var(--hospito-font-sm);
	color: var(--hospito-muted);
	margin: 0;
}

.hos-booking__locked {
	display: flex;
	align-items: center;
	gap: var(--hos-space-4);
	padding: var(--hos-space-3);
	background: var(--hospito-background-soft);
	border: 1px solid var(--hospito-border);
	border-radius: var(--hospito-radius);
}

.hos-booking__locked img {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	object-fit: cover;
}

.hos-booking__locked strong {
	display: block;
	color: var(--hospito-heading);
}

.hos-booking__locked small {
	color: var(--hospito-muted);
	font-size: var(--hospito-font-xs);
}

/* Date strip */
.hos-booking__dates {
	display: flex;
	gap: var(--hos-space-3);
	overflow-x: auto;
	padding-bottom: var(--hos-space-2);
	scrollbar-width: thin;
}

.hos-booking__date {
	flex: 0 0 auto;
	width: 72px;
	padding: var(--hos-space-3) var(--hos-space-2);
	display: grid;
	gap: 2px;
	justify-items: center;
	background: #fff;
	border: 1.5px solid var(--hospito-border);
	border-radius: var(--hospito-radius);
	cursor: pointer;
	font-family: inherit;
	transition: border-color var(--hospito-transition), background var(--hospito-transition),
		color var(--hospito-transition);
}

.hos-booking__date:hover {
	border-color: var(--hos-booking-accent);
}

.hos-booking__date.is-active {
	background: var(--hos-booking-accent);
	border-color: var(--hos-booking-accent);
	color: #fff;
}

.hos-booking__date-day {
	font-size: 0.6875rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	opacity: 0.75;
}

.hos-booking__date-num {
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.1;
}

.hos-booking__date-mon {
	font-size: 0.6875rem;
	opacity: 0.75;
}

/* Slot grid */
.hos-booking__slots {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
	gap: var(--hos-space-2);
}

.hos-booking__slot {
	padding: 0.6875rem var(--hos-space-2);
	font-family: inherit;
	font-size: var(--hospito-font-sm);
	font-weight: 500;
	color: var(--hospito-heading);
	background: var(--hospito-background-soft);
	border: 1.5px solid var(--hospito-border);
	border-radius: var(--hospito-radius-sm);
	cursor: pointer;
	transition: all var(--hospito-transition);
}

.hos-booking__slot:hover {
	border-color: var(--hos-booking-accent);
	background: #fff;
}

.hos-booking__slot.is-active {
	background: var(--hos-booking-accent);
	border-color: var(--hos-booking-accent);
	color: #fff;
}

/* ------------------------------------------------------------
   Booking fields

   These had no styling at all: the doctor select and every detail
   input rendered as raw browser defaults inside a rounded card,
   which is what "the booking section is breaking" looked like.
   ------------------------------------------------------------ */

.hos-field {
	display: block;
	margin: 0;
	min-width: 0;
}

.hos-field > label,
.hos-field__label {
	display: block;
	font-size: var(--hospito-font-xs);
	font-weight: 700;
	color: var(--hospito-muted);
	margin-bottom: var(--hos-space-2);
}

.hos-field__input {
	display: block;
	width: 100%;
	max-width: 100%;
	padding: 0.75rem var(--hos-space-4);
	font-family: var(--hospito-font-body);
	/* 16px, deliberately: iOS zooms the whole page in on focus when a field
	   is smaller than this, which reads as the layout breaking. */
	font-size: var(--hospito-font-base);
	line-height: 1.4;
	color: var(--hospito-text);
	background: #fff;
	border: 1.5px solid var(--hospito-border);
	border-radius: var(--hospito-radius-sm);
	appearance: none;
	-webkit-appearance: none;
	transition: border-color var(--hospito-transition), box-shadow var(--hospito-transition);
}

select.hos-field__input {
	padding-right: var(--hos-space-10);
	cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7a99' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right var(--hos-space-4) center;
}

textarea.hos-field__input {
	resize: vertical;
	min-height: 92px;
}

.hos-field__input::placeholder {
	color: var(--hospito-muted-2);
	opacity: 1;
}

.hos-field__input:focus {
	border-color: var(--hos-booking-accent, var(--hospito-primary));
	box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.14);
	outline: none;
}

.hos-field.has-error .hos-field__input {
	border-color: var(--hospito-error);
}

.hos-field__error {
	display: block;
	margin-top: var(--hos-space-1);
	font-size: var(--hospito-font-xs);
	color: var(--hospito-error);
}

.hos-booking__fields {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: var(--hos-space-4);
}

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

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

.hos-booking__consent {
	font-size: var(--hospito-font-xs);
	color: var(--hospito-muted);
	margin: var(--hos-space-4) 0;
}

.hos-booking__submit {
	margin-top: var(--hos-space-2);
}

.hos-booking__message {
	margin-top: var(--hos-space-5);
	padding: 0;
	font-size: var(--hospito-font-sm);
	border-radius: var(--hospito-radius-sm);
}

.hos-booking__message.is-success,
.hos-booking__message.is-error {
	padding: var(--hos-space-4) var(--hos-space-5);
}

.hos-booking__message.is-success {
	background: var(--hospito-primary-light);
	border: 1px solid var(--hospito-primary-soft);
	color: var(--hospito-primary-hover);
}

.hos-booking__message.is-error {
	background: #fdf0ee;
	border: 1px solid #f3c9c2;
	color: var(--hospito-error);
}

/* ------------------------------------------------------------
   Booking — fee and payment choice
   ------------------------------------------------------------ */

.hos-booking__fee {
	display: flex;
	align-items: baseline;
	gap: var(--hos-space-3);
	margin: var(--hos-space-4) 0 0;
	padding: var(--hos-space-3) var(--hos-space-4);
	background: var(--hospito-background-tint);
	border: 1px dashed var(--hospito-primary-soft);
	border-radius: var(--hospito-radius-sm);
	font-size: var(--hospito-font-sm);
}

.hos-booking__fee strong {
	font-family: var(--hospito-font-heading);
	font-size: var(--hospito-font-h3);
	font-weight: 800;
	color: var(--hospito-primary-hover);
}

.hos-booking__pay {
	border: 0;
	margin: var(--hos-space-5) 0 0;
	padding: 0;
	display: grid;
	gap: var(--hos-space-3);
}

.hos-booking__pay legend {
	font-size: var(--hospito-font-sm);
	font-weight: 700;
	color: var(--hospito-heading);
	margin-bottom: var(--hos-space-2);
	padding: 0;
}

.hos-booking__payopt {
	display: flex;
	align-items: flex-start;
	gap: var(--hos-space-3);
	padding: var(--hos-space-4);
	border: 1px solid var(--hospito-border);
	border-radius: var(--hospito-radius-sm);
	cursor: pointer;
	transition: border-color var(--hospito-transition), background var(--hospito-transition);
}

.hos-booking__payopt:hover,
.hos-booking__payopt:focus-within {
	border-color: var(--hospito-primary-soft);
	background: var(--hospito-background-tint);
}

.hos-booking__payopt input {
	margin-top: 0.25em;
	flex: 0 0 auto;
	accent-color: var(--hospito-primary);
}

.hos-booking__payopt strong {
	display: block;
	font-size: var(--hospito-font-sm);
	color: var(--hospito-heading);
}

.hos-booking__payopt small {
	display: block;
	font-size: var(--hospito-font-xs);
	color: var(--hospito-muted);
	margin-top: 2px;
}

/* ------------------------------------------------------------
   Doctor or branch

   A first-time patient does not know the consultants; they want
   to be seen at the centre near them. So "visit a branch" is a
   first-class choice, not a fallback.
   ------------------------------------------------------------ */

.hos-booking__modes {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
	gap: var(--hos-space-3);
	margin-bottom: var(--hos-space-5);
}

.hos-booking__mode {
	display: flex;
	align-items: flex-start;
	gap: var(--hos-space-3);
	padding: var(--hos-space-4);
	background: var(--hospito-background-tint);
	border: 1.5px solid var(--hospito-border);
	border-radius: var(--hospito-radius);
	cursor: pointer;
	transition: border-color var(--hospito-transition), background var(--hospito-transition);
}

.hos-booking__mode input {
	margin-top: 0.2em;
	flex: 0 0 auto;
	accent-color: var(--hospito-primary);
}

.hos-booking__mode:has(input:checked) {
	border-color: var(--hos-booking-accent);
	background: var(--hospito-primary-light);
}

.hos-booking__mode strong {
	display: block;
	font-size: var(--hospito-font-sm);
	color: var(--hospito-heading);
}

.hos-booking__mode small {
	display: block;
	margin-top: 2px;
	font-size: var(--hospito-font-xs);
	color: var(--hospito-muted);
	line-height: 1.45;
}

/* A branch has no portrait, so its mark is the building. */
.hos-booking__pick-photo--branch {
	background: linear-gradient(160deg, var(--hospito-primary-light), var(--hospito-primary-soft));
	font-size: 1.125rem;
}

/* ------------------------------------------------------------
   Doctor picker

   A dropdown of nine names tells a patient nothing. Cards carry
   the photo, the speciality and the experience, which is what
   they are actually choosing between.
   ------------------------------------------------------------ */

.hos-booking__picker {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
	gap: var(--hos-space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}

.hos-booking__pick {
	position: relative;
	display: flex;
	align-items: center;
	gap: var(--hos-space-3);
	padding: var(--hos-space-3);
	background: #fff;
	border: 1.5px solid var(--hospito-border);
	border-radius: var(--hospito-radius);
	cursor: pointer;
	transition: border-color var(--hospito-transition), box-shadow var(--hospito-transition),
		background var(--hospito-transition);
}

.hos-booking__pick:hover {
	border-color: var(--hospito-primary-soft);
	box-shadow: var(--hospito-shadow-xs);
}

/* The radio itself is the source of truth, so keyboard and screen readers get
   a real control and the checked state needs no JavaScript. */
.hos-booking__pick input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
}

.hos-booking__pick:has(input:checked) {
	border-color: var(--hos-booking-accent);
	background: var(--hospito-primary-light);
	box-shadow: 0 0 0 1px var(--hos-booking-accent);
}

.hos-booking__pick:focus-within {
	outline: 3px solid var(--hospito-accent);
	outline-offset: 2px;
}

.hos-booking__pick-photo {
	flex: 0 0 auto;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	overflow: hidden;
	display: grid;
	place-items: center;
	background: linear-gradient(160deg, var(--hospito-primary-light), var(--hospito-accent-light));
	font-family: var(--hospito-font-heading);
	font-size: 0.9375rem;
	font-weight: 800;
	color: var(--hospito-primary);
}

.hos-booking__pick-photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
}

.hos-booking__pick-body {
	min-width: 0;
}

.hos-booking__pick-name {
	display: block;
	font-family: var(--hospito-font-heading);
	font-size: var(--hospito-font-card);
	font-weight: 800;
	line-height: 1.25;
	color: var(--hospito-heading);
}

.hos-booking__pick-role {
	display: block;
	font-size: var(--hospito-font-xs);
	color: var(--hospito-muted);
	line-height: 1.45;
	margin-top: 2px;
}

/* A browser without :has() support still needs the choice to read, so the
   radio is drawn back in as a dot. */
@supports not selector(:has(*)) {
	.hos-booking__pick input {
		position: static;
		opacity: 1;
		width: 17px;
		height: 17px;
		accent-color: var(--hospito-primary);
	}
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

@media (max-width: 560px) {
	/* The nav stacks so neither button ends up 90px wide with a clipped label. */
	.hos-booking__nav {
		flex-direction: column-reverse;
	}

	.hos-booking__nav > * {
		width: 100%;
	}

	.hos-booking__summary {
		flex-direction: column;
		gap: var(--hos-space-2);
	}

	.hos-booking__picker {
		grid-template-columns: minmax(0, 1fr);
	}

	/* A 104px minimum left two slots per row with a gap of dead space; three
	   narrower pills read better and are still a comfortable tap target. */
	.hos-booking__slots {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.hos-booking__date {
		width: 62px;
	}

	.hos-booking__fields {
		grid-template-columns: minmax(0, 1fr);
	}

	.hos-booking {
		padding: var(--hos-space-5) var(--hos-space-4);
		border-radius: var(--hospito-radius);
	}
}

