/*
 * Webbytroops Search — layout-only stylesheet.
 *
 * No colours, borders, radii, or typography are declared here. Everything
 * visual inherits from the active theme (input fields → theme form styling,
 * .wp-element-button → theme button styling). Elementor Style controls emit
 * inline rules that win against these neutral defaults.
 */

.wbs {
	--wbs-gap: 8px;
	position: relative;
	width: 100%;
	box-sizing: border-box;
}

.wbs *,
.wbs *::before,
.wbs *::after {
	box-sizing: border-box;
}

/* --- Form scaffolding --------------------------------------------------- */

.wbs__form {
	display: flex;
	flex-direction: column;
	gap: var(--wbs-gap);
	margin: 0;
	width: 100%;
}

.wbs__field-row {
	display: flex;
	align-items: stretch;
	gap: var(--wbs-gap);
	width: 100%;
	min-width: 0;
}

.wbs__field-wrap {
	display: flex;
	align-items: stretch;
	flex: 1 1 auto;
	min-width: 0;
	position: relative;
}

/*
 * Default modes (text_button / icon_outside) keep the wrap as a flex row.
 * For "inside" modes the wrap is just a positioning context — the <input>
 * itself remains the visible pill (theme-styled) and the button/category
 * float over it via absolute positioning.
 */
.wbs--mode-icon_inside .wbs__field-wrap,
.wbs--mode-button_inside .wbs__field-wrap {
	display: block;
}

.wbs__input {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
	margin: 0;
	border: 0;
	background: transparent;
	outline: 0;
	box-shadow: none;
	font: inherit;
}

.wbs__input:focus {
	outline: 0;
	box-shadow: none;
}

/* Category dropdown sits on the left, inside the rounded field. */
.wbs__category {
	flex: 0 0 auto;
	margin: 0;
	border: 0;
	border-right: 1px solid currentColor;
	background: transparent;
	font: inherit;
	padding: 0 0.75em;
	max-width: 50%;
}

/* --- Buttons ------------------------------------------------------------ */

.wbs__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4em;
	cursor: pointer;
	white-space: nowrap;
	font: inherit;
	line-height: 1;
}

.wbs__button--icon {
	padding: 0.55em;
	aspect-ratio: 1 / 1;
}

.wbs__icon {
	display: block;
	flex: 0 0 auto;
}

/* --- Inside modes: absolute positioning over the input ----------------- */

.wbs--mode-icon_inside .wbs__input,
.wbs--mode-button_inside .wbs__input {
	width: 100%;
	display: block;
	padding-right: 3em;
}

.wbs--mode-button_inside .wbs__input {
	/* Leave a bit more room for a full label-bearing button. */
	padding-right: 7em;
}

/* When category dropdown is inside the pill, reserve left space too. */
.wbs--mode-icon_inside.wbs--with-category .wbs__input,
.wbs--mode-button_inside.wbs--with-category .wbs__input {
	padding-left: 9em;
}

.wbs--mode-icon_inside .wbs__field-wrap > .wbs__button,
.wbs--mode-button_inside .wbs__field-wrap > .wbs__button {
	position: absolute;
	right: 4px;
	top: 50%;
	transform: translateY(-50%);
	margin: 0;
}

/* Icon-only inside: invisible chrome, just the glyph. */
.wbs--mode-icon_inside .wbs__field-wrap > .wbs__button {
	background: transparent;
	color: inherit;
	border: 0;
	padding: 0.4em 0.7em;
}

/* Button inside: full theme button styling preserved (.wp-element-button). */
.wbs--mode-button_inside .wbs__field-wrap > .wbs__button {
	padding: 0.45em 1em;
}

.wbs--mode-icon_inside .wbs__category,
.wbs--mode-button_inside .wbs__category {
	position: absolute;
	left: 4px;
	top: 50%;
	transform: translateY(-50%);
	max-width: 8.5em;
	z-index: 1;
}

/* --- Orientations ------------------------------------------------------- */

.wbs--stacked .wbs__field-row,
.wbs--stacked_full .wbs__field-row {
	flex-direction: column;
}

.wbs--stacked_full .wbs__button {
	width: 100%;
}

.wbs__button-row {
	display: flex;
	justify-content: center;
}

/* --- Suggestions dropdown ---------------------------------------------- */

.wbs__results {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	margin-top: 4px;
	z-index: 50;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: #fff;
	color: #1a1a1a;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.wbs__result + .wbs__result {
	border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.wbs__result:hover,
.wbs__result.is-active,
.wbs__result:focus-visible {
	background: rgba(0, 0, 0, 0.04);
	outline: 0;
}

.wbs__results[hidden] {
	display: none;
}

.wbs__result {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.7rem 0.9rem;
	text-decoration: none;
	color: inherit;
	transition: background-color 0.15s ease;
	border-top: 1px solid transparent;
}

.wbs__result-thumb {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	overflow: hidden;
	border-radius: 6px;
}

.wbs__result-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wbs__result-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.wbs__result-title {
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wbs__result-excerpt {
	font-size: 0.875em;
	opacity: 0.75;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wbs__result-badge {
	display: inline-block;
	margin-top: 4px;
	padding: 1px 8px;
	font-size: 0.7em;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	border: 1px solid currentColor;
	border-radius: 999px;
	width: max-content;
	opacity: 0.75;
}

.wbs__view-all {
	display: block;
	padding: 0.6rem 0.9rem;
	text-decoration: none;
	color: inherit;
	font-weight: 600;
	font-size: 0.9em;
	border-top: 1px solid currentColor;
	text-align: center;
}

.wbs__view-all:hover,
.wbs__view-all:focus-visible {
	text-decoration: underline;
}

.wbs__empty {
	margin: 0;
	padding: 0.8rem 0.9rem;
	opacity: 0.7;
	font-style: italic;
}
