/* LiveLife website helper (chat panel) */

.lls-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Launcher ---------- */

.lls-chat-launcher {
	position: fixed;
	left: max(16px, env(safe-area-inset-left, 0px));
	bottom: max(16px, env(safe-area-inset-bottom, 0px));
	z-index: 990;
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	min-height: 52px;
	padding: 0.75rem 1.2rem 0.75rem 0.95rem;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--magenta);
	color: var(--wp--preset--color--white);
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.95rem;
	font-weight: 800;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 10px 28px -8px rgba(110, 23, 72, 0.55);
	transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.2s ease;
}

/* Tucked away until the visitor scrolls, so it never covers the opening text. */
html:not(.lls-scrolled) .lls-chat-launcher:not(:focus-visible) {
	opacity: 0;
	transform: translateY(24px);
	pointer-events: none;
}

.lls-chat-launcher:hover {
	background: var(--wp--preset--color--magenta-dark);
	transform: translateY(-2px);
}

.lls-chat-launcher:focus-visible {
	outline: 3px solid var(--wp--preset--color--sunflower);
	outline-offset: 3px;
}

.lls-chat-launcher svg {
	flex-shrink: 0;
}

html.lls-chat-open .lls-chat-launcher {
	display: none;
}

@media (max-width: 600px) {
	.lls-chat-launcher {
		width: 56px;
		height: 56px;
		padding: 0;
		justify-content: center;
	}
	.lls-chat-launcher__label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
	}
}

.lls-chat-hint {
	position: fixed;
	left: max(16px, env(safe-area-inset-left, 0px));
	bottom: calc(max(16px, env(safe-area-inset-bottom, 0px)) + 66px);
	z-index: 990;
	max-width: 240px;
	padding: 0.75rem 1rem;
	border-radius: 18px 18px 18px 6px;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--ink);
	font-size: 0.9rem;
	font-weight: 700;
	line-height: 1.4;
	box-shadow: 0 12px 32px -12px rgba(110, 23, 72, 0.35);
	cursor: pointer;
}

/* ---------- Panel ---------- */

.lls-chat {
	position: fixed;
	left: max(16px, env(safe-area-inset-left, 0px));
	bottom: max(16px, env(safe-area-inset-bottom, 0px));
	z-index: 995;
	width: min(390px, calc(100vw - 32px));
	height: min(640px, calc(100vh - 32px));
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--wp--preset--color--cream);
	border-radius: 26px;
	box-shadow: 0 2px 6px rgba(43, 26, 38, 0.08), 0 30px 70px -20px rgba(43, 26, 38, 0.45);
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--wp--preset--color--ink);
	transform-origin: bottom left;
}

.lls-chat[hidden] {
	display: none;
}

.lls-chat:focus {
	outline: none;
}

@media (max-width: 600px) {
	.lls-chat {
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		width: 100%;
		height: 100%;
		height: 100dvh;
		border-radius: 0;
		padding-top: env(safe-area-inset-top, 0px);
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}
	/* The panel has its own Quick exit button on phones. */
	html.lls-chat-open .lls-quick-exit {
		display: none;
	}
}

.lls-chat__head {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	padding: 0.85rem 0.85rem 0.85rem 1rem;
	background: var(--wp--preset--color--magenta);
	color: var(--wp--preset--color--white);
}

.lls-chat__logo {
	width: 34px;
	height: 34px;
	flex-shrink: 0;
}

.lls-chat__title {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-width: 0;
	line-height: 1.2;
}

.lls-chat__title strong {
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 600;
	font-size: 1.1rem;
}

.lls-chat__title span {
	font-size: 0.8rem;
	opacity: 0.85;
}

.lls-chat__exit {
	flex-shrink: 0;
	padding: 0.45rem 0.75rem;
	border-radius: 999px;
	background: var(--wp--preset--color--teal-dark);
	color: var(--wp--preset--color--white) !important;
	font-size: 0.8rem;
	font-weight: 800;
	text-decoration: none !important;
	white-space: nowrap;
}

.lls-chat__close {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--wp--preset--color--white);
	cursor: pointer;
}

.lls-chat__close:hover {
	background: rgba(255, 255, 255, 0.15);
}

.lls-chat__head :focus-visible {
	outline: 3px solid var(--wp--preset--color--sunflower);
	outline-offset: 2px;
}

.lls-chat__safety {
	margin: 0;
	padding: 0.5rem 1rem;
	background: var(--wp--preset--color--teal-soft);
	color: var(--wp--preset--color--teal-dark);
	font-size: 0.8rem;
	font-weight: 700;
}

.lls-chat__safety a {
	color: inherit;
	font-weight: 800;
}

.lls-chat__log {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	scroll-behavior: smooth;
}

.lls-msg {
	max-width: 88%;
	padding: 0.7rem 0.95rem;
	border-radius: 18px;
	overflow-wrap: anywhere;
}

.lls-msg--bot {
	align-self: flex-start;
	background: var(--wp--preset--color--white);
	border-bottom-left-radius: 6px;
	box-shadow: 0 1px 2px rgba(43, 26, 38, 0.06);
}

.lls-msg--user {
	align-self: flex-end;
	background: var(--wp--preset--color--magenta);
	color: var(--wp--preset--color--white);
	border-bottom-right-radius: 6px;
}

.lls-msg a {
	color: var(--wp--preset--color--magenta);
	font-weight: 700;
}

.lls-msg--user a {
	color: var(--wp--preset--color--white);
}

.lls-msg ul,
.lls-msg ol {
	margin: 0.35rem 0;
	padding-left: 1.15rem;
}

.lls-msg li + li {
	margin-top: 0.2rem;
}

.lls-msg--typing {
	display: inline-flex;
	gap: 0.3rem;
	align-items: center;
	padding: 0.85rem 1rem;
}

.lls-msg--typing span:not(.lls-sr) {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--wp--preset--color--muted);
	opacity: 0.5;
}

.lls-chat__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	padding: 0 1rem 0.75rem;
	max-height: 40%;
	overflow-y: auto;
}

.lls-chip {
	padding: 0.5rem 0.85rem;
	border: 2px solid var(--wp--preset--color--line);
	border-radius: 999px;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--magenta);
	font: inherit;
	font-size: 0.85rem;
	font-weight: 800;
	line-height: 1.2;
	text-align: left;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.lls-chip:hover {
	background: var(--wp--preset--color--blush);
	border-color: var(--wp--preset--color--magenta);
}

.lls-chat__form {
	display: flex;
	align-items: flex-end;
	gap: 0.5rem;
	padding: 0.7rem 1rem;
	border-top: 1px solid var(--wp--preset--color--line);
	background: var(--wp--preset--color--white);
}

.lls-chat__form textarea {
	flex: 1;
	min-height: 44px;
	max-height: 120px;
	padding: 0.65rem 0.85rem;
	border: 2px solid var(--wp--preset--color--line);
	border-radius: 14px;
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--ink);
	font: inherit;
	resize: none;
	box-sizing: border-box;
}

.lls-chat__form textarea:focus {
	outline: none;
	border-color: var(--wp--preset--color--magenta);
}

.lls-chat__send {
	flex-shrink: 0;
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: var(--wp--preset--color--magenta);
	color: var(--wp--preset--color--white);
	cursor: pointer;
}

.lls-chat__send:hover {
	background: var(--wp--preset--color--magenta-dark);
}

.lls-chat__form.is-busy .lls-chat__send {
	opacity: 0.5;
	cursor: progress;
}

.lls-chat__note {
	margin: 0;
	padding: 0 1rem 0.8rem;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--muted);
	font-size: 0.75rem;
	line-height: 1.4;
}

/* ---------- Motion ---------- */

@keyframes lls-chat-in {
	from { opacity: 0; transform: translateY(16px) scale(0.96); }
	to { opacity: 1; transform: none; }
}

@keyframes lls-msg-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}

@keyframes lls-dot {
	0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
	40% { transform: translateY(-5px); opacity: 1; }
}

@keyframes lls-nudge {
	0%, 100% { transform: none; }
	20% { transform: translateY(-6px) rotate(-4deg); }
	40% { transform: translateY(0) rotate(3deg); }
	60% { transform: translateY(-3px); }
}

@keyframes lls-ring {
	from { box-shadow: 0 0 0 0 rgba(142, 31, 94, 0.45), 0 10px 28px -8px rgba(110, 23, 72, 0.55); }
	to { box-shadow: 0 0 0 18px rgba(142, 31, 94, 0), 0 10px 28px -8px rgba(110, 23, 72, 0.55); }
}

@media (prefers-reduced-motion: no-preference) {
	.lls-chat:not([hidden]) {
		animation: lls-chat-in 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
	}
	.lls-msg {
		animation: lls-msg-in 0.3s ease both;
	}
	.lls-msg--typing span:not(.lls-sr) {
		animation: lls-dot 1.1s ease-in-out infinite;
	}
	.lls-msg--typing span:nth-child(2) { animation-delay: 0.15s; }
	.lls-msg--typing span:nth-child(3) { animation-delay: 0.3s; }
	.lls-chat-launcher.is-nudging {
		animation: lls-nudge 0.9s ease 0s 2, lls-ring 1.6s ease-out 0s 3;
	}
	.lls-chat-hint:not([hidden]) {
		animation: lls-msg-in 0.4s ease both;
	}
}
