/**
 * Search UI — sticky-header input + autocomplete, mobile rounded-top sheet,
 * results page intent indicator. Bound to design tokens.
 */

/* ===== Sticky header input ===== */
.cs-global-search {
	position: relative;
	flex: 1;
	max-width: 420px;
	min-width: 0;
}
body.cs-city-hub .cs-global-search {
	max-width: 640px;
}
.cs-global-search__field {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	background: rgba(255, 255, 255, 0.1);
	border: 1px solid rgba(255, 255, 255, 0.15);
	border-radius: var(--radius-pill);
	padding: 0.4rem 0.95rem;
	color: rgba(255, 255, 255, 0.85);
	min-height: 40px;
	transition:
		background-color var(--motion-duration-fast) var(--motion-easing-standard),
		border-color var(--motion-duration-fast) var(--motion-easing-standard);
}
.cs-global-search__field:focus-within {
	background: #fff;
	color: var(--navy-900);
	border-color: var(--gold-500);
	box-shadow: 0 0 0 3px rgba(212, 152, 42, 0.25);
}
.cs-global-search__input {
	flex: 1;
	background: transparent;
	border: 0;
	padding: 0;
	font: inherit;
	color: inherit;
	outline: none;
	min-width: 0;
}
.cs-global-search__input::placeholder { color: rgba(255, 255, 255, 0.5); }
.cs-global-search__field:focus-within .cs-global-search__input::placeholder { color: rgba(16, 29, 56, 0.45); }

.cs-global-search__listbox {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 6px);
	margin: 0;
	padding: 0.4rem;
	background: #fff;
	color: var(--navy-900);
	border: 1px solid rgba(16, 29, 56, 0.08);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-card);
	list-style: none;
	max-height: 60vh;
	overflow: auto;
	z-index: 60;
}
.cs-global-search__submit { position: absolute; left: -9999px; }

.cs-suggest__group-label {
	font-size: 0.68rem;
	letter-spacing: 0.1em;
	font-weight: 700;
	color: rgba(16, 29, 56, 0.55);
	padding: 0.5rem 0.7rem 0.2rem;
	text-transform: uppercase;
}
.cs-suggest__option {
	display: block;
	padding: 0.55rem 0.7rem;
	border-radius: var(--radius-sm);
	cursor: pointer;
	outline: none;
	min-height: 44px;
}
.cs-suggest__option:hover,
.cs-suggest__option:focus { background: rgba(16, 29, 56, 0.06); }
.cs-suggest__title {
	font-weight: 600;
	color: var(--navy-900);
	font-size: 0.95rem;
}
.cs-suggest__title-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
}
.cs-suggest__type-badge {
	display: inline-block;
	padding: 0.1rem 0.45rem;
	border-radius: 9999px;
	font-size: 0.65rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	background: rgba(16, 29, 56, 0.08);
	color: rgba(16, 29, 56, 0.75);
	white-space: nowrap;
}
.cs-suggest__summary {
	font-size: 0.82rem;
	color: rgba(16, 29, 56, 0.7);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.cs-suggest__empty,
.cs-suggest__error {
	padding: 0.85rem;
	font-size: 0.9rem;
	color: rgba(16, 29, 56, 0.6);
}
.cs-suggest__error { color: #b04b3a; }

.cs-sticky__mobile-search-btn {
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.18);
	color: #fff;
	border-radius: var(--radius-pill);
	padding: 0.45rem 0.65rem;
	cursor: pointer;
	min-height: 40px;
	min-width: 40px;
	flex-shrink: 0;
}
.cs-sticky__mobile-search-btn:hover { background: rgba(255, 255, 255, 0.14); }

@media (max-width: 879px) {
	.cs-global-search { display: none; }
	.cs-sticky__mobile-search-btn { display: inline-flex; }
}

/* ===== Mobile rounded-top sheet ===== */
.cs-mobile-search:not([hidden]) {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	flex-direction: column;
}
.cs-mobile-search__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 18, 38, 0.45);
	backdrop-filter: blur(4px);
	animation: cs-mobile-search-fade var(--motion-duration-med) var(--motion-easing-out);
}
.cs-mobile-search__sheet {
	position: relative;
	margin-top: auto;
	background: #fff;
	border-top-left-radius: 18px;
	border-top-right-radius: 18px;
	max-height: 92vh;
	overflow-y: auto;
	box-shadow: 0 -10px 40px rgba(10, 18, 38, 0.25);
	animation: cs-mobile-search-up var(--motion-duration-med) var(--motion-easing-out);
}
@keyframes cs-mobile-search-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}
@keyframes cs-mobile-search-up {
	from { transform: translateY(100%); }
	to   { transform: translateY(0); }
}
.cs-mobile-search__header {
	position: sticky;
	top: 0;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.6rem;
	padding: 1rem 1rem 0.75rem;
	border-bottom: 1px solid rgba(16, 29, 56, 0.08);
}
.cs-mobile-search__title {
	font-weight: 700;
	color: var(--navy-900);
	font-size: 1rem;
}
.cs-mobile-search__close {
	border: 0;
	background: transparent;
	padding: 0.45rem;
	cursor: pointer;
	color: var(--navy-900);
	border-radius: 50%;
	min-height: 44px;
	min-width: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.cs-mobile-search__close:hover { background: rgba(16, 29, 56, 0.06); }
.cs-mobile-search__form {
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.8rem;
}
.cs-mobile-search__field {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	background: rgba(16, 29, 56, 0.04);
	border: 1px solid rgba(16, 29, 56, 0.1);
	border-radius: var(--radius-md);
	padding: 0.8rem 1rem;
	color: rgba(16, 29, 56, 0.55);
}
.cs-mobile-search__field:focus-within {
	background: #fff;
	border-color: var(--gold-500);
	box-shadow: 0 0 0 3px rgba(212, 152, 42, 0.2);
}
.cs-mobile-search__input {
	flex: 1;
	background: transparent;
	border: 0;
	font: inherit;
	font-size: 1rem;
	outline: none;
	color: var(--navy-900);
	min-width: 0;
}
.cs-mobile-search__listbox {
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (prefers-reduced-motion: reduce) {
	.cs-mobile-search__backdrop,
	.cs-mobile-search__sheet {
		animation: none !important;
	}
}

/* ===== Search results page ===== */
.cs-search-results { padding: 1.5rem 0 3rem; }
.cs-search-results__layout {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}
.cs-search-results__header {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
}
.cs-search-results__title {
	font-size: clamp(1.5rem, 3vw, 2rem);
	font-weight: 700;
	color: var(--navy-900);
	margin: 0;
}

/* Intent rail with sliding indicator — same visual language as the landing. */
.cs-search-results__intent {
	position: relative;
	display: inline-flex;
	padding: 6px;
	background: rgba(16, 29, 56, 0.04);
	border: 1px solid rgba(16, 29, 56, 0.08);
	border-radius: var(--radius-pill);
	align-self: flex-start;
}
.cs-search-results__intent::before {
	content: "";
	position: absolute;
	top: 6px;
	left: 6px;
	width: 0;
	height: calc(100% - 12px);
	background: var(--navy-900);
	border-radius: var(--radius-pill);
	pointer-events: none;
	transition:
		transform var(--motion-duration-med) var(--motion-easing-out),
		width var(--motion-duration-med) var(--motion-easing-out);
	will-change: transform, width;
	z-index: 0;
	opacity: 0;
}
.cs-search-results__intent[data-cs-indicator-ready="true"]::before { opacity: 1; }
.cs-search-results__intent-tab {
	position: relative;
	z-index: 1;
	background: transparent;
	border: 0;
	border-radius: var(--radius-pill);
	padding: 0.5rem 1rem;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	color: rgba(16, 29, 56, 0.72);
	cursor: pointer;
	min-height: 40px;
	transition: color var(--motion-duration-fast) var(--motion-easing-standard);
}
.cs-search-results__intent-tab:hover { color: var(--navy-900); }
.cs-search-results__intent-tab.is-active { color: #fff; }

.cs-search-results__types {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}
.cs-search-results__type-tab {
	background: rgba(16, 29, 56, 0.05);
	border: 1px solid rgba(16, 29, 56, 0.08);
	border-radius: var(--radius-pill);
	padding: 0.4rem 0.9rem;
	font: inherit;
	font-size: 0.88rem;
	font-weight: 600;
	color: rgba(16, 29, 56, 0.78);
	cursor: pointer;
	min-height: 40px;
	transition: background-color var(--motion-duration-fast) var(--motion-easing-standard);
}
.cs-search-results__type-tab:hover { background: rgba(16, 29, 56, 0.1); }
.cs-search-results__type-tab.is-active {
	background: var(--navy-900);
	color: #fff;
	border-color: var(--navy-900);
}

.cs-search-results__count {
	font-size: 0.9rem;
	color: rgba(16, 29, 56, 0.7);
	padding: 0.5rem 0;
}
.cs-search-results__group {
	border-top: 1px solid rgba(16, 29, 56, 0.08);
	padding-top: 1rem;
}
.cs-search-results__group-title {
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--navy-900);
	text-transform: capitalize;
	margin: 0 0 0.6rem;
}
.cs-search-results__group-count {
	color: rgba(16, 29, 56, 0.55);
	font-weight: 600;
}
.cs-search-results__items {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.6rem;
}
.cs-search-results__item-link {
	display: flex;
	gap: 0.9rem;
	background: #fff;
	border: 1px solid rgba(16, 29, 56, 0.08);
	border-radius: var(--radius-lg);
	padding: 0.9rem 1rem;
	color: inherit;
	text-decoration: none;
	transition:
		border-color var(--motion-duration-fast) var(--motion-easing-standard),
		box-shadow var(--motion-duration-fast) var(--motion-easing-standard);
}
.cs-search-results__item-link:hover {
	border-color: rgba(16, 29, 56, 0.18);
	box-shadow: var(--shadow-card);
}
.cs-search-results__item-img {
	width: 72px;
	height: 72px;
	object-fit: cover;
	border-radius: var(--radius-md);
	flex-shrink: 0;
}
.cs-search-results__item-title-row {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
	margin: 0 0 0.25rem;
}
.cs-search-results__item-title {
	font-size: 1rem;
	font-weight: 600;
	color: var(--navy-900);
	margin: 0;
}
.cs-search-results__item-type-badge {
	font-size: 0.65rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-weight: 700;
	padding: 0.15rem 0.55rem;
	border-radius: var(--radius-pill);
	background: rgba(16, 29, 56, 0.08);
	color: rgba(16, 29, 56, 0.75);
	white-space: nowrap;
}
.cs-search-results__item-type-badge--need {
	background: rgba(212, 152, 42, 0.18);
	color: var(--gold-600);
}
.cs-search-results__item-type-badge--discussion {
	background: rgba(60, 102, 167, 0.18);
	color: #1e3a72;
}
.cs-search-results__item-type-badge--event {
	background: rgba(75, 153, 121, 0.18);
	color: #1d6244;
}
.cs-search-results__item-type-badge--resource {
	background: rgba(155, 89, 182, 0.18);
	color: #4f2c69;
}
.cs-search-results__item-type-badge--mission {
	background: rgba(231, 76, 60, 0.18);
	color: #7c241a;
}
.cs-search-results__item-type-badge--directory,
.cs-search-results__item-type-badge--coupon,
.cs-search-results__item-type-badge--exchange {
	background: rgba(46, 134, 193, 0.18);
	color: #1d4d7a;
}
.cs-search-results__item-summary {
	font-size: 0.88rem;
	color: rgba(16, 29, 56, 0.7);
	margin: 0;
}
.cs-search-results__item-badges {
	margin-top: 0.4rem;
	display: flex;
	gap: 0.35rem;
	flex-wrap: wrap;
}
.cs-search-results__item-badge {
	font-size: 0.65rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-weight: 700;
	padding: 0.15rem 0.45rem;
	border-radius: var(--radius-pill);
	background: rgba(212, 152, 42, 0.18);
	color: var(--gold-600);
}
.cs-search-results__item-badge--urgent {
	background: rgba(192, 57, 43, 0.18);
	color: #882018;
}

.cs-search-results__pagination {
	display: flex;
	gap: 0.75rem;
	align-items: center;
	justify-content: center;
	padding-top: 1rem;
}
.cs-search-results__page-btn {
	background: rgba(16, 29, 56, 0.05);
	border: 1px solid rgba(16, 29, 56, 0.1);
	color: var(--navy-900);
	padding: 0.45rem 0.95rem;
	border-radius: var(--radius-pill);
	font-weight: 600;
	font-size: 0.85rem;
	cursor: pointer;
	min-height: 40px;
}
.cs-search-results__page-btn:hover { background: rgba(16, 29, 56, 0.1); }
.cs-search-results__page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cs-search-results__page-indicator {
	font-size: 0.85rem;
	color: rgba(16, 29, 56, 0.7);
}

.cs-search-results__empty {
	background: #fff;
	border: 1px solid rgba(16, 29, 56, 0.1);
	border-radius: var(--radius-lg);
	padding: 2rem 1.5rem;
	text-align: center;
}
.cs-search-results__empty--error {
	background: rgba(192, 57, 43, 0.04);
	border-color: rgba(192, 57, 43, 0.2);
}
.cs-search-results__zero-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	justify-content: center;
	list-style: none;
	margin: 0.75rem 0 0;
	padding: 0;
}

@media (prefers-reduced-motion: reduce) {
	.cs-search-results__intent::before,
	.cs-search-results__intent-tab,
	.cs-search-results__type-tab,
	.cs-search-results__item-link {
		transition: none !important;
	}
}
