/* Ajax Live Search */

.als-wrap {
	--als-bg: #ffffff;
	--als-border: #e2e5ea;
	--als-text: #1a1d23;
	--als-muted: #6b7280;
	--als-accent: #0f766e;
	--als-accent-soft: #ecfdf8;
	--als-btn-text: #ffffff;
	--als-icon: #1a1d23;
	--als-icon-bg: #ffffff;
	--als-input-bg: #f8fafb;
	--als-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
	--als-radius: 12px;
	position: relative;
	display: inline-flex;
	align-items: center;
	font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
	z-index: 50;
}

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

.als-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 1px solid var(--als-border);
	border-radius: 999px;
	background: var(--als-icon-bg);
	color: var(--als-icon);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.als-icon-btn:hover,
.als-wrap.als-is-open .als-icon-btn {
	background: var(--als-accent);
	border-color: var(--als-accent);
	color: var(--als-btn-text);
}

.als-icon-btn:focus-visible {
	outline: 2px solid var(--als-accent);
	outline-offset: 2px;
}

.als-panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	width: min(420px, calc(100vw - 24px));
	background: var(--als-bg);
	border: 1px solid var(--als-border);
	border-radius: var(--als-radius);
	box-shadow: var(--als-shadow);
	padding: 12px;
	animation: als-fade-in 0.18s ease;
}

.als-wrap[data-open="always"] {
	display: block;
	width: 100%;
	max-width: 520px;
}

.als-wrap[data-open="always"] .als-panel {
	position: relative;
	top: auto;
	right: auto;
	width: 100%;
	box-shadow: none;
	padding: 0;
	border: none;
	animation: none;
}

.als-wrap[data-style="input"] .als-panel {
	position: relative;
	top: auto;
	right: auto;
	width: 100%;
	min-width: 280px;
	box-shadow: none;
	border: none;
	padding: 0;
}

@keyframes als-fade-in {
	from {
		opacity: 0;
		transform: translateY(-6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.als-form {
	display: flex;
	gap: 8px;
	align-items: stretch;
}

.als-field {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 12px;
	min-height: 44px;
	border: 1px solid var(--als-border);
	border-radius: 10px;
	background: var(--als-input-bg);
	transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.als-field:focus-within {
	background: var(--als-bg);
	border-color: var(--als-accent);
	box-shadow: 0 0 0 3px var(--als-accent-soft);
}

.als-field-icon {
	display: flex;
	color: var(--als-muted);
	flex-shrink: 0;
}

.als-input {
	flex: 1;
	width: 100%;
	border: 0;
	background: transparent;
	outline: none;
	font-size: 15px;
	line-height: 1.4;
	color: var(--als-text);
	padding: 10px 0;
	appearance: none;
	-webkit-appearance: none;
}

.als-input::-webkit-search-cancel-button {
	display: none;
}

.als-clear {
	border: 0;
	background: transparent;
	color: var(--als-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 0 2px;
}

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

.als-submit {
	border: 0;
	border-radius: 10px;
	background: var(--als-accent);
	color: var(--als-btn-text);
	font-size: 14px;
	font-weight: 600;
	padding: 0 16px;
	cursor: pointer;
	white-space: nowrap;
	transition: filter 0.15s ease;
}

.als-submit:hover {
	filter: brightness(0.95);
}

.als-suggestions {
	margin-top: 10px;
	max-height: min(60vh, 420px);
	overflow-y: auto;
	border: 1px solid var(--als-border);
	border-radius: 10px;
	background: var(--als-bg);
}

.als-wrap[data-open="always"] .als-suggestions,
.als-wrap[data-style="input"] .als-suggestions {
	position: absolute;
	left: 0;
	right: 0;
	z-index: 60;
	margin-top: 8px;
	box-shadow: var(--als-shadow);
}

.als-section + .als-section {
	border-top: 1px solid var(--als-border);
}

.als-section-title {
	padding: 10px 14px 6px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--als-muted);
}

.als-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	text-decoration: none;
	color: inherit;
	transition: background 0.12s ease;
}

.als-item:hover,
.als-item:focus-visible {
	background: var(--als-accent-soft);
	outline: none;
}

.als-item-media {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border-radius: 8px;
	overflow: hidden;
	background: #f1f5f9;
	display: flex;
	align-items: center;
	justify-content: center;
}

.als-item-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.als-item-placeholder {
	color: #94a3b8;
	display: flex;
}

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

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

.als-item-sub {
	font-size: 12px;
	color: var(--als-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.als-view-all {
	display: block;
	padding: 12px 14px;
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	color: var(--als-accent);
	text-decoration: none;
	border-top: 1px solid var(--als-border);
}

.als-view-all:hover {
	background: var(--als-accent-soft);
}

.als-loading,
.als-empty,
.als-hint {
	padding: 18px 14px;
	text-align: center;
	font-size: 13px;
	color: var(--als-muted);
}

.als-loading::after {
	content: "";
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-left: 8px;
	border: 2px solid #cbd5e1;
	border-top-color: var(--als-accent);
	border-radius: 50%;
	vertical-align: -2px;
	animation: als-spin 0.7s linear infinite;
}

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

@media (max-width: 480px) {
	.als-panel {
		right: 0;
		left: auto;
		transform: none;
		width: min(100vw - 24px, 320px);
	}

	.als-submit {
		padding: 0 12px;
	}
}
