.luna-ajax-search {
	--luna-accent: #0b7285;
	--luna-text: #1a1a1a;
	--luna-muted: #6b7280;
	--luna-border: #e3e3e3;
	--luna-bg: #ffffff;
	--luna-radius: 10px;

	position: relative;
	width: 100%;
	max-width: 480px;
	font-family: inherit;
	box-sizing: border-box;
}

.luna-ajax-search * {
	box-sizing: border-box;
}

/* Input */
.luna-search-input-wrap {
	position: relative;
	display: flex;
	align-items: center;
	background: var(--luna-bg);
	border: 1px solid var(--luna-border);
	border-radius: var(--luna-radius);
	padding: 0 12px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.luna-search-input-wrap:focus-within {
	border-color: var(--luna-accent);
	box-shadow: 0 0 0 3px rgba(11, 114, 133, 0.12);
}

.luna-search-icon {
	flex: 0 0 auto;
	color: var(--luna-muted);
	margin-right: 8px;
}

.luna-search-field {
	flex: 1 1 auto;
	border: 0;
	outline: 0;
	background: transparent;
	font-size: 15px;
	line-height: 1.4;
	padding: 12px 4px;
	color: var(--luna-text);
	width: 100%;
	min-width: 0;
}

.luna-search-field::placeholder {
	color: var(--luna-muted);
}

.luna-search-clear {
	flex: 0 0 auto;
	border: 0;
	background: transparent;
	color: var(--luna-muted);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 6px;
}

.luna-search-clear:hover {
	color: var(--luna-text);
}

.luna-search-spinner {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	margin-left: 6px;
	border: 2px solid var(--luna-border);
	border-top-color: var(--luna-accent);
	border-radius: 50%;
	animation: luna-spin 0.7s linear infinite;
}

@keyframes luna-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Category filter */
.luna-search-categories {
	position: relative;
	margin-top: 6px;
}

.luna-cat-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: transparent;
	border: 1px solid var(--luna-border);
	color: var(--luna-muted);
	font-size: 13px;
	border-radius: 999px;
	padding: 5px 12px;
	cursor: pointer;
}

.luna-cat-toggle:hover {
	border-color: var(--luna-accent);
	color: var(--luna-accent);
}

.luna-cat-count {
	background: var(--luna-accent);
	color: #fff;
	font-size: 11px;
	line-height: 1;
	padding: 2px 6px;
	border-radius: 999px;
}

.luna-cat-panel {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	z-index: 30;
	background: var(--luna-bg);
	border: 1px solid var(--luna-border);
	border-radius: 8px;
	padding: 10px;
	min-width: 220px;
	max-height: 240px;
	overflow-y: auto;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.luna-cat-item {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	padding: 6px 4px;
	cursor: pointer;
	color: var(--luna-text);
}

.luna-cat-item:hover {
	background: #f5f5f5;
	border-radius: 6px;
}

/* Results dropdown */
.luna-search-results {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	right: 0;
	z-index: 20;
	background: var(--luna-bg);
	border: 1px solid var(--luna-border);
	border-radius: var(--luna-radius);
	max-height: 420px;
	overflow-y: auto;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

.luna-search-result {
	display: flex;
	gap: 12px;
	padding: 10px 12px;
	text-decoration: none;
	color: inherit;
	border-bottom: 1px solid #f0f0f0;
}

.luna-search-result:last-child {
	border-bottom: 0;
}

.luna-search-result:hover,
.luna-search-result.is-active {
	background: #f7fafa;
}

.luna-result-thumb {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	border-radius: 6px;
	object-fit: cover;
	background: #eef1f1;
}

.luna-result-thumb-placeholder {
	display: block;
}

.luna-result-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.luna-result-title {
	font-size: 14px;
	font-weight: 600;
	color: var(--luna-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.luna-result-title mark {
	background: rgba(11, 114, 133, 0.18);
	color: inherit;
	padding: 0 1px;
	border-radius: 2px;
}

.luna-result-meta {
	font-size: 12px;
	color: var(--luna-muted);
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.luna-result-excerpt {
	font-size: 13px;
	color: var(--luna-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.luna-no-results {
	padding: 16px;
	text-align: center;
	font-size: 14px;
	color: var(--luna-muted);
}

@media (max-width: 480px) {
	.luna-ajax-search {
		max-width: 100%;
	}

	.luna-search-results {
		max-height: 60vh;
	}
}
