/**
 * بهبودهای جستجوی پیشرفته
 * فاز 1: اسلایدر محدوده قیمت، انیمیشن‌ها، دکمه بازنشانی، تعداد نتایج
 */

/* ========== اسلایدر محدوده قیمت ========== */
.mlm-price-filter-wrapper {
	position: relative;
}

.mlm-range-slider-container {
	padding: 15px 10px;
}

.mlm-range-slider-wrapper {
	position: relative;
	height: 50px;
	margin-bottom: 10px;
}

.mlm-range-slider {
	position: absolute;
	width: 100%;
	height: 6px;
	background: transparent;
	outline: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	pointer-events: none;
	z-index: 2;
}

.mlm-range-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	background: #fea000;
	border-radius: 50%;
	cursor: pointer;
	pointer-events: all;
	box-shadow: 0 2px 6px rgba(254, 160, 0, 0.4);
	transition: all 0.3s ease;
	position: relative;
	z-index: 3;
}

.mlm-range-slider::-webkit-slider-thumb:hover {
	transform: scale(1.15);
	box-shadow: 0 3px 10px rgba(254, 160, 0, 0.6);
	background: #ffb733;
}

.mlm-range-slider::-moz-range-thumb {
	width: 20px;
	height: 20px;
	background: #fea000;
	border-radius: 50%;
	cursor: pointer;
	pointer-events: all;
	box-shadow: 0 2px 6px rgba(254, 160, 0, 0.4);
	transition: all 0.3s ease;
	border: none;
	position: relative;
	z-index: 3;
}

.mlm-range-slider::-moz-range-thumb:hover {
	transform: scale(1.15);
	box-shadow: 0 3px 10px rgba(254, 160, 0, 0.6);
	background: #ffb733;
}

.mlm-range-slider-track {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	height: 6px;
	background: #e0e0e0;
	border-radius: 3px;
	transform: translateY(-50%);
	z-index: 1;
}

.mlm-range-slider-progress {
	position: absolute;
	height: 100%;
	background: linear-gradient(90deg, #fea000 0%, #ffb733 100%);
	border-radius: 3px;
	transition: all 0.3s ease;
}

.mlm-range-values {
	padding: 8px 0;
	font-size: 13px;
}

.mlm-range-value-min,
.mlm-range-value-max {
	display: flex;
	align-items: center;
	gap: 5px;
	font-weight: 600;
	color: #333;
}

.mlm-range-label {
	color: #666;
	font-weight: 400;
	font-size: 12px;
}

.mlm-range-value-text {
	color: #fea000;
	font-size: 14px;
	font-weight: 700;
}

.mlm-range-currency {
	color: #666;
	font-size: 11px;
	margin-right: 2px;
}

.mlm-range-separator {
	color: #999;
	font-weight: 300;
	margin: 0 10px;
}

/* ========== انیمیشن‌های پایه ========== */

/* سایدبار موبایل - بدون انیمیشن (iOS style) */
@media (max-width: 991px) {
	.app-search-page-wrapper {
		backdrop-filter: blur(5px);
		-webkit-backdrop-filter: blur(5px);
		/* NO TRANSITION - iOS style */
		/* NO SHADOW - iOS style */
		box-shadow: none !important;
	}
	
	.app-search-page-wrapper.open {
		/* NO ANIMATION - iOS style */
	}
	
	.app-search-page-wrapper:not(.open) {
		/* NO ANIMATION - iOS style */
	}
	
	/* پس‌زمینه برای سایدبار موبایل */
	.app-search-page-wrapper::before {
		content: '';
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0, 0, 0, 0.5);
		opacity: 0;
		pointer-events: none;
		/* NO TRANSITION - iOS style */
		z-index: -1;
	}
	
	.app-search-page-wrapper.open::before {
		opacity: 1;
		pointer-events: all;
	}
}

/* ویجت‌های فیلتر - بدون انیمیشن (iOS style) */
.mlm-filters-widget {
	/* NO ANIMATION - iOS style */
	opacity: 1;
}

/* باز و بسته شدن دسته‌بندی - بدون انیمیشن (iOS style) */
.mlm-filters-widget .category-item .childs {
	display: none !important;
	max-height: 0;
	overflow: hidden;
	/* NO TRANSITION - iOS style */
	padding-top: 0;
	padding-bottom: 0;
}

.mlm-filters-widget .category-item.open .childs {
	display: block !important;
	max-height: 1000px;
	padding-top: 8px;
	padding-bottom: 8px;
	/* NO ANIMATION - iOS style */
}

.mlm-filters-widget .category-item .toggle {
	/* NO TRANSITION - iOS style */
}

.mlm-filters-widget .category-item.open .toggle {
	transform: rotate(90deg);
}

/* چک‌باکس - بدون انیمیشن (iOS style) */
.mlm-filters-widget .form-check-input {
	/* NO TRANSITION - iOS style */
	cursor: pointer;
}

.mlm-filters-widget .form-check-input:checked {
	/* NO ANIMATION - iOS style */
}

.mlm-filters-widget .form-check-label {
	/* NO TRANSITION - iOS style */
	cursor: pointer;
}

.mlm-filters-widget .form-check-input:checked + .form-check-label {
	color: #fea000;
	font-weight: 600;
}

/* ========== دکمه پاک کردن فیلترها ========== */
.mlm-reset-filters-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	background: #6c757d;
	color: white;
	border: none;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.3s ease;
	margin-top: 15px;
	margin-bottom: 10px;
}

.mlm-reset-filters-btn:hover {
	background: #5a6268;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.mlm-reset-filters-btn:active {
	transform: translateY(0);
}

.mlm-reset-filters-btn svg {
	width: 16px;
	height: 16px;
	transition: transform 0.3s ease;
}

.mlm-reset-filters-btn:hover svg {
	transform: rotate(-180deg);
}

/* نمایش تعداد نتایج حذف شده */

/* ========== حالت بارگذاری ========== */
.mlm-search-loading {
	position: relative;
	opacity: 0.6;
	pointer-events: none;
}

.mlm-search-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	margin: -20px 0 0 -20px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #fea000;
	border-radius: 50%;
	animation: spin 1s linear infinite;
	z-index: 10;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* ========== واکنش‌گرا ========== */
@media (max-width: 767px) {
	.mlm-range-values {
		flex-direction: column;
		gap: 10px;
		align-items: flex-start;
	}
	
	.mlm-range-separator {
		display: none;
	}
	
	.mlm-range-value-min,
	.mlm-range-value-max {
		width: 100%;
		justify-content: space-between;
	}
}

/* ========== فاز 2: انیمیشن‌های پیشرفته و بهبودهای UI ========== */

/* نتایج جستجو - بدون انیمیشن (iOS style) */
/* اطمینان از نمایش دکمه hover بالای کارت‌های دیگر */
.app-products-archive .row,
.modern-product-grid,
.modern-search-grid {
	position: relative;
	overflow: visible; /* اجازه نمایش دکمه‌ها از کارت */
	z-index: 1;
}

.app-products-archive .col-12,
.app-products-archive .col-sm-6,
.app-products-archive .col-xl-4,
.modern-product-grid .modern-product-item,
.modern-search-grid .modern-product-item {
	opacity: 1;
	/* NO ANIMATION - iOS style */
	position: relative; /* برای z-index */
	z-index: 1; /* z-index پایه برای ایجاد stacking context */
	overflow: visible; /* اجازه نمایش دکمه‌های hover */
}

/* افزایش z-index برای column هنگام hover کارت محصول داخلش */
.app-products-archive .col-12:has(.modern-product-card:hover),
.app-products-archive .col-sm-6:has(.modern-product-card:hover),
.app-products-archive .col-xl-4:has(.modern-product-card:hover),
.app-products-archive .col-12:has(.archive-item:hover),
.app-products-archive .col-sm-6:has(.archive-item:hover),
.app-products-archive .col-xl-4:has(.archive-item:hover) {
	z-index: 100; /* افزایش z-index هنگام hover کارت برای نمایش بالای columns دیگر */
}

/* Fallback برای مرورگرهایی که :has را پشتیبانی نمی‌کنند */
@supports not selector(:has(*)) {
	.app-products-archive .col-12:hover,
	.app-products-archive .col-sm-6:hover,
	.app-products-archive .col-xl-4:hover {
		z-index: 100;
	}
}

/* Skeleton Loading */
.mlm-skeleton-loading {
	padding: 20px 0;
}

.mlm-skeleton-item {
	background: white;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 15px;
	margin-bottom: 20px;
	/* NO SHADOW - iOS style */
	box-shadow: none !important;
}

.mlm-skeleton-image {
	width: 100%;
	height: 200px;
	margin-bottom: 15px;
	border-radius: 6px;
	background: #f0f0f0;
	/* NO ANIMATION - iOS style */
}

.mlm-skeleton-title {
	width: 70%;
	height: 20px;
	margin-bottom: 12px;
	border-radius: 4px;
	background: #f0f0f0;
	/* NO ANIMATION - iOS style */
}

.mlm-skeleton-text {
	width: 90%;
	height: 16px;
	margin-bottom: 8px;
	border-radius: 4px;
	background: #f0f0f0;
	/* NO ANIMATION - iOS style */
}

.mlm-skeleton-text.short {
	width: 50%;
}

.mlm-skeleton-price {
	width: 40%;
	height: 24px;
	margin-top: 15px;
	border-radius: 4px;
	background: #f0f0f0;
	/* NO ANIMATION - iOS style */
}

/* Badge های فیلترهای فعال */
.mlm-active-filters-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 15px;
	padding: 12px;
	background: #f8f9fa;
	border-radius: 8px;
	min-height: 50px;
}

.mlm-filter-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	background: linear-gradient(135deg, #fea000 0%, #ffb733 100%);
	color: white;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	/* NO ANIMATION - iOS style */
	cursor: default;
}

.mlm-filter-badge .badge-label {
	display: flex;
	align-items: center;
	gap: 4px;
}

.mlm-filter-badge .badge-remove {
	cursor: pointer;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.3);
	display: flex;
	align-items: center;
	justify-content: center;
	/* NO TRANSITION - iOS style */
	font-size: 12px;
	line-height: 1;
}

.mlm-filter-badge .badge-remove:hover {
	background: rgba(255, 255, 255, 0.5);
	/* NO transform - iOS style */
	transform: none !important;
}

/* Empty State بهبود یافته */
.mlm-empty-state {
	text-align: center;
	padding: 60px 20px;
	/* NO ANIMATION - iOS style */
}

.mlm-empty-state-icon {
	width: 120px;
	height: 120px;
	margin: 0 auto 30px;
	opacity: 0.3;
	/* NO ANIMATION - iOS style */
}

.mlm-empty-state-title {
	font-size: 24px;
	font-weight: 700;
	color: #333;
	margin-bottom: 15px;
}

.mlm-empty-state-text {
	font-size: 16px;
	color: #666;
	margin-bottom: 30px;
	line-height: 1.6;
}

.mlm-empty-state-suggestions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin-top: 30px;
}

.mlm-suggestion-tag {
	padding: 8px 16px;
	background: #f0f0f0;
	border-radius: 20px;
	font-size: 13px;
	color: #666;
	cursor: pointer;
	/* NO TRANSITION - iOS style */
	border: 1px solid transparent;
}

.mlm-suggestion-tag:hover {
	background: #fea000;
	color: white;
	border-color: #fea000;
	/* NO transform or shadow - iOS style */
	transform: none !important;
	box-shadow: none !important;
}

/* بهبود دسته‌بندی با نمایش تعداد */
.mlm-category-with-count {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
}

.mlm-category-count {
	font-size: 11px;
	color: #999;
	background: #f0f0f0;
	padding: 2px 8px;
	border-radius: 10px;
	font-weight: 500;
}

.mlm-filters-widget .form-check-input:checked ~ .mlm-category-count {
	background: #fea000;
	color: white;
}

/* بهبود Select */
.mlm-filters-widget select {
	transition: all 0.3s ease;
	border: 1px solid #ddd;
	border-radius: 6px;
}

.mlm-filters-widget select:focus {
	border-color: #fea000;
	box-shadow: 0 0 0 3px rgba(254, 160, 0, 0.1);
}

.mlm-filters-widget select:hover {
	border-color: #fea000;
}

/* ========== فاز 3: Live Search و View Toggle ========== */

/* Live Search Suggestions */
.mlm-live-search-suggestions {
	position: absolute;
	top: calc(100% + 10px);
	left: 0;
	right: 0;
	background: white;
	border-radius: 12px;
	border: 1px solid #e5e7eb;
	/* NO SHADOW - iOS style */
	box-shadow: none !important;
	z-index: 1000;
	max-height: 500px;
	overflow-y: auto;
	display: none;
	/* NO ANIMATION - iOS style */
}

.mlm-suggestions-section {
	padding: 10px 0;
	border-bottom: 1px solid #f0f0f0;
}

.mlm-suggestions-section:last-child {
	border-bottom: none;
}

.mlm-suggestions-header {
	padding: 8px 16px;
	font-size: 12px;
	font-weight: 700;
	color: #666;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	background: #f8f9fa;
}

.mlm-suggestions-list {
	max-height: 300px;
	overflow-y: auto;
}

.mlm-suggestion-item {
	border-bottom: 1px solid #f8f9fa;
	/* NO TRANSITION - iOS style */
}

.mlm-suggestion-item:last-child {
	border-bottom: none;
}

.mlm-suggestion-item:hover,
.mlm-suggestion-item.active {
	background: #f8f9fa;
}

.mlm-suggestion-item a {
	display: flex;
	align-items: center;
	padding: 12px 16px;
	text-decoration: none;
	color: inherit;
}

.suggestion-image {
	width: 50px;
	height: 50px;
	object-fit: cover;
	border-radius: 6px;
	margin-left: 12px;
	flex-shrink: 0;
}

.suggestion-icon {
	font-size: 24px;
	margin-left: 12px;
	width: 40px;
	text-align: center;
}

.suggestion-content {
	flex: 1;
	min-width: 0;
}

.suggestion-title {
	font-size: 14px;
	font-weight: 600;
	color: #333;
	margin-bottom: 4px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.suggestion-price {
	font-size: 13px;
	color: #fea000;
	font-weight: 600;
}

.mlm-search-suggestions-loading,
.mlm-search-suggestions-empty,
.mlm-search-suggestions-error {
	padding: 20px;
	text-align: center;
	color: #999;
	font-size: 14px;
}

.mlm-search-suggestions-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
}

.mlm-suggestions-footer {
	padding: 12px 16px;
	text-align: center;
	border-top: 2px solid #f0f0f0;
	background: #f8f9fa;
}

.mlm-suggestions-footer a {
	color: #fea000;
	font-weight: 600;
	text-decoration: none;
	font-size: 13px;
	/* NO TRANSITION - iOS style */
}

.mlm-suggestions-footer a:hover {
	color: #ffb733;
}

/* View Toggle حذف شده - فقط نمایش Grid */

