/*
 * CIVF Appointment — patient-facing styles.
 * Everything is namespaced under .civf-* so the host theme is untouched.
 */

.civf-book,
.civf-status,
.civf-empty {
	--civf-ink: #14201e;
	--civf-teal: #0e6e63;
	--civf-teal-dark: #073f39;
	--civf-mist: #edf4f2;
	--civf-paper: #fff;
	--civf-line: #d6e3df;
	--civf-blush: #c4577a;
	--civf-muted: #5e736f;
	--civf-bad: #a33232;
	--civf-warn: #8a5a10;
	--civf-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

	box-sizing: border-box;
	color: var(--civf-ink);
	line-height: 1.55;
}

.civf-book *,
.civf-book *::before,
.civf-book *::after,
.civf-status * {
	box-sizing: inherit;
}

/* ---------- Heading ---------- */

.civf-book__head { margin-bottom: 22px; }

.civf-book__title {
	font-family: var(--civf-serif);
	font-size: clamp(24px, 3.2vw, 31px);
	line-height: 1.2;
	letter-spacing: -0.01em;
	margin: 0 0 6px;
}

.civf-book__intro {
	margin: 0;
	color: var(--civf-muted);
	font-size: 15px;
	max-width: 54ch;
}

/* ---------- Progress rail ---------- */

.civf-rail {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 22px;
	list-style: none;
	margin: 0 0 24px;
	padding: 0 0 16px;
	border-bottom: 1px solid var(--civf-line);
}

.civf-rail__step {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: var(--civf-muted);
}

.civf-rail__num {
	display: grid;
	place-items: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	border: 1px solid var(--civf-line);
	background: var(--civf-paper);
	font-size: 12px;
	font-weight: 600;
	transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.civf-rail__step.is-current { color: var(--civf-ink); font-weight: 600; }

.civf-rail__step.is-current .civf-rail__num {
	background: var(--civf-teal);
	border-color: var(--civf-teal);
	color: #fff;
}

.civf-rail__step.is-done .civf-rail__num {
	background: var(--civf-mist);
	border-color: var(--civf-teal);
	color: var(--civf-teal-dark);
}

/* ---------- Layout ---------- */

.civf-book__body {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 278px;
	gap: 28px;
	align-items: start;
}

.civf-book__main { min-width: 0; }

@media (max-width: 860px) {
	.civf-book__body { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Panes ---------- */

.civf-pane[hidden] { display: none; }

.civf-pane { animation: civf-in .28s ease both; }

@keyframes civf-in {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: none; }
}

.civf-pane__title {
	font-family: var(--civf-serif);
	font-size: 20px;
	font-weight: 600;
	margin: 0 0 16px;
}

/* ---------- Services ---------- */

.civf-services { display: grid; gap: 10px; }

.civf-service {
	display: grid;
	gap: 4px;
	width: 100%;
	text-align: left;
	padding: 16px 18px;
	border: 1px solid var(--civf-line);
	border-radius: 12px;
	background: var(--civf-paper);
	font: inherit;
	color: inherit;
	cursor: pointer;
	transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.civf-service:hover { border-color: var(--civf-teal); }

.civf-service[aria-checked="true"] {
	border-color: var(--civf-teal);
	background: var(--civf-mist);
	box-shadow: inset 3px 0 0 var(--civf-teal);
}

.civf-service__name { font-weight: 650; font-size: 16px; }

.civf-service__media {
	display: block;
	margin: -4px 0 8px;
	border-radius: 8px;
	overflow: hidden;
	background: var(--civf-mist);
	aspect-ratio: 16 / 9;
}

.civf-service__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* With a poster the card reads better as a two-column layout on wider screens. */
@media (min-width: 620px) {
	.civf-service:has(.civf-service__media) {
		grid-template-columns: 150px minmax(0, 1fr);
		column-gap: 16px;
		align-items: start;
	}

	.civf-service:has(.civf-service__media) .civf-service__media {
		grid-row: 1 / span 4;
		margin: 0;
	}
}

.civf-captcha { margin: 0 0 18px; }
.civf-service__blurb { font-size: 13.5px; color: var(--civf-muted); }

.civf-service__meta {
	display: flex;
	gap: 14px;
	margin-top: 6px;
	font-size: 13px;
}

.civf-service__price { font-weight: 650; }
.civf-service__time { color: var(--civf-muted); }

/* ---------- Fields ---------- */

.civf-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
}

@media (max-width: 560px) {
	.civf-grid { grid-template-columns: minmax(0, 1fr); }
}

.civf-field--wide { grid-column: 1 / -1; }

.civf-field label,
.civf-field__group label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	margin-bottom: 5px;
}

.civf-field abbr {
	color: var(--civf-blush);
	text-decoration: none;
	border: 0;
}

.civf-field input[type="text"],
.civf-field input[type="email"],
.civf-field input[type="tel"],
.civf-field input[type="date"],
.civf-field input[type="number"],
.civf-field select,
.civf-field textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--civf-line);
	border-radius: 8px;
	background: var(--civf-paper);
	font: inherit;
	font-size: 15px;
	color: var(--civf-ink);
}

.civf-field--split {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.civf-field--date { max-width: 240px; margin-bottom: 20px; }

.civf-field.has-error input,
.civf-field.has-error select,
.civf-field.has-error textarea {
	border-color: var(--civf-bad);
	background: #fdf7f7;
}

.civf-field__error {
	display: block;
	color: var(--civf-bad);
	font-size: 12.5px;
	margin-top: 4px;
}

.civf-field input:focus-visible,
.civf-field select:focus-visible,
.civf-field textarea:focus-visible,
.civf-service:focus-visible,
.civf-btn:focus-visible,
.civf-slot:focus-visible {
	outline: 2px solid var(--civf-teal);
	outline-offset: 2px;
}

.civf-consent {
	margin-top: 18px;
	font-size: 14px;
}

.civf-consent label {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	color: var(--civf-muted);
}

.civf-consent input { margin-top: 3px; flex: 0 0 auto; }
.civf-consent.has-error { color: var(--civf-bad); }

.civf-trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------- Slots ---------- */

.civf-slots { min-height: 60px; }

.civf-slots__note,
.civf-slots__empty {
	margin: 0;
	color: var(--civf-muted);
	font-size: 14px;
}

.civf-slots__count {
	margin: 0 0 10px;
	font-size: 13px;
	color: var(--civf-muted);
}

.civf-slots__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
	gap: 8px;
}

.civf-slot {
	padding: 11px 8px;
	border: 1px solid var(--civf-line);
	border-radius: 8px;
	background: var(--civf-paper);
	font: inherit;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	color: var(--civf-ink);
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease, color .15s ease;
	animation: civf-in .24s ease both;
}

.civf-slot:hover:not(:disabled) { border-color: var(--civf-teal); }

.civf-slot[aria-pressed="true"] {
	background: var(--civf-blush);
	border-color: var(--civf-blush);
	color: #fff;
	font-weight: 600;
}

.civf-slot:disabled {
	opacity: .45;
	cursor: not-allowed;
	text-decoration: line-through;
}

/* ---------- Review ---------- */

.civf-review { margin: 0 0 20px; border-top: 1px solid var(--civf-line); }

.civf-review > div {
	display: flex;
	justify-content: space-between;
	gap: 20px;
	padding: 11px 0;
	border-bottom: 1px solid var(--civf-line);
}

.civf-review dt { margin: 0; color: var(--civf-muted); font-size: 14px; }

.civf-review dd {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	text-align: right;
	word-break: break-word;
}

.civf-pay {
	border: 1px solid var(--civf-line);
	border-radius: 12px;
	padding: 14px 16px;
	margin: 0 0 18px;
}

.civf-pay legend { font-size: 13px; font-weight: 600; padding: 0 6px; }

.civf-pay__option {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 8px 0;
	cursor: pointer;
}

.civf-pay__option small {
	display: block;
	color: var(--civf-muted);
	font-size: 13px;
}

.civf-secure {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	background: var(--civf-mist);
	color: var(--civf-teal-dark);
	border-radius: 10px;
	padding: 13px 16px;
	font-size: 13.5px;
	margin: 0 0 20px;
}

.civf-secure svg { flex: 0 0 auto; margin-top: 2px; }
.civf-secure[hidden] { display: none; }

/* ---------- Buttons ---------- */

.civf-nav {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 24px;
}

.civf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 22px;
	border: 1px solid transparent;
	border-radius: 999px;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background .18s ease, color .18s ease, opacity .18s ease;
}

.civf-btn--go,
.civf-btn--submit {
	background: var(--civf-teal);
	color: #fff;
}

.civf-btn--go:hover:not(:disabled),
.civf-btn--submit:hover:not(:disabled) { background: var(--civf-teal-dark); }

.civf-btn--submit { margin-left: auto; }

.civf-btn--back {
	background: transparent;
	border-color: var(--civf-line);
	color: var(--civf-muted);
}

.civf-btn--back:hover { border-color: var(--civf-teal); color: var(--civf-teal-dark); }

.civf-btn:disabled,
.civf-btn[aria-disabled="true"] {
	opacity: .45;
	cursor: not-allowed;
}

/* Still clickable, so the form can explain what is missing rather than
   sitting there dead. Hover must not imply it is ready. */
.civf-btn[aria-disabled="true"]:hover { background: var(--civf-teal); }

.civf-spin {
	display: none;
	width: 15px;
	height: 15px;
	border: 2px solid rgba(255, 255, 255, .4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: civf-spin .7s linear infinite;
}

.civf-btn.is-busy .civf-spin { display: block; }

@keyframes civf-spin { to { transform: rotate(360deg); } }

/* ---------- Alerts ---------- */

.civf-alert {
	background: #fdf2f2;
	border: 1px solid #f0c9c9;
	color: var(--civf-bad);
	border-radius: 10px;
	padding: 12px 16px;
	font-size: 14px;
	margin-bottom: 18px;
}

.civf-alert[hidden] { display: none; }

.civf-empty {
	padding: 16px 18px;
	border: 1px dashed var(--civf-line);
	border-radius: 12px;
	color: var(--civf-muted);
	font-size: 15px;
}

/* ---------- Appointment slip ---------- */

.civf-slip {
	position: sticky;
	top: 24px;
	background: var(--civf-paper);
	border: 1px solid var(--civf-line);
	border-radius: 3px 3px 12px 12px;
	overflow: hidden;
}

.civf-slip__tear {
	height: 10px;
	background: radial-gradient(circle at 6px -3px, transparent 6px, var(--civf-teal) 6.5px) repeat-x;
	background-size: 12px 10px;
}

.civf-slip__inner { padding: 18px; }

.civf-slip__clinic {
	margin: 0;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .09em;
	text-transform: uppercase;
	color: var(--civf-teal);
}

.civf-slip__title {
	font-family: var(--civf-serif);
	font-size: 17px;
	font-weight: 600;
	margin: 2px 0 16px;
}

.civf-slip__list { margin: 0 0 16px; display: grid; gap: 12px; }

.civf-slip__line dt {
	margin: 0 0 2px;
	font-size: 11px;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--civf-muted);
}

.civf-slip__line dd { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.4; }
.civf-slip__line.is-blank dd { color: var(--civf-line); font-weight: 400; }

.civf-slip__total {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	border-top: 1px dashed var(--civf-line);
	padding-top: 14px;
	font-size: 13px;
	color: var(--civf-muted);
}

.civf-slip__total strong {
	font-size: 18px;
	color: var(--civf-ink);
	font-variant-numeric: tabular-nums;
}

@media (max-width: 860px) {
	.civf-slip { position: static; order: -1; }
}

/* ---------- Status page ---------- */

.civf-status {
	max-width: 560px;
	margin: 0 auto;
	padding: 32px;
	background: var(--civf-paper);
	border: 1px solid var(--civf-line);
	border-radius: 14px;
}

.civf-status__mark {
	display: grid;
	place-items: center;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--civf-mist);
	color: var(--civf-teal);
	margin-bottom: 18px;
}

.civf-status__mark--warn { background: #fdf6e8; color: var(--civf-warn); }
.civf-status__mark--bad { background: #fdf2f2; color: var(--civf-bad); }

.civf-status__title {
	font-family: var(--civf-serif);
	font-size: 25px;
	line-height: 1.2;
	margin: 0 0 8px;
}

.civf-status__lede {
	margin: 0 0 22px;
	color: var(--civf-muted);
	font-size: 15px;
}

.civf-status__rows { margin: 0 0 22px; border-top: 1px solid var(--civf-line); }

.civf-status__rows > div {
	display: flex;
	justify-content: space-between;
	gap: 20px;
	padding: 11px 0;
	border-bottom: 1px solid var(--civf-line);
}

.civf-status__rows dt { margin: 0; color: var(--civf-muted); font-size: 14px; }

.civf-status__rows dd {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	text-align: right;
	word-break: break-word;
}

.civf-status__note { margin: 0; font-size: 13.5px; color: var(--civf-muted); }

@media (prefers-reduced-motion: reduce) {
	.civf-pane,
	.civf-slot { animation: none; }

	.civf-btn,
	.civf-service,
	.civf-slot,
	.civf-rail__num { transition: none; }
}

/* Shown only when the script never ran; removed by JS on boot. */
.civf-boot {
	display: grid;
	gap: 4px;
	padding: 14px 16px;
	margin-bottom: 18px;
	border: 1px solid #f0d9a8;
	border-left: 4px solid #c98a12;
	border-radius: 8px;
	background: #fdf8ec;
	color: #6b4a06;
	font-size: 14px;
}

/* ---------- Phone with dial-code prefix ---------- */

.civf-phone {
	display: flex;
	align-items: stretch;
	border: 1px solid var(--civf-line);
	border-radius: 8px;
	background: var(--civf-paper);
	overflow: hidden;
}

.civf-phone:focus-within {
	outline: 2px solid var(--civf-teal);
	outline-offset: 2px;
}

.civf-phone__code {
	display: flex;
	align-items: center;
	padding: 0 10px 0 12px;
	background: var(--civf-mist);
	border-right: 1px solid var(--civf-line);
	font-size: 15px;
	font-weight: 600;
	color: var(--civf-teal-dark);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.civf-phone__code[hidden] { display: none; }

.civf-field .civf-phone input[type="tel"] {
	border: 0;
	border-radius: 0;
	flex: 1 1 auto;
	min-width: 0;
}

.civf-field .civf-phone input[type="tel"]:focus-visible { outline: none; }

.civf-field.has-error .civf-phone {
	border-color: var(--civf-bad);
	background: #fdf7f7;
}

.civf-field__hint {
	display: block;
	margin-top: 5px;
	font-size: 12.5px;
	color: var(--civf-muted);
}

/* ---------- Receipt on the status page ---------- */

.civf-receipt-wrap {
	margin: 0 0 22px;
	border-top: 1px solid var(--civf-line);
	padding-top: 16px;
}

.civf-receipt-wrap > summary {
	cursor: pointer;
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 14px;
}

.civf-receipt__actions { margin: 14px 0 0; }

/* ---------- Receipt: defend against theme table styling ----------
   Themes routinely add borders, striping and their own padding to every
   table in post content. The receipt is a layout table, not a data table,
   so those rules have to be neutralised or the slip looks like a spreadsheet. */

.civf-receipt table,
.civf-receipt tbody,
.civf-receipt tr,
.civf-receipt td,
.civf-receipt th {
	border: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	font-family: inherit;
	line-height: 1.5;
	vertical-align: top;
}

.civf-receipt table {
	width: 100%;
	border-collapse: collapse !important;
	margin: 0 !important;
	table-layout: auto;
}

.civf-receipt tr:nth-child(odd) td,
.civf-receipt tr:nth-child(even) td {
	background: transparent !important;
}

/* The outer card keeps its own border and rounding. */
.civf-receipt > table {
	border: 1px solid var(--civf-line) !important;
	border-radius: 12px;
	overflow: hidden;
	background: #fff !important;
}

/* Comfortable gutters so nothing touches the card edge. */
.civf-receipt > table > tbody > tr > td {
	padding: 18px 24px !important;
}

.civf-receipt > table > tbody > tr:first-child > td {
	border-bottom: 1px solid var(--civf-line) !important;
}

.civf-receipt > table > tbody > tr:last-child > td {
	border-top: 1px solid var(--civf-line) !important;
}

/* Detail rows: a clear column gap and room around each value. */
.civf-receipt .civf-receipt__rows td {
	padding: 7px 0 !important;
}

.civf-receipt .civf-receipt__rows td:first-child {
	padding-right: 24px !important;
	white-space: nowrap;
}

.civf-receipt .civf-receipt__rows td:last-child {
	text-align: right;
	word-break: break-word;
}

.civf-receipt .civf-receipt__total td {
	padding: 12px 0 0 !important;
	border-top: 2px solid var(--civf-ink) !important;
}

.civf-receipt .civf-receipt__head td {
	padding: 0 !important;
}

.civf-receipt .civf-receipt__head td + td {
	padding-left: 18px !important;
}

.civf-receipt img { max-width: 100%; height: auto; }


@media print {
	/*
	 * The reliable print path is the standalone view at ?civf_print=1, which
	 * renders outside the theme. These rules only tidy up if someone prints
	 * the confirmation page directly from the browser menu.
	 */
	@page {
		size: A4 portrait;
		margin: 12mm;
	}

	.civf-receipt__actions,
	.civf-receipt-wrap > summary,
	.civf-status__mark,
	.civf-book,
	.civf-alert {
		display: none !important;
	}

	.civf-receipt-wrap > *:not(summary) {
		display: block !important;
	}

	.civf-status,
	.civf-receipt-wrap {
		border: 0 !important;
		padding: 0 !important;
		margin: 0 !important;
		max-width: none !important;
	}

	.civf-receipt,
	.civf-receipt > table {
		page-break-inside: avoid;
		break-inside: avoid;
	}

	.civf-receipt * {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
}

.civf-chat { margin: 0 0 20px; }

.civf-btn--chat {
	background: #25d366;
	color: #08331a;
	text-decoration: none;
}

.civf-btn--chat:hover { background: #1eb455; color: #08331a; }
