/* Rita — assistente virtuale. Il launcher sta in basso a destra per non coprire il bottone WhatsApp. */

.bunz-rita {
	--rita-accent: #1a73e8;
	--rita-dark: #16233c;
	--rita-bg: #ffffff;
	--rita-muted: #5b6779;
	--rita-line: #e4e8ef;
	position: fixed;
	bottom: var(--rita-bottom, 20px);
	z-index: 99998;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
}

.bunz-rita--right {
	right: var(--rita-side, 20px);
}

.bunz-rita--left {
	left: var(--rita-side, 20px);
}

.bunz-rita__launcher {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 18px;
	border: 0;
	border-radius: 999px;
	background: var(--rita-accent);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	box-shadow: 0 8px 24px rgba(22, 35, 60, .28);
}

.bunz-rita__launcher:hover {
	filter: brightness(1.06);
}

.bunz-rita__launcher svg {
	width: 20px;
	height: 20px;
	flex: none;
}

.bunz-rita__panel {
	display: flex;
	flex-direction: column;
	width: 370px;
	max-width: calc(100vw - 32px);
	height: 540px;
	max-height: calc(100vh - 120px);
	background: var(--rita-bg);
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 18px 48px rgba(22, 35, 60, .3);
}

.bunz-rita__header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 14px 16px;
	background: var(--rita-dark);
	color: #fff;
}

.bunz-rita__avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--rita-accent);
	display: grid;
	place-items: center;
	font-weight: 700;
	flex: none;
}

.bunz-rita__title {
	font-weight: 600;
	line-height: 1.2;
}

.bunz-rita__subtitle {
	font-size: 12px;
	opacity: .75;
}

.bunz-rita__close {
	margin-left: auto;
	background: none;
	border: 0;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	opacity: .8;
	padding: 4px 6px;
}

.bunz-rita__close:hover {
	opacity: 1;
}

.bunz-rita__log {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	background: #f7f9fc;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.bunz-rita__msg {
	max-width: 85%;
	padding: 10px 13px;
	border-radius: 14px;
	white-space: pre-wrap;
	word-wrap: break-word;
}

.bunz-rita__msg--bot {
	align-self: flex-start;
	background: #fff;
	border: 1px solid var(--rita-line);
	border-bottom-left-radius: 4px;
}

.bunz-rita__msg--user {
	align-self: flex-end;
	background: var(--rita-accent);
	color: #fff;
	border-bottom-right-radius: 4px;
}

.bunz-rita__sources {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid var(--rita-line);
}

.bunz-rita__sources span {
	width: 100%;
	font-size: 12px;
	color: var(--rita-muted);
}

.bunz-rita__sources a {
	display: inline-block;
	max-width: 100%;
	padding: 5px 10px;
	border-radius: 999px;
	background: #eef4fe;
	color: var(--rita-accent);
	font-size: 13px;
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bunz-rita__sources a:hover {
	background: #e0ebfd;
}

.bunz-rita__typing {
	align-self: flex-start;
	display: flex;
	gap: 4px;
	padding: 12px 14px;
	background: #fff;
	border: 1px solid var(--rita-line);
	border-radius: 14px;
}

.bunz-rita__typing i {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #c3ccda;
	animation: bunz-rita-blink 1.2s infinite;
}

.bunz-rita__typing i:nth-child(2) {
	animation-delay: .2s;
}

.bunz-rita__typing i:nth-child(3) {
	animation-delay: .4s;
}

@keyframes bunz-rita-blink {
	0%, 60%, 100% { opacity: .35; }
	30% { opacity: 1; }
}

.bunz-rita__form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--rita-line);
	background: #fff;
}

.bunz-rita__input {
	flex: 1;
	resize: none;
	max-height: 96px;
	padding: 10px 12px;
	border: 1px solid var(--rita-line);
	border-radius: 10px;
	font: inherit;
	color: inherit;
}

.bunz-rita__input:focus {
	outline: 2px solid var(--rita-accent);
	outline-offset: -1px;
}

.bunz-rita__send {
	flex: none;
	width: 42px;
	border: 0;
	border-radius: 10px;
	background: var(--rita-accent);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
}

.bunz-rita__send[disabled] {
	opacity: .5;
	cursor: default;
}

.bunz-rita__send svg {
	width: 18px;
	height: 18px;
}

.bunz-rita__privacy {
	padding: 0 12px 10px;
	background: #fff;
	font-size: 11px;
	color: var(--rita-muted);
	text-align: center;
}

.bunz-rita__privacy a {
	color: var(--rita-muted);
}

@media (max-width: 480px) {
	.bunz-rita {
		bottom: min( var(--rita-bottom, 12px), 16px );
	}

	.bunz-rita--right {
		right: min( var(--rita-side, 12px), 16px );
	}

	.bunz-rita--left {
		left: min( var(--rita-side, 12px), 16px );
	}

	.bunz-rita__panel {
		width: calc(100vw - 24px);
		height: calc(100vh - 90px);
	}

	.bunz-rita__launcher span {
		display: none;
	}

	.bunz-rita__launcher {
		padding: 14px;
	}
}
