/**
 * Multisite Search — styles.
 * All selectors are scoped with the `mss-` prefix to avoid clashing with theme CSS.
 * Colours are exposed as custom properties so PHP/JS config can override them per site.
 */

:root {
	--mss-primary: #2563EB;
	--mss-ai: #7C3AED;
}

.mss-fab,
.mss-panel-wrap {
	font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
	box-sizing: border-box;
}

.mss-fab *,
.mss-panel-wrap *,
.mss-panel-wrap *::before,
.mss-panel-wrap *::after {
	box-sizing: border-box;
}

/* ---------- FAB ---------- */

.mss-fab {
	position: fixed;
	bottom: 24px;
	right: 24px;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--mss-primary);
	border: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	z-index: 9999;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	transition: transform 150ms ease;
	padding: 0;
}

.mss-fab.mss-fab--bottom-left {
	right: auto;
	left: 24px;
}

.mss-fab:hover,
.mss-fab:focus-visible {
	transform: scale(1.06);
}

.mss-fab svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: #FFFFFF;
	stroke-width: 2;
}

.mss-fab[hidden] {
	display: none;
}

.mss-fab-tooltip {
	position: absolute;
	right: calc(100% + 10px);
	top: 50%;
	transform: translateY(-50%);
	background: #1A1A18;
	color: #FFFFFF;
	font-size: 12px;
	line-height: 1;
	white-space: nowrap;
	padding: 6px 10px;
	border-radius: 6px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 150ms ease;
}

.mss-fab:hover .mss-fab-tooltip,
.mss-fab:focus-visible .mss-fab-tooltip {
	opacity: 1;
}

/* ---------- Overlay & panel ---------- */

.mss-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.38);
	z-index: 10000;
	display: flex;
	justify-content: center;
}

.mss-overlay[hidden] {
	display: none;
}

.mss-panel {
	width: 520px;
	max-width: 100vw;
	max-height: 70vh;
	margin-top: 15vh;
	background: #FFFFFF;
	border-radius: 14px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 200ms ease-out, transform 200ms ease-out;
}

.mss-overlay.mss-overlay--visible .mss-panel {
	opacity: 1;
	transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
	.mss-panel {
		transition: none;
	}

	.mss-fab {
		transition: none;
	}
}

@media (max-width: 640px) {
	.mss-panel {
		width: 100vw;
		max-height: 100vh;
		height: 100vh;
		margin-top: 0;
		border-radius: 0;
	}
}

/* ---------- Search input row ---------- */

.mss-search-row {
	padding: 16px 16px 8px;
}

.mss-input-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 44px;
	background: #F1F0EC;
	border: 0.5px solid #D1CFC8;
	border-radius: 8px;
	padding: 0 12px;
}

.mss-input-icon {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	stroke: #6B6B67;
	fill: none;
	stroke-width: 2;
}

.mss-input {
	flex: 1;
	border: 0;
	background: transparent;
	outline: none;
	font-size: 14px;
	color: #1A1A18;
	min-width: 0;
}

.mss-input::placeholder {
	color: #6B6B67;
}

.mss-esc-badge {
	flex-shrink: 0;
	font-size: 10px;
	color: #6B6B67;
	background: #FFFFFF;
	border: 0.5px solid #E5E3DC;
	border-radius: 4px;
	padding: 2px 6px;
}

/* ---------- Mode toggle ---------- */

.mss-tabs {
	margin: 8px 16px 0;
	display: flex;
	background: #F1F0EC;
	border: 0.5px solid #E5E3DC;
	border-radius: 6px;
	padding: 2px;
}

.mss-tab {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	border: 0;
	background: transparent;
	color: #6B6B67;
	font-size: 12px;
	padding: 7px 0;
	border-radius: 5px;
	cursor: pointer;
}

.mss-tab svg {
	width: 14px;
	height: 14px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
}

.mss-tab[aria-selected="true"] {
	background: #FFFFFF;
	font-weight: 500;
	color: #1A1A18;
}

/* ---------- Chips ---------- */

.mss-keyword-body {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	overflow: hidden;
}

.mss-keyword-body[hidden] {
	display: none;
}

.mss-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 12px 16px 4px;
}

.mss-chip {
	border: 0.5px solid #E5E3DC;
	background: #F1F0EC;
	color: #6B6B67;
	font-size: 11px;
	border-radius: 11px;
	padding: 3px 12px;
	cursor: pointer;
}

.mss-chip[aria-pressed="true"] {
	background: #DBEAFE;
	border-color: #93C5FD;
	color: #1D4ED8;
}

/* ---------- Results ---------- */

.mss-results {
	list-style: none;
	margin: 0;
	padding: 4px 8px 8px;
	overflow-y: auto;
	flex: 1;
	min-height: 0;
}

.mss-result {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px;
	border-radius: 6px;
	text-decoration: none;
	color: inherit;
}

.mss-result:hover,
.mss-result.mss-result--active {
	background: #F1F0EC;
}

.mss-result-body {
	flex: 1;
	min-width: 0;
}

.mss-badge {
	display: inline-block;
	font-size: 10px;
	border-radius: 10px;
	padding: 2px 8px;
	background: #F1F0EC;
	color: #6B6B67;
	margin-bottom: 4px;
}

.mss-result-title {
	font-size: 14px;
	font-weight: 500;
	color: #1A1A18;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.mss-result-snippet {
	font-size: 12px;
	color: #6B6B67;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.mss-result-snippet mark {
	background: #FEF08A;
	color: #1A1A18;
	border-radius: 2px;
}

.mss-result-arrow {
	flex-shrink: 0;
	color: #D1CFC8;
}

.mss-result:hover .mss-result-arrow,
.mss-result.mss-result--active .mss-result-arrow {
	color: #6B6B67;
}

/* ---------- Skeletons ---------- */

.mss-skeleton {
	height: 56px;
	border-radius: 6px;
	margin: 4px 8px;
	background: linear-gradient(90deg, #F1F0EC 25%, #E5E3DC 37%, #F1F0EC 63%);
	background-size: 400% 100%;
	animation: mss-shimmer 1.4s ease infinite;
}

@media (prefers-reduced-motion: reduce) {
	.mss-skeleton {
		animation: none;
	}
}

@keyframes mss-shimmer {
	0% { background-position: 100% 50%; }
	100% { background-position: 0 50%; }
}

/* ---------- Empty state ---------- */

.mss-empty {
	text-align: center;
	color: #6B6B67;
	font-size: 13px;
	padding: 32px 16px;
}

.mss-empty svg {
	width: 28px;
	height: 28px;
	stroke: #D1CFC8;
	fill: none;
	stroke-width: 2;
	margin-bottom: 8px;
}

/* ---------- Footer ---------- */

.mss-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 16px;
	border-top: 0.5px solid #E5E3DC;
	font-size: 10px;
	color: #6B6B67;
}

/* ---------- AI mode ---------- */

.mss-ai-body {
	padding: 12px 16px 8px;
	overflow-y: auto;
	flex: 1;
}

.mss-ai-box {
	background: #F5F3FF;
	border: 0.5px solid #C4B5FD;
	border-radius: 8px;
	padding: 14px 16px;
}

.mss-ai-label {
	color: var(--mss-ai);
	font-size: 11px;
	font-weight: 600;
	margin: 0 0 8px;
}

.mss-ai-label--pulsing {
	animation: mss-pulse 1.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
	.mss-ai-label--pulsing {
		animation: none;
	}
}

@keyframes mss-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.4; }
}

.mss-ai-answer {
	font-size: 13px;
	color: #1A1A18;
	line-height: 1.65;
	white-space: pre-wrap;
}

.mss-ai-citation {
	display: inline-block;
	background: #DDD6FE;
	color: #6D28D9;
	font-size: 9px;
	border-radius: 3px;
	padding: 0 4px;
	margin: 0 2px;
}

.mss-ai-meta {
	margin-top: 10px;
	font-size: 11px;
	color: #6B6B67;
}

.mss-sources-label {
	text-transform: uppercase;
	font-size: 10px;
	color: #6B6B67;
	margin: 16px 0 6px;
}

.mss-source-card {
	display: block;
	padding: 8px;
	border-radius: 6px;
	text-decoration: none;
	color: inherit;
}

.mss-source-card:hover {
	background: #F1F0EC;
}

.mss-source-title {
	font-size: 12px;
	font-weight: 500;
	color: #1A1A18;
}

.mss-source-url {
	font-size: 10px;
	color: #6B6B67;
}

.mss-followup-row {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #F1F0EC;
	border-radius: 6px;
	height: 32px;
	padding: 0 4px 0 10px;
	margin-top: 12px;
}

.mss-followup-input {
	flex: 1;
	border: 0;
	background: transparent;
	outline: none;
	font-size: 12px;
	color: #1A1A18;
	min-width: 0;
}

.mss-followup-send {
	flex-shrink: 0;
	background: var(--mss-ai);
	color: #FFFFFF;
	border: 0;
	border-radius: 5px;
	height: 24px;
	width: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.mss-followup-send svg {
	width: 12px;
	height: 12px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
}

.mss-qa-block + .mss-qa-block {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 0.5px solid #E5E3DC;
}

.mss-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
