/* BV Live Search */

/* Base form */
.bv-live-search {
	position: relative;
	width: min(680px, 100%);
	margin-left: auto;
	margin-right: auto;
}

.bv-live-search__field {
	display: flex;
	align-items: center;
	width: 100%;
	padding: 5px;
	border: 2px solid var(--wp--preset--color--accent-10);
	border-radius: 999px;
	background: var(--wp--preset--color--base);
	transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.bv-live-search__field:focus-within {
	border-color: var(--wp--preset--color--accent-1);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--wp--preset--color--accent-1) 14%, transparent);
}

.bv-live-search__input {
	flex: 1;
	min-width: 0;
	border: 0;
	outline: 0;
	background: transparent;
	padding: 0 24px;
	font: inherit;
	color: var(--wp--preset--color--entry);
}

.bv-live-search__input::placeholder {
	color: var(--wp--preset--color--accent-4);
	opacity: 1;
}

.bv-live-search__input:focus {
	outline: 0;
	box-shadow: none;
}

.bv-live-search__button {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 90px;
	height: 56px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	cursor: pointer;
	font: inherit;
	transition: background-color .2s ease, transform .2s ease;
}

.bv-live-search__button:hover {
	background: var(--wp--preset--color--accent-3);
}

.bv-live-search__button:active {
	transform: translateY(1px);
}

.bv-live-search__icon {
	display: block;
	width: 26px;
	height: 26px;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	fill: none;
}

/* Result panel */
.bv-live-search__panel {
	position: absolute;
	z-index: 50;
	top: calc(100% + 10px);
	left: 0;
	right: 0;
	padding: 12px;
	border: 1px solid var(--wp--preset--color--accent-10);
	border-radius: 22px;
	background: var(--wp--preset--color--base);
	box-shadow: 0 18px 50px rgba(6, 27, 51, .12);
	text-align: left;
	max-height: min(53vh, 620px);
	overflow-y: auto;
	overflow-x: hidden;
	overscroll-behavior: contain;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.bv-live-search__panel::-webkit-scrollbar {
	display: none;
}

.bv-live-search__group + .bv-live-search__group {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--wp--preset--color--accent-10);
}

.bv-live-search__group-title {
	margin-bottom: 8px;
	font-size: 13px;
	font-weight: 700;
	color: var(--wp--preset--color--accent-4);
}

.bv-live-search__network-group + .bv-live-search__network-group {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid #eef0f3;
}

.bv-live-search__network-title {
	margin: 0 0 8px;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.2;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: .04em;
}

.bv-live-search__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 14px;
	color: inherit;
	text-decoration: none;
	transition: background-color .2s ease;
}

.bv-live-search__item:hover {
	background: var(--wp--preset--color--accent-7);
	text-decoration: none;
}

.bv-live-search__item img {
	width: 44px;
	height: 44px;
	border-radius: 10px;
	object-fit: cover;
	background: var(--wp--preset--color--accent-9);
	flex: 0 0 44px;
}

.bv-live-search__item strong {
	display: block;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.25;
	color: var(--wp--preset--color--entry);
}

.bv-live-search__item small {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	color: var(--wp--preset--color--accent-4);
}

.bv-live-search__empty {
	padding: 14px;
	color: var(--wp--preset--color--accent-4);
	text-align: center;
}

/* Featured results */
.bv-live-search__group--featured {
	padding: 10px;
	border: 1px solid var(--wp--preset--color--accent-2);
	border-radius: 18px;
	background: var(--wp--preset--color--accent-5);
}

.bv-live-search__group--featured + .bv-live-search__group {
	margin-top: 12px;
}

.bv-live-search__item--featured {
	background: var(--wp--preset--color--base);
}

.bv-live-search__item--featured:hover {
	background: color-mix(in srgb, var(--wp--preset--color--accent-1) 10%, var(--wp--preset--color--base));
}

.bv-live-search__item--featured small::before {
	content: '★ ';
	color: var(--wp--preset--color--accent-1);
}

/* Loading state */
.bv-live-search--loading .bv-live-search__button {
	cursor: wait;
}

.bv-live-search--loading .bv-live-search__icon {
	opacity: 0;
}

.bv-live-search__button::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 20px;
	margin-top: -10px;
	margin-left: -10px;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	opacity: 0;
	pointer-events: none;
}

.bv-live-search--loading .bv-live-search__button::after {
	opacity: 1;
	animation: bv-live-search-spinner .7s linear infinite;
}

@keyframes bv-live-search-spinner {
	to {
		transform: rotate(360deg);
	}
}

/* Responsive */
@media (max-width: 640px) {
	.bv-live-search__button {
		width: 78px;
		height: 54px;
	}

	.bv-live-search__input {
		padding: 0 18px;
	}
	
	.bv-live-search__panel {
		max-height: 58vh;
		padding: 10px;
	}
}