/* M&J chat widget. Colours come from the theme palette (theme.json) with fallbacks. */
.mjc {
	--mjc-red: var(--wp--preset--color--primary, #ef0909);
	--mjc-red-dark: var(--wp--preset--color--primary-dark, #c00606);
	--mjc-red-soft: var(--wp--preset--color--primary-soft, #fdecec);
	--mjc-ink: var(--wp--preset--color--dark, #17181c);
	--mjc-body: var(--wp--preset--color--body, #495057);
	--mjc-muted: var(--wp--preset--color--muted, #6c757d);
	--mjc-line: var(--wp--preset--color--line, #e9ecef);
	--mjc-light: var(--wp--preset--color--light, #f5f6f8);
	--mjc-b: 1.5rem; /* launcher distance from the bottom */
	--mjc-r: 1.5rem;
	font-family: var(--wp--preset--font-family--poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
	font-size: 15px;
	line-height: 1.5;
	visibility: visible !important; /* chat.js hides the widget until this file has loaded */
}
.mjc *, .mjc *::before, .mjc *::after { box-sizing: border-box; }
html.mjc-lock { overflow: hidden; }

/* ---- launcher ---- */
.mjc-launch {
	position: fixed;
	right: var(--mjc-r);
	bottom: calc(var(--mjc-b) + env(safe-area-inset-bottom, 0px));
	z-index: 997;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	min-width: 3.4rem;
	height: 3.4rem;
	padding: 0 1.1rem;
	border: 0;
	border-radius: 999px;
	background: var(--mjc-ink);
	color: #fff;
	font: inherit;
	font-weight: 600;
	font-size: 0.95rem;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(14, 15, 18, 0.35);
	transition: opacity 0.2s ease, background 0.2s ease;
}
.mjc-launch:hover { background: #000; }
.mjc-launch:focus-visible, .mjc-chip:focus-visible, .mjc-btn:focus-visible, .mjc-call:focus-visible, .mjc-close:focus-visible, .mjc-send:focus-visible {
	outline: 3px solid var(--mjc-red);
	outline-offset: 2px;
}
.mjc-launch .mjc-i-x { display: none; }
.mjc.is-open .mjc-i-chat { display: none; }
.mjc.is-open .mjc-i-x { display: block; }
.mjc.is-open .mjc-launch-label { display: none; }
.mjc.is-open .mjc-launch { padding: 0; width: 3.4rem; }
/* The launcher fades out while it would sit on top of a booking form (never moves, so no flicker). */
.mjc.is-over-form .mjc-launch { opacity: 0; pointer-events: none; }

/* tablet and phone: the call FAB (bottom right, <1100px) owns the corner, so stack above it */
@media (max-width: 1099.98px) {
	.mjc { --mjc-b: 5.6rem; --mjc-r: 1.1rem; }
	body:has(.mj-call-fab.mj-fab-hidden) .mjc { --mjc-b: 1.1rem; }
}
@media (max-width: 699.98px) {
	.mjc-launch { padding: 0; width: 3.4rem; }
	.mjc-launch-label { display: none; }
}

/* ---- panel (desktop and tablet: floating card above the launcher) ---- */
.mjc-panel {
	position: fixed;
	right: var(--mjc-r);
	bottom: calc(var(--mjc-b) + env(safe-area-inset-bottom, 0px) + 4.25rem);
	z-index: 997;
	display: flex;
	flex-direction: column;
	width: min(24rem, calc(100vw - 2rem));
	height: min(37rem, calc(100dvh - var(--mjc-b) - 6.5rem));
	background: #fff;
	color: var(--mjc-body);
	border: 1px solid var(--mjc-line);
	border-radius: 18px;
	box-shadow: 0 24px 60px rgba(14, 15, 18, 0.28);
	overflow: hidden;
	animation: mjc-in 0.18s ease-out;
}
.mjc-panel[hidden] { display: none; }
@keyframes mjc-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* phone: full-screen sheet */
@media (max-width: 699.98px) {
	.mjc.is-open .mjc-launch { display: none; }
	.mjc-panel {
		inset: 0 auto auto 0;
		top: 0;
		left: 0;
		right: 0;
		bottom: auto;
		width: 100%;
		height: 100dvh;
		border: 0;
		border-radius: 0;
		z-index: 10000;
		animation: none;
	}
}

/* ---- header ---- */
.mjc-head {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.85rem 0.9rem 0.85rem 1.1rem;
	background: var(--mjc-ink);
	color: #fff;
	border-bottom: 3px solid var(--mjc-red);
	flex: 0 0 auto;
}
.mjc-head-text { flex: 1 1 auto; min-width: 0; }
.mjc-head h2 { margin: 0; font-size: 1rem; line-height: 1.25; font-weight: 600; color: #fff; }
.mjc-head p { margin: 0; font-size: 0.78rem; color: rgba(255, 255, 255, 0.72); }
.mjc-call {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.45rem 0.8rem;
	border-radius: 999px;
	background: var(--mjc-red);
	color: #fff !important;
	font-weight: 600;
	font-size: 0.85rem;
	text-decoration: none;
}
.mjc-call:hover { background: var(--mjc-red-dark); }
.mjc-close {
	display: inline-grid;
	place-items: center;
	width: 2.4rem;
	height: 2.4rem;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
}
.mjc-close:hover { background: rgba(255, 255, 255, 0.14); }

/* ---- conversation ---- */
.mjc-log {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 1rem;
	background: var(--mjc-light);
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}
.mjc-msg { display: flex; flex-direction: column; max-width: 92%; }
.mjc-bot { align-self: flex-start; }
.mjc-user { align-self: flex-end; align-items: flex-end; }
.mjc-bubble {
	padding: 0.6rem 0.85rem;
	border-radius: 14px;
	font-size: 0.93rem;
	line-height: 1.5;
	overflow-wrap: anywhere;
}
.mjc-bot .mjc-bubble { background: #fff; color: var(--mjc-ink); border: 1px solid var(--mjc-line); border-top-left-radius: 4px; }
.mjc-user .mjc-bubble { background: var(--mjc-red); color: #fff; border-top-right-radius: 4px; white-space: pre-wrap; }
.mjc-bubble p { margin: 0 0 0.5em; }
.mjc-bubble p:last-child, .mjc-bubble ul:last-child { margin-bottom: 0; }
.mjc-bubble ul { margin: 0 0 0.5em; padding-left: 1.2em; }
.mjc-bubble li { margin: 0.15em 0; }
.mjc-bubble a { color: var(--mjc-red-dark); text-decoration: underline; }
.mjc-bubble strong { font-weight: 600; }

.mjc-typing .mjc-bubble { display: inline-flex; gap: 4px; padding: 0.8rem 0.9rem; }
.mjc-typing i {
	width: 7px; height: 7px; border-radius: 50%;
	background: var(--mjc-muted);
	animation: mjc-dot 1.2s infinite ease-in-out;
}
.mjc-typing i:nth-child(2) { animation-delay: 0.15s; }
.mjc-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes mjc-dot { 0%, 60%, 100% { opacity: 0.25; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

/* ---- quick replies ---- */
.mjc-chips { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 1rem 0.75rem; background: var(--mjc-light); }
.mjc-chips:empty { display: none; }
.mjc-chip {
	padding: 0.4rem 0.8rem;
	border: 1px solid var(--mjc-red);
	border-radius: 999px;
	background: #fff;
	color: var(--mjc-red-dark);
	font: inherit;
	font-size: 0.85rem;
	font-weight: 500;
	cursor: pointer;
}
.mjc-chip:hover { background: var(--mjc-red-soft); }

/* ---- booking summary card ---- */
.mjc-card {
	margin-top: 0.5rem;
	padding: 0.9rem;
	background: #fff;
	border: 1px solid var(--mjc-line);
	border-left: 4px solid var(--mjc-red);
	border-radius: 12px;
}
.mjc-card-title { margin: 0 0 0.5rem; font-size: 0.95rem; font-weight: 600; color: var(--mjc-ink); }
.mjc-card-list { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.75rem; margin: 0 0 0.75rem; font-size: 0.85rem; }
.mjc-card-list dt { color: var(--mjc-muted); }
.mjc-card-list dd { margin: 0; color: var(--mjc-ink); overflow-wrap: anywhere; }
.mjc-card-actions { display: flex; flex-direction: column; gap: 0.45rem; }
.mjc-btn {
	display: block;
	padding: 0.6rem 0.9rem;
	border-radius: 999px;
	font-size: 0.9rem;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
}
.mjc-btn-primary { background: var(--mjc-red); color: #fff !important; }
.mjc-btn-primary:hover { background: var(--mjc-red-dark); }
.mjc-btn-ghost { border: 1px solid var(--mjc-line); color: var(--mjc-ink) !important; background: #fff; }
.mjc-btn-ghost:hover { background: var(--mjc-light); }
.mjc-card-note { margin: 0.6rem 0 0; font-size: 0.78rem; color: var(--mjc-muted); }

/* ---- input ---- */
.mjc-form {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 0.5rem;
	padding: 0.7rem 0.8rem 0.4rem;
	background: #fff;
	border-top: 1px solid var(--mjc-line);
}
.mjc-input {
	flex: 1 1 auto;
	min-width: 0;
	max-height: 7rem;
	padding: 0.6rem 0.85rem;
	border: 1px solid #ced4da;
	border-radius: 18px;
	font: inherit;
	font-size: 16px; /* 16px stops iOS zooming the page on focus */
	line-height: 1.4;
	color: var(--mjc-ink);
	background: #fff;
	resize: none;
}
.mjc-input:focus { outline: 2px solid var(--mjc-red); outline-offset: 0; border-color: var(--mjc-red); }
.mjc-send {
	flex: 0 0 auto;
	display: inline-grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	border: 0;
	border-radius: 50%;
	background: var(--mjc-red);
	color: #fff;
	cursor: pointer;
}
.mjc-send:hover { background: var(--mjc-red-dark); }
.mjc-send:disabled { background: #c9ccd1; cursor: default; }
.mjc-foot { flex: 0 0 auto; margin: 0; padding: 0.15rem 1rem 0.65rem; background: #fff; font-size: 0.7rem; line-height: 1.35; color: var(--mjc-muted); }
@media (max-width: 699.98px) { .mjc-foot { padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px)); } }

/* ---- booking-form note shown after hand-off ---- */
.mjc-prefill-note {
	margin: 0;
	padding: 0.75rem 1rem;
	border-left: 4px solid var(--wp--preset--color--primary, #ef0909);
	background: var(--wp--preset--color--primary-soft, #fdecec);
	border-radius: 6px;
	font-size: 0.9rem;
	color: var(--wp--preset--color--dark, #17181c);
}

@media (prefers-reduced-motion: reduce) {
	.mjc-panel { animation: none; }
	.mjc-typing i { animation: none; opacity: 0.6; }
	.mjc-launch { transition: none; }
}
@media print { .mjc { display: none; } }
