/* NF Docs Assistant — barra di ricerca liquid glass "Vetro Chiaro" */

.nfdas {
	--nfdas-accent: #12A37A;
	--nfdas-ink: #123029;
	position: relative;
	width: 100%;
	max-width: 720px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Barra --- */
.nfdas-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 8px 8px 16px;
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.88);
	border: 1px solid rgba(255, 255, 255, 0.75);
	-webkit-backdrop-filter: blur(8px) saturate(140%);
	backdrop-filter: blur(8px) saturate(140%);
	box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.nfdas-ico {
	display: flex;
	color: var(--nfdas-accent);
	flex: 0 0 auto;
}
.nfdas-ico svg { width: 26px; height: 26px; }

.nfdas-input {
	flex: 1;
	min-width: 0;
	border: none;
	background: transparent;
	outline: none;
	font-size: 16px;
	color: var(--nfdas-ink);
	padding: 8px 2px;
	-webkit-appearance: none;
	appearance: none;
}
.nfdas-input::placeholder { color: rgba(18, 48, 41, 0.5); }
/* nasconde la X nativa del type=search */
.nfdas-input::-webkit-search-decoration,
.nfdas-input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Toggle AI — forzato con !important per non ereditare lo stile bottoni del tema.
   OFF = pillola bianca con contorno smeraldo (chiaramente un interruttore).
   ON  = pieno smeraldo con alone (stato attivo inequivocabile). */
.nfdas-ai {
	display: inline-flex !important;
	align-items: center !important;
	gap: 5px !important;
	font-size: 12.5px !important;
	font-weight: 700 !important;
	line-height: 1 !important;
	cursor: pointer;
	color: #7C3AED !important;
	background: rgba(255, 255, 255, 0.7) !important;
	border: 1.5px solid #7C3AED !important;
	padding: 7px 12px !important;
	height: auto !important;
	width: auto !important;
	min-width: 0 !important;
	border-radius: 999px !important;
	white-space: nowrap;
	flex: 0 0 auto;
	box-shadow: none !important;
	text-transform: none !important;
	transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.nfdas-ai svg { width: 13px; height: 13px; fill: currentColor; }
.nfdas-ai[aria-pressed="true"] {
	color: #fff !important;
	background: linear-gradient(135deg, #7C3AED, #A855F7 55%, #D946EF) !important;
	border-color: transparent !important;
	box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.35), 0 6px 18px -4px rgba(124, 58, 237, 0.55) !important;
}
/* Indicatore statico "AI sempre attivo" — etichetta piatta, non un interruttore */
.nfdas-ai.nfdas-ai-static {
	pointer-events: none;
	cursor: default;
	color: #7C3AED !important;
	background: rgba(124, 58, 237, 0.12) !important;
	border-color: #7C3AED !important;
	box-shadow: none !important;
}

.nfdas-btn {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border: none;
	border-radius: 12px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	background: var(--nfdas-accent);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.nfdas-btn svg { width: 26px; height: 26px; }
.nfdas-btn:hover { filter: brightness(0.96); }

/* --- Dropdown --- */
.nfdas-dropdown {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 10px);
	z-index: 40;
	border-radius: 14px;
	overflow: hidden;
	max-height: 60vh;
	overflow-y: auto;
	background: rgba(255, 255, 255, 0.96);
	border: 1px solid rgba(255, 255, 255, 0.7);
	-webkit-backdrop-filter: blur(14px) saturate(150%);
	backdrop-filter: blur(14px) saturate(150%);
	box-shadow: 0 20px 44px -16px rgba(0, 0, 0, 0.5);
	color: var(--nfdas-ink, #123029);
	text-align: left;
}
.nfdas-item {
	display: block;
	padding: 11px 15px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
	text-decoration: none;
	color: var(--nfdas-ink, #123029) !important;
	text-align: left;
}
.nfdas-item:last-child { border-bottom: none; }
.nfdas-item:hover,
.nfdas-item:focus { background: rgba(18, 163, 122, 0.09); outline: none; }
.nfdas-title { font-weight: 700; font-size: 14.5px; margin-bottom: 2px; text-align: left; color: var(--nfdas-ink, #123029) !important; }
.nfdas-snip { font-size: 13px; color: #3f5a51 !important; text-align: left; }
.nfdas-snip b { color: var(--nfdas-ink); }
.nfdas-dropdown mark {
	background: rgba(18, 163, 122, 0.24);
	color: inherit;
	padding: 0 2px;
	border-radius: 3px;
}
.nfdas-empty { padding: 14px 15px; font-size: 13.5px; color: #5a746b; }

/* --- Risposta AI --- */
.nfdas-ai-answer { padding: 16px 18px; text-align: left; color: var(--nfdas-ink, #123029) !important; }
.nfdas-ai-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	font-weight: 800;
	color: #fff;
	background: var(--nfdas-accent);
	padding: 4px 10px;
	border-radius: 999px;
	margin-bottom: 10px;
}
.nfdas-ai-badge svg { width: 13px; height: 13px; }
.nfdas-ai-text { font-size: 14.5px; line-height: 1.55; text-align: left; color: var(--nfdas-ink, #123029) !important; }
.nfdas-ai-text b { font-weight: 700; }
.nfdas-ai-text a { color: var(--nfdas-accent); }
.nfdas-src { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nfdas-src-label { font-size: 12px; color: #5a746b !important; }
.nfdas-src a {
	font-size: 12px;
	text-decoration: none;
	color: var(--nfdas-accent, #12A37A) !important;
	background: rgba(18, 163, 122, 0.08);
	border: 1px solid var(--nfdas-accent, #12A37A);
	padding: 2px 9px;
	border-radius: 999px;
}
.nfdas-src a:hover { background: var(--nfdas-accent, #12A37A); color: #fff !important; }
/* Link dentro il testo della risposta AI (il tema li renderebbe bianchi) */
.nfdas-ai-text a { color: var(--nfdas-accent, #12A37A) !important; text-decoration: underline; }

/* indicatore caricamento */
.nfdas-dots { display: inline-flex; gap: 4px; padding: 14px 15px; }
.nfdas-dots span {
	width: 7px; height: 7px; border-radius: 50%;
	background: var(--nfdas-accent);
	opacity: .4;
	animation: nfdas-blink 1.2s infinite ease-in-out both;
}
.nfdas-dots span:nth-child(2) { animation-delay: .2s; }
.nfdas-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes nfdas-blink { 0%,80%,100%{ opacity:.3; } 40%{ opacity:1; } }

/* --- Pills popolari --- */
.nfdas-pop {
	margin-top: 14px;
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	font-size: 13.5px;
	color: rgba(255, 255, 255, 0.9);
}
.nfdas-pill {
	cursor: pointer;
	padding: 5px 14px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.5);
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font: inherit;
}
.nfdas-pill:hover { background: rgba(255, 255, 255, 0.22); }

/* --- Aggancio alla barra del tema (Hero Search Form di EazyDocs/Docly) --- */
.nfdas-enh {
	position: relative;
	--nfdas-accent: #12A37A;
	--nfdas-ink: #123029;
}
.nfdas-enh .input-group {
	display: flex !important;
	align-items: center;
	gap: 8px;
	padding: 8px 8px 8px 16px !important;
	border-radius: 16px !important;
	background: rgba(255, 255, 255, 0.95) !important;
	border: 1px solid rgba(255, 255, 255, 0.85) !important;
	-webkit-backdrop-filter: blur(6px) saturate(140%);
	backdrop-filter: blur(6px) saturate(140%);
	box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
}
.nfdas-enh .input-group > input[type="search"]::-webkit-search-cancel-button,
.nfdas-enh .input-group > input[type="search"]::-webkit-search-decoration {
	-webkit-appearance: none;
	appearance: none;
}
.nfdas-enh .input-group > input[type="search"]::placeholder,
.nfdas-enh .input-group .form-control::placeholder {
	color: rgba(18, 48, 41, 0.5) !important;
}
/* Icona lente a sinistra (come nell'artefatto Vetro Chiaro) */
.nfdas-enh .nfdas-lead {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	color: var(--nfdas-accent);
}
.nfdas-enh .nfdas-lead svg { width: 26px; height: 26px; }
.nfdas-enh .input-group > input[type="search"],
.nfdas-enh .input-group .form-control {
	flex: 1;
	min-width: 0;
	height: auto !important;
	margin: 0 !important;
	padding: 8px 2px !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	background: transparent !important;
	color: #123029 !important;
	font-size: 16px !important;
}
.nfdas-enh .input-group-append {
	margin: 0 !important;
	display: flex;
	background: transparent !important;
}
.nfdas-enh .input-group button[type="submit"] {
	width: 44px !important;
	height: 44px !important;
	padding: 0 !important;
	box-sizing: border-box !important;
	flex: 0 0 auto;
	border: none !important;
	border-radius: 12px !important;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--nfdas-accent) !important;
	color: #fff !important;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.nfdas-enh .input-group button[type="submit"] i,
.nfdas-enh .input-group button[type="submit"] i::before {
	color: #fff !important;
	font-size: 20px !important;
	line-height: 1 !important;
}
.nfdas-enh .input-group button[type="submit"] svg {
	width: 20px !important;
	height: 20px !important;
}

/* Selettore "cerca in" (nice-select) dentro la barra Docs — chip nel vetro */
.nfdas-enh .input-group-append {
	gap: 0;
	padding: 0;
	margin: 0 !important;
	display: flex;
	align-items: center;
	background: transparent !important;
}
.nfdas-enh .nice-select {
	height: 40px;
	line-height: 40px;
	padding: 0 32px 0 14px;
	margin: 0;
	float: none;
	border-radius: 999px;
	border: 1px solid rgba(0, 0, 0, 0.10) !important;
	background: rgba(255, 255, 255, 0.55) !important;
	color: #123029 !important;
	font-size: 13px;
	font-weight: 600;
	box-shadow: none !important;
	transition: background .15s ease;
}
.nfdas-enh .nice-select:hover { background: rgba(255, 255, 255, 0.85) !important; }
.nfdas-enh .nice-select .current { color: #123029 !important; font-weight: 600; }
.nfdas-enh .nice-select::after {
	content: '';
	position: absolute;
	right: 15px;
	top: 50%;
	width: 8px;
	height: 8px;
	margin-top: -6px;
	border-left: 0 !important;
	border-top: 0 !important;
	border-bottom: 2px solid var(--nfdas-accent) !important;
	border-right: 2px solid var(--nfdas-accent) !important;
	transform: rotate(45deg);
	pointer-events: none;
}
.nfdas-enh .nice-select .list {
	background: #fff !important;
	border-radius: 12px !important;
	box-shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.4) !important;
	color: #123029 !important;
	overflow: hidden;
	margin-top: 8px;
}
.nfdas-enh .nice-select .option { color: #123029 !important; }
.nfdas-enh .nice-select .option.selected { color: var(--nfdas-accent) !important; font-weight: 600; }
.nfdas-enh .nice-select .option:hover,
.nfdas-enh .nice-select .option.focus { background: rgba(18, 163, 122, 0.10) !important; color: #123029 !important; }

/* Il selettore "cerca in" del tema (nice-select) resta disallineato e non serve
   alla ricerca AJAX (che usa la sorgente configurata nel plugin): lo nascondiamo.
   Per renderlo di nuovo visibile/funzionale, rimuovere questa regola. */
.nfdas-enh .input-group-append > .nice-select,
.nfdas-enh .input-group-append > select[name="search_in_doc"],
.nfdas-enh .nice-select,
.nfdas-enh select[name="search_in_doc"] { display: none !important; }

/* --- Responsive (mobile) --- */
@media (max-width: 600px) {
	.nfdas-bar { padding: 6px 6px 6px 12px; }
	.nfdas-enh .input-group { gap: 6px; padding: 6px 6px 6px 12px !important; }
	.nfdas-input,
	.nfdas-enh .input-group > input[type="search"],
	.nfdas-enh .input-group .form-control { font-size: 15px !important; }
	.nfdas-ai { padding: 6px 9px !important; font-size: 11.5px !important; }
	.nfdas-btn { width: 42px; height: 42px; }
	.nfdas-enh .input-group button[type="submit"] { width: 42px !important; height: 42px !important; }
	.nfdas-enh .nice-select { display: none !important; } /* selettore "cerca in": nascosto su mobile per non sforare */
	.nfdas-dropdown { max-height: 55vh; }
	.nfdas-item { padding: 10px 13px; }
	.nfdas-title { font-size: 14px !important; }
	.nfdas-snip { font-size: 12.5px; }
	.nfdas-ai-answer { padding: 14px 15px; }
	.nfdas-ai-text { font-size: 14px !important; }
}
/* Schermi molto stretti: mostra solo l'icona ✨ del toggle AI */
@media (max-width: 380px) {
	.nfdas-ai span { display: none; }
	.nfdas-ai { padding: 6px 8px !important; }
}

@media (prefers-reduced-motion: reduce) {
	.nfdas-ai { transition: none; }
	.nfdas-dots span { animation: none; }
}
