/*-----------------------------------------------------------------------------
 * Live Search: the suggest dropdown and filter-mode busy state.
 * Behavior: js/live-search.js. Guide: /home2/sagedev/.guides/patterns/live-search-guide.md
 *
 * The menu is a Bootstrap .dropdown-menu placed inside the search bar's .input-group
 * (Bootstrap 5.3 leaves .dropdown-menu out of the input-group's corner rounding).
 *---------------------------------------------------------------------------*/

.input-group > .live-search-menu {
	position: absolute;
	top: 100%;
	z-index: 1060;              /* above cards, sticky headers and tooltips' parents */
	margin-top: 2px;
	max-width: min(36rem, calc(100vw - 2rem));
	max-height: 70vh;
	overflow-y: auto;
	padding: .25rem 0;
}

.live-search-menu .dropdown-item {
	display: flex;
	flex-direction: column;
	gap: .1rem;
	padding: .45rem .9rem;
	white-space: normal;
	line-height: 1.3;
}

.live-search-menu .live-search-meta {
	opacity: .75;
	font-size: .8em;
}

.live-search-menu mark {
	padding: 0;
	background: transparent;
	color: inherit;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.live-search-menu .live-search-all {
	font-weight: 600;
}

.live-search-menu .live-search-empty {
	padding: .45rem .9rem;
	opacity: .75;
}

/* Filter mode: dim the old results while the new ones load */
.live-search-busy {
	opacity: .55;
	transition: opacity .15s ease-in;
}

form.live-search-busy {
	opacity: 1;                 /* suggest mode marks the form; only the cursor changes */
	cursor: progress;
}

/* Dark mode (html.dark), out-specifying Porto's dark dropdown rules.
 * The accents are sagentic.dev's palette; anywhere those variables don't exist (dashboards
 * with a client's brand colors) the fallbacks are neutral, so this file stays one canonical copy. */
html.dark .input-group > .live-search-menu {
	background-color: #1d2127;
	border: 1px solid var(--medium-purple, rgba(255, 255, 255, .2));
	box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .5);
}

html.dark .live-search-menu .dropdown-item {
	color: #e8e8ec;
}

html.dark .live-search-menu .dropdown-item:hover,
html.dark .live-search-menu .dropdown-item.active {
	background-color: var(--cyber-grape, rgba(255, 255, 255, .12));
	color: #fff;
}

html.dark .live-search-menu .live-search-all {
	color: var(--medium-purple-light, inherit);
}

html.dark .live-search-menu .dropdown-divider {
	border-top-color: rgba(255, 255, 255, .15);
}

@media (prefers-reduced-motion: reduce) {
	.live-search-busy { transition: none; }
}
