/**
 * Super Ajax Search — Frontend Styles.
 *
 * @package SuperAjaxSearch
 * @since   2.0.0
 */

/* ── Wrapper ──────────────────────────────────────── */
.super-ajax-search-wrapper {
	position: relative;
	max-width: 600px;
	width: 100%;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	box-sizing: border-box;
}

.super-ajax-search-wrapper *,
.super-ajax-search-wrapper *::before,
.super-ajax-search-wrapper *::after {
	box-sizing: inherit;
}

/* ── Form ─────────────────────────────────────────── */
.sas-form {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: stretch;
}

.sas-input-group {
	display: flex;
	flex: 1 1 0%;
	min-width: 0;
}

.sas-search-input {
	flex: 1 1 0%;
	min-width: 0;
	padding: 10px 14px;
	border: 1px solid #d0d5dd;
	border-right: none;
	border-radius: 8px 0 0 8px;
	outline: none;
	font-size: 15px;
	color: #1d2939;
	background: #fff;
	transition: border-color 0.2s, box-shadow 0.2s;
	height: 44px;
}

.sas-search-input:focus {
	border-color: #4f46e5;
	box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.sas-search-input::placeholder {
	color: #98a2b3;
}

.sas-search-button {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 14px;
	border: 1px solid #d0d5dd;
	border-left: none;
	border-radius: 0 8px 8px 0;
	background: #f9fafb;
	color: #475467;
	cursor: pointer;
	height: 44px;
	transition: background 0.2s, color 0.2s;
}

.sas-search-button:hover {
	background: #4f46e5;
	color: #fff;
	border-color: #4f46e5;
}

.sas-search-button svg {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

/* ── Category Filter ──────────────────────────────── */
.sas-category-filter {
	padding: 10px 12px;
	border: 1px solid #d0d5dd;
	border-radius: 8px;
	background: #fff;
	font-size: 14px;
	color: #1d2939;
	cursor: pointer;
	height: 44px;
	min-width: 140px;
	outline: none;
	transition: border-color 0.2s;
}

.sas-category-filter:focus {
	border-color: #4f46e5;
}

/* ── Loading Spinner ──────────────────────────────── */
.sas-spinner {
	display: none;
}

.sas-loading .sas-spinner {
	display: block;
	position: absolute;
	top: 13px;
	right: 52px;
	width: 18px;
	height: 18px;
	border: 2px solid #e5e7eb;
	border-top-color: #4f46e5;
	border-radius: 50%;
	animation: sas-spin 0.6s linear infinite;
}

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

/* ── Results Dropdown ─────────────────────────────── */
.sas-results {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 9999;
	margin-top: 4px;
	max-height: 400px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
}

.sas-results.sas-visible {
	display: block;
}

/* Scrollbar */
.sas-results::-webkit-scrollbar {
	width: 6px;
}

.sas-results::-webkit-scrollbar-thumb {
	background: #d0d5dd;
	border-radius: 3px;
}

/* ── Group Header ─────────────────────────────────── */
.sas-group-header {
	padding: 8px 16px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #6b7280;
	background: #f9fafb;
	border-bottom: 1px solid #f3f4f6;
	position: sticky;
	top: 0;
	z-index: 1;
}

/* ── Result Item ──────────────────────────────────── */
.sas-result-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	text-decoration: none;
	color: #1d2939;
	border-bottom: 1px solid #f3f4f6;
	transition: background 0.15s;
}

.sas-result-item:last-child {
	border-bottom: none;
}

.sas-result-item:hover,
.sas-result-item.sas-active {
	background: #f0f0ff;
}

/* ── Thumbnail ────────────────────────────────────── */
.sas-thumb {
	width: 48px;
	height: 48px;
	border-radius: 6px;
	object-fit: cover;
	flex-shrink: 0;
	background: #f3f4f6;
}

/* ── Result Content ───────────────────────────────── */
.sas-result-content {
	flex: 1;
	min-width: 0;
}

.sas-result-title {
	font-weight: 600;
	font-size: 14px;
	color: #1d2939;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sas-result-excerpt {
	font-size: 13px;
	color: #6b7280;
	margin-top: 2px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.sas-result-excerpt strong {
	color: #4f46e5;
	font-weight: 700;
}

/* ── No Results ───────────────────────────────────── */
.sas-no-results {
	padding: 24px 16px;
	text-align: center;
	color: #98a2b3;
	font-size: 14px;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 600px) {
	.sas-form {
		flex-direction: column;
	}

	.sas-category-filter {
		width: 100%;
	}

	.sas-search-input,
	.sas-search-button {
		height: 40px;
	}

	.sas-thumb {
		width: 40px;
		height: 40px;
	}

	.sas-result-item {
		padding: 8px 12px;
		gap: 10px;
	}
}