/* ═══════════════════════════════════════════════════════════════════════════
   AQS Public Styles v1.2.0
   Clean horizontal search bar — professional education portal style
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Base ─────────────────────────────────────────────────────────────────── */
.aqs-wrapper {
	font-family: inherit;
	line-height: 1.6;
	box-sizing: border-box;
}

.aqs-wrapper *,
.aqs-wrapper *::before,
.aqs-wrapper *::after {
	box-sizing: inherit;
}

/* ── Search container ─────────────────────────────────────────────────────── */
.aqs-filter-wrap {
	background: #fff;
	border: 1.5px solid #dde2ea;
	border-radius: 12px;
	box-shadow: 0 4px 24px rgba( 0, 0, 0, 0.07 );
	margin-bottom: 28px;
}

/* ── Horizontal filter bar ────────────────────────────────────────────────── */
.aqs-filter-bar {
	display: flex;
	align-items: center;
	padding: 10px 10px 10px 16px;
	gap: 10px;
	min-height: 60px;
}

/* ── Search field (takes most width) ─────────────────────────────────────── */
.aqs-bar-search {
	flex: 2;
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	padding-right: 12px;
	border-right: 1.5px solid #e8ecf0;
}

/* Search icon */
.aqs-bar-icon {
	color: #9aa3b0;
	flex-shrink: 0;
	display: flex;
	align-items: center;
}

.aqs-bar-icon svg {
	width: 18px;
	height: 18px;
}

/* ── Keyword input ────────────────────────────────────────────────────────── */
.aqs-input {
	border: none;
	background: transparent;
	width: 100%;
	min-width: 0;
	font-size: 15px;
	color: #2d3748;
	outline: none;
	padding: 0;
}

.aqs-input::placeholder {
	color: #b0b8c4;
}

.aqs-input[type="search"]::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

/* ── Reset / Clear button — lives inside the search field ─────────────────── */
/*
 * Use width + opacity instead of display:none/flex so theme CSS resets on
 * <button> elements (e.g. `button { display:inline-block }`) can't interfere.
 */
.aqs-reset-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 0;
	min-width: 0;
	height: 22px;
	overflow: hidden;
	opacity: 0;
	pointer-events: none;
	border-radius: 50%;
	border: none;
	background: #bdc5ce;
	color: #fff;
	cursor: pointer;
	padding: 0;
	transition: width 0.2s ease, opacity 0.2s ease, background 0.18s;
}

/* JS adds .aqs-visible when any filter is active */
.aqs-reset-btn.aqs-visible {
	width: 22px;
	min-width: 22px;
	opacity: 1;
	pointer-events: auto;
}

.aqs-reset-btn:hover {
	background: #6b7280;
}

.aqs-reset-btn:hover {
	background: #6b7280;
}

/* ── Dropdown field wrapper — gives Category / Level a visible pill border ── */
.aqs-bar-field {
	flex: 1;
	display: flex;
	align-items: center;
	min-width: 0;
}

/* Pill border around each select */
.aqs-select-pill {
	display: flex;
	align-items: center;
	width: 100%;
	border: 1.5px solid #dde2ea;
	border-radius: 8px;
	padding: 0 10px;
	height: 40px;
	background: #fff;
	transition: border-color 0.18s, box-shadow 0.18s;
}

.aqs-select-pill:focus-within {
	border-color: #1a4731;
	box-shadow: 0 0 0 3px rgba( 26, 71, 49, 0.12 );
}

/* ── Selects ──────────────────────────────────────────────────────────────── */
.aqs-select {
	border: none;
	background: transparent;
	width: 100%;
	font-size: 14px;
	color: #4a5568;
	outline: none;
	appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
	padding-right: 20px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa3b0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0 center;
}

.aqs-select option {
	color: #2d3748;
}

/* ── Search button ────────────────────────────────────────────────────────── */
.aqs-search-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 0 26px;
	height: 44px;
	background: #1a4731;
	color: #fff;
	border: none;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	border-radius: 8px;
	letter-spacing: 0.02em;
	transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
	box-shadow: 0 2px 8px rgba( 26, 71, 49, 0.3 );
}

.aqs-search-btn svg {
	width: 15px;
	height: 15px;
	flex-shrink: 0;
}

.aqs-search-btn:hover {
	background: #155130;
	transform: translateY( -1px );
	box-shadow: 0 4px 14px rgba( 26, 71, 49, 0.4 );
}

.aqs-search-btn:active {
	background: #0f3b23;
	transform: translateY( 0 );
}

/* ── Results topbar (count + sort pills) ──────────────────────────────────── */
.aqs-results-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	padding: 14px 0 12px;
	border-bottom: 1.5px solid #f0f2f5;
	margin-bottom: 20px;
}

.aqs-count-wrap {
	display: flex;
	align-items: center;
	gap: 9px;
}

.aqs-count-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	padding: 4px 10px;
	background: #1a4731;
	color: #fff;
	border-radius: 20px;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
}

.aqs-results-label-text {
	font-size: 14px;
	font-weight: 500;
	color: #6b7280;
}

/* Sort pills */
.aqs-sort-pills-wrap {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.aqs-sort-label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #9ca3af;
	white-space: nowrap;
}

.aqs-sort-pills {
	display: flex;
	gap: 5px;
	flex-wrap: wrap;
}

.aqs-sort-pill {
	padding: 5px 14px;
	border: 1.5px solid #e5e7eb;
	border-radius: 15px;
	background: #fff;
	color: #6b7280;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.18s;
	white-space: nowrap;
}

.aqs-sort-pill:hover {
	background: #1a4731;
	border-color: #1a4731;
	color: #fff;
}

.aqs-sort-pill.active {
	background: #1a4731;
	border-color: #1a4731;
	color: #fff;
	font-weight: 600;
	border-radius: 15px;
}

/* ── Loading ──────────────────────────────────────────────────────────────── */
.aqs-loading-overlay {
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 48px 24px;
}

.aqs-loading-overlay.visible {
	display: flex;
}

.aqs-spinner {
	width: 40px;
	height: 40px;
	border: 3px solid #e5e7eb;
	border-top-color: #1a4731;
	border-radius: 50%;
	animation: aqs-spin 0.7s linear infinite;
}

.aqs-loading-text {
	font-size: 14px;
	color: #9ca3af;
}

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

/* ── No results ───────────────────────────────────────────────────────────── */
.aqs-no-results {
	text-align: center;
	padding: 56px 24px;
	color: #9ca3af;
	border: 2px dashed #e5e7eb;
	border-radius: 12px;
}

.aqs-no-results-icon {
	font-size: 48px;
	margin-bottom: 12px;
	opacity: 0.45;
}

.aqs-no-results p {
	margin: 0;
	font-size: 16px;
	font-weight: 500;
}

/* ── Results grid ─────────────────────────────────────────────────────────── */
.aqs-results-grid {
	display: grid;
	gap: 20px;
}

.aqs-layout-grid .aqs-results-grid {
	grid-template-columns: repeat( auto-fill, minmax( 280px, 1fr ) );
}

.aqs-layout-list .aqs-results-grid {
	grid-template-columns: 1fr;
}

/* ── Result card ──────────────────────────────────────────────────────────── */
.aqs-result-card {
	background: #fff;
	border: 1px solid #e5e9ef;
	border-radius: 10px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: transform 0.22s cubic-bezier( 0.34, 1.56, 0.64, 1 ),
	            box-shadow 0.22s ease;
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.05 );
	animation: aqs-card-in 0.3s ease both;
}

@keyframes aqs-card-in {
	from { opacity: 0; transform: translateY( 12px ); }
	to   { opacity: 1; transform: translateY( 0 ); }
}

.aqs-result-card:hover {
	transform: translateY( -5px );
	box-shadow: 0 12px 32px rgba( 0, 0, 0, 0.10 );
}

/* Card image */
.aqs-card-image {
	position: relative;
	overflow: hidden;
	background: #f0f4f8;
	flex-shrink: 0;
}

.aqs-layout-grid .aqs-card-image {
	height: 180px;
}

.aqs-card-image a {
	display: block;
	height: 100%;
}

.aqs-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

.aqs-result-card:hover .aqs-card-image img {
	transform: scale( 1.05 );
}

.aqs-card-image-placeholder {
	width: 100%;
	height: 180px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient( 135deg, #e8f5ee, #d4ede0 );
	font-size: 48px;
	opacity: 0.5;
}

/* Card body */
.aqs-card-body {
	padding: 18px 20px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	flex: 1;
}

/* Title */
.aqs-result-title {
	margin: 0;
	font-size: 1em;
	font-weight: 700;
	line-height: 1.4;
}

.aqs-result-title a {
	color: #1a202c;
	text-decoration: none;
	transition: color 0.18s;
}

.aqs-result-title a:hover {
	color: #1a4731;
}

/* Tags */
.aqs-result-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.aqs-tag {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 20px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.aqs-tag--level {
	background: #e8f5ee;
	color: #1a4731;
	border: 1px solid #b2d8c0;
}

.aqs-tag--cat {
	background: #fef3c7;
	color: #92400e;
	border: 1px solid #fcd34d;
}

/* Excerpt */
.aqs-result-excerpt {
	margin: 0;
	font-size: 0.875em;
	line-height: 1.65;
	color: #6b7280;
	flex: 1;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Card footer */
.aqs-card-footer {
	margin-top: auto;
}

.aqs-read-more {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 18px;
	background: #1a4731;
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	border-radius: 6px;
	transition: background 0.18s, transform 0.15s;
}

.aqs-read-more:hover {
	background: #155130;
	transform: translateY( -1px );
	color: #fff;
}

/* ── List layout ──────────────────────────────────────────────────────────── */
.aqs-layout-list .aqs-result-card {
	flex-direction: row;
}

.aqs-layout-list .aqs-card-image {
	width: 200px;
	min-height: 150px;
	flex-shrink: 0;
}

.aqs-layout-list .aqs-card-image img {
	height: 100%;
}

.aqs-layout-list .aqs-card-image-placeholder {
	height: 100%;
	min-height: 150px;
}

/* ── Pagination ───────────────────────────────────────────────────────────── */
.aqs-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 5px;
	margin-top: 28px;
	padding-top: 20px;
	border-top: 1.5px solid #f0f2f5;
}

.aqs-page-btn {
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	border: 1.5px solid #e5e7eb;
	border-radius: 6px;
	background: #fff;
	color: #4b5563;
	font-size: 14px;
	cursor: pointer;
	transition: all 0.18s;
}

.aqs-page-btn:hover {
	border-color: #1a4731;
	color: #1a4731;
}

.aqs-page-btn.active {
	background: #1a4731;
	border-color: #1a4731;
	color: #fff;
	font-weight: 700;
}

.aqs-page-ellipsis {
	padding: 0 4px;
	color: #d1d5db;
	font-size: 16px;
	user-select: none;
}

/* ── Accessibility ────────────────────────────────────────────────────────── */
.aqs-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0,0,0,0);
	border: 0;
}

.aqs-search-btn:focus-visible,
.aqs-reset-btn:focus-visible,
.aqs-sort-pill:focus-visible,
.aqs-page-btn:focus-visible,
.aqs-input:focus-visible {
	outline: 3px solid #1a4731;
	outline-offset: 2px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media ( max-width: 767px ) {
	.aqs-filter-bar {
		flex-direction: column;
		align-items: stretch;
		padding: 12px;
		gap: 8px;
		min-height: auto;
	}

	.aqs-bar-search {
		border-right: none;
		border-bottom: 1.5px solid #e8ecf0;
		padding-right: 0;
		padding-bottom: 10px;
	}

	.aqs-bar-field {
		flex: none;
	}

	.aqs-select-pill {
		height: 46px;
	}

	.aqs-search-btn {
		width: 100%;
		height: 48px;
		border-radius: 8px;
		justify-content: center;
		margin-top: 2px;
	}

	.aqs-layout-grid .aqs-results-grid,
	.aqs-layout-list .aqs-results-grid {
		grid-template-columns: 1fr;
	}

	.aqs-layout-list .aqs-result-card {
		flex-direction: column;
	}

	.aqs-layout-list .aqs-card-image {
		width: 100%;
		height: 170px;
	}

	.aqs-results-topbar {
		flex-direction: column;
		align-items: flex-start;
	}
}

@media ( min-width: 768px ) and ( max-width: 1024px ) {
	.aqs-layout-grid .aqs-results-grid {
		grid-template-columns: repeat( 2, 1fr );
	}
}
