/* TBP Live Search Widget */

/* ── Root ──────────────────────────────────────────────── */
.tbp-search {
	position: relative;
}

/* ── Trigger (hidden by default) ──────────────────────── */
.tbp-search__trigger {
	display: none;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	line-height: 1;
	transition: color 0.2s, background-color 0.2s;
}

/* ── Responsive overlay modes ─────────────────────────── */

/* Mobile overlay */
@media ( max-width: 767px ) {
	.tbp-search--mobile-overlay .tbp-search__trigger    { display: flex; }
	.tbp-search--mobile-overlay .tbp-search__field-wrap { display: none; }
}

/* Desktop overlay */
@media ( min-width: 768px ) {
	.tbp-search--desktop-overlay .tbp-search__trigger    { display: flex; }
	.tbp-search--desktop-overlay .tbp-search__field-wrap { display: none; }
}

/* ── Inline field wrap ────────────────────────────────── */
.tbp-search__field-wrap {
	position: relative;
}

/* ── Input (default skin) ─────────────────────────────── */
.tbp-search__input {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 10px 16px;
	border: 1px solid #ddd;
	border-radius: 4px;
	font-size: 14px;
	background: #fff;
	color: #333;
	outline: none;
	appearance: none;
	-webkit-appearance: none;
	transition: border-color 0.2s;
}
.tbp-search__input:focus {
	border-color: #aaa;
}
.tbp-search__input::-webkit-search-cancel-button,
.tbp-search__input::-webkit-search-decoration {
	display: none;
}

/* ── Results container ────────────────────────────────── */
.tbp-search__results[hidden] { display: none !important; }

.tbp-search__results {
	position: absolute;
	top: calc( 100% + 4px );
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.10 );
	z-index: 200;
	overflow-y: auto;
	max-height: 420px;
}

/* ── Groups ───────────────────────────────────────────── */
.tbp-search__group { padding: 6px 0; }

.tbp-search__group + .tbp-search__group {
	border-top: 1px solid #eee;
}

.tbp-search__group-label {
	padding: 6px 14px 4px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #aaa;
}

.tbp-search__group-items {
	list-style: none;
	margin: 0;
	padding: 0;
}

/* ── Items ─────────────────────────────────────────────── */
.tbp-search__item a {
	display: block;
	padding: 8px 14px;
	color: #333;
	text-decoration: none;
	font-size: 14px;
	transition: background-color 0.15s;
}
.tbp-search__item a:hover {
	background-color: #f5f5f5;
}

/* User items — avatar left, name + role stacked right */
.tbp-search__item--user a {
	display: flex;
	align-items: center;
	gap: 10px;
}

.tbp-search__item-avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
}

.tbp-search__item-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
}

.tbp-search__item-title {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	line-height: 1.3;
}

.tbp-search__item-role {
	font-size: 12px;
	color: #888;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.tbp-search__item-role-sep {
	color: #ccc;
}

/* ── Kbd hint ──────────────────────────────────────────── */
.tbp-search__kbd {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY( -50% );
	font-size: 11px;
	font-weight: 500;
	color: #999;
	background: #f0f0f0;
	border: 1px solid #ddd;
	border-radius: 4px;
	padding: 2px 5px;
	pointer-events: none;
	white-space: nowrap;
	line-height: 1.4;
}

/* ── No results / loading ─────────────────────────────── */
.tbp-search__no-results {
	padding: 12px 14px;
	margin: 0;
	color: #999;
	font-size: 14px;
}

/* ── Overlay ──────────────────────────────────────────── */
.tbp-search-overlay[hidden] { display: none !important; }

.tbp-search-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

.tbp-search-overlay__backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.5 );
}

.tbp-search-overlay__panel {
	position: relative;
	z-index: 1;
	background: #fff;
	width: 100%;
	display: flex;
	flex-direction: column;
	max-height: 80vh;
}

.tbp-search-overlay__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 20px;
	border-bottom: 1px solid #eee;
	flex-shrink: 0;
}

/* Overlay input resets — overrides inline defaults */
.tbp-search-overlay__input.tbp-search__input {
	flex: 1;
	border: none !important;
	border-radius: 0 !important;
	padding: 6px 0 !important;
	box-shadow: none !important;
	background: transparent !important;
}

.tbp-search-overlay__close {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 4px;
	line-height: 1;
	color: #666;
	font-size: 18px;
	transition: color 0.2s;
}
.tbp-search-overlay__close:hover {
	color: #333;
}

/* Overlay results — static, fills panel */
.tbp-search-overlay__results.tbp-search__results {
	position: static;
	border: none;
	border-radius: 0;
	box-shadow: none;
	max-height: none;
	flex: 1;
	overflow-y: auto;
}

/* Prevent body scroll when overlay is open */
body.tbp-search-overlay-open {
	overflow: hidden;
}
