/**
 * Booking page (page-dat-lich.php, inc/booking/form.php): the info
 * column and the form panel, fieldsets, the date field with its month
 * calendar and the time list, and the confirmation panel. Loaded on
 * that page only. The fields use forms.css, the next steps
 * numbered-list.css, the contact list contact-list.css. See "Booking
 * page" in docs/design-system.md.
 */

/*
 * Layout: info column first; from 1024px the info column (about 5 of 12
 * columns) on the left and the form on the right.
 */
.bst-booking__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: calc(2 * var(--gap));
}

@media (min-width: 1024px) {

	.bst-booking__layout {
		grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
		align-items: start;
	}
}

/* Info column: intro, next steps, contact list. */
.bst-booking__intro {
	margin-bottom: 2em;
}

.bst-booking__steps-title {
	margin-bottom: 0.25em;
}

.bst-booking__contact {
	margin-top: 2em;
}

/* Panel: white, 1px border, padding --gap (form, confirmation, no slots). */
.bst-booking__panel {
	padding: var(--gap);
	border: 1px solid var(--color-border);
	background-color: var(--color-white);
}

.bst-booking__panel > :last-child,
.bst-booking-form > :last-child {
	margin-bottom: 0;
}

/* Groups: fieldsets without a box; legend in the menu type style in forest. */
.bst-booking__group {
	min-width: 0;
	margin: 0 0 2em;
	padding: 0;
	border: 0;
}

.bst-booking__legend {
	margin-bottom: 1em;
	padding: 0;
	color: var(--color-forest);
	font-family: var(--font-body);
	font-size: var(--text-menu);
	font-weight: 500;
	letter-spacing: 0.15em;
	text-transform: uppercase;
}

/*
 * Date and time. Without JavaScript: the select "Ngày và giờ hẹn" in the
 * input style (forms.css). With JavaScript (assets/js/booking.js) the
 * select is hidden and replaced by the date field, the inline calendar
 * and the time list.
 */
.bst-booking__slot-field {
	margin-bottom: 0;
}

.bst-booking__slot-field.is-enhanced > label[for="bst-slot"],
.bst-booking__slot-field.is-enhanced > select {
	display: none;
}

/*
 * Date field: looks like the other inputs (bottom border only); the
 * chosen date or the placeholder "Chọn ngày", an accent calendar icon at
 * the right. Same specificity as the GeneratePress button rules.
 */
button.bst-datepicker__toggle,
button.bst-datepicker__toggle:hover,
button.bst-datepicker__toggle:focus {
	background-color: transparent;
	color: var(--color-forest);
}

button.bst-datepicker__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75em;
	box-sizing: border-box;
	width: 100%;
	min-height: 44px;
	padding: 0.5em 0;
	border: 0;
	border-bottom: 1px solid var(--color-border);
	border-radius: 0;
	font-family: var(--font-body);
	font-size: var(--text-body);
	font-weight: 400;
	line-height: 1.5;
	text-align: left;
	cursor: pointer;
	transition: border-color var(--motion-fast) ease;
}

button.bst-datepicker__toggle:focus,
button.bst-datepicker__toggle[aria-expanded="true"] {
	border-color: var(--color-forest);
}

.bst-field--invalid button.bst-datepicker__toggle {
	border-color: var(--color-error);
}

/* Placeholder style while no day is chosen. */
.bst-datepicker__toggle.is-empty .bst-datepicker__value {
	color: var(--color-text);
	font-family: var(--font-heading);
	font-size: var(--text-link);
	font-style: italic;
}

.bst-datepicker__icon {
	flex-shrink: 0;
	color: var(--color-accent);
}

/*
 * Calendar: inline below the field (pushes the content down), at most
 * 420px wide. Header: month and year between the month buttons.
 */
.bst-calendar {
	max-width: 420px;
	margin-top: 1em;
}

.bst-calendar[hidden] {
	display: none;
}

.bst-calendar__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5em;
	margin-bottom: 0.5em;
}

.bst-calendar__title {
	flex: 1;
	margin: 0;
	color: var(--color-forest);
	font-family: var(--font-heading);
	font-size: var(--text-h4);
	line-height: 1.3;
	text-align: center;
}

button.bst-calendar__nav,
button.bst-calendar__nav:hover,
button.bst-calendar__nav:focus {
	background-color: transparent;
	color: var(--color-accent);
}

button.bst-calendar__nav {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 0;
	cursor: pointer;
	transition: opacity var(--motion-fast) ease;
}

button.bst-calendar__nav:disabled {
	opacity: 0.35;
	cursor: default;
}

/* Grid: weekday labels in the eyebrow style, 7 square cells per row. */
.bst-calendar__grid {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	table-layout: fixed;
}

.bst-calendar__grid th,
.bst-calendar__grid td {
	padding: 0;
	border: 0;
	text-align: center;
}

.bst-calendar__grid th {
	padding-bottom: 0.5em;
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: var(--text-small);
	font-weight: 500;
	letter-spacing: 0.3em;
	text-transform: uppercase;
}

/*
 * Days: plain --color-text and not selectable, except open days (sage,
 * forest text) and the selected day (forest, ivory text). The 1px
 * transparent border leaves a hairline gap between sage cells
 * (background-clip) and turns forest on hover and focus.
 */
button.bst-calendar__day,
button.bst-calendar__day:hover,
button.bst-calendar__day:focus {
	background-color: transparent;
	color: var(--color-text);
}

button.bst-calendar__day {
	display: grid;
	place-items: center;
	box-sizing: border-box;
	width: 100%;
	aspect-ratio: 1;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 0;
	background-clip: padding-box;
	font-family: var(--font-body);
	font-size: var(--text-body);
	font-weight: 400;
	line-height: 1;
	cursor: default;
	transition: border-color var(--motion-fast) ease, background-color var(--motion-fast) ease;
}

button.bst-calendar__day.is-open,
button.bst-calendar__day.is-open:hover,
button.bst-calendar__day.is-open:focus {
	background-color: var(--color-sage);
	color: var(--color-forest);
	cursor: pointer;
}

button.bst-calendar__day.is-open:hover,
button.bst-calendar__day.is-open:focus {
	border-color: var(--color-forest);
}

button.bst-calendar__day.is-selected,
button.bst-calendar__day.is-selected:hover,
button.bst-calendar__day.is-selected:focus {
	background-color: var(--color-forest);
	color: var(--color-ivory);
}

/* Today: a 1px accent underline under its number. */
.bst-calendar__day.is-today .bst-calendar__number {
	text-decoration: underline;
	text-decoration-color: var(--color-accent);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.3em;
}

/* Legend below the grid: a small sage square and "Còn lịch trống". */
.bst-calendar__legend {
	display: flex;
	align-items: center;
	gap: 0.5em;
	margin: 0.75em 0 0;
	color: var(--color-text);
}

.bst-calendar__swatch {
	flex-shrink: 0;
	width: 0.75em;
	height: 0.75em;
	background-color: var(--color-sage);
}

/*
 * Time list: a fieldset (legend "Giờ hẹn, Thứ Hai 02/11") with the
 * slots as square chips in a wrapping grid. The radio is invisible but
 * stays focusable over the whole chip.
 */
.bst-booking__times {
	min-width: 0;
	margin: 1.5em 0 0;
	padding: 0;
	border: 0;
}

.bst-booking__times[hidden] {
	display: none;
}

.bst-booking__chips {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(5.5em, 1fr));
	gap: 0.5em;
}

.bst-choice {
	position: relative;
	display: block;
	margin: 0;
	cursor: pointer;
}

.bst-choice__input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

/* The time in the menu type style, at least 44px tall. */
.bst-choice__text {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: 44px;
	padding: 0 0.5em;
	border: 1px solid var(--color-border);
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: var(--text-menu);
	font-weight: 500;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	transition: border-color var(--motion-fast) ease, background-color var(--motion-fast) ease, color var(--motion-fast) ease;
}

.bst-choice:hover .bst-choice__text,
.bst-choice__input:focus-visible + .bst-choice__text {
	border-color: var(--color-forest);
}

.bst-choice__input:focus-visible + .bst-choice__text {
	outline: 2px solid var(--focus-color);
	outline-offset: 2px;
}

.bst-choice__input:checked + .bst-choice__text {
	border-color: var(--color-forest);
	background-color: var(--color-forest);
	color: var(--color-ivory);
}

/* Booked: dashed border, struck through, not selectable. */
.bst-choice.is-booked,
.bst-choice.is-booked .bst-choice__input {
	cursor: not-allowed;
}

.bst-choice.is-booked .bst-choice__text,
.bst-choice.is-booked:hover .bst-choice__text {
	border-style: dashed;
	border-color: var(--color-border);
	text-decoration: line-through;
}

/* Consent, then the submit button. */
.bst-booking__consent {
	margin: 0 0 2em;
}

.bst-booking__consent .bst-check {
	margin: 0;
}

.bst-booking__submit {
	margin: 0;
}

/* Honeypot: out of view and out of the tab order. */
.bst-booking__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/*
 * Confirmation: success title, date and time, text, button. Focused on
 * load; not a control, so no focus outline (the panel keeps its border).
 */
.bst-booking__done:focus {
	outline: none;
}

.bst-booking__done-title {
	margin-bottom: 0.5em;
}

.bst-booking__when {
	margin: 0 0 1em;
	color: var(--color-forest);
	font-family: var(--font-heading);
	font-size: var(--text-h3);
	font-style: italic;
}

.bst-booking__done-text {
	margin-bottom: 1.5em;
}

.bst-booking__empty p {
	margin: 0;
}
