/* TE AI Growth Assistant — chat widget.
   Look: navy rounded header with avatar + online dot, light message
   canvas, user bubbles right in pale cyan with time + ticks, bot
   bubbles left in soft grey, quick-action chips above a pill input
   with a circular gradient send button. */

.aga-chat {
	--aga-primary: #192964;
	--aga-accent: #04aaea;
	--aga-canvas: #ffffff;
	--aga-ink: #212a3d;
	--aga-muted: #7a86a3;
	--aga-line: #e6ebf5;
	display: flex;
	flex-direction: column;
	width: var(--aga-width, 100%);
	height: var(--aga-height, 520px);
	max-width: 100%;
	background: var(--aga-canvas);
	border-radius: 22px;
	box-shadow: 0 24px 60px rgba(22, 39, 107, .18);
	overflow: hidden;
	font-family: inherit;
	font-size: 15px;
	color: var(--aga-ink);
}
.aga-chat--fill { height: 100%; }
@media (max-width: 782px) {
	.aga-chat { height: var(--aga-height-mobile, var(--aga-height, 65vh)); }
	.aga-chat--fill { height: 100%; }
}

/* ---------- header ---------- */
.aga-chat__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 18px;
	background: linear-gradient(115deg, var(--aga-primary) 0%, #22307a 70%, #1b4a97 100%);
	color: #fff;
}
.aga-chat__avatar {
	width: 42px;
	height: 42px;
	flex-shrink: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .95);
	color: var(--aga-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}
.aga-chat__avatar svg { width: 26px; height: 26px; }
.aga-chat__avatar img { width: 100%; height: 100%; object-fit: cover; }
.aga-chat__titles { display: flex; flex-direction: column; min-width: 0; }
.aga-chat__title { font-weight: 800; font-size: 16px; line-height: 1.25; }
.aga-chat__subtitle {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: rgba(255, 255, 255, .82);
}
.aga-chat__dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #2ecc71;
	box-shadow: 0 0 0 3px rgba(46, 204, 113, .25);
}
.aga-chat__actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.aga-chat__restart,
.aga-chat__close {
	background: rgba(255, 255, 255, .12);
	border: 0;
	color: #fff;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	line-height: 1;
	transition: background .2s ease;
	padding: 0;
}
.aga-chat__restart svg { width: 16px; height: 16px; }
.aga-chat__restart:hover,
.aga-chat__close:hover { background: rgba(255, 255, 255, .24); }

/* ---------- messages ---------- */
.aga-chat__messages {
	flex: 1;
	overflow-y: auto;
	padding: 18px 16px 10px;
	background: #f6f9fe;
	scrollbar-width: thin;
}
.aga-row { display: flex; flex-direction: column; margin-bottom: 14px; }
.aga-row--user { align-items: flex-end; }
.aga-row--bot { align-items: flex-start; }
.aga-msg {
	max-width: 86%;
	padding: 11px 15px;
	border-radius: 16px;
	line-height: 1.55;
	word-wrap: break-word;
}
.aga-msg--user {
	background: #d9f1fe;
	color: #123;
	border-bottom-right-radius: 5px;
}
.aga-msg--bot {
	background: #fff;
	border: 1px solid var(--aga-line);
	border-bottom-left-radius: 5px;
	box-shadow: 0 3px 10px rgba(22, 39, 107, .05);
}
.aga-msg__meta {
	margin-top: 4px;
	font-size: 11px;
	color: var(--aga-muted);
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 0 6px;
}
.aga-msg__ticks { color: var(--aga-accent); letter-spacing: -2px; }
.aga-msg__text + .aga-msg__text { margin-top: 8px; }
.aga-msg a { color: var(--aga-accent); font-weight: 600; text-decoration: none; }
.aga-msg a:hover { text-decoration: underline; }
.aga-msg strong { color: var(--aga-primary); }
.aga-msg code {
	background: #eef3fb;
	border-radius: 5px;
	padding: 1px 6px;
	font-size: 13px;
}

/* typing dots */
.aga-msg--typing { padding: 13px 16px; }
.aga-dots { display: inline-flex; gap: 4px; }
.aga-dots i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--aga-accent);
	opacity: .35;
	animation: aga-blink 1.2s infinite;
}
.aga-dots i:nth-child(2) { animation-delay: .2s; }
.aga-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes aga-blink {
	0%, 80%, 100% { opacity: .25; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-2px); }
}

/* ---------- page cards ---------- */
.aga-cell { margin-top: 10px; }
.aga-cell__caption {
	font-size: 12.5px;
	font-weight: 600;
	color: var(--aga-muted);
	margin-bottom: 5px;
}
.aga-page {
	display: flex;
	gap: 12px;
	align-items: stretch;
	background: #f8fbff;
	border: 1px solid var(--aga-line);
	border-radius: 12px;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	transition: border-color .2s ease, box-shadow .2s ease;
}
.aga-page:hover {
	border-color: var(--aga-accent);
	box-shadow: 0 8px 20px rgba(4, 170, 234, .12);
	text-decoration: none;
}
.aga-page__img {
	width: 86px;
	min-height: 86px;
	object-fit: cover;
	flex-shrink: 0;
}
.aga-page__body { padding: 10px 12px 10px 0; min-width: 0; }
.aga-page:not(:has(.aga-page__img)) .aga-page__body,
.aga-page__body:first-child { padding-left: 12px; }
.aga-page__type {
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--aga-accent);
}
.aga-page__title { font-weight: 700; color: var(--aga-primary); margin: 2px 0; font-size: 14.5px; }
.aga-page__excerpt {
	font-size: 12.5px;
	color: var(--aga-muted);
	line-height: 1.45;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.aga-page__cta { margin-top: 4px; font-size: 12.5px; font-weight: 700; color: var(--aga-accent); }

/* ---------- suggestions ---------- */
.aga-suggestions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin: 2px 0 8px; }
.aga-suggestion {
	background: #fff;
	border: 1px solid var(--aga-line);
	color: var(--aga-primary);
	border-radius: 100px;
	padding: 8px 16px;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	transition: all .2s ease;
}
.aga-suggestion:hover { border-color: var(--aga-accent); color: var(--aga-accent); }

/* ---------- quick-action chips ---------- */
.aga-chat__quick {
	display: flex;
	gap: 8px;
	padding: 10px 14px 0;
	background: var(--aga-canvas);
	flex-wrap: wrap;
	justify-content: center;
}
.aga-quick {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	background: #fff;
	border: 1.5px solid #dbe9fb;
	color: var(--aga-primary);
	border-radius: 100px;
	padding: 8px 15px;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	transition: all .2s ease;
}
.aga-quick svg { width: 15px; height: 15px; color: var(--aga-accent); }
.aga-quick:hover { border-color: var(--aga-accent); box-shadow: 0 6px 14px rgba(4, 170, 234, .14); }

/* ---------- input ---------- */
.aga-chat__form {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	background: var(--aga-canvas);
}
.aga-chat__input {
	flex: 1;
	border: 1.5px solid var(--aga-line);
	border-radius: 100px;
	padding: 12px 20px;
	font-size: 14.5px;
	outline: none;
	background: #f8fafd;
	color: var(--aga-ink);
	transition: border-color .2s ease, background .2s ease;
	min-width: 0;
}
.aga-chat__input:focus { border-color: var(--aga-accent); background: #fff; }
.aga-chat__input::placeholder { color: #9aa7c2; }
.aga-chat__send {
	flex-shrink: 0;
	width: 46px;
	height: 46px;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--aga-accent), #3fc6ff);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 8px 18px rgba(4, 170, 234, .35);
	transition: transform .15s ease, box-shadow .2s ease;
	padding: 0;
}
.aga-chat__send svg { width: 20px; height: 20px; margin-left: 2px; }
.aga-chat__send:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(4, 170, 234, .45); }
.aga-chat__send:disabled { opacity: .6; cursor: default; transform: none; }

.aga-chat__footnote {
	padding: 0 16px 10px;
	font-size: 11px;
	color: var(--aga-muted);
	text-align: center;
	background: var(--aga-canvas);
}

/* ---------- lead gate ---------- */
.aga-gatecard { display: flex; flex-direction: column; gap: 8px; width: 280px; max-width: 100%; }
.aga-gatecard input {
	border: 1.5px solid var(--aga-line);
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14px;
	outline: none;
}
.aga-gatecard input:focus { border-color: var(--aga-accent); }
.aga-gate-start {
	border: 0;
	border-radius: 100px;
	background: linear-gradient(135deg, var(--aga-accent), #3fc6ff);
	color: #fff;
	font-weight: 700;
	padding: 10px 16px;
	cursor: pointer;
}
.aga-gate-error { color: #d63638; font-size: 12.5px; }

/* ---------- floating bubble ---------- */
.aga-bubble-wrap { position: fixed; bottom: 22px; z-index: 99990; }
.aga-bubble-wrap--br { right: 22px; }
.aga-bubble-wrap--bl { left: 22px; }
.aga-bubble {
	width: 60px;
	height: 60px;
	border: 0;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--aga-primary), #22307a);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 14px 34px rgba(22, 39, 107, .4);
	transition: transform .2s ease;
	padding: 0;
}
.aga-bubble:hover { transform: scale(1.06); }
.aga-bubble svg { width: 28px; height: 28px; }
.aga-bubble img { width: 34px; height: 34px; object-fit: contain; }
.aga-float {
	display: none;
	position: absolute;
	bottom: 76px;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 120px);
}
.aga-bubble-wrap--br .aga-float { right: 0; }
.aga-bubble-wrap--bl .aga-float { left: 0; }
.aga-bubble-wrap--open .aga-float { display: block; }
.aga-chat--floatwin { height: 100%; }

/* ---------- v1.0 UI refinements: avatars, numbered badges, input pill ---------- */

/* rows carry avatars beside the bubble stack */
.aga-row { flex-direction: row; align-items: flex-end; gap: 8px; }
.aga-row--user { justify-content: flex-end; }
.aga-row--bot { justify-content: flex-start; }
.aga-stack { display: flex; flex-direction: column; max-width: 82%; min-width: 0; }
.aga-row--user .aga-stack { align-items: flex-end; }
.aga-row--bot .aga-stack { align-items: flex-start; }
.aga-stack .aga-msg { max-width: 100%; }
.aga-avatar {
	width: 32px;
	height: 32px;
	flex-shrink: 0;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	margin-bottom: 20px; /* sits beside the bubble, above the meta line */
}
.aga-avatar svg { width: 18px; height: 18px; }
.aga-avatar img { width: 100%; height: 100%; object-fit: cover; }
.aga-avatar--bot { background: var(--aga-primary); color: #fff; }
.aga-avatar--user { background: #d9f1fe; color: var(--aga-accent); }
.aga-row--typing .aga-avatar { margin-bottom: 0; }

/* numbered badges for ordered lists in bot replies */
.aga-ol { list-style: none; counter-reset: agaol; margin: 8px 0 4px; padding: 0; }
.aga-ol li {
	counter-increment: agaol;
	position: relative;
	padding-left: 32px;
	margin-bottom: 7px;
	line-height: 1.5;
}
.aga-ol li::before {
	content: counter(agaol);
	position: absolute;
	left: 0;
	top: 1px;
	width: 21px;
	height: 21px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--aga-accent), #3fc6ff);
	color: #fff;
	font-size: 11.5px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* input pill with the attach icon inside */
.aga-chat__pill {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 4px;
	border: 1.5px solid var(--aga-line);
	border-radius: 100px;
	background: #f8fafd;
	padding: 0 6px 0 10px;
	transition: border-color .2s ease, background .2s ease;
	min-width: 0;
}
.aga-chat__pill:focus-within { border-color: var(--aga-accent); background: #fff; }
.aga-chat__attach {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	border: 0;
	background: transparent;
	color: #9aa7c2;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}
.aga-chat__attach svg { width: 18px; height: 18px; }
.aga-chat__pill .aga-chat__input {
	border: 0;
	background: transparent;
	padding: 12px 10px 12px 0;
}
.aga-chat__pill .aga-chat__input:focus { border: 0; background: transparent; }

/* quiet, thin scrollbar */
.aga-chat__messages::-webkit-scrollbar { width: 6px; }
.aga-chat__messages::-webkit-scrollbar-track { background: transparent; }
.aga-chat__messages::-webkit-scrollbar-thumb { background: #ccd7ea; border-radius: 100px; }

/* v1.1 — geometry polish to match the reference composition:
   avatars top-aligned with their bubble, tighter rows, soft grey bot
   bubble, scrollbar without arrow buttons */
.aga-row { align-items: flex-start; margin-bottom: 12px; }
.aga-avatar { margin-bottom: 0; margin-top: 2px; }
.aga-msg--bot {
	background: #eef3fa;
	border: 0;
	box-shadow: none;
}
.aga-msg__meta { margin-top: 3px; }
.aga-chat__messages { padding: 16px 16px 8px; }
.aga-chat__messages::-webkit-scrollbar-button { display: none; height: 0; }
.aga-ol { margin: 6px 0 2px; }
.aga-ol li { margin-bottom: 6px; }

/* v1.2 — reference layout: suggestion chips side-by-side, quick chips
   below the input (swipeable single row on phones), mic voice input */
.aga-suggestions { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.aga-chat__form { padding-bottom: 4px; }
.aga-chat__quick { padding: 8px 14px 10px; }
.aga-chat__mic {
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 50%;
	background: rgba(4, 170, 234, .10);
	color: var(--aga-accent);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background .2s ease;
}
.aga-chat__mic svg { width: 17px; height: 17px; }
.aga-chat__mic:hover { background: rgba(4, 170, 234, .18); }
.aga-chat__mic--on {
	background: linear-gradient(135deg, var(--aga-accent), #3fc6ff);
	color: #fff;
	animation: aga-mic-pulse 1.4s ease-in-out infinite;
}
@keyframes aga-mic-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(4, 170, 234, .35); }
	50% { box-shadow: 0 0 0 7px rgba(4, 170, 234, 0); }
}
@media (max-width: 782px) {
	/* single swipeable row of quick chips on phones */
	.aga-chat__quick {
		flex-wrap: nowrap;
		justify-content: flex-start;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}
	.aga-chat__quick::-webkit-scrollbar { display: none; }
	.aga-quick { flex-shrink: 0; }
}

/* v1.2.1 — narrow widgets (phone viewport OR the floating bubble window,
   which is narrow even on desktop): suggestion chips go two-across with
   wrapped text, quick chips become one swipeable row */
@media (max-width: 782px) {
	.aga-suggestion {
		white-space: normal;
		text-align: left;
		line-height: 1.35;
		max-width: calc(50% - 4px);
		padding: 9px 14px;
	}
}
.aga-chat--floatwin .aga-suggestion {
	white-space: normal;
	text-align: left;
	line-height: 1.35;
	max-width: calc(50% - 4px);
	padding: 9px 14px;
}
.aga-chat--floatwin .aga-chat__quick {
	flex-wrap: nowrap;
	justify-content: flex-start;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}
.aga-chat--floatwin .aga-chat__quick::-webkit-scrollbar { display: none; }
.aga-chat--floatwin .aga-quick { flex-shrink: 0; }
