/**
 * Global header search: compact header row; suggestions in a fixed layer under #header-container.
 *
 * @package Listeo_Child
 */

/* -------------------------------------------------------------------------
   Shell — never stretch the header row
------------------------------------------------------------------------- */
.appsinsight-header-search {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: flex-end;
	flex-shrink: 0;
	width: auto;
	max-width: none;
	min-width: 0;
	z-index: 6;
	vertical-align: middle;
	align-self: center;
}

.appsinsight-header-search--layout-hws {
	justify-content: flex-end;
}

.appsinsight-header-search--layout-standard {
	margin-right: 0;
}

/**
 * Standard header (non-HWS): search sits in .right-side immediately before .header-widget
 * (avatar / login) on all breakpoints.
 */
@media (max-width: 1200px) {
	#header-container:not(.hws-wrapper) #header .container {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		align-items: center !important;
		justify-content: flex-start !important;
	}

	#header-container:not(.hws-wrapper) #header .left-side {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: wrap !important;
		align-items: center !important;
		flex: 1 1 auto !important;
		min-width: 0 !important;
		width: auto !important;
		max-width: none !important;
		float: none !important;
	}

	#header-container:not(.hws-wrapper) #header .left-side #logo {
		flex: 1 1 auto !important;
		min-width: 0 !important;
		width: auto !important;
		max-width: none !important;
		text-align: left !important;
	}

	#header-container:not(.hws-wrapper) #header .left-side .mmenu-trigger {
		flex: 0 0 auto !important;
		float: none !important;
		margin: 0 !important;
		align-self: center;
	}

	#header-container:not(.hws-wrapper) #header .left-side #navigation {
		flex: 1 0 100% !important;
		width: 100% !important;
	}

	#header-container:not(.hws-wrapper) #header .right-side {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		align-items: center !important;
		justify-content: flex-end !important;
		flex: 0 0 auto !important;
		width: auto !important;
		float: none !important;
		gap: 16px;
	}

	#header-container:not(.hws-wrapper) #header .right-side .appsinsight-header-search--layout-standard {
		flex: 0 0 auto !important;
		margin-top: -4px;
		margin-right: 4px !important;
	}

	#header-container:not(.hws-wrapper) #header .right-side .header-widget {
		flex: 0 0 auto !important;
		padding: 0 !important;
		border-top: none !important;
		display: flex !important;
		flex-wrap: nowrap !important;
		align-items: center !important;
	}

	/* Between Listeo’s 1024px header rules and our row, stop account links from growing. */
	#header-container:not(.hws-wrapper) #header .right-side .sign-in,
	#header-container:not(.hws-wrapper) #header .right-side .user-menu {
		flex: 0 0 auto !important;
	}
}

@media (min-width: 1200px) {
	#header-container:not(.hws-wrapper) #header .container {
		align-items: center;
	}

	#header-container:not(.hws-wrapper) #header .left-side {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
		flex: 1;
		min-width: 0;
	}

	#header-container:not(.hws-wrapper) #header .left-side #logo {
		flex: 0 0 auto;
	}

	#header-container:not(.hws-wrapper) #header .left-side #navigation {
		flex: 1 1 auto;
		min-width: 0;
	}

	#header-container:not(.hws-wrapper) #header .right-side {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
		justify-content: flex-end;
		flex: 0 0 auto;
		width: auto;
		gap: 20px;
	}

	#header-container:not(.hws-wrapper) #header .right-side .appsinsight-header-search--layout-standard {
		flex: 0 0 auto;
		/*
		 * Listeo’s .header-widget is 54px tall with .sign-in { top: 10px }; flex vertical
		 * center aligns the 44px toggle to the box center, so it looks low vs label text.
		 */
		margin-top: -7px;
		margin-right: 4px;
	}

	#header-container:not(.hws-wrapper) #header .right-side .header-widget {
		flex: 0 0 auto;
	}

	#header-container:not(.hws-wrapper) .appsinsight-header-search {
		align-self: center;
	}
}

/* Full-width header row: align logo, search slot, and widgets on one axis */
.hws-container {
	align-items: center;
}

/* Do not let Listeo’s flex slot blow up — keep search column content-sized;
   reset Listeo’s top/margin offsets that pull the slot out of line */
.hws-container .header-search-container {
	flex: 0 1 auto;
	min-width: 0;
	max-width: none;
	justify-content: flex-end;
	top: 0;
	position: relative;
	margin: 0;
	margin-right: 20px;
	align-items: center;
	align-self: center;
}

/* -------------------------------------------------------------------------
   Mobile (≤1200px): match Listeo breakpoint — icon in one row with logo /
   account; expanded bar lives in #appsinsight-header-search-mobile-slot.
   Listeo uses max-width 1200px + inline `top` on .header-search-container;
   1199-only overrides miss 1200px and fail vs theme.
------------------------------------------------------------------------- */
@media (max-width: 1200px) {
	.appsinsight-header-search-mobile-slot {
		position: relative;
		z-index: 997;
		width: 100%;
		box-sizing: border-box;
		padding: 10px 15px;
		background: #fff;
		border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	}

	.appsinsight-header-search-mobile-slot[hidden] {
		display: none !important;
	}

	.appsinsight-header-search-mobile-slot .appsinsight-header-search__panel {
		display: flex !important;
		max-width: none !important;
		width: 100% !important;
		min-width: 0;
	}

	.appsinsight-header-search-mobile-slot .appsinsight-header-search__toolbar {
		width: 100%;
		min-height: 0;
	}

	/* One horizontal row: [ logo | account | search ] + [ hamburger ] — search sits flush left of menu */
	#header-container.hws-wrapper #header .container {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		align-items: center !important;
		justify-content: flex-start !important;
		position: relative !important;
	}

	#header-container.hws-wrapper #header .container .hws-container {
		display: flex !important;
		flex-direction: row !important;
		flex-wrap: nowrap !important;
		align-items: center !important;
		justify-content: flex-start !important;
		width: calc(100% - 72px) !important;
		min-width: 0 !important;
		position: relative !important;
		z-index: 1;
	}

	#header-container.hws-wrapper .hws-container #logo {
		order: 1;
		flex: 1 1 auto !important;
		min-width: 0 !important;
		max-width: none !important;
		margin-right: 8px !important;
	}

	/* Kill Listeo’s full-bleed mobile sheet + inline top positioning */
	#header-container.hws-wrapper .hws-container .header-search-container {
		position: static !important;
		inset: auto !important;
		left: auto !important;
		right: auto !important;
		top: auto !important;
		bottom: auto !important;
		width: auto !important;
		min-width: 0 !important;
		max-width: none !important;
		flex: 0 0 auto !important;
		flex-grow: 0 !important;
		flex-shrink: 0 !important;
		flex-basis: auto !important;
		margin: 0 0 0 6px !important;
		padding: 0 !important;
		background: transparent !important;
		box-shadow: none !important;
		border: none !important;
		visibility: visible !important;
		opacity: 1 !important;
		pointer-events: auto !important;
		order: 3;
	}

	#header-container.hws-wrapper .hws-container .header-widget {
		order: 2;
		flex: 0 0 auto !important;
		flex-shrink: 0 !important;
	}

	#header-container.hws-wrapper .hws-container .header-search-container .appsinsight-header-search {
		display: inline-flex !important;
		width: auto !important;
		max-width: none !important;
		flex-shrink: 0 !important;
		min-width: 0 !important;
	}

	#header-container.hws-wrapper .mobile-search-trigger {
		display: none !important;
	}
}

@media (max-width: 1024px) {
	#header-container.hws-wrapper #header .container .hws-container {
		width: calc(100% - 62px) !important;
	}
}


/* -------------------------------------------------------------------------
   Toggle — square, hairline border, no fill; optical centering
------------------------------------------------------------------------- */
.appsinsight-header-search__toggle {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.14);
	border-radius: 10px;
	background: transparent;
	color: var(--listeo-primary-color, #66676b);
	cursor: pointer;
	line-height: 0;
	flex-shrink: 0;
	transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.appsinsight-header-search__toggle-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.appsinsight-header-search__toggle-icon svg {
	display: block;
	flex-shrink: 0;
}

.appsinsight-header-search__toggle:hover {
	border-color: var(--listeo-primary-color, #66676b);
	color: var(--listeo-primary-color, #66676b);
}

.appsinsight-header-search__toggle:focus {
	outline: none;
}

.appsinsight-header-search__toggle:focus-visible {
	box-shadow: 0 0 0 3px rgba(var(--listeo-primary-color-rgb, 102, 103, 107), 0.28);
}

.appsinsight-header-search.is-expanded .appsinsight-header-search__toggle {
	display: none;
}

/* -------------------------------------------------------------------------
   Inline panel — toolbar only (stays in header)
------------------------------------------------------------------------- */
.appsinsight-header-search__panel {
	display: none;
	width: auto;
	max-width: min(420px, 38vw);
	min-width: 180px;
	flex: 0 1 auto;
}

.appsinsight-header-search__panel[hidden] {
	display: none !important;
}

.appsinsight-header-search.is-expanded .appsinsight-header-search__panel {
	display: flex !important;
	align-items: center;
	animation: appsinsight-header-search-fade-inline 0.2s ease;
}

@keyframes appsinsight-header-search-fade-inline {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.appsinsight-header-search__toolbar {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	min-width: 0;
	min-height: 0;
}

/* Rounded rectangle — flat interior (no WebKit search “segments”) */
.appsinsight-header-search__field {
	position: relative;
	flex: 1;
	display: flex;
	align-items: stretch;
	min-width: 0;
	height: 44px;
	min-height: 44px;
	padding: 0 16px;
	border: 1px solid rgba(0, 0, 0, 0.14);
	border-radius: 10px;
	background: #fff;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.appsinsight-header-search__field:focus-within {
	border-color: var(--listeo-primary-color, #66676b);
	box-shadow: 0 0 0 3px rgba(var(--listeo-primary-color-rgb, 102, 103, 107), 0.2);
}

.appsinsight-header-search__field-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	margin-right: 10px;
	background: transparent;
	border: none;
	box-shadow: none;
	color: var(--listeo-primary-color, #66676b);
	opacity: 0.85;
	pointer-events: none;
	align-self: center;
}

.appsinsight-header-search__field-icon svg {
	display: block;
	flex-shrink: 0;
}

/* Beat Bootstrap `input[type="search"]` (textfield + content-box) — removes inner dividers / gray end caps */
.appsinsight-header-search__field .appsinsight-header-search__input[type="search"],
.appsinsight-header-search__input[type="search"] {
	flex: 1;
	width: 100%;
	min-width: 0;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-sizing: border-box;
	background: transparent;
	background-color: transparent;
	box-shadow: none;
	font-size: 15px;
	font-weight: 500;
	line-height: 44px;
	color: #333;
	-webkit-appearance: none;
	appearance: none;
}

.appsinsight-header-search__input[type="search"]::-webkit-search-cancel-button,
.appsinsight-header-search__input[type="search"]::-webkit-search-decoration,
.appsinsight-header-search__input[type="search"]::-webkit-search-results-button,
.appsinsight-header-search__input[type="search"]::-webkit-search-results-decoration {
	display: none !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	margin: 0;
	padding: 0;
	width: 0;
	height: 0;
}

.appsinsight-header-search__input::placeholder {
	color: #888;
}

.appsinsight-header-search__input:focus {
	outline: none;
}

/* Close — same height + corner style as search field */
.appsinsight-header-search__close {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.14);
	border-radius: 10px;
	background: transparent;
	color: var(--listeo-primary-color, #66676b);
	cursor: pointer;
	flex-shrink: 0;
	line-height: 0;
	transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.appsinsight-header-search__close-inner {
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
}

.appsinsight-header-search__close-inner svg {
	display: block;
	flex-shrink: 0;
}

.appsinsight-header-search__close:hover {
	border-color: var(--listeo-primary-color, #66676b);
	color: var(--listeo-primary-color, #66676b);
}

.appsinsight-header-search__close:focus {
	outline: none;
}

.appsinsight-header-search__close:focus-visible {
	box-shadow: 0 0 0 3px rgba(var(--listeo-primary-color-rgb, 102, 103, 107), 0.25);
	border-color: var(--listeo-primary-color, #66676b);
}

/* -------------------------------------------------------------------------
   Floating dropdown (portaled to body via JS) — below header, not in flow
------------------------------------------------------------------------- */
.appsinsight-header-search__dropdown {
	position: fixed;
	z-index: 100220;
	box-sizing: border-box;
	padding: 0;
	margin: 0;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.06);
	overflow: visible;
	display: block;
	max-height: none;
}

.appsinsight-header-search__dropdown[hidden] {
	display: none !important;
}

/* Compact layer when only the “keep typing” hint (no result list yet) */
.appsinsight-header-search__dropdown--hint-only {
	max-height: none;
}

.appsinsight-header-search__dropdown--hint-only .appsinsight-header-search__scroll {
	display: none;
}

.appsinsight-header-search__dropdown--hint-only .appsinsight-header-search__hint {
	padding: 14px 18px 16px;
}

.appsinsight-header-search__hint {
	margin: 0;
	padding: 10px 16px 0;
	font-size: 13px;
	line-height: 1.4;
	color: #666;
}

.appsinsight-header-search__hint[hidden] {
	display: none !important;
}

.appsinsight-header-search__hint.is-error {
	color: #b00020;
}

.appsinsight-header-search__scroll {
	max-height: none;
	overflow: visible;
}

.appsinsight-header-search__results {
	padding: 8px 0 12px;
}

/*
 * home-it-directory.css sets max-height + scroll on body.appsinsight-it-directory-home div[role="listbox"].
 * Our suggestions use the same role; scope an override so the panel can grow to full content height.
 */
.appsinsight-header-search__dropdown .appsinsight-header-search__results[role="listbox"] {
	max-height: none !important;
	height: auto !important;
	overflow-y: visible !important;
	overflow-x: visible !important;
	-webkit-overflow-scrolling: auto;
}

.appsinsight-header-search__section + .appsinsight-header-search__section {
	margin-top: 2px;
	padding-top: 8px;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.appsinsight-header-search__section-title {
	margin: 0;
	padding: 8px 16px 4px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #666;
}

/* Chip rows — companies, software, glossary (compact; radius matches `.appsinsight-header-search__field`) */
.appsinsight-header-search__pills {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 6px;
	padding: 0 12px 10px;
	box-sizing: border-box;
}

.appsinsight-header-search__pill {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	box-sizing: border-box;
	max-width: 100%;
	min-height: 0;
	padding: 2px 8px 2px 3px;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 10px;
	background: #fff;
	color: #1a1a1a;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.25;
	text-decoration: none;
	cursor: pointer;
	font-family: inherit;
	transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.appsinsight-header-search__pill:hover,
.appsinsight-header-search__pill:focus {
	border-color: rgba(var(--listeo-primary-color-rgb, 102, 103, 107), 0.45);
	background: rgba(var(--listeo-primary-color-rgb, 102, 103, 107), 0.06);
	outline: none;
}

.appsinsight-header-search__pill:focus-visible {
	box-shadow: 0 0 0 3px rgba(var(--listeo-primary-color-rgb, 102, 103, 107), 0.22);
}

.appsinsight-header-search__pill-media {
	flex-shrink: 0;
	width: 26px;
	height: 26px;
	border-radius: 6px;
	overflow: hidden;
	background: rgba(0, 0, 0, 0.04);
	display: flex;
	align-items: center;
	justify-content: center;
}

.appsinsight-header-search__pill-media--icon {
	color: var(--listeo-primary-color, #66676b);
	background: rgba(var(--listeo-primary-color-rgb, 102, 103, 107), 0.08);
	border-radius: 6px;
}

.appsinsight-header-search__pill-media--fallback {
	padding: 0;
	font-size: 0;
	line-height: 0;
	background: rgba(0, 0, 0, 0.06);
	border-radius: 6px;
}

.appsinsight-header-search__pill-fallback-char {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	color: #555;
	text-align: center;
	overflow: hidden;
	white-space: nowrap;
	text-transform: uppercase;
}

.appsinsight-header-search__pill-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.appsinsight-header-search__pill-label {
	min-width: 0;
	flex: 1;
	text-align: left;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.appsinsight-header-search__link {
	display: block;
	padding: 10px 16px;
	font-size: 15px;
	line-height: 1.35;
	color: #1a1a1a;
	text-decoration: none;
	transition: background 0.15s ease;
	width: 100%;
	text-align: left;
	cursor: pointer;
	font-family: inherit;
	box-sizing: border-box;
}

.appsinsight-header-search__link:hover,
.appsinsight-header-search__link:focus {
	background: rgba(46, 134, 222, 0.08);
	outline: none;
}

.appsinsight-header-search__link:focus-visible {
	box-shadow: inset 0 0 0 2px rgba(46, 134, 222, 0.35);
}

.appsinsight-header-search__loading {
	padding: 14px 16px;
	text-align: center;
	font-size: 14px;
	color: #666;
}

@media (max-width: 1200px) {
	.appsinsight-header-search__panel {
		max-width: min(320px, 72vw);
	}

	.appsinsight-header-search__dropdown {
		max-height: none;
		border-radius: 14px;
	}

	.appsinsight-header-search__scroll {
		max-height: none;
	}

	.header-search-container.visible .appsinsight-header-search__panel {
		max-width: none;
		width: 100%;
	}

	.header-search-container.visible .appsinsight-header-search__toolbar {
		min-height: 48px;
	}
}

@media (max-width: 1200px) {
	.mobile-search-trigger.visible .gg-close,
	.mobile-search-trigger.visible .gg-search {
		z-index: 2;
	}
}

body#dark-mode .appsinsight-header-search-mobile-slot {
	background: #1a1a1a;
	border-bottom-color: rgba(255, 255, 255, 0.1);
}

body#dark-mode .appsinsight-header-search__toggle {
	border-color: rgba(255, 255, 255, 0.22);
	background: transparent;
	color: #e8e8e8;
}

body#dark-mode .appsinsight-header-search__toggle:hover {
	border-color: rgba(255, 255, 255, 0.35);
	color: #fff;
}

body#dark-mode .appsinsight-header-search__field {
	background: rgba(0, 0, 0, 0.25);
	border-color: rgba(255, 255, 255, 0.2);
}

body#dark-mode .appsinsight-header-search__field:focus-within {
	border-color: #5aa7ff;
	box-shadow: 0 0 0 3px rgba(90, 167, 255, 0.25);
}

body#dark-mode .appsinsight-header-search__close {
	background: rgba(0, 0, 0, 0.25);
	border-color: rgba(255, 255, 255, 0.2);
	color: #ddd;
}

body#dark-mode .appsinsight-header-search__close:hover {
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(255, 255, 255, 0.35);
	color: #fff;
}

body#dark-mode .appsinsight-header-search__field-icon {
	color: #9ca3af;
}

body#dark-mode .appsinsight-header-search__input {
	color: #f2f2f2;
}

body#dark-mode .appsinsight-header-search__input::placeholder {
	color: #999;
}

body#dark-mode .appsinsight-header-search__dropdown {
	background: #1e1e1e;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

body#dark-mode .appsinsight-header-search__section-title {
	color: #9a9a9a;
}

body#dark-mode .appsinsight-header-search__section + .appsinsight-header-search__section {
	border-top-color: rgba(255, 255, 255, 0.08);
}

body#dark-mode .appsinsight-header-search__link {
	color: #eee;
}

body#dark-mode .appsinsight-header-search__link:hover,
body#dark-mode .appsinsight-header-search__link:focus {
	background: rgba(90, 167, 255, 0.15);
}

body#dark-mode .appsinsight-header-search__hint {
	color: #aaa;
}

body#dark-mode .appsinsight-header-search__pill {
	background: #2a2a2a;
	border-color: rgba(255, 255, 255, 0.12);
	color: #f0f0f0;
	box-shadow: none;
}

body#dark-mode .appsinsight-header-search__pill:hover,
body#dark-mode .appsinsight-header-search__pill:focus {
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(255, 255, 255, 0.22);
}

body#dark-mode .appsinsight-header-search__pill-media {
	background: rgba(255, 255, 255, 0.08);
}

body#dark-mode .appsinsight-header-search__pill-media--icon {
	background: rgba(90, 167, 255, 0.15);
	color: #8ec5ff;
}

body#dark-mode .appsinsight-header-search__pill-media--fallback {
	background: rgba(255, 255, 255, 0.12);
}

body#dark-mode .appsinsight-header-search__pill-fallback-char {
	color: #e0e0e0;
}

body#dark-mode .appsinsight-header-search__loading {
	color: #aaa;
}
