/* Comparix Premium Search Overlay */
.cx-ps {
	position: fixed;
	inset: 0;
	z-index: 100010;
	pointer-events: none;
}

.cx-ps:not([hidden]) {
	pointer-events: auto;
}

.cx-ps__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.62);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	opacity: 0;
	transition: opacity 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.cx-ps.is-open .cx-ps__backdrop {
	opacity: 1;
}

.cx-ps__panel {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: min(100%, 720px);
	max-height: min(94vh, 880px);
	margin: clamp(1rem, 4vh, 2.5rem) auto 0;
	padding: 0 0 env(safe-area-inset-bottom, 0);
	border-radius: 24px;
	background: color-mix(in srgb, var(--cx-theme-bg, #fff) 78%, transparent);
	border: 1px solid color-mix(in srgb, var(--cx-theme-border, #e2e8f0) 70%, transparent);
	box-shadow:
		0 32px 100px rgba(15, 23, 42, 0.28),
		0 0 0 1px rgba(255, 255, 255, 0.04) inset;
	backdrop-filter: blur(24px) saturate(1.35);
	-webkit-backdrop-filter: blur(24px) saturate(1.35);
	transform: translate3d(0, -16px, 0) scale(0.98);
	opacity: 0;
	transition:
		transform 0.36s cubic-bezier(0.32, 0.72, 0, 1),
		opacity 0.28s ease;
	overflow: hidden;
}

.cx-ps.is-open .cx-ps__panel {
	transform: translate3d(0, 0, 0) scale(1);
	opacity: 1;
}

@media (max-width: 768px) {
	.cx-ps__panel {
		width: 100%;
		max-height: 100vh;
		margin: 0;
		border-radius: 0;
		border-left: 0;
		border-right: 0;
		border-top: 0;
	}
}

/* Header */
.cx-ps__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px 8px;
	flex-shrink: 0;
}

.cx-ps__brand {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 800;
	font-size: 15px;
	letter-spacing: -0.03em;
	color: var(--cx-theme-text, #0f172a);
}

.cx-ps__brand-mark {
	width: 28px;
	height: 28px;
	border-radius: 8px;
	background: linear-gradient(135deg, var(--cx-theme-primary, #6366f1), var(--cx-theme-accent, #06b6d4));
}

.cx-ps__close {
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 1px solid color-mix(in srgb, var(--cx-theme-border, #e2e8f0) 80%, transparent);
	border-radius: 999px;
	background: color-mix(in srgb, var(--cx-theme-surface, #f8fafc) 60%, transparent);
	color: var(--cx-theme-text-muted, #64748b);
	cursor: pointer;
	transition: background 0.2s, color 0.2s, transform 0.15s;
}

.cx-ps__close:hover,
.cx-ps__close:focus-visible {
	background: var(--cx-theme-surface, #f8fafc);
	color: var(--cx-theme-primary, #6366f1);
	outline: none;
}

/* Search form */
.cx-ps__form-wrap {
	padding: 0 20px 12px;
	flex-shrink: 0;
}

.cx-ps__form {
	display: flex;
	gap: 10px;
	align-items: stretch;
}

.cx-ps__input-wrap {
	flex: 1;
	position: relative;
	display: flex;
	align-items: center;
	border-radius: 16px;
	background: color-mix(in srgb, var(--cx-theme-surface, #f8fafc) 55%, transparent);
	border: 1.5px solid color-mix(in srgb, var(--cx-theme-primary, #6366f1) 35%, var(--cx-theme-border, #e2e8f0));
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--cx-theme-primary, #6366f1) 8%, transparent);
	transition: border-color 0.2s, box-shadow 0.2s;
}

.cx-ps__input-wrap:focus-within {
	border-color: var(--cx-theme-primary, #6366f1);
	box-shadow:
		0 0 0 4px color-mix(in srgb, var(--cx-theme-primary, #6366f1) 14%, transparent),
		0 8px 32px color-mix(in srgb, var(--cx-theme-primary, #6366f1) 12%, transparent);
}

.cx-ps__input-icon {
	flex-shrink: 0;
	margin-left: 14px;
	color: var(--cx-theme-text-muted, #64748b);
}

.cx-ps__input {
	flex: 1;
	min-width: 0;
	border: 0;
	background: transparent;
	padding: 16px 14px 16px 10px;
	font-size: 1.0625rem;
	font-weight: 600;
	color: var(--cx-theme-text, #0f172a);
	outline: none;
}

.cx-ps__input::placeholder {
	color: var(--cx-theme-text-muted, #64748b);
	font-weight: 500;
}

.cx-ps__submit {
	flex-shrink: 0;
	padding: 0 20px;
	border: 0;
	border-radius: 14px;
	font-size: 14px;
	font-weight: 800;
	cursor: pointer;
	color: #fff;
	background: linear-gradient(135deg, var(--cx-theme-primary, #6366f1), color-mix(in srgb, var(--cx-theme-accent, #06b6d4) 80%, var(--cx-theme-primary, #6366f1)));
	box-shadow: 0 8px 24px color-mix(in srgb, var(--cx-theme-primary, #6366f1) 35%, transparent);
	transition: transform 0.15s, box-shadow 0.2s;
}

.cx-ps__submit:hover,
.cx-ps__submit:focus-visible {
	transform: translateY(-1px);
	box-shadow: 0 12px 28px color-mix(in srgb, var(--cx-theme-primary, #6366f1) 42%, transparent);
	outline: none;
}

/* Scroll body */
.cx-ps__body {
	flex: 1;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	padding: 4px 20px 12px;
}

.cx-ps__block {
	margin-bottom: 18px;
}

.cx-ps__block-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 10px;
}

.cx-ps__label {
	margin: 0;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--cx-theme-text-muted, #64748b);
}

.cx-ps__clear {
	border: 0;
	background: none;
	font-size: 12px;
	font-weight: 700;
	color: var(--cx-theme-primary, #6366f1);
	cursor: pointer;
	padding: 4px 0;
}

.cx-ps__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.cx-ps__chip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 16px;
	border-radius: 999px;
	border: 1px solid color-mix(in srgb, var(--cx-theme-border, #e2e8f0) 75%, transparent);
	background: color-mix(in srgb, var(--cx-theme-surface, #f8fafc) 65%, transparent);
	color: var(--cx-theme-text, #0f172a);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.2s, border-color 0.2s, transform 0.15s, color 0.2s;
}

.cx-ps__chip:hover,
.cx-ps__chip:focus-visible {
	border-color: color-mix(in srgb, var(--cx-theme-primary, #6366f1) 45%, transparent);
	background: color-mix(in srgb, var(--cx-theme-primary, #6366f1) 8%, var(--cx-theme-surface, #f8fafc));
	color: var(--cx-theme-primary, #6366f1);
	outline: none;
	transform: translateY(-1px);
}

.cx-ps__chip--link {
	cursor: pointer;
}

.cx-ps__chip--suggest {
	font-size: 12px;
	padding: 8px 12px;
}

/* Live results */
.cx-ps__section {
	margin-bottom: 16px;
}

.cx-ps__section-title {
	margin: 0 0 8px;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--cx-theme-text-muted, #64748b);
	display: flex;
	align-items: center;
	gap: 6px;
}

.cx-ps__results {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.cx-ps__result {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 14px;
	text-decoration: none;
	color: var(--cx-theme-text, #0f172a);
	background: color-mix(in srgb, var(--cx-theme-surface, #f8fafc) 50%, transparent);
	border: 1px solid transparent;
	transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.cx-ps__result:hover,
.cx-ps__result:focus-visible {
	background: color-mix(in srgb, var(--cx-theme-primary, #6366f1) 7%, var(--cx-theme-surface, #f8fafc));
	border-color: color-mix(in srgb, var(--cx-theme-primary, #6366f1) 25%, transparent);
	outline: none;
	transform: translateX(2px);
}

.cx-ps__result-img {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	object-fit: cover;
	flex-shrink: 0;
	background: var(--cx-theme-surface, #f8fafc);
}

.cx-ps__result-icon {
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 10px;
	background: color-mix(in srgb, var(--cx-theme-primary, #6366f1) 12%, transparent);
	font-size: 18px;
	flex-shrink: 0;
}

.cx-ps__result-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.cx-ps__result-title {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cx-ps__result-meta {
	font-size: 11px;
	font-weight: 600;
	color: var(--cx-theme-text-muted, #64748b);
}

.cx-ps__empty,
.cx-ps__loading {
	font-size: 13px;
	color: var(--cx-theme-text-muted, #64748b);
	padding: 12px 4px;
	margin: 0;
}

/* Footer CTA */
.cx-ps__foot {
	flex-shrink: 0;
	padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0));
	border-top: 1px solid color-mix(in srgb, var(--cx-theme-border, #e2e8f0) 70%, transparent);
}

.cx-ps__show-all {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 14px 18px;
	border-radius: 14px;
	font-size: 14px;
	font-weight: 800;
	text-decoration: none;
	color: var(--cx-theme-primary, #6366f1);
	background: color-mix(in srgb, var(--cx-theme-primary, #6366f1) 8%, transparent);
	border: 1.5px solid color-mix(in srgb, var(--cx-theme-primary, #6366f1) 35%, transparent);
	transition: background 0.2s, transform 0.15s;
}

.cx-ps__show-all:hover,
.cx-ps__show-all:focus-visible {
	background: color-mix(in srgb, var(--cx-theme-primary, #6366f1) 14%, transparent);
	outline: none;
	transform: translateY(-1px);
}

body.cx-ps-open {
	overflow: hidden;
}

@supports (scrollbar-gutter: stable) {
	html {
		scrollbar-gutter: stable;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cx-ps__panel,
	.cx-ps__backdrop,
	.cx-ps__chip,
	.cx-ps__result {
		transition: none !important;
	}
}

[data-theme="dark"] .cx-ps__panel,
body.cx-theme-scheme-dark .cx-ps__panel {
	background: color-mix(in srgb, var(--cx-theme-bg, #0f172a) 88%, transparent);
}

[data-theme="dark"] .cx-ps__backdrop,
body.cx-theme-scheme-dark .cx-ps__backdrop {
	background: rgba(0, 0, 0, 0.72);
}
