/* NF Docs Assistant — widget liquid glass "Grigio Perla" (colori configurabili) */

.nfda-root {
	--nfda-accent: #7A9C30;
	--nfda-grad-from: #EEF0EC;
	--nfda-grad-to: #C7CCC4;
	--nfda-bottom: 96px;
	--nfda-side: 20px;
	position: fixed;
	right: var(--nfda-side);
	bottom: var(--nfda-bottom);
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
}

/* --- Badge circolare col logo --- */
.nfda-badge {
	width: 62px;
	height: 62px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.5);
	cursor: pointer;
	overflow: hidden;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--nfda-accent);
	background: linear-gradient(140deg, var(--nfda-grad-from), var(--nfda-grad-to));
	-webkit-backdrop-filter: blur(10px) saturate(150%);
	backdrop-filter: blur(10px) saturate(150%);
	box-shadow: 0 12px 28px -6px rgba(20, 30, 10, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.65);
	transition: transform .15s ease, box-shadow .15s ease;
}
.nfda-badge:hover {
	transform: translateY(-2px);
	box-shadow: 0 18px 34px -8px rgba(20, 30, 10, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.nfda-badge-inner {
	width: 100%;
	height: 100%;
	padding: 3px;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
}
.nfda-logo-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	display: block;
}
.nfda-logo-drop svg {
	width: 30px;
	height: 30px;
	fill: currentColor;
}
.nfda-open .nfda-badge {
	display: none;
}

/* --- Pannello chat in vetro --- */
.nfda-panel {
	position: absolute;
	right: 0;
	bottom: 0;
	width: 380px;
	max-width: calc(100vw - 32px);
	height: 560px;
	max-height: calc(100vh - 40px);
	border-radius: 18px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	color: #1c2016;
	background: linear-gradient(160deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.44));
	border: 1px solid var(--nfda-accent);
	-webkit-backdrop-filter: blur(22px) saturate(150%);
	backdrop-filter: blur(22px) saturate(150%);
	box-shadow: 0 20px 54px -14px rgba(20, 30, 10, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.6);
	animation: nfda-in .18s ease;
}
.nfda-panel::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	pointer-events: none;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 40%);
}
@keyframes nfda-in {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: translateY(0); }
}

.nfda-header {
	position: relative;
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 12px 14px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.nfda-hlogo {
	width: 28px;
	height: 28px;
	padding: 2px;
	box-sizing: border-box;
	border-radius: 50%;
	overflow: hidden;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--nfda-accent);
	background: linear-gradient(140deg, var(--nfda-grad-from), var(--nfda-grad-to));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.nfda-hlogo .nfda-logo-drop svg {
	width: 15px;
	height: 15px;
}
.nfda-title {
	flex: 1;
	font-weight: 700;
	font-size: 15px;
	letter-spacing: -0.01em;
	color: #20241b;
}
.nfda-close {
	background: transparent;
	border: none;
	color: #5b6152;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
	opacity: .8;
}
.nfda-close:hover { opacity: 1; }

.nfda-messages {
	position: relative;
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.nfda-msg {
	display: flex;
	flex-direction: column;
	max-width: 85%;
}
.nfda-msg-user { align-self: flex-end; align-items: flex-end; }
.nfda-msg-assistant { align-self: flex-start; align-items: flex-start; }

.nfda-bubble {
	padding: 10px 14px;
	border-radius: 14px;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}
.nfda-msg-user .nfda-bubble {
	background: var(--nfda-accent);
	color: #fff;
	border-bottom-right-radius: 4px;
}
.nfda-msg-assistant .nfda-bubble {
	background: rgba(255, 255, 255, 0.72);
	color: #1c2016;
	border: 1px solid rgba(0, 0, 0, 0.05);
	border-bottom-left-radius: 4px;
}
.nfda-bubble a { color: inherit; text-decoration: underline; }
.nfda-msg-assistant .nfda-bubble a { color: var(--nfda-accent); }
.nfda-bubble strong { font-weight: 700; }

/* Fonti */
.nfda-sources {
	margin-top: 6px;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
}
.nfda-sources-label { font-size: 12px; color: #6b7160; }
.nfda-source {
	font-size: 12px;
	background: rgba(255, 255, 255, 0.6);
	border: 1px solid var(--nfda-accent);
	color: var(--nfda-accent);
	padding: 3px 10px;
	border-radius: 999px;
	text-decoration: none;
	white-space: nowrap;
	max-width: 200px;
	overflow: hidden;
	text-overflow: ellipsis;
}
.nfda-source:hover { background: var(--nfda-accent); color: #fff; }

/* Indicatore di digitazione */
.nfda-dots { display: inline-flex; gap: 4px; align-items: center; height: 12px; }
.nfda-dots span {
	width: 7px; height: 7px; border-radius: 50%;
	background: #b7b7ae;
	animation: nfda-blink 1.2s infinite ease-in-out both;
}
.nfda-dots span:nth-child(2) { animation-delay: .2s; }
.nfda-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes nfda-blink {
	0%, 80%, 100% { opacity: .3; }
	40% { opacity: 1; }
}

/* Form */
.nfda-form {
	position: relative;
	display: flex;
	align-items: flex-end;
	gap: 8px;
	padding: 10px;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
	background: rgba(255, 255, 255, 0.32);
}
.nfda-input {
	flex: 1;
	resize: none;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 12px;
	padding: 10px 12px;
	font: inherit;
	max-height: 120px;
	outline: none;
	background: rgba(255, 255, 255, 0.85);
	color: #1c2016;
}
.nfda-input:focus { border-color: var(--nfda-accent); }
.nfda-send {
	background: var(--nfda-accent);
	color: #fff;
	border: none;
	border-radius: 12px;
	width: 42px;
	height: 42px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex: 0 0 auto;
}
.nfda-send:hover { filter: brightness(.95); }

@media (max-width: 600px) {
	.nfda-root { right: 14px; bottom: 14px; }
	.nfda-badge { width: 52px; height: 52px; }
	.nfda-logo-drop svg { width: 26px; height: 26px; }
	.nfda-badge-inner { padding: 2px; }
	.nfda-panel {
		width: calc(100vw - 24px);
		max-width: 100vw;
		height: calc(100vh - 28px);
		height: calc(100dvh - 28px);
		max-height: 100vh;
		border-radius: 16px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nfda-badge, .nfda-panel { transition: none; animation: none; }
}
