/* plugins/apaxon-bookings/assets/css/booking.css */
/*
 * The booking form, on the customer's own site.
 *
 * Two things had to be true at once and the first version only managed one.
 *
 * It must not clash with whatever theme it lands in — so typography is
 * inherited entirely, spacing is in ems, and neutrals are derived from the
 * page's own text colour with color-mix. Nothing here assumes a light
 * background or a dark one.
 *
 * And it must not look unfinished. Inheriting *everything*, including the
 * accent, produced a grey outlined form that read as a placeholder. So there
 * is one colour the restaurant chooses, applied to the things that should draw
 * the eye — the selected time, the button that takes the booking — and
 * nothing else.
 *
 * No Apaxon branding anywhere. A restaurant's booking form says "Book a
 * table"; a prospective buyer who sees our name on it reasonably concludes
 * their own site would carry it too.
 */

.apaxon-bk {
	/*
	 * A query container, so the form answers to the space it is in rather
	 * than to the window.
	 *
	 * This matters most in a page builder. Dropped into an Elementor sidebar
	 * or a 33% column, the form can be 300px wide on a 1400px screen — and a
	 * viewport media query sees only the 1400 and lays the fields out side by
	 * side in a column that cannot hold them. The same happens in a popup, a
	 * off-canvas panel, and a narrow theme sidebar.
	 *
	 * Naming the container rather than relying on the nearest one means a
	 * builder wrapping its own `container-type` around us cannot capture these
	 * queries by accident.
	 */
	container-type: inline-size;
	container-name: apaxon-bk;

	/* Overridden per site by Frontend\Styles. Defaults here so the form is
	   never unstyled if that inline block fails to print. */
	--bk-accent: #8a6d3b;
	--bk-accent-ink: #ffffff;
	--bk-radius: 10px;

	--bk-line: color-mix(in srgb, currentColor 16%, transparent);
	--bk-line-strong: color-mix(in srgb, currentColor 34%, transparent);
	--bk-quiet: color-mix(in srgb, currentColor 62%, transparent);
	--bk-wash: color-mix(in srgb, currentColor 4%, transparent);
	--bk-accent-wash: color-mix(in srgb, var(--bk-accent) 10%, transparent);

	max-width: 42rem;
	font-size: 1rem;
	line-height: 1.5;
	box-sizing: border-box;
}

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

.apaxon-bk--width-full { max-width: none; }

/* ── The panel ────────────────────────────────────────────────────── */

.apaxon-bk--fill-card,
.apaxon-bk--fill-raised {
	padding: 1.75rem;
	border-radius: calc(var(--bk-radius) + 4px);
	background: var(--bk-wash);
}

.apaxon-bk--fill-card { border: 1px solid var(--bk-line); }

.apaxon-bk--fill-raised {
	border: 1px solid var(--bk-line);
	box-shadow: 0 12px 32px -12px color-mix(in srgb, currentColor 22%, transparent);
}

.apaxon-bk__title {
	margin: 0 0 1.25rem;
	font-size: 1.5rem;
	line-height: 1.15;
	letter-spacing: -0.02em;
}

/* ── Fields ───────────────────────────────────────────────────────── */

.apaxon-bk__pair {
	display: flex;
	flex-wrap: wrap;
	gap: 0.875rem;
	align-items: flex-end;
	margin-bottom: 1.5rem;
}

.apaxon-bk__field {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	flex: 1 1 10rem;
}

.apaxon-bk__field > span {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--bk-quiet);
}

.apaxon-bk__field input,
.apaxon-bk__field select,
.apaxon-bk__field textarea {
	width: 100%;
	padding: 0.75rem 0.875rem;
	border: 1px solid var(--bk-line-strong);
	border-radius: var(--bk-radius);
	background: transparent;
	color: inherit;
	font: inherit;
	line-height: 1.3;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.apaxon-bk__field input:focus,
.apaxon-bk__field select:focus,
.apaxon-bk__field textarea:focus {
	outline: none;
	border-color: var(--bk-accent);
	box-shadow: 0 0 0 3px var(--bk-accent-wash);
}

.apaxon-bk__field textarea { resize: vertical; min-height: 5rem; }

/* ── Buttons ──────────────────────────────────────────────────────── */

.apaxon-bk__go,
.apaxon-bk__confirm {
	padding: 0.75rem 1.375rem;
	border: 1px solid var(--bk-accent);
	border-radius: var(--bk-radius);
	background: var(--bk-accent);
	color: var(--bk-accent-ink);
	font: inherit;
	font-weight: 600;
	line-height: 1.3;
	cursor: pointer;
	transition: filter 0.15s ease;
}

.apaxon-bk__go:hover,
.apaxon-bk__confirm:hover { filter: brightness(1.08); }

.apaxon-bk__confirm {
	width: 100%;
	margin-top: 1rem;
	padding: 0.9375rem;
	font-size: 1.0625rem;
}

/* ── Times ────────────────────────────────────────────────────────── */

.apaxon-bk__service { margin-bottom: 1.75rem; }

.apaxon-bk__service-name {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 0 0 0.75rem;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--bk-quiet);
}

/* A rule running off to the right of the label, so several sittings read as
   separate sections without needing a heavier heading. */
.apaxon-bk__service-name::after {
	content: '';
	flex: 1;
	height: 1px;
	background: var(--bk-line);
}

.apaxon-bk__times { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* An even grid keeps the times aligned in columns, which reads as a schedule.
   Flowing packs more in. Neither is right for every restaurant, so it is a
   choice rather than a decision made here. */
.apaxon-bk--times-grid .apaxon-bk__times {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(5.25rem, 1fr));
}

.apaxon-bk__timeform { margin: 0; display: contents; }

.apaxon-bk__time {
	display: block;
	width: 100%;
	padding: 0.6875rem 0.75rem;
	border: 1px solid var(--bk-line-strong);
	border-radius: var(--bk-radius);
	background: transparent;
	color: inherit;
	font: inherit;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.apaxon-bk__time:hover {
	border-color: var(--bk-accent);
	background: var(--bk-accent-wash);
	color: var(--bk-accent);
}

.apaxon-bk__time:focus-visible {
	outline: none;
	border-color: var(--bk-accent);
	box-shadow: 0 0 0 3px var(--bk-accent-wash);
}

/* Struck through rather than removed. The gaps in the grid are what tell a
   guest the restaurant is busy, and a guest who can see that books now
   instead of deciding later. */
.apaxon-bk__time.is-gone {
	border-color: transparent;
	background: var(--bk-wash);
	color: var(--bk-quiet);
	font-weight: 400;
	text-decoration: line-through;
	cursor: default;
}

/* ── Chosen, and the details ──────────────────────────────────────── */

.apaxon-bk__details {
	margin-top: 1.75rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--bk-line);
}

.apaxon-bk__chosen {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	margin: 0 0 1.25rem;
	padding: 0.875rem 1rem;
	border-radius: var(--bk-radius);
	background: var(--bk-accent-wash);
	color: inherit;
	font-weight: 600;
}

.apaxon-bk__chosen::before {
	content: '';
	width: 0.5rem;
	height: 0.5rem;
	flex-shrink: 0;
	border-radius: 50%;
	background: var(--bk-accent);
}

.apaxon-bk__empty {
	padding: 1.5rem;
	border: 1px dashed var(--bk-line-strong);
	border-radius: var(--bk-radius);
	color: var(--bk-quiet);
	text-align: center;
}

/* ── After booking ───────────────────────────────────────────────── */

.apaxon-bk--done .apaxon-bk__title,
.apaxon-bk--closed .apaxon-bk__title { margin-bottom: 0.75rem; }

.apaxon-bk__reference {
	display: inline-flex;
	align-items: baseline;
	gap: 0.5rem;
	margin: 0.5rem 0 1rem;
	padding: 0.625rem 1rem;
	border-radius: var(--bk-radius);
	background: var(--bk-accent-wash);
	font-size: 0.8125rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--bk-quiet);
}

.apaxon-bk__reference strong {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 1.25rem;
	letter-spacing: 0.12em;
	text-transform: none;
	color: var(--bk-accent);
}

/* ── Managing a booking ──────────────────────────────────────────── */

/* The search-and-choose form on the first step. It carries no styling of its
   own — everything is on the fields inside it — but the class stays because
   it is the hook a site owner will reach for first when they want to move it,
   and finding nothing there is worse than finding an empty rule. */
.apaxon-bk__form { margin: 0; }

.apaxon-bk--manage .apaxon-bk__chosen { margin-bottom: 1rem; }

.apaxon-bk__cancel { margin: 1.5rem 0 0.75rem; }

.apaxon-bk__cancelbtn {
	padding: 0.625rem 1.125rem;
	border: 1px solid var(--bk-line-strong);
	border-radius: var(--bk-radius);
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.apaxon-bk__cancelbtn:hover { border-color: currentColor; }

.apaxon-bk__note {
	margin: 0.75rem 0 0;
	font-size: 0.875rem;
	line-height: 1.55;
	color: var(--bk-quiet);
}

/*
 * Off the screen, not display:none.
 *
 * A field set to display:none is the first thing an automated submitter
 * checks for and skips. Positioned away it is invisible to a person and
 * present to anything filling fields blindly.
 */
.apaxon-bk__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/*
 * The narrow layout.
 *
 * Stated twice on purpose. The container query is the one that is right — it
 * fires whenever the form itself is narrow, wherever that happens. The
 * viewport query below is a floor for browsers without container query support
 * (Safari before 16), where a phone would otherwise get the wide layout.
 *
 * A browser with both applies both and they agree, so the duplication costs
 * nothing at runtime.
 */
@container apaxon-bk (max-width: 600px) {
	.apaxon-bk--fill-card,
	.apaxon-bk--fill-raised { padding: 1.25rem; }

	.apaxon-bk__field { flex: 1 1 100%; }
	.apaxon-bk__go { width: 100%; }
	.apaxon-bk--times-grid .apaxon-bk__times { grid-template-columns: repeat(auto-fill, minmax(4.75rem, 1fr)); }
}

@supports not (container-type: inline-size) {
	@media (max-width: 600px) {
		.apaxon-bk--fill-card,
		.apaxon-bk--fill-raised { padding: 1.25rem; }

		.apaxon-bk__field { flex: 1 1 100%; }
		.apaxon-bk__go { width: 100%; }
		.apaxon-bk--times-grid .apaxon-bk__times { grid-template-columns: repeat(auto-fill, minmax(4.75rem, 1fr)); }
	}
}

/* Somebody who has asked for less movement gets less movement. */
@media (prefers-reduced-motion: reduce) {
	.apaxon-bk * { transition: none !important; }
}

/* Shown in a page builder's canvas in place of the live form. A working form
   inside an editor iframe posts the editor's own page, and its buttons are a
   trap for whoever is laying the page out. */
.apaxon-bk-placeholder {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	padding: 2.5rem 1.5rem;
	border: 1px dashed color-mix(in srgb, currentColor 30%, transparent);
	border-radius: 12px;
	background: color-mix(in srgb, currentColor 4%, transparent);
	text-align: center;
}

.apaxon-bk-placeholder strong { font-size: 1rem; }

.apaxon-bk-placeholder span {
	font-size: 0.875rem;
	color: color-mix(in srgb, currentColor 62%, transparent);
}
