/**
 * AiNews fullscreen search overlay.
 *
 * Kept separate from the global header stylesheet so the component can be
 * maintained without changing shared header presentation.
 */

.site-search {
	position: fixed;
	inset: 0;
	z-index: 4000;
	display: flex;
	align-items: center;
	justify-content: center;
	height: auto;
	min-height: 100vh;
	min-height: 100dvh;
	padding: 24px 0;
	overflow-y: auto;
	background: rgba(8, 15, 30, 0.72);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 180ms ease, visibility 180ms ease;
}

body:not(.tfm-dark-mode) .site-search,
body.tfm-dark-mode .site-search {
	background: rgba(8, 15, 30, 0.72);
	-webkit-backdrop-filter: blur(12px);
	backdrop-filter: blur(12px);
}

.site-search.show-search {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

body.search-is-open {
	overflow: hidden;
}

.site-search .site-search-wrapper {
	position: relative;
	display: block;
	width: calc(100% - 32px);
	max-width: 780px;
	height: auto;
	margin: auto;
	padding: 32px;
	color: #13213c;
	background: rgba(255, 255, 255, 0.98);
	border: 1px solid rgba(255, 255, 255, 0.66);
	border-radius: 24px;
	box-shadow: 0 28px 80px rgba(2, 8, 23, 0.32);
	opacity: 1;
	transform: translateY(10px) scale(0.985);
	transition: transform 180ms ease;
}

.site-search.show-search .site-search-wrapper {
	transform: translateY(0) scale(1);
}

.site-search .site-search-close {
	position: absolute;
	top: 18px;
	right: 18px;
	display: grid;
	width: 42px;
	height: 42px;
	min-width: 42px;
	max-width: none;
	padding: 0;
	place-items: center;
	color: #334155;
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	border-radius: 50%;
	cursor: pointer;
	transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.site-search .site-search-close::before,
.site-search .site-search-close::after {
	position: absolute;
	width: 17px;
	height: 2px;
	content: "";
	background: currentColor;
	border-radius: 999px;
}

.site-search .site-search-close::before {
	transform: rotate(45deg);
}

.site-search .site-search-close::after {
	transform: rotate(-45deg);
}

.site-search .site-search-close:hover {
	color: #0f172a;
	background: #e2e8f0;
	transform: rotate(4deg);
}

.site-search .site-search-close:focus-visible,
.site-search .site-search-submit:focus-visible,
.site-search .site-search-chip:focus-visible,
.site-search .site-search-result-link:focus-visible {
	outline: 3px solid rgba(37, 99, 235, 0.35);
	outline-offset: 3px;
}

.site-search-intro {
	display: block;
	width: 100%;
	max-width: none;
	padding-right: 54px;
}

.site-search-title {
	margin: 0;
	color: #0f172a;
	font-size: clamp(1.75rem, 4vw, 2.35rem);
	font-weight: 750;
	line-height: 1.12;
	letter-spacing: -0.035em;
}

.site-search-description {
	margin: 9px 0 0;
	color: #64748b;
	font-size: 0.98rem;
	line-height: 1.55;
}

.site-search .site-search-form {
	display: block;
	width: 100%;
	max-width: none;
	margin: 24px 0 0;
	border-radius: 0;
	box-shadow: none;
}

.site-search-control {
	position: relative;
	display: flex;
	align-items: center;
	width: 100%;
	min-height: 64px;
	padding: 5px;
	overflow: hidden;
	background: #f8fafc;
	border: 1px solid #cbd5e1;
	border-radius: 16px;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
	transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.site-search-control:focus-within {
	background: #fff;
	border-color: #2563eb;
	box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.site-search .site-search-form .site-search-field {
	flex: 1 1 auto;
	width: 100%;
	height: 52px;
	min-width: 0;
	margin: 0;
	padding: 0 18px;
	color: #0f172a;
	font-family: inherit;
	font-size: 1.08rem;
	font-weight: 500;
	line-height: 1;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	outline: 0;
}

.site-search .site-search-form .site-search-field::placeholder {
	color: #94a3b8;
	opacity: 1;
}

.site-search .site-search-submit {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	height: 52px;
	margin: 0;
	padding: 0 19px;
	gap: 8px;
	color: #fff;
	font-family: inherit;
	font-size: 0.94rem;
	font-weight: 700;
	line-height: 1;
	background: #2563eb;
	border: 0;
	border-radius: 12px;
	cursor: pointer;
	box-shadow: 0 7px 18px rgba(37, 99, 235, 0.24);
	transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.site-search .site-search-submit:hover {
	background: #1d4ed8;
	box-shadow: 0 9px 22px rgba(37, 99, 235, 0.3);
	transform: translateY(-1px);
}

.site-search .site-search-submit:active {
	transform: translateY(0);
}

.site-search-submit svg {
	width: 19px;
	height: 19px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 2;
}

.site-search-popular {
	display: block;
	width: 100%;
	max-width: none;
	margin: 20px 0 0;
}

.site-search-popular-label {
	flex: 0 0 100%;
	margin-bottom: 2px;
	color: #64748b;
	font-size: 0.76rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1.4;
	text-transform: uppercase;
}

.site-search-chips {
	display: flex;
	flex-wrap: wrap;
	margin-top: 8px;
	gap: 8px;
}

.site-search-chip {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	padding: 7px 12px;
	color: #334155;
	font-size: 0.86rem;
	font-weight: 650;
	line-height: 1.2;
	text-decoration: none;
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	border-radius: 999px;
	transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.site-search-chip:hover {
	color: #1d4ed8;
	background: #eff6ff;
	border-color: #bfdbfe;
	transform: translateY(-1px);
}

.site-search-results {
	display: block;
	width: 100%;
	max-width: none;
	margin-top: 20px;
	padding-top: 17px;
	border-top: 1px solid #e2e8f0;
}

.site-search-results-status {
	margin: 0;
	color: #64748b;
	font-size: 0.86rem;
	line-height: 1.5;
}

.site-search-results-list {
	max-height: min(270px, 31vh);
	margin: 10px 0 0;
	padding: 0;
	overflow-y: auto;
	list-style: none;
	scrollbar-width: thin;
}

.site-search-results-list[hidden] {
	display: none;
}

.site-search-result-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 45px;
	padding: 10px 12px;
	color: #172554;
	font-size: 0.92rem;
	font-weight: 650;
	line-height: 1.35;
	text-decoration: none;
	border-radius: 10px;
	transition: color 150ms ease, background-color 150ms ease;
}

.site-search-result-link::after {
	flex: 0 0 auto;
	margin-left: 16px;
	color: #94a3b8;
	content: "\2197";
}

.site-search-result-link:hover {
	color: #1d4ed8;
	background: #eff6ff;
}

.site-search-widgets {
	display: block;
	width: 100%;
	max-width: none;
	margin-top: 20px;
	padding-top: 18px;
	border-top: 1px solid #e2e8f0;
}

.site-search-widgets:empty {
	display: none;
}

body.tfm-dark-mode .site-search .site-search-wrapper {
	color: #e2e8f0;
	background: rgba(15, 23, 42, 0.98);
	border-color: rgba(148, 163, 184, 0.2);
	box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

body.tfm-dark-mode .site-search-title,
body.tfm-dark-mode .site-search .site-search-form .site-search-field {
	color: #f8fafc;
}

body.tfm-dark-mode .site-search-description,
body.tfm-dark-mode .site-search-popular-label,
body.tfm-dark-mode .site-search-results-status {
	color: #94a3b8;
}

body.tfm-dark-mode .site-search .site-search-close,
body.tfm-dark-mode .site-search-chip {
	color: #cbd5e1;
	background: #1e293b;
	border-color: #334155;
}

body.tfm-dark-mode .site-search .site-search-close:hover,
body.tfm-dark-mode .site-search-chip:hover {
	color: #fff;
	background: #334155;
	border-color: #475569;
}

body.tfm-dark-mode .site-search-control {
	background: #111c30;
	border-color: #334155;
}

body.tfm-dark-mode .site-search-control:focus-within {
	background: #0f172a;
	border-color: #60a5fa;
	box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.14);
}

body.tfm-dark-mode .site-search-results,
body.tfm-dark-mode .site-search-widgets {
	border-top-color: #334155;
}

body.tfm-dark-mode .site-search-result-link {
	color: #e2e8f0;
}

body.tfm-dark-mode .site-search-result-link:hover {
	color: #fff;
	background: #1e293b;
}

@media (max-width: 680px) {
	.site-search {
		align-items: flex-start;
		padding-top: max(18px, env(safe-area-inset-top));
		padding-bottom: max(18px, env(safe-area-inset-bottom));
	}

	.site-search .site-search-wrapper {
		max-height: calc(100dvh - 36px);
		padding: 24px;
		overflow-y: auto;
		border-radius: 20px;
	}

	.site-search-title {
		font-size: 1.75rem;
	}

	.site-search-description {
		max-width: 90%;
		font-size: 0.92rem;
	}

	.site-search-results-list {
		max-height: 24vh;
	}
}

@media (max-width: 480px) {
	.site-search .site-search-wrapper {
		width: calc(100% - 24px);
		padding: 24px 18px 20px;
	}

	.site-search .site-search-close {
		top: 14px;
		right: 14px;
		width: 38px;
		height: 38px;
		min-width: 38px;
	}

	.site-search-intro {
		padding-right: 42px;
	}

	.site-search .site-search-form {
		margin-top: 20px;
	}

	.site-search .site-search-form .site-search-field {
		padding-left: 14px;
		font-size: 1rem;
	}

	.site-search .site-search-submit {
		width: 52px;
		padding: 0;
	}

	.site-search-submit-text {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.site-search,
	.site-search .site-search-wrapper,
	.site-search .site-search-close,
	.site-search .site-search-submit,
	.site-search-chip {
		transition: none;
	}
}
