/* ==========================================================================
   Open Awards — Advanced Search styles
   Loaded via oa_search_enqueue_assets() in includes/search.php.
   Scoped under .oa-search* so it never collides with theme/Bootstrap rules.
   ========================================================================== */

:root {
	--oa-search-accent: #b57cff; /* Matches the theme's violet brand accent. */
	--oa-search-ink: #1c1340;
	--oa-search-muted: #6b6680;
	--oa-search-border: #e7e2f2;
}

/* --- Header toggle icon ---------------------------------------------------- */
.oa-search-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	margin-left: 12px;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	transition:
		background-color 0.2s ease,
		color 0.2s ease;
}

.oa-search-toggle:hover,
.oa-search-toggle:focus-visible {
	background: var(--oa-search-accent);
	color: #fff;
	outline: none;
}

/* --- Modal shell ----------------------------------------------------------- */
.oa-search-modal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: none;
	align-items: flex-start;
	justify-content: center;
	padding: 8vh 16px 16px;
}

.oa-search-modal.is-open {
	display: flex;
}

.oa-search-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(28, 19, 64, 0.55);
	backdrop-filter: blur(3px);
}

.oa-search-modal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 720px;
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 24px 60px rgba(28, 19, 64, 0.35);
	padding: 32px;
	animation: oaSearchIn 0.18s ease-out;
}

@keyframes oaSearchIn {
	from {
		transform: translateY(-12px);
		opacity: 0;
	}
	to {
		transform: translateY(0);
		opacity: 1;
	}
}

/* Prevent the underlying page from scrolling while the modal is open. */
body.oa-search-open {
	overflow: hidden;
}

.oa-search-modal__close {
	position: absolute;
	top: 14px;
	right: 16px;
	width: 36px;
	height: 36px;
	border: none;
	border-radius: 50%;
	background: #f4f1fb;
	color: var(--oa-search-ink);
	font-size: 16px;
	cursor: pointer;
	line-height: 1;
}

.oa-search-modal__close:hover {
	background: var(--oa-search-accent);
	color: #fff;
}

/* --- Search field ---------------------------------------------------------- */
.oa-search-modal__label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--oa-search-muted);
	margin-bottom: 8px;
}

.oa-search-modal__field {
	position: relative;
	display: flex;
	align-items: center;
	border: 2px solid var(--oa-search-border);
	border-radius: 12px;
	overflow: hidden;
	transition: border-color 0.2s ease;
}

.oa-search-modal__field:focus-within {
	border-color: var(--oa-search-accent);
}

.oa-search-modal__icon {
	padding: 0 14px;
	color: var(--oa-search-muted);
	font-size: 16px;
}

.oa-search-modal__input {
	flex: 1;
	border: none;
	outline: none;
	padding: 16px 8px;
	font-size: 18px;
	color: var(--oa-search-ink);
	background: transparent;
}

.oa-search-modal__submit {
	border: none;
	background: var(--oa-search-accent);
	color: #fff;
	padding: 0 24px;
	align-self: stretch;
	font-weight: 600;
	cursor: pointer;
}

.oa-search-modal__submit:hover {
	filter: brightness(0.94);
}

/* --- Post-type filter checkboxes (shared: modal + page) -------------------- */
.oa-search-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-top: 14px;
}

.oa-search-filters__label {
	font-size: 13px;
	font-weight: 600;
	color: var(--oa-search-muted);
	margin-right: 2px;
}

.oa-search-filter {
	margin: 0;
	cursor: pointer;
	user-select: none;
}

/* Hide the native box but keep it accessible/focusable. */
.oa-search-filter input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	pointer-events: none;
}

/* Unchecked pill: white with the type colour as outline + text, so it's clear
   which type each filter maps to. Checked: filled with the type colour. */
.oa-search-filter span {
	display: inline-block;
	padding: 6px 14px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	color: var(--oa-type-color, var(--oa-search-ink));
	background: #fff;
	border: 1px solid var(--oa-type-color, var(--oa-search-border));
	border-radius: 999px;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.oa-search-filter:hover span {
	background: var(--oa-type-color, var(--oa-search-accent));
	border-color: var(--oa-type-color, var(--oa-search-accent));
	color: #fff;
}

.oa-search-filter input:checked + span {
	background: var(--oa-type-color, var(--oa-search-accent));
	border-color: var(--oa-type-color, var(--oa-search-accent));
	color: #fff;
}

/* Keyboard focus ring on the pill. */
.oa-search-filter input:focus-visible + span {
	outline: 2px solid var(--oa-type-color, var(--oa-search-accent));
	outline-offset: 2px;
}

/* --- Per-post-type colour palette ----------------------------------------- */
/* Single source of truth: each post type sets --oa-type-color on its is-type-*
   element. Both the result badges AND the "Search in" filter pills read this
   variable, so a pill always matches the badge of the type it filters. Add /
   tweak a post type by editing one line here. */
.is-type-post              { --oa-type-color: #b57cff; } /* Posts — brand violet. */
.is-type-page              { --oa-type-color: #5b6cff; } /* Pages — indigo. */
.is-type-faqs              { --oa-type-color: #f08c2e; } /* FAQs — orange. */
.is-type-qualifications    { --oa-type-color: #1f9d6e; } /* Qualifications — green. */
.is-type-units,
.is-type-courses           { --oa-type-color: #e0517a; } /* Units / Courses — pink. */

/* Badges take the type colour (falling back to the brand accent). */
.oa-search-results__type,
.oa-result-card__type {
	background: var(--oa-type-color, var(--oa-search-accent));
}

/* --- Live results ---------------------------------------------------------- */
.oa-search-modal__results {
	margin-top: 20px;
	max-height: 50vh;
	overflow-y: auto;
}

.oa-search-results__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.oa-search-results__item + .oa-search-results__item {
	border-top: 1px solid var(--oa-search-border);
}

.oa-search-results__link {
	display: block;
	padding: 14px 8px;
	text-decoration: none;
	color: var(--oa-search-ink);
	border-radius: 8px;
	transition: background-color 0.15s ease;
}

.oa-search-results__link:hover,
.oa-search-results__link:focus-visible {
	background: #f7f4fe;
	outline: none;
}

.oa-search-results__title {
	display: block;
	font-weight: 600;
	font-size: 16px;
}

.oa-search-results__type {
	display: inline-block;
	margin-top: 4px;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #fff;
	/* background set by the per-type palette (.is-type-*) above. */
	padding: 2px 8px;
	border-radius: 999px;
}

.oa-search-results__snippet {
	display: block;
	margin-top: 6px;
	font-size: 13px;
	color: var(--oa-search-muted);
}

.oa-search-results__status {
	padding: 16px 8px;
	color: var(--oa-search-muted);
	font-size: 14px;
	margin: 0;
}

.oa-search-results__status--loading::after {
	content: "";
	display: inline-block;
	width: 12px;
	height: 12px;
	margin-left: 8px;
	border: 2px solid var(--oa-search-border);
	border-top-color: var(--oa-search-accent);
	border-radius: 50%;
	vertical-align: middle;
	animation: oaSpin 0.7s linear infinite;
}

@keyframes oaSpin {
	to {
		transform: rotate(360deg);
	}
}

.oa-search-results__viewall {
	display: block;
	margin-top: 12px;
	padding: 12px;
	text-align: center;
	font-weight: 600;
	color: var(--oa-search-accent);
	border: 1px dashed var(--oa-search-accent);
	border-radius: 10px;
	text-decoration: none;
}

.oa-search-results__viewall:hover {
	background: var(--oa-search-accent);
	color: #fff;
}

/* --- search.php results page ---------------------------------------------- */
/* Pull the whole results block up tight under the hero (kill the big gap that
   the theme's .archive-section padding leaves), then keep the refine form and
   the result list close together. */
.search-results-section {
	padding-top: 36px;
	padding-bottom: 64px;
}

.search-results-section .oa-searchform {
	margin: 0 0 8px;
}

/* Dim + lock the results while a live update is fetching. */
.oa-search-results-area {
	position: relative;
	transition: opacity 0.15s ease;
}

.oa-search-results-area.is-loading {
	opacity: 0.45;
	pointer-events: none;
}

.search-results-list {
	display: grid;
	gap: 20px;
	margin-top: 28px;
}

.oa-result-card {
	position: relative; /* Anchor for the stretched-link overlay below. */
	border: 1px solid var(--oa-search-border);
	border-radius: 14px;
	padding: 24px;
	transition: box-shadow 0.2s ease, border-color 0.2s ease;
	    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.oa-result-card:hover {
	box-shadow: 0 12px 32px rgba(28, 19, 64, 0.12);
	border-color: var(--oa-search-accent);
}

/* Make the whole card clickable: the title link's ::after stretches to cover
   the entire card, so a click anywhere follows it. The real <a> stays on the
   title for accessibility / SEO (no extra wrapper markup needed). */
.oa-result-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

/* Keep the card title accent on hover anywhere over the card. */
.oa-result-card:hover .oa-result-card__title a {
	color: var(--oa-search-accent);
}

.oa-result-card__type {
	display: inline-block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #fff;
	/* background set by the per-type palette (.is-type-*) above. */
	padding: 3px 10px;
	border-radius: 999px;
	margin-bottom: 10px;
}

.oa-result-card__title {
	margin: 0 0 8px;
	font-size: 22px;
}

.oa-result-card__title a {
	color: var(--oa-search-ink);
	text-decoration: none;
}

.oa-result-card__title a:hover {
	color: var(--oa-search-accent);
}

.oa-result-card__snippet {
	color: var(--oa-search-muted);
	margin: 0 0 14px;
}

.oa-result-card__more {
	position: relative; /* Sit above the stretched-link overlay. */
	z-index: 2;
	font-weight: 600;
	color: var(--oa-search-accent);
	text-decoration: none;
	margin-top: auto;
}

.oa-result-card__more:hover {
	text-decoration: underline;
}

.oa-result-card__more i {
	margin-left: 6px;
}

.search-no-results {
	text-align: center;
	padding: 48px 0;
}

/* --- Pagination (paginate_links output from open_awards_pagination) -------- */
.pagination-holder {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 48px;
}

.pagination-holder .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 46px;
	height: 46px;
	padding: 0 14px;
	border: 1px solid var(--oa-search-border);
	border-radius: 12px;
	color: var(--oa-search-ink);
	font-weight: 600;
	font-size: 15px;
	line-height: 1;
	text-decoration: none;
	transition:
		background-color 0.15s ease,
		border-color 0.15s ease,
		color 0.15s ease;
}

.pagination-holder a.page-numbers:hover,
.pagination-holder a.page-numbers:focus-visible {
	border-color: var(--oa-search-accent);
	color: var(--oa-search-accent);
	outline: none;
}

.pagination-holder .page-numbers.current {
	background: var(--oa-search-accent);
	border-color: var(--oa-search-accent);
	color: #fff;
}

/* The "…" gap marker shouldn't look clickable. */
.pagination-holder .page-numbers.dots {
	border-color: transparent;
	min-width: auto;
	padding: 0 4px;
	color: var(--oa-search-muted);
}

/* Prev / next arrow buttons (FontAwesome icons from open_awards_pagination). */
.pagination-holder .page-numbers.prev,
.pagination-holder .page-numbers.next {
	color: var(--oa-search-accent);
}

.pagination-holder .page-numbers.prev:hover,
.pagination-holder .page-numbers.next:hover {
	background: var(--oa-search-accent);
	border-color: var(--oa-search-accent);
	color: #fff;
}

/* --- In-page refine form --------------------------------------------------- */
.oa-searchform__field {
	display: flex;
	max-width: 520px;
	margin: 0 auto;
	border: 2px solid var(--oa-search-border);
	border-radius: 12px;
	overflow: hidden;
}

.oa-searchform__field:focus-within {
	border-color: var(--oa-search-accent);
}

.oa-searchform__input {
	flex: 1;
	border: none;
	outline: none;
	padding: 12px 16px;
	font-size: 16px;
}

.oa-searchform__submit {
	border: none;
	background: var(--oa-search-accent);
	color: #fff;
	padding: 0 20px;
	cursor: pointer;
}

.search-results .hero-style-1 {
	margin-bottom: 0 !important;
}

.search-results .archive-section {
	padding-top: 50px;
}

.search-results .archive-section .oa-searchform__field {
	max-width: 100%;
}

/* Visually-hidden but screen-reader-available labels. */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

@media (max-width: 575px) {
	.oa-search-modal__dialog {
		padding: 24px 18px;
	}
	.oa-search-modal__submit {
		padding: 0 14px;
	}
}