/* نوشته‌های مرتبط — کادر گرادیانی، بنر متحرک، تصویر گرد با محو آرام */

.wpcustomcrm-related-posts {
	--wpcrm-rp-accent-1: #6366f1;
	--wpcrm-rp-accent-2: #a855f7;
	--wpcrm-rp-accent-3: #ec4899;
	--wpcrm-rp-accent-4: #22d3ee;
	--wpcrm-rp-surface: #ffffff;
	--wpcrm-rp-surface-soft: #f8fafc;
	--wpcrm-rp-text: #1e293b;
	--wpcrm-rp-text-muted: #64748b;
	--wpcrm-rp-item-bg: rgba(255, 255, 255, 0.72);
	--wpcrm-rp-radius: 22px;
	--wpcrm-rp-thumb: 72px;
	--wpcrm-rp-font: "IRANYekan", Tahoma, Arial, sans-serif;
	margin: 2em 0;
	font-family: var(--wpcrm-rp-font);
	line-height: 1.5;
}

.wpcustomcrm-related-posts--has-font,
.wpcustomcrm-related-posts--has-font * {
	font-family: var(--wpcrm-rp-font);
}

/* کادر بیرونی با حاشیهٔ گرادیانی متحرک (آهسته) */
.wpcustomcrm-related-posts__frame {
	position: relative;
	padding: 3px;
	border-radius: var(--wpcrm-rp-radius);
	overflow: visible;
	background: linear-gradient(
		125deg,
		var(--wpcrm-rp-accent-1),
		var(--wpcrm-rp-accent-2),
		var(--wpcrm-rp-accent-3),
		var(--wpcrm-rp-accent-4),
		var(--wpcrm-rp-accent-1)
	);
	background-size: 320% 320%;
	animation: wpcrm-rp-border-flow 18s ease-in-out infinite;
	box-shadow:
		0 4px 24px rgba(99, 102, 241, 0.12),
		0 12px 40px rgba(168, 85, 247, 0.08);
}

.wpcustomcrm-related-posts__inner {
	position: relative;
	padding: 20px 18px 20px;
	border-radius: calc(var(--wpcrm-rp-radius) - 3px);
	background: linear-gradient(165deg, var(--wpcrm-rp-surface) 0%, var(--wpcrm-rp-surface-soft) 100%);
	overflow: visible;
}

.wpcustomcrm-related-posts__inner::before {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(ellipse 80% 50% at 100% 0%, rgba(99, 102, 241, 0.06), transparent 55%),
		radial-gradient(ellipse 60% 40% at 0% 100%, rgba(236, 72, 153, 0.05), transparent 50%);
	pointer-events: none;
}

/* بنر علایق / دسته — کادر شکیل با حرکت بسیار آرام */
.wpcustomcrm-related-posts__banner {
	position: relative;
	z-index: 1;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin: 0 0 18px;
	padding: 14px 16px;
	border-radius: 14px;
	background: linear-gradient(
		110deg,
		rgba(99, 102, 241, 0.1) 0%,
		rgba(168, 85, 247, 0.12) 35%,
		rgba(34, 211, 238, 0.08) 70%,
		rgba(236, 72, 153, 0.1) 100%
	);
	background-size: 200% 200%;
	animation: wpcrm-rp-banner-shift 14s ease-in-out infinite;
	border: 1px solid rgba(99, 102, 241, 0.18);
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.85),
		0 2px 12px rgba(99, 102, 241, 0.1);
}

.wpcustomcrm-related-posts__banner::after {
	content: "";
	position: absolute;
	inset: -1px;
	border-radius: inherit;
	padding: 1px;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
	background-size: 200% 100%;
	animation: wpcrm-rp-banner-shine 10s ease-in-out infinite;
	-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	pointer-events: none;
	opacity: 0.6;
}

.wpcustomcrm-related-posts__banner-label {
	font-size: 15px;
	font-weight: 700;
	color: var(--wpcrm-rp-text);
	letter-spacing: -0.01em;
}

.wpcustomcrm-related-posts__banner-tags {
	font-size: 13px;
	font-weight: 500;
	color: var(--wpcrm-rp-accent-2);
	padding: 4px 12px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.75);
	border: 1px solid rgba(168, 85, 247, 0.2);
}

.wpcustomcrm-related-posts--category .wpcustomcrm-related-posts__banner-tags {
	color: #0e7490;
	border-color: rgba(34, 211, 238, 0.35);
}

/* لیست مقالات */
.wpcustomcrm-related-posts__list {
	position: relative;
	z-index: 1;
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 12px;
}

.wpcustomcrm-related-posts__list > .wpcustomcrm-related-posts__item {
	min-width: 0;
}

/* ستونی: کارت عمودی (سایدبار) */
.wpcustomcrm-related-posts--layout-column .wpcustomcrm-related-posts__item {
	display: flex !important;
	flex-direction: column !important;
	align-items: center !important;
	text-align: center;
}

.wpcustomcrm-related-posts--layout-column .wpcustomcrm-related-posts__item--has-thumb {
	gap: 10px;
}

.wpcustomcrm-related-posts--layout-column .wpcustomcrm-related-posts__title {
	text-align: center;
	width: 100%;
}

/* سطری: تصویر کنار عنوان (فوتر) */
.wpcustomcrm-related-posts--layout-row .wpcustomcrm-related-posts__item {
	flex-direction: row;
	align-items: center;
	text-align: start;
}

.wpcustomcrm-related-posts__item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 14px;
	border-radius: 14px;
	background: var(--wpcrm-rp-item-bg);
	border: 1px solid rgba(226, 232, 240, 0.9);
	backdrop-filter: blur(6px);
	transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}

.wpcustomcrm-related-posts__item:hover {
	border-color: rgba(99, 102, 241, 0.35);
	box-shadow: 0 6px 20px rgba(99, 102, 241, 0.1);
	transform: translateY(-1px);
}

/* تصویر شاخص — دایره؛ پس‌زمینه از style#wpcustomcrm-rp-thumb-bg در فوتر (Elementor) */
.wpcustomcrm-related-posts__thumb {
	flex: 0 0 var(--wpcrm-rp-thumb);
	width: var(--wpcrm-rp-thumb);
	height: var(--wpcrm-rp-thumb);
	display: block;
	border-radius: 50%;
	overflow: hidden;
	box-shadow:
		0 0 0 2px rgba(255, 255, 255, 0.9),
		0 0 0 3px rgba(99, 102, 241, 0.25),
		0 4px 14px rgba(99, 102, 241, 0.2);
	transition: box-shadow 0.4s ease, transform 0.4s ease;
}

.wpcustomcrm-related-posts__thumb--photo {
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

.wpcustomcrm-related-posts__item:hover .wpcustomcrm-related-posts__thumb {
	box-shadow:
		0 0 0 2px #fff,
		0 0 0 3px rgba(168, 85, 247, 0.45),
		0 6px 18px rgba(168, 85, 247, 0.25);
	transform: scale(1.03);
}

.wpcustomcrm-related-posts__thumb img,
.wpcustomcrm-related-posts__thumb-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 1;
	filter: none;
	animation: wpcrm-rp-thumb-reveal 1.2s ease-out forwards;
}

.wpcustomcrm-related-posts__item:hover .wpcustomcrm-related-posts__thumb img,
.wpcustomcrm-related-posts__item:hover .wpcustomcrm-related-posts__thumb-img {
	transform: scale(1.04);
	transition: transform 0.35s ease;
}

/* جایگزین وقتی نوشته تصویر شاخص ندارد */
.wpcustomcrm-related-posts__thumb--placeholder {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: visible;
	box-shadow:
		0 0 0 2px rgba(255, 255, 255, 0.95),
		0 0 0 3px rgba(99, 102, 241, 0.28),
		0 4px 16px rgba(99, 102, 241, 0.22);
}

.wpcustomcrm-related-posts__thumb-ph-ring {
	position: absolute;
	inset: -3px;
	border-radius: 50%;
	background: conic-gradient(
		from 200deg,
		var(--wpcrm-rp-accent-1),
		var(--wpcrm-rp-accent-2),
		var(--wpcrm-rp-accent-3),
		var(--wpcrm-rp-accent-4),
		var(--wpcrm-rp-accent-1)
	);
	animation: wpcrm-rp-border-flow 14s linear infinite;
	z-index: 0;
}

.wpcustomcrm-related-posts__thumb-ph-ring::after {
	content: "";
	position: absolute;
	inset: 3px;
	border-radius: 50%;
	background: linear-gradient(145deg, #eef2ff 0%, #fdf4ff 100%);
}

.wpcustomcrm-related-posts__thumb-ph-letter {
	position: relative;
	z-index: 1;
	font-size: 22px;
	font-weight: 800;
	line-height: 1;
	color: var(--wpcrm-rp-accent-2);
	text-transform: uppercase;
}

/* فقط عنوان */
.wpcustomcrm-related-posts__title {
	flex: 1;
	min-width: 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--wpcrm-rp-text);
	text-decoration: none;
	line-height: 1.55;
	transition: color 0.3s ease;
}

.wpcustomcrm-related-posts__title:hover {
	color: var(--wpcrm-rp-accent-1);
}

.wpcustomcrm-related-posts__item--no-thumb .wpcustomcrm-related-posts__title {
	padding-inline-start: 4px;
}

.wpcustomcrm-related-posts__date {
	display: block;
	width: 100%;
	margin-top: 4px;
	font-size: 12px;
	color: var(--wpcrm-rp-text-muted);
}

/* دکمه همه مقالات این دسته */
.wpcustomcrm-related-posts__footer {
	position: relative;
	z-index: 3;
	margin: 0;
	padding: 16px 8px 4px;
	display: flex !important;
	justify-content: center;
	visibility: visible;
}

.wpcustomcrm-related-posts__category-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 14px 26px;
	border-radius: 999px;
	text-decoration: none;
	font-size: 15px;
	font-weight: 700;
	color: #fff;
	letter-spacing: -0.01em;
	background: linear-gradient(
		120deg,
		var(--wpcrm-rp-accent-1) 0%,
		var(--wpcrm-rp-accent-2) 38%,
		var(--wpcrm-rp-accent-3) 72%,
		var(--wpcrm-rp-accent-4) 100%
	);
	background-size: 220% 220%;
	animation: wpcrm-rp-btn-flow 12s ease-in-out infinite;
	box-shadow:
		0 4px 18px rgba(99, 102, 241, 0.35),
		0 8px 28px rgba(168, 85, 247, 0.2),
		inset 0 1px 0 rgba(255, 255, 255, 0.25);
	border: 1px solid rgba(255, 255, 255, 0.22);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	max-width: 100%;
}

.wpcustomcrm-related-posts__category-btn:hover,
.wpcustomcrm-related-posts__category-btn:focus-visible {
	color: #fff;
	text-decoration: none;
	transform: translateY(-2px);
	box-shadow:
		0 8px 26px rgba(99, 102, 241, 0.45),
		0 14px 36px rgba(236, 72, 153, 0.22),
		inset 0 1px 0 rgba(255, 255, 255, 0.35);
	outline: none;
}

.wpcustomcrm-related-posts__category-btn-icon,
.wpcustomcrm-related-posts__category-btn-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	opacity: 0.95;
}

.wpcustomcrm-related-posts__category-btn-text {
	white-space: nowrap;
}

.wpcustomcrm-related-posts__category-btn-arrow {
	transition: transform 0.25s ease;
}

.wpcustomcrm-related-posts__category-btn:hover .wpcustomcrm-related-posts__category-btn-arrow,
.wpcustomcrm-related-posts__category-btn:focus-visible .wpcustomcrm-related-posts__category-btn-arrow {
	transform: translateX(-4px);
}

@keyframes wpcrm-rp-btn-flow {
	0%,
	100% {
		background-position: 0% 50%;
	}
	50% {
		background-position: 100% 50%;
	}
}

/* پیام خالی */
.wpcustomcrm-related-posts--empty .wpcustomcrm-related-posts__inner {
	padding-bottom: 14px;
}

.wpcustomcrm-related-posts--empty .wpcustomcrm-related-posts__empty {
	margin: 0;
	padding: 14px 16px;
	background: #fffbeb;
	border: 1px solid #fde68a;
	border-radius: 12px;
	color: #92400e;
	font-size: 14px;
}

@media (min-width: 640px) {
	.wpcustomcrm-related-posts__inner {
		padding: 22px 20px 20px;
	}

	.wpcustomcrm-related-posts__list {
		gap: 14px;
	}

	.wpcustomcrm-related-posts__title {
		font-size: 16px;
	}
}

/* فوتر سطری: در عرض کم اسکرول افقی ملایم */
.wpcustomcrm-related-posts--layout-row .wpcustomcrm-related-posts__list {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}

@keyframes wpcrm-rp-border-flow {
	0%,
	100% {
		background-position: 0% 50%;
	}
	50% {
		background-position: 100% 50%;
	}
}

@keyframes wpcrm-rp-banner-shift {
	0%,
	100% {
		background-position: 0% 50%;
	}
	50% {
		background-position: 100% 50%;
	}
}

@keyframes wpcrm-rp-banner-shine {
	0%,
	100% {
		background-position: 200% 0;
		opacity: 0.35;
	}
	50% {
		background-position: -100% 0;
		opacity: 0.75;
	}
}

@keyframes wpcrm-rp-thumb-reveal {
	0% {
		opacity: 0.65;
		transform: scale(0.94);
	}
	100% {
		opacity: 1;
		transform: scale(1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wpcustomcrm-related-posts__frame,
	.wpcustomcrm-related-posts__banner,
	.wpcustomcrm-related-posts__banner::after,
	.wpcustomcrm-related-posts__thumb img,
	.wpcustomcrm-related-posts__category-btn {
		animation: none;
	}

	.wpcustomcrm-related-posts__thumb img {
		opacity: 1;
		filter: none;
	}

	.wpcustomcrm-related-posts__item {
		transition: none;
	}

	.wpcustomcrm-related-posts__item:hover {
		transform: none;
	}

	.wpcustomcrm-related-posts__category-btn:hover,
	.wpcustomcrm-related-posts__category-btn:focus-visible {
		transform: none;
	}
}

@media (max-width: 480px) {
	.wpcustomcrm-related-posts__category-btn {
		width: 100%;
		padding: 13px 18px;
		font-size: 14px;
	}

	.wpcustomcrm-related-posts__category-btn-text {
		white-space: normal;
		text-align: center;
	}
}
