/**
 * Ask Livia chat. Lives bottom-left so it never collides with the WhatsApp
 * button and the back-to-top button on the right.
 */

.lv-chat {
	--lv-teal: #4AA691;
	--lv-teal-700: #1F5F55;
	--lv-navy: #12355B;
	--lv-line: #e3e8ee;
	--lv-muted: #64748b;
	position: fixed;
	left: 18px;
	bottom: 18px;
	z-index: 95;
	font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ---------------------------------------------------------- the launcher */

.lv-chat__launcher {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: .55rem;
	padding: 0 1.05rem 0 .75rem;
	height: 52px;
	border: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--lv-teal), var(--lv-teal-700));
	color: #fff;
	font: 700 .92rem/1 Montserrat, "Segoe UI", sans-serif;
	cursor: pointer;
	box-shadow: 0 10px 28px rgba(31, 95, 85, .38);
	transition: transform .2s ease, box-shadow .2s ease;
}

.lv-chat__launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(31, 95, 85, .46); }
.lv-chat__launcher:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.lv-chat__launcher-icon {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .2);
}

.lv-chat.is-open .lv-chat__launcher { opacity: 0; pointer-events: none; }

/* Gentle attention pulse, once the page has settled. */
.lv-chat__launcher::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 999px;
	box-shadow: 0 0 0 0 rgba(74, 166, 145, .55);
	animation: lv-pulse 3.4s ease-out 2s 3;
	pointer-events: none;
}

@keyframes lv-pulse {
	0% { box-shadow: 0 0 0 0 rgba(74, 166, 145, .5); }
	70% { box-shadow: 0 0 0 16px rgba(74, 166, 145, 0); }
	100% { box-shadow: 0 0 0 0 rgba(74, 166, 145, 0); }
}

/* ------------------------------------------------------------- the panel */

.lv-chat__panel {
	position: absolute;
	left: 0;
	bottom: 0;
	width: min(372px, calc(100vw - 36px));
	max-height: min(600px, calc(100vh - 110px));
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 24px 60px rgba(13, 40, 70, .28);
	overflow: hidden;
	animation: lv-rise .22s ease-out;
}

@keyframes lv-rise {
	from { opacity: 0; transform: translateY(14px) scale(.98); }
	to { opacity: 1; transform: none; }
}

.lv-chat__head {
	position: relative;
	display: flex;
	align-items: flex-start;
	gap: .7rem;
	padding: .95rem 1rem 1rem;
	background: linear-gradient(135deg, #1F5F55, #12355B);
	color: #fff;
}

.lv-chat__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: .35rem;
	font: 700 .66rem/1 Montserrat, "Segoe UI", sans-serif;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: #f0b6d6;
	margin-bottom: .3rem;
}

.lv-chat__head-text { min-width: 0; flex: 1; }
.lv-chat__head-text strong { display: block; font: 700 1.08rem/1.2 Montserrat, sans-serif; }

.lv-chat__close {
	width: 28px;
	height: 28px;
	flex: none;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .16);
	color: #fff;
	cursor: pointer;
}

.lv-chat__close:hover { background: rgba(255, 255, 255, .3); }

/* ------------------------------------------------------------------ tabs */

.lv-chat__tabs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	background: #fff;
	border-bottom: 1px solid var(--lv-line);
	flex: none;
}

.lv-chat__tab {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .4rem;
	padding: .8rem .5rem;
	border: 0;
	border-bottom: 2px solid transparent;
	background: none;
	color: var(--lv-muted);
	font: 700 .78rem/1 Montserrat, "Segoe UI", sans-serif;
	letter-spacing: .04em;
	text-transform: uppercase;
	cursor: pointer;
	transition: color .15s, border-color .15s;
}

.lv-chat__tab:hover { color: var(--lv-teal-700); }
.lv-chat__tab.is-active { color: var(--lv-teal-700); border-bottom-color: var(--lv-teal); }
.lv-chat__tab svg { flex: none; }

.lv-chat__pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* ---------------------------------------------------------- health facts */

.lv-tips { background: #fff; }

.lv-tips__scroll { flex: 0 1 auto; overflow-y: auto; max-height: 340px; padding: 1rem 1.05rem .5rem; }

.lv-tips__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .6rem;
	margin-bottom: .7rem;
}

.lv-tips__badge {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	padding: .3rem .6rem .3rem .45rem;
	border-radius: 999px;
	background: #fdeaf4;
	color: #a63c79;
	font: 700 .66rem/1.2 Montserrat, sans-serif;
	letter-spacing: .06em;
	text-transform: uppercase;
}

.lv-tips__badge svg { flex: none; }
.lv-tips__count { font-size: .72rem; color: #94a3b8; font-weight: 600; white-space: nowrap; }

.lv-tips__title {
	margin: 0 0 .5rem;
	font: 800 1.02rem/1.35 Montserrat, "Segoe UI", sans-serif;
	color: var(--lv-navy);
}

.lv-tips__body { font-size: .86rem; line-height: 1.6; color: #334155; }

.lv-tips__tip {
	display: flex;
	gap: .55rem;
	margin-top: .85rem;
	padding: .7rem .8rem;
	border-radius: 10px;
	background: #EAF8F1;
	border: 1px solid #cfe9e1;
	color: var(--lv-teal-700);
}

.lv-tips__tip svg { flex: none; margin-top: .15rem; }
.lv-tips__tip p { margin: 0; font-size: .8rem; line-height: 1.55; }

.lv-tips__nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .6rem;
	padding: .5rem 1.05rem;
	flex: none;
}

.lv-tips__arrow {
	width: 32px;
	height: 32px;
	flex: none;
	display: grid;
	place-items: center;
	border: 1px solid var(--lv-line);
	border-radius: 50%;
	background: #fff;
	color: var(--lv-navy);
	cursor: pointer;
	transition: background .15s, border-color .15s;
}

.lv-tips__arrow:hover { background: var(--lv-teal); border-color: var(--lv-teal); color: #fff; }

.lv-tips__dots { display: flex; align-items: center; gap: .3rem; flex-wrap: nowrap; overflow: hidden; }

.lv-dot {
	width: 6px;
	height: 6px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: #d7dee7;
	cursor: pointer;
	transition: width .18s, background .18s;
}

.lv-dot.is-on { width: 20px; background: var(--lv-teal); }

.lv-tips__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .45rem;
	margin: .2rem .9rem .9rem;
	padding: .7rem .9rem;
	border: 1px solid var(--lv-line);
	border-radius: 10px;
	background: #f7f9fb;
	color: var(--lv-teal-700);
	font: 700 .82rem/1.2 Montserrat, sans-serif;
	cursor: pointer;
	flex: none;
	transition: background .15s, border-color .15s;
}

.lv-tips__cta:hover { background: #EAF8F1; border-color: #cfe9e1; }

/* --------------------------------------------------------------- the chat */

.lv-ask { background: #f7f9fb; }

/* The facts tab hugs its card; the chat tab needs a definite height so the
   message list, the input box and the disclaimer each get their own space. */
.lv-chat.is-asking .lv-chat__panel { height: min(560px, calc(100vh - 110px)); }
.lv-chat__form { flex: 0 0 auto; }
.lv-chat__note { flex: 0 0 auto; }

.lv-chat__log {
	/* On the chat tab the panel has a definite height (see .is-asking below),
	   so the message area flexes within it. min-height: 0 is what lets it
	   shrink and scroll instead of pushing the input box out of the panel. */
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: .9rem .85rem .4rem;
	display: flex;
	flex-direction: column;
	gap: .55rem;
	scroll-behavior: smooth;
}
/* ---------------------------------------------------------- the messages */

.lv-msg { display: flex; }
.lv-msg--me { justify-content: flex-end; }

.lv-msg__bubble {
	max-width: 85%;
	padding: .65rem .85rem;
	border-radius: 14px;
	font-size: .88rem;
	line-height: 1.55;
	color: #1f2933;
	background: #fff;
	border: 1px solid var(--lv-line);
	border-bottom-left-radius: 4px;
}

.lv-msg--me .lv-msg__bubble {
	background: var(--lv-navy);
	border-color: var(--lv-navy);
	color: #fff;
	border-bottom-left-radius: 14px;
	border-bottom-right-radius: 4px;
}

.lv-msg--wait .lv-msg__bubble { color: var(--lv-muted); font-style: italic; }

.lv-msg--alert .lv-msg__bubble {
	background: #fff4f4;
	border-color: #f3c6c6;
	color: #8d2222;
	font-weight: 600;
}

.lv-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .1rem 0 .3rem; }

.lv-chip {
	border: 1px solid #cfe9e1;
	background: #EAF8F1;
	color: var(--lv-teal-700);
	border-radius: 999px;
	padding: .42rem .75rem;
	font: 600 .78rem/1.3 "Open Sans", sans-serif;
	text-align: left;
	cursor: pointer;
	transition: background .15s;
}

.lv-chip:hover { background: #d8f0e6; }

.lv-links { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .4rem; }

.lv-link {
	display: inline-block;
	padding: .42rem .75rem;
	border-radius: 999px;
	background: var(--lv-navy);
	color: #fff;
	font: 600 .78rem/1.3 "Open Sans", sans-serif;
	text-decoration: none;
}

.lv-link:hover { background: #0d2846; color: #fff; }

/* ------------------------------------------------------------- the input */

.lv-chat__form {
	display: flex;
	gap: .5rem;
	padding: .7rem .8rem .3rem;
	background: #fff;
	border-top: 1px solid var(--lv-line);
}

.lv-chat__form input {
	flex: 1;
	min-width: 0;
	padding: .65rem .8rem;
	border: 1px solid var(--lv-line);
	border-radius: 999px;
	font: inherit;
	font-size: .88rem;
	background: #f7f9fb;
	color: #1f2933;
}

.lv-chat__form input:focus {
	outline: none;
	border-color: var(--lv-teal);
	box-shadow: 0 0 0 3px rgba(74, 166, 145, .18);
}

.lv-chat__form button {
	width: 40px;
	height: 40px;
	flex: none;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: var(--lv-teal);
	color: #fff;
	cursor: pointer;
}

.lv-chat__form button:hover { background: var(--lv-teal-700); }

.lv-chat__note {
	margin: 0;
	padding: .35rem .9rem .7rem;
	background: #fff;
	font-size: .68rem;
	line-height: 1.4;
	color: var(--lv-muted);
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 560px) {
	.lv-chat { left: 12px; right: 12px; bottom: 12px; }
	.lv-chat__launcher-text { display: none; }
	.lv-chat__launcher { width: 52px; padding: 0; justify-content: center; }
	.lv-chat__panel { width: calc(100vw - 24px); max-height: calc(100vh - 90px); }
	.lv-chat.is-asking .lv-chat__panel { height: calc(100vh - 90px); }
	.lv-tips__scroll { max-height: min(300px, 42vh); }
}

@media (prefers-reduced-motion: reduce) {
	.lv-chat__panel, .lv-chat__launcher::after { animation: none; }
	.lv-chat__launcher { transition: none; }
}

@media print {
	.lv-chat { display: none !important; }
}
