/* ============================================================================
 * Rex Chat — floating action button + chat panel
 * Layering: FAB 1041 (above booking CTA 1040), panel 1080 (above Bootstrap
 * modals 1055, deliberately below the promo popup 1090).
 * ==========================================================================*/

/* ---------- Floating action button ---------- */
.wg-rex-fab {
	position: fixed;
	right: clamp(1rem, 2.5vw, 1.75rem);
	bottom: clamp(1rem, 2.5vw, 1.75rem); /* same baseline as the centered booking pill */
	z-index: 1041;
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.55rem 1.05rem 0.55rem 0.65rem;
	border: 0;
	border-radius: var(--wg-radius-pill, 999px);
	background: var(--wg-blue, #235868);
	color: var(--wg-on-blue, #fff);
	cursor: pointer;
	box-shadow: var(--wg-shadow-pop, 0 18px 44px rgba(35, 88, 104, 0.16));
	animation: wg-rex-bob 4.2s ease-in-out infinite;
	transition: transform 0.25s var(--wg-ease, ease), box-shadow 0.25s ease;
}
.wg-rex-fab:hover { transform: translateY(-3px); box-shadow: var(--wg-shadow-pink, 0 10px 28px rgba(244, 157, 163, 0.42)); }
/* Mobile: icon-only circle (58px, matches the dock) so the corner stays clear
   of the centered booking pill on the shared baseline. */
@media (max-width: 767.98px) {
	.wg-rex-fab { padding: 6px; border-radius: 50%; gap: 0; }
	.wg-rex-fab__badge { display: none; }
}
/* Keep the whole bottom row (pill + Rex) above the mobile sticky CTA bar.
   --wg-sticky-h is the bar's measured height (set by custom.js on show). */
body.has-sticky-bar .wg-rex-fab { bottom: calc(clamp(1rem, 2.5vw, 1.75rem) + var(--wg-sticky-h, 72px) + .6rem); }
.wg-rex-fab img {
	width: 46px;
	height: 46px;
	padding: 4px;
	border-radius: 50%;
	background: var(--wg-cream, #FFF6F4);
	object-fit: contain;
}
.wg-rex-fab__badge {
	font-family: var(--font-display, Georgia, serif);
	font-size: 1.05rem;
	line-height: 1;
	letter-spacing: 0.01em;
}
@keyframes wg-rex-bob {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-5px); }
}
body.wg-rex-open .wg-rex-fab,
body.wg-rex-open .wg-floating-cta { opacity: 0; pointer-events: none; }

/* ---------- Panel shell ---------- */
.wg-rex {
	position: fixed;
	right: clamp(1rem, 2.5vw, 1.75rem);
	bottom: clamp(1rem, 2.5vw, 1.75rem);
	z-index: 1080;
	width: min(380px, calc(100vw - 2rem));
	height: min(560px, 76vh);
}
.wg-rex[hidden] { display: none; }
.wg-rex__backdrop { display: none; }
.wg-rex__card {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #fff;
	border-radius: var(--wg-radius-xl, 28px);
	box-shadow: var(--wg-shadow-pop, 0 18px 44px rgba(35, 88, 104, 0.16));
	opacity: 0;
	transform: translateY(18px) scale(0.96);
	transform-origin: bottom right;
	transition: transform 0.3s var(--wg-ease, ease), opacity 0.25s ease;
}
.wg-rex.is-open .wg-rex__card { opacity: 1; transform: translateY(0) scale(1); }

/* ---------- Header ---------- */
.wg-rex__head {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	padding: 0.85rem 1rem;
	background: var(--wg-pink, #F49DA3);
	color: var(--wg-on-pink, #fff);
	flex: 0 0 auto;
}
.wg-rex__avatar {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #fff;
	display: grid;
	place-items: center;
	flex: 0 0 auto;
}
.wg-rex__avatar img { width: 34px; height: 34px; object-fit: contain; }
.wg-rex__id { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.wg-rex__name { font-family: var(--font-display, Georgia, serif); font-size: 1.3rem; }
.wg-rex__tag { font-size: 0.75rem; opacity: 0.92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wg-rex__close {
	margin-left: auto;
	width: 2.1rem;
	height: 2.1rem;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.22);
	color: var(--wg-on-pink, #fff);
	display: grid;
	place-items: center;
	cursor: pointer;
	flex: 0 0 auto;
	transition: background-color 0.2s ease;
}
.wg-rex__close:hover { background: rgba(255, 255, 255, 0.38); }

/* ---------- Message log ---------- */
.wg-rex__log {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 1rem 0.9rem;
	background: var(--wg-cream, #FFF6F4);
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}

/* Bubbles — shape lifted from .wgx-bark (speech-bubble radius + tail) */
.wg-rex-msg { display: flex; align-items: flex-end; gap: 0.45rem; }
.wg-rex-msg--user { justify-content: flex-end; }
.wg-rex-msg__avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #fff;
	display: grid;
	place-items: center;
	flex: 0 0 auto;
	box-shadow: var(--wg-soft-1, 0 4px 18px rgba(35, 88, 104, 0.07));
}
.wg-rex-msg__avatar img { width: 20px; height: 20px; object-fit: contain; }
.wg-rex-msg__bubble {
	max-width: 82%;
	padding: 0.65em 1em;
	font-size: 0.95rem;
	line-height: 1.4;
	font-weight: 500;
	white-space: pre-line;
	overflow-wrap: break-word;
}
.wg-rex-msg--bot .wg-rex-msg__bubble {
	background: #fff;
	color: var(--wg-blue, #235868);
	border-radius: 20px 20px 20px 4px;
	box-shadow: var(--wg-soft-1, 0 4px 18px rgba(35, 88, 104, 0.07));
}
.wg-rex-msg--user .wg-rex-msg__bubble {
	background: var(--wg-pink, #F49DA3);
	color: var(--wg-on-pink, #fff);
	border-radius: 20px 20px 4px 20px;
}
.wg-rex-msg__bubble a { color: inherit; text-decoration: underline; font-weight: 600; }

/* Markdown emitted by formatResponse() (headings, rules, lists, emphasis) */
.wg-rex-msg__bubble strong { font-weight: 700; }
.wg-rex-msg__bubble em { font-style: italic; }
.wg-rex-msg__bubble .pcai-md-heading { font-weight: 700; margin: 0.5em 0 0.15em; line-height: 1.25; }
.wg-rex-msg__bubble .pcai-md-heading:first-child { margin-top: 0; }
.wg-rex-msg__bubble .pcai-md-hr { border: 0; border-top: 1px solid rgba(35, 88, 104, 0.15); margin: 0.6em 0; }
.wg-rex-msg__bubble ul { margin: 0.35em 0; padding-left: 1.2em; }
.wg-rex-msg__bubble li { margin: 0.15em 0; }

/* Typing indicator */
.wg-rex-typing .wg-rex-msg__bubble { display: inline-flex; gap: 0.3em; padding: 0.8em 1em; }
.wg-rex-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--wg-pink, #F49DA3);
	animation: wg-rex-dot 1.1s ease-in-out infinite;
}
.wg-rex-dot:nth-child(2) { animation-delay: 0.18s; }
.wg-rex-dot:nth-child(3) { animation-delay: 0.36s; }
@keyframes wg-rex-dot {
	0%, 100% { transform: translateY(0); opacity: 0.5; }
	40% { transform: translateY(-5px); opacity: 1; }
}

/* Quick-reply chips */
.wg-rex-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.2rem; }
.wg-rex-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	padding: 0.5em 0.95em;
	border: 1px solid rgba(244, 157, 163, 0.55);
	border-radius: var(--wg-radius-pill, 999px);
	background: #fff;
	color: var(--wg-blue, #235868);
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.18s var(--wg-ease, ease);
}
.wg-rex-chip:hover { background: var(--wg-pink, #F49DA3); color: var(--wg-on-pink, #fff); transform: translateY(-2px); }
.wg-rex-chip .bi { color: var(--wg-pink, #F49DA3); }
.wg-rex-chip:hover .bi { color: var(--wg-on-pink, #fff); }

/* ---------- Composer ---------- */
.wg-rex__form {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.7rem 0.8rem 0.35rem;
	background: #fff;
	flex: 0 0 auto;
}
.wg-rex__hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.wg-rex__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0.65em 1.1em;
	border: 1px solid rgba(35, 88, 104, 0.18);
	border-radius: var(--wg-radius-pill, 999px);
	font-family: var(--font-primary, sans-serif);
	font-size: 0.95rem;
	color: var(--wg-ink, #2B2829);
	background: var(--wg-cream, #FFF6F4);
}
.wg-rex__input:focus { outline: none; border-color: var(--wg-pink, #F49DA3); box-shadow: 0 0 0 3px rgba(105, 193, 241, 0.35); }
.wg-rex__input:disabled { opacity: 0.6; }
.wg-rex__send {
	width: 2.6rem;
	height: 2.6rem;
	border: 0;
	border-radius: 50%;
	background: var(--wg-blue, #235868);
	color: var(--wg-on-blue, #fff);
	display: grid;
	place-items: center;
	cursor: pointer;
	flex: 0 0 auto;
	transition: transform 0.2s var(--wg-ease, ease), background-color 0.2s ease;
}
.wg-rex__send:hover { transform: translateY(-2px); background: var(--wg-pink, #F49DA3); }
.wg-rex__send:disabled { opacity: 0.55; transform: none; cursor: default; }
.wg-rex__disclaimer {
	margin: 0;
	padding: 0 1rem 0.7rem;
	background: #fff;
	font-size: 0.68rem;
	line-height: 1.35;
	color: rgba(35, 88, 104, 0.65);
	flex: 0 0 auto;
}

/* ---------- Hero "Ask Rex" bark (button variant of .wgx-bark) ---------- */
.wgx-hero__bark button.wgx-bark { border: 0; background: #fff; font: inherit; font-weight: 600; text-align: left; }

/* ---------- Mobile: true full-screen sheet ---------- */
/* Covers the full mobile range (≤767.98px, matching the FAB breakpoint).
   The card fills the whole viewport — square corners, 100dvh — so no page
   background ever peeks through, and body scroll is locked while open. */
@media (max-width: 767.98px) {
	.wg-rex { inset: 0; width: auto; height: auto; }
	.wg-rex__backdrop {
		display: block;
		position: absolute;
		inset: 0;
		background: rgba(46, 51, 78, 0.55);
		backdrop-filter: blur(3px);
		-webkit-backdrop-filter: blur(3px);
	}
	.wg-rex__card {
		position: absolute;
		inset: 0;
		height: 100%;
		height: 100dvh;
		border-radius: 0;
		transform: translateY(100%);
	}
	.wg-rex.is-open .wg-rex__card { transform: translateY(0); }
	body.wg-rex-open { overflow: hidden; }
	.wg-rex-fab__badge { display: none; }
	.wg-rex-fab { padding: 0.55rem; }
}

/* ---------- Inline lead form (in-thread card) ---------- */
.wg-rex-lead {
	max-width: 88%;
	background: #fff;
	border-radius: 20px 20px 20px 4px;
	box-shadow: var(--wg-soft-1, 0 4px 18px rgba(35, 88, 104, 0.07));
	padding: 0.9rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}
.wg-rex-lead__head {
	margin: 0;
	font-weight: 600;
	font-size: 0.92rem;
	color: var(--wg-blue, #235868);
}
.wg-rex-lead__field {
	width: 100%;
	padding: 0.55em 0.9em;
	border: 1px solid rgba(35, 88, 104, 0.18);
	border-radius: 12px;
	font-family: var(--font-primary, sans-serif);
	font-size: 0.9rem;
	color: var(--wg-ink, #2B2829);
	background: var(--wg-cream, #FFF6F4);
}
.wg-rex-lead__field:focus { outline: none; border-color: var(--wg-pink, #F49DA3); box-shadow: 0 0 0 3px rgba(105, 193, 241, 0.35); }
.wg-rex-lead__err {
	margin: 0;
	font-size: 0.8rem;
	color: #b3261e;
}
.wg-rex-lead__actions {
	display: flex;
	align-items: center;
	gap: 0.7rem;
}
.wg-rex-lead__send {
	border: 0;
	border-radius: var(--wg-radius-pill, 999px);
	background: var(--wg-blue, #235868);
	color: var(--wg-on-blue, #fff);
	font-family: var(--font-primary, sans-serif);
	font-weight: 600;
	font-size: 0.88rem;
	padding: 0.55em 1.2em;
	cursor: pointer;
	transition: transform 0.2s var(--wg-ease, ease), background-color 0.2s ease;
}
.wg-rex-lead__send:hover { transform: translateY(-2px); background: var(--wg-pink, #F49DA3); }
.wg-rex-lead__send:disabled { opacity: 0.55; transform: none; cursor: default; }
.wg-rex-lead__dismiss {
	border: 0;
	background: none;
	color: rgba(35, 88, 104, 0.6);
	font-size: 0.8rem;
	cursor: pointer;
	text-decoration: underline;
}

/* ---------- Visibility schedule (store hours) ---------- */
body.wg-rex-denied [data-rex-open] { display: none !important; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.wg-rex-fab { animation: none; }
	.wg-rex-dot { animation: none; opacity: 0.8; }
	.wg-rex__card { transition: none; }
}

/* ==========================================================================
   Capture gate, puppy cards & in-chat booking (Rex upgrade)
   ========================================================================== */

/* ---- Gate card (require-capture mode) ---- */
.wg-rex-gate { width: 100%; }
.wg-rex-gate .wg-rex-lead__head { margin-bottom: 2px; }
.wg-rex-gate__row { display: flex; gap: 8px; }
.wg-rex-gate__row .wg-rex-lead__field { flex: 1 1 0; min-width: 0; }
/* TCPA fine print: a clearly-scrollable soft box instead of a raw mid-word
   clip — bordered, padded, cream, so the cut-off reads as "scroll me". */
.wg-rex-gate__consent {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	margin: 8px 0 2px;
	cursor: pointer;
}
.wg-rex-gate__consent input { margin-top: 7px; min-width: 15px; accent-color: var(--wg-blue, #235868); }
.wg-rex-gate__consent span {
	display: block;
	flex: 1 1 0;
	min-width: 0;
	font-size: 10.5px;
	line-height: 1.45;
	color: rgba(35, 88, 104, .62);
	/* 12px padding + 5 full lines (5 × 15.2px) — the cut lands BETWEEN lines. */
	max-height: 88px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 6px 9px;
	background: var(--wg-cream, #FFF6F4);
	border: 1px solid rgba(35, 88, 104, .08);
	border-radius: 10px;
}
.wg-rex-gate__consent span a { color: inherit; text-decoration: underline; }
.wg-rex-gate__start { width: 100%; justify-content: center; margin-top: 2px; }

/* Locked composer while the gate is open */
.wg-rex__form.is-locked .wg-rex__input {
	opacity: .55;
	background: #f3edec;
	cursor: not-allowed;
}
.wg-rex__form.is-locked .wg-rex__send { opacity: .4; cursor: not-allowed; }

/* ---- Puppy cards rail ---- */
.wg-rex-cards {
	display: flex;
	gap: 12px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scroll-snap-type: x proximity;
	max-width: 100%;
	min-width: 0;
	padding: 4px 2px 10px;
	scrollbar-width: thin;
	/* overflow-x:auto sets the flex auto-min-height to 0; without this the rail
	   collapses to just its scrollbar inside the column-flex log when earlier
	   bubbles fill the panel, and the square card media overflows. */
	flex-shrink: 0;
}
.wg-rex-card {
	flex: 0 0 190px;
	scroll-snap-align: start;
	background: #fff;
	border: 1.5px solid rgba(35, 88, 104, .1);
	border-radius: 18px;
	overflow: hidden;
	box-shadow: 0 10px 22px -12px rgba(35, 88, 104, .3);
	display: flex;
	flex-direction: column;
	transition: transform .16s ease, box-shadow .16s ease;
}
.wg-rex-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 16px 30px -14px rgba(35, 88, 104, .4);
}
.wg-rex-card__media { position: relative; aspect-ratio: 1 / 1; background: #FFF6F4; }
.wg-rex-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wg-rex-card__media .wg-rex-card__placeholder { object-fit: contain; padding: 22px; }
.wg-rex-card__badge {
	position: absolute;
	top: 8px;
	left: 8px;
	font-size: 9.5px;
	font-weight: 800;
	letter-spacing: .03em;
	text-transform: uppercase;
	padding: 3px 8px;
	border-radius: 999px;
	background: rgba(255, 255, 255, .94);
	color: #1f8a5b;
	box-shadow: 0 2px 6px -1px rgba(0, 0, 0, .18);
}
.wg-rex-card__badge.is-soon { color: var(--wg-teal-deep, #235868); }
.wg-rex-card__body { display: flex; flex-direction: column; gap: 3px; padding: 9px 11px 11px; flex: 1; }
.wg-rex-card__name {
	font-size: 13.5px;
	font-weight: 700;
	color: var(--wg-teal-deep, #235868);
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.wg-rex-card__meta {
	font-size: 11px;
	color: rgba(35, 88, 104, .62);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.wg-rex-card__actions {
	display: flex;
	gap: 6px;
	margin-top: auto;
	padding-top: 8px;
}
.wg-rex-card__view,
.wg-rex-card__details {
	flex: 1 1 0;
	text-align: center;
	font-size: 11.5px;
	font-weight: 700;
	border-radius: 999px;
	padding: 7px 4px;
	cursor: pointer;
	text-decoration: none;
	transition: filter .15s ease;
}
.wg-rex-card__view:hover,
.wg-rex-card__details:hover { filter: brightness(.96); }
.wg-rex-card__view {
	border: 1.5px solid rgba(35, 88, 104, .25);
	color: var(--wg-teal-deep, #235868);
	background: #fff;
}
.wg-rex-card__details {
	border: 0;
	background: var(--wg-pink, #F49DA3);
	color: var(--wg-on-pink, #235868);
}

/* ---- In-chat booking widget ---- */
.wg-rex-book { width: 100%; }
.wg-rex-book__head {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 700;
	font-size: 13.5px;
	color: var(--wg-teal-deep, #235868);
	margin-bottom: 10px;
}
.wg-rex-book__thumb {
	width: 40px;
	height: 40px;
	border-radius: 12px;
	object-fit: cover;
	flex: 0 0 auto;
	box-shadow: 0 4px 10px -4px rgba(35, 88, 104, .4);
}
.wg-rex-book__label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: rgba(35, 88, 104, .55);
	margin: 0 0 5px;
}
.wg-rex-book__days {
	display: flex;
	gap: 7px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	padding: 2px 2px 10px;
	scrollbar-width: thin;
}
.wg-rex-day {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1px;
	border: 1.5px solid rgba(35, 88, 104, .18);
	background: #fff;
	color: var(--wg-teal-deep, #235868);
	border-radius: 14px;
	padding: 7px 12px;
	cursor: pointer;
	white-space: nowrap;
	transition: border-color .15s ease, transform .15s ease;
}
.wg-rex-day:hover { border-color: var(--wg-pink, #F49DA3); }
.wg-rex-day__wd { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; opacity: .7; }
.wg-rex-day__md { font-size: 12.5px; font-weight: 700; }
.wg-rex-day.is-selected,
.wg-rex-slot.is-selected {
	background: var(--wg-pink, #F49DA3);
	border-color: var(--wg-pink, #F49DA3);
	color: var(--wg-on-pink, #235868);
}
.wg-rex-day.is-selected .wg-rex-day__wd { opacity: 1; }
.wg-rex-book__slots {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 6px;
	max-height: 10.5rem;
	overflow-y: auto;
	padding: 2px;
	margin-bottom: 8px;
}
.wg-rex-slot {
	border: 1.5px solid rgba(35, 88, 104, .18);
	background: #fff;
	color: var(--wg-teal-deep, #235868);
	border-radius: 10px;
	font-size: 12px;
	font-weight: 600;
	padding: 8px 2px;
	cursor: pointer;
	transition: border-color .15s ease;
}
.wg-rex-slot:hover { border-color: var(--wg-pink, #F49DA3); }
.wg-rex-book__contact { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.wg-rex-book__summary {
	font-size: 12.5px;
	font-weight: 700;
	color: var(--wg-teal-deep, #235868);
	background: #FFF6F4;
	border-radius: 10px;
	padding: 8px 10px;
	margin: 0 0 8px;
	text-align: center;
}
.wg-rex-book__confirm { width: 100%; justify-content: center; }
.wg-rex-book__confirm:disabled { opacity: .5; cursor: not-allowed; }

/* Retry chip inside an error bubble */
.wg-rex-chip--retry { display: inline-flex; margin-top: 6px; }

/* Keep rails inside the bubble column on the mobile sheet */
.wg-rex-msg { min-width: 0; }
