/* Site chat widget. Uses the theme's own tokens so it cannot drift from the site. */

.ambot-launch {
	position: fixed;
	right: 22px;
	bottom: 76px; /* clears the TranslatePress language switcher */
	z-index: 9998;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 13px 20px 13px 17px;
	border: 0;
	border-radius: var(--r-pill);
	background: var(--accent);
	color: #04222A;
	font-family: var(--font-body);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(2, 8, 20, .45);
	transition: transform .18s ease, box-shadow .18s ease;
}

.ambot-launch:hover {
	transform: translateY(-2px);
	box-shadow: 0 14px 36px rgba(2, 8, 20, .55);
}

.ambot-launch svg {
	width: 19px;
	height: 19px;
}

.ambot-launch[hidden],
.ambot-panel[hidden],
.ambot-nudge[hidden] {
	display: none !important;
}

/* The unprompted opener. */
.ambot-nudge {
	position: fixed;
	right: 22px;
	bottom: 138px;
	z-index: 9998;
	max-width: 268px;
	padding: 14px 16px;
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	background: var(--surface);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 14.5px;
	line-height: 1.5;
	cursor: pointer;
	box-shadow: 0 12px 34px rgba(2, 8, 20, .5);
	animation: ambot-rise .3s ease both;
}

.ambot-nudge-x {
	position: absolute;
	top: 4px;
	right: 6px;
	padding: 4px 7px;
	border: 0;
	background: none;
	color: var(--muted);
	font-size: 17px;
	line-height: 1;
	cursor: pointer;
}

@keyframes ambot-rise {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: none; }
}

/* The TranslatePress switcher sits at z-index 99999 and would float over the
   composer. Hide it while the chat is open; it comes back on close. */
body.ambot-open .trp-floating-switcher {
	display: none !important;
}

/* Panel */
.ambot-panel {
	position: fixed;
	right: 22px;
	bottom: 22px;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	width: 390px;
	height: min(600px, calc(100vh - 44px));
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	background: var(--bg);
	box-shadow: 0 24px 60px rgba(2, 8, 20, .6);
	overflow: hidden;
	animation: ambot-rise .22s ease both;
}

.ambot-head {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 15px 16px;
	border-bottom: 1px solid var(--line);
	background: var(--surface);
}

.ambot-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--support);
	box-shadow: 0 0 0 4px rgba(20, 184, 184, .16);
	flex: none;
}

.ambot-title {
	font-family: var(--font-display);
	font-size: 15.5px;
	font-weight: 600;
	color: var(--ink);
	letter-spacing: .01em;
}

.ambot-sub {
	font-size: 12.5px;
	color: var(--muted);
	margin-top: 1px;
}

.ambot-head-x {
	margin-left: auto;
	padding: 6px 8px;
	border: 0;
	background: none;
	color: var(--muted);
	font-size: 21px;
	line-height: 1;
	cursor: pointer;
	border-radius: var(--r-sm);
}

.ambot-head-x:hover {
	color: var(--ink);
	background: var(--surface-alt);
}

.ambot-log {
	flex: 1;
	overflow-y: auto;
	padding: 18px 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	font-family: var(--font-body);
	font-size: 14.5px;
	line-height: 1.55;
	overscroll-behavior: contain;
}

.ambot-msg {
	max-width: 84%;
	padding: 11px 14px;
	border-radius: var(--r-md);
	white-space: pre-wrap;
	word-wrap: break-word;
}

.ambot-bot {
	align-self: flex-start;
	background: var(--surface);
	border: 1px solid var(--line);
	color: var(--ink);
	border-bottom-left-radius: var(--r-sm);
}

.ambot-me {
	align-self: flex-end;
	background: var(--accent-deep);
	color: #EAFDFF;
	border-bottom-right-radius: var(--r-sm);
}

.ambot-who {
	align-self: flex-start;
	margin: 4px 0 -6px;
	font-size: 12px;
	color: var(--support);
	font-weight: 600;
	letter-spacing: .02em;
}

.ambot-msg a {
	color: var(--accent);
}

/* Typing */
.ambot-typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 14px;
	border: 1px solid var(--line);
	border-radius: var(--r-md);
	background: var(--surface);
}

.ambot-typing i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--muted);
	animation: ambot-blink 1.3s infinite;
}

.ambot-typing i:nth-child(2) { animation-delay: .18s; }
.ambot-typing i:nth-child(3) { animation-delay: .36s; }

@keyframes ambot-blink {
	0%, 60%, 100% { opacity: .28; }
	30%           { opacity: 1; }
}

/* Composer */
.ambot-form {
	display: flex;
	gap: 9px;
	padding: 12px;
	border-top: 1px solid var(--line);
	background: var(--surface);
}

.ambot-input {
	flex: 1;
	max-height: 108px;
	padding: 11px 13px;
	border: 1px solid var(--line);
	border-radius: var(--r-sm);
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 14.5px;
	line-height: 1.45;
	resize: none;
}

.ambot-input:focus {
	outline: 2px solid var(--accent);
	outline-offset: -1px;
}

.ambot-input::placeholder {
	color: var(--muted);
}

.ambot-send {
	flex: none;
	width: 42px;
	border: 0;
	border-radius: var(--r-sm);
	background: var(--accent);
	color: #04222A;
	cursor: pointer;
	display: grid;
	place-items: center;
}

.ambot-send:disabled {
	opacity: .4;
	cursor: default;
}

.ambot-send svg {
	width: 18px;
	height: 18px;
}

.ambot-foot {
	padding: 0 12px 10px;
	background: var(--surface);
	font-family: var(--font-body);
	font-size: 11.5px;
	color: var(--muted);
	text-align: center;
}

@media (max-width: 560px) {
	.ambot-panel {
		right: 0;
		bottom: 0;
		width: 100vw;
		height: 100dvh;
		border: 0;
		border-radius: 0;
	}

	.ambot-launch {
		right: 16px;
		bottom: 72px;
	}

	.ambot-nudge {
		right: 16px;
		left: 16px;
		bottom: 130px;
		max-width: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ambot-panel,
	.ambot-nudge {
		animation: none;
	}

	.ambot-launch {
		transition: none;
	}

	.ambot-typing i {
		animation: none;
		opacity: .6;
	}
}
