/* AJAX Post Loader - by امیراحسان مهدیزاده - persiantik.net */

.apl-wrapper {
	position: relative;
}

/* ---------- Progress bar (بالای باکس، هنگام لود صفحه بعدی) ---------- */
.apl-progress-bar {
	position: absolute;
	top: 0;
	left: 0;
	height: 3px;
	width: 0%;
	background-color: var(--primary, var(--apl-primary, #2271b1));
	transition: width 0.25s ease;
	z-index: 5;
}
.apl-wrapper.apl-loading-active .apl-progress-bar {
	width: 90%;
}

/* ---------- Loading spinner ---------- */
.apl-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 24px 0;
}
.apl-loading-text {
	font-size: 1rem;
}
/* برای مدل‌های متنی (text-fade/text-slide/text-radial/text-linear/text-underline)
   خود اسپینر متن «در حال بارگذاری» را دارد، پس span اصلی تکراری مخفی می‌شود */
.apl-loading.apl-loading-hide-text .apl-loading-text {
	display: none;
}

.apl-spinner {
	display: inline-block;
}

/* مدل circle (پیش‌فرض) */
.apl-spinner.apl-spinner-circle {
	width: 20px;
	height: 20px;
	border: 3px solid rgba(0, 0, 0, 0.15);
	border-top-color: var(--apl-primary);
	border-radius: 50%;
	animation: apl-spin-circle 0.7s linear infinite;
}
@keyframes apl-spin-circle {
	to { transform: rotate(360deg); }
}

/* مدل sticks: دو میله‌ی چرخان با رنگ primary/secondary */
.apl-spinner.apl-spinner-sticks {
	width: 60px;
	height: 16px;
	display: flex;
	justify-content: space-between;
	animation: apl-spin-sticks-0 2s infinite alternate;
}
.apl-spinner.apl-spinner-sticks::before,
.apl-spinner.apl-spinner-sticks::after {
	content: "";
	width: 16px;
	background: var(--apl-primary);
	animation: apl-spin-sticks-1 1s infinite alternate;
}
.apl-spinner.apl-spinner-sticks::after {
	background: var(--apl-secondary);
	--s: -1;
}
@keyframes apl-spin-sticks-0 {
	0%, 40%   { transform: rotate(0); }
	80%, 100% { transform: rotate(.5turn); }
}
@keyframes apl-spin-sticks-1 {
	80%, 100% { transform: translate(calc(var(--s, 1) * 14px)); }
}

/* مدل orbit4: چهار نقطه‌ی ژله‌ای دور هم (blob) */
.apl-spinner.apl-spinner-orbit4 {
	height: 50px;
	aspect-ratio: 2;
	border: 10px solid #000;
	box-sizing: border-box;
	background:
		radial-gradient(farthest-side, #fff 98%, #0000) left / 20px 20px,
		radial-gradient(farthest-side, #fff 98%, #0000) left / 20px 20px,
		radial-gradient(farthest-side, #fff 98%, #0000) center / 20px 20px,
		radial-gradient(farthest-side, #fff 98%, #0000) right / 20px 20px,
		#000;
	background-repeat: no-repeat;
	filter: blur(4px) contrast(10);
	animation: apl-spin-orbit4 1s infinite;
}
@keyframes apl-spin-orbit4 {
	100% { background-position: right, left, center, right; }
}

/* مدل orbit5: پنج نقطه‌ی ژله‌ای در چهار گوشه + مرکز */
.apl-spinner.apl-spinner-orbit5 {
	width: 80px;
	aspect-ratio: 1;
	border: 10px solid #000;
	box-sizing: border-box;
	background:
		radial-gradient(farthest-side, #fff 98%, #0000) top,
		radial-gradient(farthest-side, #fff 98%, #0000) top,
		radial-gradient(farthest-side, #fff 98%, #0000) left,
		radial-gradient(farthest-side, #fff 98%, #0000) right,
		radial-gradient(farthest-side, #fff 98%, #0000) bottom,
		#000;
	background-size: 20px 20px;
	background-repeat: no-repeat;
	filter: blur(4px) contrast(10);
	animation: apl-spin-orbit5 2s infinite;
}
@keyframes apl-spin-orbit5 {
	0%   { background-position: top, top, left, right, bottom; }
	25%  { background-position: right, top, left, right, bottom; }
	50%  { background-position: bottom, top, left, right, bottom; }
	75%  { background-position: left, top, left, right, bottom; }
	100% { background-position: top, top, left, right, bottom; }
}

/* مدل dots-grow: سه دایره‌ی در حال بزرگ/کوچک شدن پشت‌سرهم */
.apl-spinner.apl-spinner-dots-grow {
	width: 60px;
	aspect-ratio: 4;
	--_g: no-repeat radial-gradient(circle closest-side, #000 90%, #0000);
	background:
		var(--_g) 0% 50%,
		var(--_g) 50% 50%,
		var(--_g) 100% 50%;
	background-size: calc(100% / 3) 100%;
	animation: apl-spin-dots-grow 1s infinite linear;
}
@keyframes apl-spin-dots-grow {
	33% { background-size: calc(100% / 3) 0%,   calc(100% / 3) 100%, calc(100% / 3) 100%; }
	50% { background-size: calc(100% / 3) 100%, calc(100% / 3) 0%,   calc(100% / 3) 100%; }
	66% { background-size: calc(100% / 3) 100%, calc(100% / 3) 100%, calc(100% / 3) 0%; }
}

/* مدل bar-scan: نقطه‌ای که داخل یک نوار محو در حال حرکت است */
.apl-spinner.apl-spinner-bar-scan {
	height: 15px;
	aspect-ratio: 5;
	-webkit-mask: linear-gradient(90deg, #0000, #000 20% 80%, #0000);
	mask: linear-gradient(90deg, #0000, #000 20% 80%, #0000);
	background: radial-gradient(closest-side at 37.5% 50%, #000 94%, #0000) 0 / calc(80% / 3) 100%;
	animation: apl-spin-bar-scan .75s infinite linear;
}
@keyframes apl-spin-bar-scan {
	100% { background-position: 36.36%; }
}

/* مدل dots-bounce: سه نقطه که پشت‌سرهم می‌جهند */
.apl-spinner.apl-spinner-dots-bounce {
	width: 15px;
	aspect-ratio: 1;
	background: #000;
	border-radius: 50%;
	animation: apl-spin-dots-bounce 1s infinite linear alternate;
}
@keyframes apl-spin-dots-bounce {
	0%   { box-shadow: 15px 0, -25px 0; }
	50%  { box-shadow: 15px 0, -15px 0; }
	100% { box-shadow: 25px 0, -15px 0; }
}

/* مدل text-fade: متن «در حال بارگذاری» که محو و ظاهر می‌شود */
.apl-spinner.apl-spinner-text-fade {
	font-weight: bold;
	font-family: inherit;
	font-size: 1rem;
	animation: apl-spin-text-fade 1s linear infinite alternate;
}
.apl-spinner.apl-spinner-text-fade::before {
	content: "در حال بارگذاری";
}
@keyframes apl-spin-text-fade {
	to { opacity: 0; }
}

/* مدل text-slide: متن به‌صورت دوتایی می‌لغزد (برای همراستایی درست، فونت مونواسپیس لازم است) */
.apl-spinner.apl-spinner-text-slide {
	--c: #000;
	width: fit-content;
	font-weight: bold;
	font-family: monospace;
	font-size: 1rem;
	color: #0000;
	overflow: hidden;
	text-shadow: 0 0 var(--c), 16ch 0 var(--c);
	animation: apl-spin-text-slide 2s infinite linear;
}
.apl-spinner.apl-spinner-text-slide::before {
	content: "در حال بارگذاری";
}
@keyframes apl-spin-text-slide {
	to { text-shadow: -16ch 0 var(--c), 0ch 0 var(--c); }
}

/* مدل text-radial: پر شدن متن با یک افکت دایره‌ای */
.apl-spinner.apl-spinner-text-radial {
	width: fit-content;
	font-weight: bold;
	font-family: inherit;
	font-size: 1rem;
	background: radial-gradient(circle closest-side, #000 94%, #0000) right / calc(200% - 1em) 100%;
	animation: apl-spin-text-radial 1s infinite alternate linear;
}
.apl-spinner.apl-spinner-text-radial::before {
	content: "در حال بارگذاری";
	line-height: 1em;
	color: #0000;
	background: inherit;
	background-image: radial-gradient(circle closest-side, #fff 94%, #000);
	-webkit-background-clip: text;
	background-clip: text;
}
@keyframes apl-spin-text-radial {
	100% { background-position: left; }
}

/* مدل text-linear: پر شدن متن با یک افکت خطی */
.apl-spinner.apl-spinner-text-linear {
	width: fit-content;
	font-weight: bold;
	font-family: inherit;
	font-size: 1rem;
	background: linear-gradient(90deg, #000 50%, #0000 0) right / 200% 100%;
	animation: apl-spin-text-linear 2s infinite linear;
}
.apl-spinner.apl-spinner-text-linear::before {
	content: "در حال بارگذاری";
	color: #0000;
	padding: 0 5px;
	background: inherit;
	background-image: linear-gradient(90deg, #fff 50%, #000 0);
	-webkit-background-clip: text;
	background-clip: text;
}
@keyframes apl-spin-text-linear {
	100% { background-position: left; }
}

/* مدل text-underline: خط‌چین زیر متن که به‌صورت پله‌ای پر می‌شود */
.apl-spinner.apl-spinner-text-underline {
	width: fit-content;
	font-weight: bold;
	font-family: inherit;
	font-size: 1rem;
	padding: 0 5px 8px;
	background: repeating-linear-gradient(90deg, currentColor 0 8%, #0000 0 10%) 200% 100% / 200% 3px no-repeat;
	animation: apl-spin-text-underline 2s steps(6) infinite;
}
.apl-spinner.apl-spinner-text-underline::before {
	content: "در حال بارگذاری";
}
@keyframes apl-spin-text-underline {
	to { background-position: 80% 100%; }
}


/* ---------- Grid transition (none) ---------- */
.apl-items.apl-transition-none {
	display: grid;
	grid-template-columns: repeat(var(--apl-cols, 2), 1fr);
	gap: var(--apl-gap, 15px);
}

/* ---------- Fade transition ---------- */
.apl-items.apl-transition-fade {
	display: grid;
	grid-template-columns: repeat(var(--apl-cols, 2), 1fr);
	gap: var(--apl-gap, 15px);
}
.apl-items.apl-transition-fade .apl-item {
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.4s ease, transform 0.4s ease;
}
.apl-items.apl-transition-fade .apl-item.apl-visible {
	opacity: 1;
	transform: translateY(0);
}

/* ---------- Masonry (پیاده‌سازی با جاوااسکریپت به روش «کوتاه‌ترین ستون بعدی» مثل پینترست) ---------- */
.apl-items.apl-transition-masonry {
	position: relative;
}
.apl-items.apl-transition-masonry .apl-item {
	position: absolute;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.4s ease, transform 0.4s ease, left 0.25s ease, top 0.25s ease;
}
.apl-items.apl-transition-masonry .apl-item.apl-visible {
	opacity: 1;
	transform: translateY(0);
}

@media (max-width: 782px) {
	.apl-items.apl-transition-none,
	.apl-items.apl-transition-fade {
		grid-template-columns: 1fr;
	}
}

/* ---------- کارت پیش‌فرض ---------- */
.apl-card {
	background: #fff;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.apl-card-thumb img {
	width: 100%;
	height: auto;
	display: block;
}
.apl-card-body {
	padding: 14px 16px;
}
.apl-card-title {
	font-size: 17px;
	margin: 0 0 8px;
}
.apl-card-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	font-size: 12px;
	color: #777;
	margin-bottom: 8px;
}
.apl-card-excerpt {
	font-size: 13px;
	color: #555;
	line-height: 1.8;
	margin-bottom: 10px;
}
.apl-card-more {
	font-size: 13px;
	font-weight: 600;
}

/* ---------- صفحه‌بندی: ساختار مشترک ---------- */
/* روی body تا --primary قالب اگر روی body تعریف شده باشد دیده شود. :root پدر body است و آن متغیر را نمی‌بیند. */
body {
	--apl-primary: var(--primary, #2271b1);
	--apl-secondary: var(--secondary, #6c757d);
	--apl-gray1: var(--gray1, #e2e2e2);
	--apl-text: var(--text, #333333);
}

.apl-pagination {
	margin-top: 24px;
	display: flex;
	justify-content: center;
}
.apl-pagination-inner {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
	justify-content: center;
}
.apl-page-dots {
	padding: 0 4px;
	color: var(--apl-secondary);
	user-select: none;
}
.apl-page-arrow-label {
	display: none;
}

/* ---------- استایل پیش‌فرض (default) ---------- */
.apl-pagi-default .apl-page-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding: 0 8px;
	border-radius: 6px;
	background: #f1f1f1;
	text-decoration: none;
	color: #333;
	transition: background 0.2s, color 0.2s;
}
.apl-pagi-default .apl-page-num:hover {
	background: var(--apl-primary);
	color: #fff;
}
.apl-pagi-default .apl-page-num.apl-current {
	background: var(--apl-primary);
	color: #fff;
	pointer-events: none;
}
.apl-pagi-default .apl-page-arrow-prev::before {
	content: '\2039';
	font-size: 20px;
}
.apl-pagi-default .apl-page-arrow-next::before {
	content: '\203A';
	font-size: 20px;
}

/* ---------- المان مشترک: نشانگر متحرک (magic line / hover overlay) ---------- */
.apl-pagi-indicator {
	position: absolute;
	opacity: 0;
	z-index: 1;
	pointer-events: none;
	transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
		top 0.3s cubic-bezier(0.4, 0, 0.2, 1), height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
		opacity 0.25s ease, background-color 0.25s ease;
}
.apl-pagi-indicator.apl-pagi-indicator--instant {
	transition: none !important;
}

/* ---------- استایل pagi1: باکس گرد با هاور و اکتیو متحرک (الهام از Hover/Active Pagination) ---------- */
.apl-pagi-pagi1 {
	background: #fff;
	border: 1px solid var(--apl-gray1);
	border-radius: 12px;
	padding: 6px;
	gap: 4px;
	position: relative;
}
.apl-pagi-pagi1 .apl-pagi-indicator {
	border-radius: 7px;
	background: var(--apl-primary);
}
.apl-pagi-pagi1 .apl-pagi-indicator.apl-pagi-indicator--hover {
	background: var(--apl-secondary);
}
.apl-pagi-pagi1 .apl-page-num {
	position: relative;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 6px;
	font-weight: 700;
	font-size: 1rem;
	color: var(--apl-secondary);
	text-decoration: none;
	transition: color 0.25s;
}
.apl-pagi-pagi1 .apl-page-num.apl-pagi-highlighted {
	color: #fff;
}
.apl-pagi-pagi1 .apl-page-prev,
.apl-pagi-pagi1 .apl-page-next {
	color: var(--apl-secondary);
	background: transparent;
}
.apl-pagi-pagi1 .apl-page-prev:hover,
.apl-pagi-pagi1 .apl-page-next:hover {
	background: var(--apl-gray1);
	color: var(--apl-secondary);
}
.apl-pagi-pagi1 .apl-page-arrow-prev::before {
	content: '\2039';
	font-size: 18px;
}
.apl-pagi-pagi1 .apl-page-arrow-next::before {
	content: '\203A';
	font-size: 18px;
}

/* ---------- استایل pagi2: نوار سراسری با خط لغزان (الهام از Magic Line Pagination) ---------- */
.apl-pagi-pagi2 {
	width: 100%;
	display: flex;
	align-items: stretch;
	flex-wrap: nowrap;
	gap: 0;
	position: relative;
	padding-top: 14px;
}

/* ریل خاکستری سراسری بالای اعداد (چون بک‌گراند سایت سفیده، رنگش غیرسفید است) */
.apl-pagi-pagi2::before {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	height: 2px;
	background: var(--apl-gray1);
}

/* بخش رنگی که روی همان ریل، محل صفحه‌ی جاری/هاورشده را لغزان مشخص می‌کند */
.apl-pagi-pagi2 .apl-pagi-indicator {
	top: 0;
	height: 2px;
	background: var(--apl-primary);
}

.apl-pagi-pagi2 .apl-page-num,
.apl-pagi-pagi2 .apl-page-dots {
	flex: 1 1 0;
}
.apl-pagi-pagi2 .apl-page-num {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	height: 46px;
	padding: 0 4px;
	color: var(--apl-secondary);
	text-decoration: none;
	font-weight: 600;
	font-size: 1rem;
	transition: color 0.25s;
}
.apl-pagi-pagi2 .apl-page-dots {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--apl-secondary);
}
.apl-pagi-pagi2 .apl-page-num:not(.apl-page-prev):not(.apl-page-next):hover,
.apl-pagi-pagi2 .apl-page-num.apl-current {
	color: var(--apl-primary);
}
.apl-pagi-pagi2 .apl-page-num.apl-current {
	pointer-events: none;
}

/* قبلی/بعدی: عریض‌تر، با آیکون فلش و برچسب متنی هم‌تراز */
.apl-pagi-pagi2 .apl-page-prev,
.apl-pagi-pagi2 .apl-page-next {
	flex: 0 1 auto;
	min-width: 90px;
	gap: 6px;
	color: var(--apl-secondary);
	font-weight: 500;
	transition: color 0.25s;
}
.apl-pagi-pagi2 .apl-page-prev:hover,
.apl-pagi-pagi2 .apl-page-next:hover {
	color: var(--apl-primary);
}
.apl-pagi-pagi2 .apl-page-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	line-height: 1;
}
.apl-pagi-pagi2 .apl-page-arrow-prev::before {
	content: '\2039';
}
.apl-pagi-pagi2 .apl-page-arrow-next::before {
	content: '\203A';
}
.apl-pagi-pagi2 .apl-page-arrow-label {
	display: inline-block;
	font-size: 14px;
}

@media (max-width: 480px) {
	.apl-pagi-pagi2 .apl-page-prev,
	.apl-pagi-pagi2 .apl-page-next {
		min-width: 0;
	}
	.apl-pagi-pagi2 .apl-page-arrow-label {
		display: none;
	}
}

/* ---------- دکمه‌ی Load More ---------- */
.apl-loadmore-wrap {
	text-align: center;
	margin-top: 24px;
}
.apl-loadmore-btn {
	padding: 10px 26px;
	border-radius: 30px;
	border: 1px solid #2271b1;
	background: #fff;
	color: #2271b1;
	cursor: pointer;
	font-size: 14px;
	transition: background 0.2s, color 0.2s;
}
.apl-loadmore-btn:hover {
	background: #2271b1;
	color: #fff;
}
.apl-loadmore-btn[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}

.apl-infinite-sentinel {
	height: 1px;
}

/* ---------- شورت‌کد مرتب‌سازی ---------- */
.apl-sort-wrap {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 16px;
	font-size: 1rem;
}
.apl-sort-group {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
}
.apl-sort-label {
	color: var(--apl-text);
	font-weight: 600;
}
.apl-sort-count {
	color: var(--apl-secondary);
	font-size: 0.9rem;
	white-space: nowrap;
}
.apl-sort-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.apl-sort-btn {
	min-width: 100px;
	height: 50px;
	padding: 0 10px;
	border-radius: 10px;
	border: 1px solid var(--apl-gray1);
	background: #fff;
	color: var(--apl-text);
	font-size: 0.9rem;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.apl-sort-btn.apl-sort-btn-active {
	border-color: var(--apl-primary);
	background: var(--apl-primary);
	color: #fff;
}
.apl-sort-select {
	display: none;
	box-sizing: border-box;
	min-width: 0;
	height: 44px;
	padding: 0 12px;
	border-radius: 10px;
	border: 1px solid var(--apl-gray1);
	background: #fff;
	color: var(--apl-text);
	font-size: 0.95rem;
	font-family: inherit;
}

@media (max-width: 767px) {
	.apl-sort--hide-count-mobile .apl-sort-count {
		display: none;
	}

	.apl-sort--collapse-mobile .apl-sort-buttons {
		display: none;
	}

	.apl-sort--collapse-mobile .apl-sort-group {
		flex: 1 1 auto;
		min-width: 0;
	}

	.apl-sort--collapse-mobile .apl-sort-select {
		display: block;
		flex: 1 1 140px;
		width: auto;
		max-width: 100%;
	}
}

.apl-no-posts {
	text-align: center;
	padding: 30px 0;
	color: #777;
}
