/**
 * AI Virtual Salesperson — chat widget styles.
 * Panel + floating toggle, mobile-safe, no external fonts.
 */

#aivs-root {
	--aivs-accent: #0E7C66;
	--aivs-accent-dark: #0a5b4d;
	--aivs-bg: #ffffff;
	--aivs-bubble-user: #eef5f3;
	--aivs-text: #1d2b28;
	--aivs-muted: #6b7a77;
	--aivs-radius: 16px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	color: var(--aivs-text);
	z-index: 99999;
}

/* ---- floating toggle button ---- */

#aivs-root .aivs-toggle {
	position: fixed;
	right: 22px;
	bottom: 22px;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: none;
	background: var(--aivs-accent);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(14, 124, 102, 0.42);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
	z-index: 99999;
}

#aivs-root .aivs-toggle:hover,
#aivs-root .aivs-toggle:focus-visible {
	background: var(--aivs-accent-dark);
	transform: translateY(-2px);
	outline: none;
	box-shadow: 0 10px 26px rgba(14, 124, 102, 0.5);
}

#aivs-root .aivs-toggle.aivs-left {
	right: auto;
	left: 22px;
}

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

#aivs-root .aivs-panel {
	position: fixed;
	right: 22px;
	bottom: 92px;
	width: 360px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 130px);
	background: var(--aivs-bg);
	border-radius: var(--aivs-radius);
	box-shadow: 0 18px 46px rgba(16, 36, 33, 0.28);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(14px) scale(0.98);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
	z-index: 99999;
}

#aivs-root .aivs-panel.aivs-open {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}

#aivs-root .aivs-panel.aivs-left,
#aivs-root .aivs-toggle.aivs-left ~ .aivs-panel {
	right: auto;
	left: 22px;
}

/* ---- header ---- */

#aivs-root .aivs-head {
	background: var(--aivs-accent);
	color: #fff;
	padding: 12px 14px;
	display: flex;
	align-items: center;
	gap: 10px;
}

#aivs-root .aivs-head-left {
	display: flex;
	align-items: center;
	gap: 9px;
	flex: 1;
	min-width: 0;
}

#aivs-root .aivs-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #7df0cb;
	box-shadow: 0 0 0 3px rgba(125, 240, 203, 0.25);
	flex: none;
}

#aivs-root .aivs-title {
	font-weight: 600;
	font-size: 15px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

#aivs-root .aivs-icon-btn {
	background: rgba(255, 255, 255, 0.14);
	border: none;
	color: #fff;
	width: 28px;
	height: 28px;
	border-radius: 8px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
}

#aivs-root .aivs-icon-btn:hover,
#aivs-root .aivs-icon-btn:focus-visible {
	background: rgba(255, 255, 255, 0.28);
	outline: none;
}

/* ---- messages ---- */

#aivs-root .aivs-msgs {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafcfb;
	scroll-behavior: smooth;
}

#aivs-root .aivs-msg {
	max-width: 88%;
}

#aivs-root .aivs-user {
	align-self: flex-end;
}

#aivs-root .aivs-assistant {
	align-self: flex-start;
}

#aivs-root .aivs-bubble {
	padding: 10px 13px;
	border-radius: 14px;
	background: #fff;
	border: 1px solid #e2e9e7;
	box-shadow: 0 1px 2px rgba(16, 36, 33, 0.05);
	word-wrap: break-word;
	overflow-wrap: break-word;
}

#aivs-root .aivs-user .aivs-bubble {
	background: var(--aivs-bubble-user);
	border-color: #d6e6e2;
}

#aivs-root .aivs-bubble a {
	color: var(--aivs-accent-dark);
	text-decoration: underline;
}

#aivs-root .aivs-bullet {
	color: var(--aivs-accent);
	font-weight: 700;
}

#aivs-root .aivs-tag {
	font-size: 10px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--aivs-muted);
	margin: 4px 0 0 4px;
}

#aivs-root .aivs-tag-fix {
	color: var(--aivs-accent-dark);
}

/* ---- quick-reply chips ---- */

#aivs-root .aivs-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0 14px 10px;
	background: #fafcfb;
}

#aivs-root .aivs-chip {
	border: 1px solid #cfe0dc;
	background: #fff;
	color: var(--aivs-accent-dark);
	border-radius: 999px;
	padding: 5px 12px;
	font-size: 12.5px;
	cursor: pointer;
	transition: background 0.15s ease;
}

#aivs-root .aivs-chip:hover,
#aivs-root .aivs-chip:focus-visible {
	background: var(--aivs-bubble-user);
	outline: none;
}

/* ---- input row ---- */

#aivs-root .aivs-form {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid #e2e9e7;
	background: #fff;
	position: relative;
}

#aivs-root .aivs-input {
	flex: 1;
	border: 1px solid #d4ded9;
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14.5px;
	font-family: inherit;
	color: var(--aivs-text);
	min-width: 0;
}

#aivs-root .aivs-input:focus {
	border-color: var(--aivs-accent);
	outline: 2px solid rgba(14, 124, 102, 0.15);
	outline-offset: 0;
}

#aivs-root .aivs-send {
	width: 40px;
	height: 40px;
	flex: none;
	border: none;
	border-radius: 10px;
	background: var(--aivs-accent);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}

#aivs-root .aivs-send:hover,
#aivs-root .aivs-send:focus-visible {
	background: var(--aivs-accent-dark);
	outline: none;
}

#aivs-root .aivs-form.aivs-busy .aivs-send {
	opacity: 0.55;
	cursor: default;
}

/* ---- typing indicator ---- */

#aivs-root .aivs-typing {
	display: none;
	position: absolute;
	top: -26px;
	left: 22px;
	background: #fff;
	border: 1px solid #e2e9e7;
	border-radius: 10px;
	padding: 5px 9px;
	box-shadow: 0 1px 3px rgba(16, 36, 33, 0.08);
}

#aivs-root .aivs-typing.aivs-on {
	display: flex;
	gap: 4px;
}

#aivs-root .aivs-typing span {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--aivs-muted);
	animation: aivsBounce 1.1s infinite ease-in-out;
}

#aivs-root .aivs-typing span:nth-child(2) { animation-delay: 0.16s; }
#aivs-root .aivs-typing span:nth-child(3) { animation-delay: 0.32s; }

@keyframes aivsBounce {
	0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
	30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- footer ---- */

#aivs-root .aivs-foot {
	padding: 7px 14px 9px;
	font-size: 11px;
	color: var(--aivs-muted);
	background: #fff;
	border-top: 1px solid #eef2f0;
	text-align: center;
}

/* ---- mobile ---- */

@media (max-width: 480px) {
	#aivs-root .aivs-panel {
		right: 8px;
		left: 8px;
		bottom: 88px;
		width: auto;
		height: calc(100vh - 120px);
	}

	#aivs-root .aivs-panel.aivs-left {
		left: 8px;
	}

	#aivs-root .aivs-toggle {
		right: 16px;
		bottom: 16px;
	}

	#aivs-root .aivs-toggle.aivs-left {
		left: 16px;
		right: auto;
	}
}

/* ---- accessibility ---- */

@media (prefers-reduced-motion: reduce) {
	#aivs-root .aivs-panel,
	#aivs-root .aivs-toggle,
	#aivs-root .aivs-typing span {
		transition: none;
		animation: none;
	}
}
