/* Ahmed's Filters - front-end styles */

.ahflt-wrap {
	display: grid;
	gap: 32px;
	position: relative;
}

.ahflt-layout--sidebar {
	grid-template-columns: 260px minmax(0, 1fr);
	align-items: start;
}

.ahflt-layout--top {
	grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 900px) {
	.ahflt-layout--sidebar {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Filters panel */
.ahflt-filters {
	display: flex;
	flex-direction: column;
	gap: 20px;
	background: #fff;
	border: 1px solid #e6e6e6;
	border-radius: 12px;
	padding: 20px;
}

.ahflt-layout--top .ahflt-filters {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: flex-end;
}

.ahflt-layout--top .ahflt-filter {
	flex: 1 1 200px;
	min-width: 180px;
}

.ahflt-filter__label {
	display: block;
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 8px;
	line-height: 1.3;
}

.ahflt-search-input,
.ahflt-tax-select,
.ahflt-sort-select,
.ahflt-price-min,
.ahflt-price-max {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid #d5d5d5;
	border-radius: 8px;
	font-size: 14px;
	line-height: 1.4;
	box-sizing: border-box;
	background: #fff;
	color: inherit;
}

.ahflt-search-input:focus,
.ahflt-tax-select:focus,
.ahflt-sort-select:focus,
.ahflt-price-min:focus,
.ahflt-price-max:focus {
	outline: none;
	border-color: #111;
	box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.ahflt-checkboxes {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 230px;
	overflow-y: auto;
	padding-right: 4px;
}

.ahflt-checkbox {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	line-height: 1.3;
	cursor: pointer;
}

.ahflt-checkbox input {
	margin: 0;
	flex: 0 0 auto;
}

.ahflt-price-inputs {
	display: flex;
	align-items: center;
	gap: 8px;
}

.ahflt-price-sep {
	color: #999;
	flex: 0 0 auto;
}

.ahflt-reset {
	background: transparent;
	border: none;
	color: #666;
	text-decoration: underline;
	cursor: pointer;
	font-size: 13px;
	padding: 0;
	align-self: flex-start;
}

.ahflt-reset:hover {
	color: #111;
}

/* Results grid */
.ahflt-grid {
	display: grid;
	gap: 24px;
}

.ahflt-grid--cols-1 { grid-template-columns: minmax(0, 1fr); }
.ahflt-grid--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ahflt-grid--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ahflt-grid--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ahflt-grid--cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ahflt-grid--cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

@media (max-width: 1024px) {
	.ahflt-grid--cols-4,
	.ahflt-grid--cols-5,
	.ahflt-grid--cols-6 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 782px) {
	.ahflt-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 480px) {
	.ahflt-grid {
		grid-template-columns: minmax(0, 1fr) !important;
	}
}

/* Cards */
.ahflt-card {
	border: 1px solid #ececec;
	border-radius: 12px;
	overflow: hidden;
	background: #fff;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ahflt-card:hover {
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
}

.ahflt-card__link {
	text-decoration: none;
	color: inherit;
	display: block;
	height: 100%;
}

.ahflt-card__thumb img {
	width: 100%;
	height: auto;
	display: block;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.ahflt-card__thumb--empty {
	aspect-ratio: 4 / 3;
	background: linear-gradient(135deg, #f2f2f2, #e8e8e8);
}

.ahflt-card__body {
	padding: 16px;
}

.ahflt-card__title {
	font-size: 16px;
	margin: 0 0 8px;
	line-height: 1.35;
}

.ahflt-card__excerpt {
	font-size: 14px;
	color: #666;
	line-height: 1.5;
	margin: 0;
}

.ahflt-card__price {
	font-weight: 700;
	color: #111;
	font-size: 15px;
}

.ahflt-card__price del {
	color: #999;
	font-weight: 400;
	margin-right: 6px;
}

/* Empty state */
.ahflt-no-results {
	padding: 48px 24px;
	text-align: center;
	color: #888;
	border: 1px dashed #ddd;
	border-radius: 12px;
	font-size: 15px;
}

/* Pagination */
.ahflt-pagination {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	margin-top: 28px;
	justify-content: center;
}

.ahflt-page {
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	border: 1px solid #ddd;
	background: #fff;
	border-radius: 8px;
	cursor: pointer;
	font-size: 14px;
	color: inherit;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.ahflt-page:hover {
	border-color: #111;
}

.ahflt-page.is-active {
	background: #111;
	color: #fff;
	border-color: #111;
	cursor: default;
}

/* Loading state */
.ahflt-wrap.is-loading .ahflt-results {
	opacity: 0.4;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.ahflt-wrap.is-loading::after {
	content: "";
	position: absolute;
	top: 40px;
	left: 50%;
	width: 34px;
	height: 34px;
	margin-left: -17px;
	border: 3px solid rgba(0, 0, 0, 0.15);
	border-top-color: #111;
	border-radius: 50%;
	animation: ahflt-spin 0.7s linear infinite;
	z-index: 5;
}

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

/* ------------------------------------------------------------------ *
 * Loop Grid filter bar (tabs / dropdown)
 * ------------------------------------------------------------------ */

.ahflt-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin-bottom: 24px;
	position: relative;
}

.ahflt-tab {
	appearance: none;
	border: 1px solid #dcdcdc;
	background: #f6f6f6;
	color: #333;
	font-size: 15px;
	line-height: 1.2;
	padding: 10px 18px;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
	white-space: nowrap;
}

.ahflt-tab:not(.is-active):hover {
	border-color: #111;
}

.ahflt-tab.is-active {
	background: #111;
	color: #fff;
	border-color: #111;
	cursor: default;
}

.ahflt-bar-select,
.ahflt-bar--dropdown .ahflt-bar-select {
	padding: 10px 14px;
	border: 1px solid #d5d5d5;
	border-radius: 8px;
	font-size: 15px;
	min-width: 220px;
	background: #fff;
	color: inherit;
}

.ahflt-bar.is-loading::after {
	content: "";
	position: absolute;
	right: 0;
	top: 50%;
	width: 18px;
	height: 18px;
	margin-top: -9px;
	border: 2px solid rgba(0, 0, 0, 0.15);
	border-top-color: #111;
	border-radius: 50%;
	animation: ahflt-spin 0.7s linear infinite;
}

.ahflt-bar-notice {
	padding: 10px 14px;
	border: 1px dashed #cbb;
	border-radius: 8px;
	color: #a15;
	background: #fff6f8;
	font-size: 14px;
}

/* Smooth cross-fade when the target grid swaps its items */
.ahflt-target-fade {
	opacity: 0.35;
	transition: opacity 0.15s ease;
}

/* ------------------------------------------------------------------ *
 * RTL support
 * ------------------------------------------------------------------ */

.rtl .ahflt-reset,
[dir="rtl"] .ahflt-reset {
	align-self: flex-end;
}

.rtl .ahflt-bar.is-loading::after,
[dir="rtl"] .ahflt-bar.is-loading::after {
	right: auto;
	left: 0;
}

.rtl .ahflt-card__price del,
[dir="rtl"] .ahflt-card__price del {
	margin-right: 0;
	margin-left: 6px;
}

.rtl .ahflt-wrap.is-loading::after,
[dir="rtl"] .ahflt-wrap.is-loading::after {
	left: auto;
	right: 50%;
	margin-left: 0;
	margin-right: -17px;
}

.rtl .ahflt-checkboxes,
[dir="rtl"] .ahflt-checkboxes {
	padding-right: 0;
	padding-left: 4px;
}

/* Admin-only diagnostic note (visible to logged-in admins only) */
.ahflt-admin-note {
	margin: 8px 0 16px;
	padding: 10px 14px;
	background: #fff6f8;
	border: 1px solid #f0c0cc;
	border-radius: 8px;
	color: #a1152b;
	font-size: 13px;
	line-height: 1.5;
}
