/**
 * KF Booking widget styles.
 *
 * All colour/shape is driven by CSS custom properties set on `.kf-booking`
 * (defaults below; the widget overrides them inline from the site's theme
 * settings). Mobile-first; the layout is a single column that gains a little
 * breathing room on wider viewports.
 */

.kf-booking {
	--kf-accent: #146b74;
	--kf-on-accent: #ffffff;
	--kf-text: #111827;
	--kf-muted: #6b7280;
	--kf-surface: #ffffff;
	--kf-surface-alt: #f3f4f6;
	--kf-border: #e5e7eb;
	--kf-radius: 14px;
	--kf-font: inherit;
	--kf-danger: #b32d2e;
	--kf-ok: #0f8a4a;

	font-family: var(--kf-font);
	color: var(--kf-text);
	background: var(--kf-surface);
	border-radius: var(--kf-radius);
	max-width: 560px;
	margin: 0 auto;
	box-sizing: border-box;
	overflow-wrap: break-word;   /* never let a long string force horizontal scroll */
	-webkit-font-smoothing: antialiased;
}
.kf-booking *,
.kf-booking *::before,
.kf-booking *::after { box-sizing: border-box; }

.kf-booking__inner { padding: 20px; }
@media (min-width: 480px) { .kf-booking__inner { padding: 28px; } }

/* The inner region is a programmatic focus target on step change — no ring. */
.kf-booking__inner:focus { outline: none; }

/* Visible focus for keyboard users on every interactive element. */
.kf-booking button:focus-visible,
.kf-booking a:focus-visible,
.kf-booking input:focus-visible,
.kf-booking textarea:focus-visible {
	outline: 2px solid var(--kf-accent);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.kf-spinner { animation: none; }
}

.kf-booking__loading,
.kf-hint {
	display: flex; align-items: center; gap: 8px;
	color: var(--kf-muted); font-size: 14px; padding: 12px 0;
}

/* ---- Spinner ---- */
.kf-spinner {
	width: 16px; height: 16px; border-radius: 50%;
	border: 2px solid var(--kf-border); border-top-color: var(--kf-accent);
	display: inline-block; animation: kf-spin .7s linear infinite;
}
@keyframes kf-spin { to { transform: rotate(360deg); } }

/* ---- Header + stepper ---- */
.kf-head { margin-bottom: 18px; }
.kf-title { font-size: 20px; line-height: 1.25; margin: 0 0 4px; font-weight: 700; color: var(--kf-text); }
.kf-sub { margin: 0 0 12px; color: var(--kf-muted); font-size: 14px; }

.kf-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 14px 0 0; }
.kf-step { display: flex; align-items: center; gap: 6px; flex: 1 1 0; min-width: 0; font-size: 12px; color: var(--kf-muted); }
.kf-step__dot {
	width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
	display: grid; place-items: center; font-weight: 700; font-size: 12px;
	background: var(--kf-surface-alt); color: var(--kf-muted); border: 1px solid var(--kf-border);
}
.kf-step__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kf-step--current .kf-step__dot { background: var(--kf-accent); color: var(--kf-on-accent); border-color: var(--kf-accent); }
.kf-step--current { color: var(--kf-text); font-weight: 600; }
.kf-step--done .kf-step__dot { background: var(--kf-accent); color: var(--kf-on-accent); border-color: var(--kf-accent); opacity: .55; }

/* ---- Panels ---- */
.kf-panel { }
.kf-panel__title { font-size: 16px; margin: 0 0 12px; font-weight: 700; }

/* ---- Calendar ---- */
.kf-cal { }
.kf-cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kf-cal__title { font-weight: 700; font-size: 16px; }
.kf-cal__nav {
	width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--kf-border);
	background: var(--kf-surface); color: var(--kf-text); font-size: 20px; line-height: 1; cursor: pointer;
}
.kf-cal__nav:disabled { opacity: .35; cursor: default; }
.kf-cal__nav:not(:disabled):hover { border-color: var(--kf-accent); color: var(--kf-accent); }

.kf-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.kf-cal__grid--dow { margin-bottom: 4px; }
.kf-cal__dow { text-align: center; font-size: 11px; color: var(--kf-muted); font-weight: 600; padding: 4px 0; }

/* Day tiles (accent-ring affordance; no dot). Available days read as tappable
   via four non-hue cues at once: white fill, a 2px accent ring, bold weight and
   a soft lift — legible down to ~34px on small phones. */
.kf-cal__cell {
	position: relative; aspect-ratio: 1 / 1; min-height: 40px;
	/* Every cell carries a 2px border (transparent unless it's the accent ring),
	   so the border-box content area is identical across all states and the
	   centred number never shifts by a sub-pixel between available/unavailable. */
	border: 2px solid transparent; border-radius: 10px;
	background: var(--kf-surface-alt); color: var(--kf-text);
	font-size: 14px; line-height: 1; cursor: pointer;
	margin: 0; padding: 0; text-indent: 0;
	/* Centre the number robustly: flex handles it on modern engines, and
	   text-align is the fallback if a browser mis-handles flex/grid on a <button>
	   (older mobile Safari), so the digit can never drift toward an edge. */
	display: flex; align-items: center; justify-content: center; text-align: center;
	-webkit-appearance: none; appearance: none;
	box-shadow: none;
	transition: border-color .12s ease, background-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.kf-cal__num { display: block; direction: ltr; text-indent: 0; }

/* Leading blank grid cells — part of the ground. */
.kf-cal__cell--empty { background: transparent; border-color: transparent; box-shadow: none; cursor: default; }

/* Unavailable (past, out-of-window, or no slots): no fill/border/shadow, lighter
   weight — recedes, but the number stays faintly legible rather than invisible. */
.kf-cal__cell.is-disabled {
	background: transparent; border-color: transparent; box-shadow: none;
	color: var(--kf-border);                                  /* fallback where color-mix is unsupported */
	color: color-mix(in srgb, var(--kf-muted) 45%, transparent);
	font-weight: 400; cursor: default;
}

/* Available (CLICKABLE): white tile + crisp 2px accent ring + bold dark number
   + soft lift. No color-mix in the resting state. */
.kf-cal__cell.is-available {
	background: var(--kf-surface); color: var(--kf-text);
	border: 2px solid var(--kf-accent); font-weight: 700;
	box-shadow: 0 1px 2px rgba(17, 24, 39, .08);
}
.kf-cal__cell.is-available:not(.is-selected):hover {
	background: var(--kf-surface-alt);                        /* fallback */
	background: color-mix(in srgb, var(--kf-accent) 12%, var(--kf-surface));
	border-color: var(--kf-accent);
	box-shadow: 0 2px 6px rgba(17, 24, 39, .12);
}
.kf-cal__cell.is-available:not(.is-selected):active {
	box-shadow: 0 1px 2px rgba(17, 24, 39, .08);
	transform: translateY(1px);
}

/* Selected: solid accent fill (the loudest tier). After is-available so it wins. */
.kf-cal__cell.is-selected {
	background: var(--kf-accent); color: var(--kf-on-accent);
	border-color: var(--kf-accent); font-weight: 700;
	box-shadow: 0 1px 3px rgba(17, 24, 39, .14);
}

@media (prefers-reduced-motion: reduce) {
	.kf-cal__cell { transition: none; }
	.kf-cal__cell.is-available:not(.is-selected):active { transform: none; }
}

/* Forced-colors / high-contrast: shadows drop out, so the border carries figure/ground. */
@media (forced-colors: active) {
	.kf-cal__cell.is-available { border-color: CanvasText; }
	.kf-cal__cell.is-selected { border-color: Highlight; }
	.kf-cal__cell.is-disabled { color: GrayText; }
}

/* Small phones: tighten the grid. The 2px ring is kept by the base rule. */
@media (max-width: 380px) {
	.kf-cal__grid { gap: 3px; }
	.kf-cal__cell { min-height: 34px; border-radius: 9px; font-size: 13px; }
}

/* ---- Day times / chips ---- */
.kf-daytimes { margin-top: 20px; border-top: 1px solid var(--kf-border); padding-top: 16px; }
.kf-daytimes__title { font-size: 15px; margin: 0 0 12px; font-weight: 700; }
/* Time view shown on its own (date already chosen) — no calendar above it. */
.kf-panel--times { min-height: 220px; }
.kf-daytimes__title--solo { font-size: 16px; margin: 6px 0 16px; }
.kf-chips__group { margin-bottom: 14px; }
.kf-chips__label { font-size: 12px; color: var(--kf-muted); font-weight: 600; margin-bottom: 6px; }
.kf-chips__row { display: flex; flex-wrap: wrap; gap: 8px; }
.kf-chip {
	border: 1px solid var(--kf-border); background: var(--kf-surface); color: var(--kf-text);
	border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.kf-chip:hover { border-color: var(--kf-accent); color: var(--kf-accent); }
.kf-chip.is-selected { background: var(--kf-accent); color: var(--kf-on-accent); border-color: var(--kf-accent); }

/* ---- Location list ---- */
.kf-chosenslot { font-size: 14px; color: var(--kf-muted); margin: 4px 0 16px; }
.kf-chosenslot strong { color: var(--kf-text); }
.kf-locs { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.kf-loc { border: 1px solid var(--kf-border); border-radius: var(--kf-radius); overflow: hidden; background: var(--kf-surface); }
.kf-loc__btn {
	width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 14px 16px; background: none; border: 0; cursor: pointer; text-align: left; color: inherit;
}
/* min-width:0 lets this flex child shrink so long addresses wrap instead of
   overflowing (and being clipped by .kf-loc's overflow:hidden). */
.kf-loc__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.kf-loc__name, .kf-loc__addr, .kf-loc__msg { overflow-wrap: break-word; word-break: break-word; }
.kf-loc__name { font-weight: 700; font-size: 15px; }
.kf-loc__addr { font-size: 13px; color: var(--kf-muted); }
.kf-loc__time { font-size: 13px; color: var(--kf-ok); font-weight: 600; margin-top: 2px; }
.kf-loc__msg { font-size: 13px; color: var(--kf-muted); margin-top: 2px; }
.kf-loc__cta { color: var(--kf-accent); font-weight: 700; font-size: 14px; white-space: nowrap; flex: 0 0 auto; }
.kf-loc--ok:hover { border-color: var(--kf-accent); }
.kf-loc--alt .kf-loc__btn { }
.kf-loc--alt .kf-loc__msg strong { color: var(--kf-accent); }
.kf-loc--off { opacity: .55; }
.kf-loc--off .kf-loc__btn { cursor: default; }
.kf-loc__map {
	display: inline-block; padding: 0 16px 12px; font-size: 12px; color: var(--kf-muted);
	text-decoration: none;
}
.kf-loc__map:hover { color: var(--kf-accent); text-decoration: underline; }
.kf-loc__filter {
	display: block; margin: 0 16px 12px; padding: 0; background: none; border: 0;
	color: var(--kf-accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-align: left;
}
.kf-loc__filter:hover { text-decoration: underline; }

/* Clinic-filter banner above the calendar. */
.kf-filter {
	display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
	background: var(--kf-surface-alt); border-radius: 10px; padding: 9px 12px; margin-bottom: 12px; font-size: 13px;
}

/* ---- Summary (details step) ---- */
.kf-summary {
	background: var(--kf-surface-alt); border-radius: var(--kf-radius); padding: 12px 14px;
	margin: 8px 0 18px; display: flex; flex-direction: column; gap: 6px;
}
.kf-summary > div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.kf-summary__k { color: var(--kf-muted); flex: 0 0 auto; }
.kf-summary__v { font-weight: 600; text-align: right; min-width: 0; overflow-wrap: break-word; }

/* ---- Form ---- */
.kf-form { display: flex; flex-direction: column; gap: 14px; }
.kf-field { display: flex; flex-direction: column; gap: 5px; }
.kf-field__label { font-size: 13px; font-weight: 600; color: var(--kf-text); }
.kf-req { color: var(--kf-danger); }
.kf-field input,
.kf-field textarea {
	width: 100%; font: inherit; font-size: 15px; color: var(--kf-text);
	background: var(--kf-surface); border: 1px solid var(--kf-border); border-radius: 10px; padding: 11px 12px;
}
.kf-field input:focus,
.kf-field textarea:focus { outline: 2px solid var(--kf-accent); outline-offset: 1px; border-color: var(--kf-accent); }
.kf-field.has-error input,
.kf-field.has-error textarea { border-color: var(--kf-danger); }
.kf-field__err { color: var(--kf-danger); font-size: 12px; }

.kf-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--kf-text); line-height: 1.45; }
.kf-consent input { margin-top: 2px; flex: 0 0 auto; width: 18px; height: 18px; accent-color: var(--kf-accent); }
.kf-consent.has-error span { color: var(--kf-danger); }
.kf-legal { font-size: 13px; margin: 2px 0 0; }
.kf-legal a { color: var(--kf-accent); }

/* Honeypot — off-screen but focusable-safe. */
.kf-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Buttons / links ---- */
.kf-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	font: inherit; font-weight: 700; font-size: 15px; border-radius: 10px; padding: 12px 18px;
	cursor: pointer; border: 1px solid transparent; text-decoration: none;
}
.kf-btn--primary { background: var(--kf-accent); color: var(--kf-on-accent); }
.kf-btn--primary:hover { filter: brightness(.94); }
.kf-btn--primary:disabled { opacity: .6; cursor: default; filter: none; }
.kf-btn--ghost { background: var(--kf-surface); color: var(--kf-accent); border-color: var(--kf-border); }
.kf-btn--ghost:hover { border-color: var(--kf-accent); }
.kf-btn--block { width: 100%; margin-top: 4px; }

.kf-link { background: none; border: 0; color: var(--kf-accent); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.kf-link:hover { text-decoration: underline; }
.kf-back { margin-bottom: 12px; display: inline-block; }

/* ---- Alerts / empties ---- */
.kf-alert { background: #fdecec; color: var(--kf-danger); border: 1px solid #f5c2c2; border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.kf-empty { color: var(--kf-muted); font-size: 14px; padding: 8px 0; }
.kf-muted { color: var(--kf-muted); }

/* ---- Confirmation ---- */
.kf-confirm { text-align: center; padding: 8px 0; }
.kf-confirm__tick {
	width: 56px; height: 56px; border-radius: 50%; margin: 4px auto 14px;
	background: var(--kf-accent); color: var(--kf-on-accent); font-size: 30px; display: grid; place-items: center;
}
.kf-confirm__title { font-size: 20px; margin: 0 0 16px; font-weight: 700; }
.kf-confirm__details { text-align: left; background: var(--kf-surface-alt); border-radius: var(--kf-radius); padding: 14px 16px; margin: 0 0 18px; }
.kf-confirm__details > div { display: flex; gap: 12px; padding: 6px 0; }
.kf-confirm__details dt { flex: 0 0 60px; color: var(--kf-muted); font-size: 13px; margin: 0; }
.kf-confirm__details dd { margin: 0; font-weight: 600; font-size: 14px; min-width: 0; overflow-wrap: break-word; }
.kf-addcal { margin-bottom: 18px; }
.kf-addcal__label { display: block; font-size: 12px; color: var(--kf-muted); font-weight: 600; margin-bottom: 8px; }
.kf-addcal__row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.kf-addcal__row .kf-btn { font-size: 14px; padding: 9px 14px; }

/* ------------------------------------------------------------------------ *
 * Style isolation (toggle in WP → Theme). When on, the mount gets
 * .kf-booking--isolated and we neutralise the ambient/inherited properties a
 * host theme or Elementor's global element styles impose — fonts, uppercase
 * buttons, letter-spacing, native/theme control chrome, link underlines,
 * heading colour/transform. The doubled root class raises specificity so these
 * beat single-wrapper-class theme rules; we only reset properties the widget's
 * own component classes don't set, so the widget's look is preserved intact.
 * (Note: appearance is reset on buttons/selects only — never on inputs — so the
 * native date picker and checkbox keep working.)
 * ------------------------------------------------------------------------ */
.kf-booking.kf-booking--isolated {
	--kf-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-family: var(--kf-font);
	font-size: 16px;
	line-height: 1.5;
	letter-spacing: normal;
	word-spacing: normal;
	font-weight: 400;
	font-style: normal;
	text-transform: none;
	text-align: left;
	text-decoration: none;
	text-shadow: none;
	text-indent: 0;
	direction: ltr;
	color: var(--kf-text);
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}
.kf-booking.kf-booking--isolated button,
.kf-booking.kf-booking--isolated input,
.kf-booking.kf-booking--isolated textarea,
.kf-booking.kf-booking--isolated select {
	font-family: inherit;
	font-size: inherit;
	letter-spacing: normal;
	text-transform: none;
	box-shadow: none;
	text-shadow: none;
}
.kf-booking.kf-booking--isolated button,
.kf-booking.kf-booking--isolated select {
	-webkit-appearance: none;
	appearance: none;
	line-height: normal;
	min-width: 0;
	min-height: 0;
}
.kf-booking.kf-booking--isolated a {
	text-decoration: none;
	box-shadow: none;
	background: none;
	text-shadow: none;
}
.kf-booking.kf-booking--isolated h1,
.kf-booking.kf-booking--isolated h2,
.kf-booking.kf-booking--isolated h3,
.kf-booking.kf-booking--isolated h4 {
	font-family: inherit;
	text-transform: none;
	letter-spacing: normal;
	color: inherit;
	text-shadow: none;
}

/* Harden interactive surfaces: re-assert only the themed properties
   (background / colour / border) at high specificity, so a theme rule can't
   repaint the widget's buttons, chips, calendar cells or inputs. Sizing and
   radius come from the base rules above. */
.kf-booking.kf-booking--isolated .kf-btn--primary { background: var(--kf-accent); color: var(--kf-on-accent); border-color: transparent; }
.kf-booking.kf-booking--isolated .kf-btn--ghost { background: var(--kf-surface); color: var(--kf-accent); border-color: var(--kf-border); }
.kf-booking.kf-booking--isolated .kf-chip { background: var(--kf-surface); color: var(--kf-text); border-color: var(--kf-border); }
.kf-booking.kf-booking--isolated .kf-chip.is-selected { background: var(--kf-accent); color: var(--kf-on-accent); border-color: var(--kf-accent); }
.kf-booking.kf-booking--isolated .kf-cal__cell { background: var(--kf-surface-alt); color: var(--kf-text); border-color: transparent; box-shadow: none; }
.kf-booking.kf-booking--isolated .kf-cal__cell--empty { background: transparent; border-color: transparent; box-shadow: none; }
.kf-booking.kf-booking--isolated .kf-cal__cell.is-disabled { background: transparent; border-color: transparent; box-shadow: none; color: var(--kf-border); color: color-mix(in srgb, var(--kf-muted) 45%, transparent); }
.kf-booking.kf-booking--isolated .kf-cal__cell.is-available { background: var(--kf-surface); color: var(--kf-text); border: 2px solid var(--kf-accent); box-shadow: 0 1px 2px rgba(17, 24, 39, .08); }
.kf-booking.kf-booking--isolated .kf-cal__cell.is-available:not(.is-selected):hover { background: var(--kf-surface-alt); background: color-mix(in srgb, var(--kf-accent) 12%, var(--kf-surface)); border-color: var(--kf-accent); box-shadow: 0 2px 6px rgba(17, 24, 39, .12); }
.kf-booking.kf-booking--isolated .kf-cal__cell.is-selected { background: var(--kf-accent); color: var(--kf-on-accent); border-color: var(--kf-accent); box-shadow: 0 1px 3px rgba(17, 24, 39, .14); }
.kf-booking.kf-booking--isolated .kf-cal__nav { background: var(--kf-surface); color: var(--kf-text); }
.kf-booking.kf-booking--isolated .kf-loc__btn { background: none; color: inherit; }
.kf-booking.kf-booking--isolated .kf-link,
.kf-booking.kf-booking--isolated .kf-loc__filter { background: none; color: var(--kf-accent); }
.kf-booking.kf-booking--isolated .kf-confirm__tick { background: var(--kf-accent); color: var(--kf-on-accent); }
.kf-booking.kf-booking--isolated input:not([type="checkbox"]):not([type="radio"]),
.kf-booking.kf-booking--isolated textarea { background: var(--kf-surface); color: var(--kf-text); border: 1px solid var(--kf-border); }
