/* ODG Assistente — widget di chat */

.odg-ass {
	--odg-color: #FF6B6B;
	--odg-bg: #ffffff;
	--odg-text: #23262b;
	--odg-muted: #6b7280;
	--odg-line: #e8eaee;
	--odg-bubble: #f3f4f6;
	position: fixed;
	bottom: 20px;
	z-index: 99998;
	font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--odg-text);
}

.odg-ass--right { right: 20px; }
.odg-ass--left  { left: 20px; }

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

.odg-ass__launcher {
	width: 58px;
	height: 58px;
	border-radius: 50%;
	border: 0;
	background: var(--odg-color);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .15s ease, box-shadow .15s ease;
}

.odg-ass__launcher { position: relative; }

.odg-ass__dot {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: #1a7f37;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	box-shadow: 0 0 0 2px #fff;
}

.odg-ass__launcher:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0, 0, 0, .22); }
.odg-ass__launcher:focus-visible { outline: 3px solid var(--odg-color); outline-offset: 3px; }
.odg-ass[data-state="open"] .odg-ass__launcher { display: none; }

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

.odg-ass__panel {
	width: 370px;
	max-width: calc(100vw - 32px);
	height: 540px;
	max-height: calc(100vh - 100px);
	background: var(--odg-bg);
	border-radius: 18px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, .22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: odg-in .18s ease;
}

@keyframes odg-in {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: translateY(0); }
}

.odg-ass__head {
	background: var(--odg-color);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex: 0 0 auto;
}

.odg-ass__title strong { display: block; font-size: 15px; font-weight: 600; }
.odg-ass__sub { display: block; font-size: 12px; opacity: .9; }

.odg-ass__close {
	background: transparent;
	border: 0;
	color: #fff;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
	opacity: .9;
}
.odg-ass__close:hover { opacity: 1; }

/* ------------------------------------------------------------------ log */

.odg-ass__log {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fbfbfc;
	overscroll-behavior: contain;
}

.odg-ass__msg {
	max-width: 84%;
	padding: 10px 13px;
	border-radius: 14px;
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

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

.odg-ass__msg--assistant,
.odg-ass__msg--operator {
	align-self: flex-start;
	background: var(--odg-bubble);
	border-bottom-left-radius: 4px;
}

.odg-ass__msg--operator { background: #e8f4ea; }

.odg-ass__msg a { color: inherit; text-decoration: underline; }
.odg-ass__msg--assistant a, .odg-ass__msg--operator a { color: #0b62c4; }

.odg-ass__who {
	display: block;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .04em;
	opacity: .65;
	margin-bottom: 3px;
}

.odg-ass__note {
	align-self: center;
	font-size: 12px;
	color: var(--odg-muted);
	background: #fff;
	border: 1px solid var(--odg-line);
	border-radius: 999px;
	padding: 4px 12px;
	text-align: center;
}

.odg-ass__typing { display: flex; gap: 4px; align-self: flex-start; padding: 12px 14px; }
.odg-ass__typing span {
	width: 7px; height: 7px; border-radius: 50%;
	background: #b9bec7;
	animation: odg-blink 1.2s infinite ease-in-out;
}
.odg-ass__typing span:nth-child(2) { animation-delay: .18s; }
.odg-ass__typing span:nth-child(3) { animation-delay: .36s; }

@keyframes odg-blink {
	0%, 80%, 100% { opacity: .25; transform: translateY(0); }
	40% { opacity: 1; transform: translateY(-3px); }
}

/* ----------------------------------------------------------------- form */

.odg-ass__form {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid var(--odg-line);
	background: #fff;
}

.odg-ass__input {
	flex: 1 1 auto;
	border: 1px solid var(--odg-line);
	border-radius: 12px;
	padding: 10px 12px;
	font: inherit;
	resize: none;
	max-height: 110px;
	background: #fff;
	color: var(--odg-text);
}
.odg-ass__input:focus { outline: 2px solid var(--odg-color); outline-offset: 1px; border-color: transparent; }

.odg-ass__send {
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 12px;
	background: var(--odg-color);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.odg-ass__send:disabled { opacity: .5; cursor: default; }

.odg-ass__disclaimer {
	margin: 0;
	padding: 8px 14px 12px;
	font-size: 11px;
	line-height: 1.4;
	color: var(--odg-muted);
	background: #fff;
	text-align: center;
}

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

@media (max-width: 520px) {
	.odg-ass { bottom: 14px; }
	.odg-ass--right { right: 14px; }
	.odg-ass--left  { left: 14px; }

	.odg-ass[data-state="open"] {
		inset: 0;
		bottom: 0;
		right: 0;
		left: 0;
	}

	.odg-ass[data-state="open"] .odg-ass__panel {
		width: 100%;
		height: 100%;
		max-height: 100%;
		max-width: 100%;
		border-radius: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.odg-ass__panel, .odg-ass__launcher, .odg-ass__typing span { animation: none; transition: none; }
}
