/**
 * AIBM course search: desktop search band, search box, results dropdown,
 * and the mobile (off-canvas) search.
 * Search box specs from Figma "Search Box" frame: 442 × 40, radius 20,
 * fill white 3.92%, 1px inside stroke white 10.2%, padding-x 11.
 * Band height reduced to 48px per owner (Figma implied 85px).
 * Width follows the site-wide container (aibm-base.css).
 *
 * @package AIBM
 * @author  Sameer Ali N
 */

/* =========================================================
   Search button: swap icon when open
   ========================================================= */
.aibm-header .aibm-search-toggle .aibm-icon-close {
	display: none;
}
.aibm-header.is-search-open .aibm-search-toggle .aibm-icon-search {
	display: none;
}
.aibm-header.is-search-open .aibm-search-toggle .aibm-icon-close {
	display: block;
}
.aibm-header.is-search-open .aibm-search-toggle {
	background: rgba(255, 255, 255, .12);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .24);
}

/* =========================================================
   Desktop search band (drops below the header)
   ========================================================= */
.aibm-search-panel {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	height: 48px; /* Box (40) - overlap (11) + bottom space (19) */
	background: var(--aibm-color-primary);
	box-shadow: 0 18px 30px -20px rgba(4, 6, 60, .65);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px);
	transition:
		opacity .3s var(--aibm-ease),
		transform .4s var(--aibm-anim-ease, var(--aibm-ease)),
		visibility 0s linear .4s;
}
.aibm-header.is-search-open .aibm-search-panel {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition-delay: 0s;
}

.aibm-search-panel__inner {
	display: flex;
	align-items: flex-start; /* Do not stretch the search to the band height */
	justify-content: flex-end;
	box-sizing: border-box;
	max-width: calc(var(--aibm-container, 1420px) + var(--aibm-header-pad-x) * 2);
	height: 100%;
	margin: 0 auto;
	padding: 0 var(--aibm-header-pad-x);
}

.aibm-search--desktop {
	position: relative;
	width: 442px;
	max-width: 100%;
	margin-top: -11px; /* Figma: box top sits 11px above the header bottom */
}

/* Box slides in from the right */
.aibm-search--desktop .aibm-search__box {
	-webkit-clip-path: inset(0 0 0 100% round 20px);
	clip-path: inset(0 0 0 100% round 20px);
	transition:
		-webkit-clip-path .5s var(--aibm-anim-ease, var(--aibm-ease)) .05s,
		clip-path .5s var(--aibm-anim-ease, var(--aibm-ease)) .05s,
		background-color .2s var(--aibm-ease),
		box-shadow .2s var(--aibm-ease);
}
.aibm-header.is-search-open .aibm-search--desktop .aibm-search__box {
	-webkit-clip-path: inset(0 0 0 0 round 20px);
	clip-path: inset(0 0 0 0 round 20px);
}

@media (max-width: 1099px) {
	.aibm-search-panel {
		display: none;
	}
}

/* =========================================================
   Search component (shared by desktop + mobile)
   ========================================================= */
.aibm-search {
	text-align: left;
}
/* Force our font on everything inside (parent theme styles p/span/strong) */
.aibm-site .aibm-search,
.aibm-site .aibm-search * {
	font-family: var(--aibm-font-body);
}
.aibm-site .aibm-search [hidden] {
	display: none !important;
}

.aibm-site .aibm-search__box {
	position: relative;
	display: flex;
	align-items: center;
	gap: 8px;
	box-sizing: border-box;
	height: 40px;
	padding: 0 11px;
	border-radius: 20px;
	background: rgba(255, 255, 255, .0392);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .102);
	color: #fff;
}
.aibm-site .aibm-search__box:focus-within {
	background: rgba(255, 255, 255, .07);
	box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .9);
}

.aibm-site .aibm-search__icon {
	display: block;
	flex: 0 0 16px;
	width: 16px;
	height: 16px;
	opacity: .8;
}

.aibm-site .aibm-search__input {
	flex: 1 1 auto;
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	outline: none;
	background: transparent;
	box-shadow: none;
	color: #fff;
	font-size: 14px;
	font-weight: 400;
	line-height: 20px;
	letter-spacing: 0;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}
.aibm-site .aibm-search__input:focus {
	outline: none;
	border: 0;
	background: transparent;
	box-shadow: none;
	color: #fff;
}
.aibm-site .aibm-search__input::placeholder {
	color: rgba(255, 255, 255, .6);
	opacity: 1;
}
.aibm-site .aibm-search__input::-webkit-search-decoration,
.aibm-site .aibm-search__input::-webkit-search-cancel-button,
.aibm-site .aibm-search__input::-webkit-search-results-button,
.aibm-site .aibm-search__input::-webkit-search-results-decoration {
	display: none;
	-webkit-appearance: none;
}

/* Loading spinner */
.aibm-site .aibm-search__spinner {
	display: none;
	flex: 0 0 16px;
	box-sizing: border-box;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, .25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: aibm-search-spin .7s linear infinite;
}
.aibm-site .aibm-search.is-loading .aibm-search__spinner {
	display: block;
}
.aibm-site .aibm-search.is-loading .aibm-search__clear {
	display: none;
}
@keyframes aibm-search-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Clear (x) button */
.aibm-site .aibm-search__clear {
	display: inline-flex;
	flex: 0 0 24px;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: rgba(255, 255, 255, .1);
	box-shadow: none;
	color: #fff;
	line-height: 1;
	cursor: pointer;
	transition: background-color .2s var(--aibm-ease);
}
.aibm-site .aibm-search__clear:hover {
	background: rgba(255, 255, 255, .2);
	color: #fff;
}
.aibm-site .aibm-search__clear:focus {
	outline: none;
}
.aibm-site .aibm-search__clear:focus-visible {
	outline: 2px solid var(--aibm-color-accent);
	outline-offset: 2px;
}
.aibm-site .aibm-search__clear svg {
	display: block;
	width: 12px;
	height: 12px;
}

/* =========================================================
   Results dropdown (attached right under the search box)
   ========================================================= */
.aibm-site .aibm-search__results {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 5;
	box-sizing: border-box;
	width: 100%;
	background: #fff;
	border-radius: 16px;
	box-shadow:
		0 24px 60px -12px rgba(6, 8, 70, .45),
		0 0 0 1px rgba(15, 19, 150, .06);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px) scale(.985);
	transform-origin: top center;
	transition:
		opacity .2s var(--aibm-ease),
		transform .25s var(--aibm-ease),
		visibility 0s linear .25s;
}
/* Small pointer connecting the dropdown to the search box */
.aibm-site .aibm-search__results::before {
	content: "";
	position: absolute;
	top: -5px;
	left: 16px;
	width: 12px;
	height: 12px;
	border-radius: 2px;
	background: #fff;
	box-shadow: -1px -1px 0 rgba(15, 19, 150, .06);
	transform: rotate(45deg);
}
.aibm-site .aibm-search.is-open .aibm-search__results {
	opacity: 1;
	visibility: visible;
	transform: none;
	transition-delay: 0s;
}

.aibm-site .aibm-search__status {
	position: relative;
	margin: 0;
	padding: 12px 16px 6px;
	color: #6b7280;
	font-size: 12px;
	font-weight: 400;
	line-height: 16px;
}
.aibm-site .aibm-search__results.is-empty .aibm-search__status {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

.aibm-site .aibm-search__list {
	position: relative;
	max-height: min(360px, 55vh);
	margin: 0;
	padding: 0 8px 8px;
	overflow-y: auto;
	overscroll-behavior: contain;
	list-style: none;
}
.aibm-site .aibm-search__list li {
	margin: 0;
	padding: 0;
	list-style: none;
}
.aibm-site .aibm-search__list li::before,
.aibm-site .aibm-search__list li::after {
	content: none;
}

.aibm-site .aibm-search__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px;
	border-radius: 12px;
	color: #12153f;
	text-decoration: none;
	transition: background-color .15s var(--aibm-ease);
}
.aibm-site .aibm-search__item:hover,
.aibm-site .aibm-search__item:focus {
	color: #12153f;
	text-decoration: none;
	outline: none;
}
.aibm-site .aibm-search__option.is-active .aibm-search__item {
	background: #eef4ff;
}

.aibm-site .aibm-search__badge {
	display: inline-flex;
	flex: 0 0 36px;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 10px;
	background: linear-gradient(135deg, #38bdf8 0%, #0f1396 100%);
	color: #fff;
	transition: transform .25s var(--aibm-ease);
}
.aibm-site .aibm-search__option.is-active .aibm-search__badge {
	transform: scale(1.06);
}
.aibm-site .aibm-search__badge svg {
	display: block;
	width: 18px;
	height: 18px;
}

.aibm-site .aibm-search__text {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}
.aibm-site .aibm-search__title {
	color: #12153f;
	font-size: 14px;
	font-weight: 500;
	line-height: 20px;
}
.aibm-site .aibm-search__title mark {
	padding: 0 2px;
	border-radius: 4px;
	background: rgba(56, 189, 248, .22);
	color: var(--aibm-color-accent-text);
}
.aibm-site .aibm-search__cat {
	overflow: hidden;
	color: #6b7280;
	font-size: 12px;
	font-weight: 400;
	line-height: 16px;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.aibm-site .aibm-search__go {
	display: inline-flex;
	flex: 0 0 auto;
	color: var(--aibm-color-accent-text);
	opacity: 0;
	transform: translateX(-6px);
	transition: opacity .15s var(--aibm-ease), transform .2s var(--aibm-ease);
}
.aibm-site .aibm-search__option.is-active .aibm-search__go {
	opacity: 1;
	transform: none;
}
.aibm-site .aibm-search__go svg {
	display: block;
}

/* Empty / error state */
.aibm-site .aibm-search__empty {
	position: relative;
	padding: 22px 20px 24px;
	color: #4b5563;
	font-size: 14px;
	line-height: 20px;
	text-align: center;
}
.aibm-site .aibm-search__empty-title {
	display: block;
	margin-bottom: 4px;
	color: #12153f;
	font-weight: 500;
}

/* Keyboard hints (desktop) */
.aibm-site .aibm-search__hint {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	padding: 10px 16px;
	border-top: 1px solid #eef0f6;
	color: #6b7280;
	font-size: 12px;
	line-height: 18px;
}
.aibm-site .aibm-search__results.is-empty .aibm-search__hint {
	display: none;
}
.aibm-site .aibm-search__hint kbd {
	display: inline-block;
	min-width: 18px;
	margin-right: 4px;
	padding: 0 5px;
	border-radius: 6px;
	background: #f3f4f8;
	box-shadow: inset 0 -1px 0 #e1e4ee;
	color: #374151;
	font-size: 11px;
	line-height: 18px;
	text-align: center;
}

/* =========================================================
   Mobile search (inside the off-canvas menu)
   ========================================================= */
.aibm-offcanvas__search {
	padding: 16px 20px 4px;
}
.aibm-site .aibm-search--mobile .aibm-search__results {
	position: static;
	display: none;
	margin-top: 12px;
	transform: none;
	box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .5);
}
.aibm-site .aibm-search--mobile.is-open .aibm-search__results {
	display: block;
}
.aibm-site .aibm-search--mobile .aibm-search__results::before {
	top: -5px;
	left: 20px;
}
.aibm-site .aibm-search--mobile .aibm-search__list {
	max-height: none;
}