/*
	Live search / autocomplete dropdown for the shared search bar
	(_inc/search_bar.php). Scoped to .search-autocomplete-wrap, added as an
	extra class directly on the existing .search-area-division-input /
	.search-area-division-location divs -- no new wrapper element, so the
	legacy float-based layout in css/styles.css is untouched.

	.search-area has `overflow:hidden` (a float-clearfix left over from the
	legacy layout); the dropdown needs to escape that to avoid being clipped,
	so js/search-autocomplete.js toggles .search-area-suggestions-open on the
	<form> only while a dropdown is actually open, rather than removing
	overflow:hidden permanently (which could affect the row's static layout).
*/
.search-autocomplete-wrap {
	position: relative;
}
.search-area.search-area-suggestions-open {
	overflow: visible;
}

.search-suggestions {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 1050;
	width: 100%;
	min-width: 280px;
	margin: 4px 0 0;
	padding: 6px 0;
	list-style: none;
	background: #fff;
	border-radius: 6px;
	box-shadow: 0 8px 24px rgba(0,0,0,0.18);
	max-height: 340px;
	overflow-y: auto;
	text-align: left;
	font-family: 'Roboto', arial, helvetica, sans-serif;
}
.search-suggestions[hidden] {
	display: none;
}

.search-suggestion-group {
	padding: 6px 14px 4px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .4px;
	text-transform: uppercase;
	color: #8a97a3;
}

.search-suggestion-item {
	display: flex;
	align-items: baseline;
	gap: 8px;
	padding: 9px 14px;
	font-size: 15px;
	line-height: 1.3;
	color: #213642;
	cursor: pointer;
}
.search-suggestion-item .fa {
	flex: 0 0 auto;
	width: 16px;
	color: #F5A623;
}
.search-suggestion-label {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.search-suggestion-sub {
	flex: 0 0 auto;
	font-size: 12px;
	color: #8a97a3;
}
.search-suggestion-item:hover,
.search-suggestion-item.is-active {
	background: #f6f8fa;
}

.search-suggestion-status {
	padding: 10px 14px;
	font-size: 14px;
	color: #8a97a3;
	font-style: italic;
}

/* Small loading affordance on the input itself while a request is in flight. */
.search-autocomplete-wrap.is-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 6px;
	width: 14px;
	height: 14px;
	margin-top: -7px;
	border: 2px solid rgba(255,255,255,0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: search-autocomplete-spin .6s linear infinite;
	pointer-events: none;
}
@keyframes search-autocomplete-spin {
	to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
	.search-suggestions {
		min-width: 100%;
		max-height: 260px;
	}
	.search-suggestion-item {
		padding: 12px 14px;
	}
}
