/* ============================================
 * Download Box - Redesign from Scratch
 * هماهنگ با استایل‌های وبلاگ
 * ============================================ */

.mlm-download-box {
	--dl-primary: var(--zh-blog-primary, #ff9606);
	--dl-text: #1f2937;
	--dl-subtext: #6b7280;
	--dl-meta: #9b9da2;
	--dl-border: rgba(15, 23, 42, 0.08);
	
	margin-top: 32px;
	padding: 18px 20px;
	border-radius: 5px;
	background: #fff;
	border: 1px solid var(--dl-border);
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.mlm-download-box__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.mlm-download-box__item {
	display: contents;
}

/* ساختار قدیمی - برای سازگاری (اکنون استفاده نمی‌شود) */
.mlm-download-box__link {
	display: none !important;
}

.mlm-download-box__icon {
	width: 40px;
	height: 40px;
	border-radius: 5px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 0.75rem;
	letter-spacing: 0.05em;
	color: #fff;
	background: linear-gradient(135deg, #9ca3af, #6b7280);
	text-transform: uppercase;
	flex-shrink: 0;
	position: relative;
	margin-left: 0;
}

.mlm-download-box__icon::after {
	content: attr(data-ext);
}

.mlm-download-box__right {
	display: flex !important;
	align-items: center !important;
	flex-wrap: nowrap !important;
	flex-direction: row !important;
	gap: 0;
	flex: 0 0 auto;
	min-width: 0;
	flex-shrink: 0;
}

.mlm-download-box__label {
	font-size: 14px;
	font-weight: 600;
	color: var(--dl-text);
	margin: 0;
	line-height: 1.5;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
	margin-right: 12px;
}

.mlm-download-box__meta {
	display: flex !important;
	align-items: center !important;
	flex-wrap: nowrap !important;
	flex-direction: row !important;
	gap: 0;
	font-size: 13px;
	color: var(--dl-subtext);
	white-space: nowrap;
	margin-right: 12px;
	flex-shrink: 0 !important;
}

.mlm-download-box__size {
	font-size: 13px;
	color: var(--dl-subtext);
	margin-right: 8px;
}

.mlm-download-box__size::before {
	content: "حجم: ";
	font-weight: 600;
}
.mlm-download-box__spacer {
	flex: 1 1 auto !important;
	min-width: 20px !important;
	display: block !important;
}

.mlm-download-box__left {
	display: flex !important;
	align-items: center !important;
	flex-wrap: nowrap !important;
	flex-direction: row !important;
	gap: 0;
	flex-shrink: 0;
}

.mlm-download-box__status {
	display: flex !important;
	align-items: center !important;
	flex-wrap: nowrap !important;
	flex-direction: row !important;
	gap: 12px;
	margin-right: 8px;
}

.mlm-download-box__badge {
	display: flex !important;
	align-items: center !important;
	flex-wrap: nowrap !important;
	gap: 0;
	padding: 4px 10px;
	border-radius: 5px;
	font-size: 12px;
	font-weight: 600;
	background: rgba(148, 163, 184, 0.16);
	color: var(--dl-text);
	margin-left: 12px;
	flex-shrink: 0;
}

.mlm-download-box__badge:first-child {
	margin-left: 0;
}

.mlm-download-box__badge::before {
	content: "";
	width: 14px;
	height: 14px;
	mask-repeat: no-repeat;
	mask-position: center;
	mask-size: contain;
	background-color: currentColor;
	opacity: 0.8;
}

.mlm-download-box__badge--login {
	color: #1d4ed8;
	background: rgba(29, 78, 216, 0.14);
}

.mlm-download-box__badge--login::before {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8V6a3 3 0 0 1 6 0v2'/%3E%3Crect x='5' y='8' width='8' height='8' rx='1.5'/%3E%3C/svg%3E");
}

.mlm-download-box__badge--password {
	color: #b91c1c;
	background: rgba(185, 28, 28, 0.15);
}

.mlm-download-box__badge--password::before {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 13v2.5M8 13v2.5M5 6h10M8 6V4a2 2 0 1 1 4 0v2'/%3E%3C/svg%3E");
}

.mlm-download-box__badge--direct {
	color: #047857;
	background: rgba(4, 120, 87, 0.15);
}

.mlm-download-box__badge--direct::before {
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 10h10M9 5l5 5-5 5'/%3E%3C/svg%3E");
}

.mlm-download-box__cta {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 32px;
	height: 32px;
	border-radius: 5px;
	background: rgba(255, 150, 6, 0.12);
	color: var(--dl-primary);
	flex-shrink: 0 !important;
	margin-left: 0;
	margin-right: 12px;
}

.mlm-download-box__cta svg {
	width: 16px;
	height: 16px;
}

.mlm-download-box__link.mlm-need-login,
.mlm-download-box__link.mlm-need-pass {
	background: #fff;
	border-color: rgba(29, 78, 216, 0.2);
}

.mlm-download-box__link.mlm-need-pass {
	border-color: rgba(185, 28, 28, 0.25);
}

.mlm-download-box__link::before,
.mlm-download-box__link.mlm-need-login::before,
.mlm-download-box__link.mlm-need-pass::before {
	content: none !important;
	display: none !important;
}

/* آیکون‌های مختلف برای انواع فایل */
.mlm-download-box__icon--pdf {
	background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.mlm-download-box__icon--zip,
.mlm-download-box__icon--rar,
.mlm-download-box__icon--7z {
	background: linear-gradient(135deg, #6366f1, #4338ca);
}

.mlm-download-box__icon--mp3,
.mlm-download-box__icon--wav {
	background: linear-gradient(135deg, #ec4899, #c026d3);
}

.mlm-download-box__icon--mp4,
.mlm-download-box__icon--mov,
.mlm-download-box__icon--mkv {
	background: linear-gradient(135deg, #f97316, #ea580c);
}

.mlm-download-box__icon--doc,
.mlm-download-box__icon--docx,
.mlm-download-box__icon--ppt,
.mlm-download-box__icon--pptx,
.mlm-download-box__icon--xls,
.mlm-download-box__icon--xlsx {
	background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.mlm-download-box__icon--psd,
.mlm-download-box__icon--ai,
.mlm-download-box__icon--fig {
	background: linear-gradient(135deg, #0ea5e9, #0369a1);
}

.mlm-download-box__icon--apk,
.mlm-download-box__icon--exe {
	background: linear-gradient(135deg, #10b981, #047857);
}

/* Wrapper for accordion structure */
.mlm-download-box__wrapper {
	display: contents;
}

/* Header button - کارت اصلی */
.mlm-download-box__header {
	display: flex !important;
	align-items: center !important;
	flex-wrap: nowrap !important;
	flex-direction: row !important;
	width: 100%;
	gap: 0;
	padding: 14px 18px;
	border-radius: 5px;
	text-decoration: none;
	background: #fff;
	border: 1px solid var(--dl-border);
	color: var(--dl-text);
	cursor: pointer;
	transition: all 0.2s ease;
}

.mlm-download-box__header:hover {
	border-color: rgba(255, 150, 6, 0.3);
}

.mlm-download-box__header-content {
	display: flex !important;
	align-items: center !important;
	flex-wrap: nowrap !important;
	flex-direction: row !important;
	gap: 0;
	flex: 1 1 auto;
	min-width: 0;
}

.mlm-download-box__header-badges {
	display: flex !important;
	align-items: center !important;
	flex-wrap: nowrap !important;
	flex-direction: row !important;
	gap: 12px;
	margin-right: 8px;
	flex-shrink: 0;
}

.mlm-download-box__toggle-icon {
	display: none;
	flex-shrink: 0;
	margin-right: 8px;
	color: var(--dl-subtext);
	transition: transform 0.3s ease;
}

/* Content - آکاردئون */
.mlm-download-box__content {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease;
}

.mlm-download-box__item.is-open .mlm-download-box__content {
	max-height: 200px;
}

.mlm-download-box__content-inner {
	padding: 12px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	background: #f9fafb;
	border: 1px solid var(--dl-border);
	border-top: none;
	border-radius: 0 0 5px 5px;
}

.mlm-download-box__download-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 18px;
	border-radius: 5px;
	background: var(--dl-primary);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	border: none;
	cursor: pointer;
	transition: background 0.2s ease;
	flex-shrink: 0;
}

.mlm-download-box__download-btn:hover {
	background: #ff8f2e;
}

.mlm-download-box__download-btn svg {
	width: 16px;
	height: 16px;
}

/* Desktop: آکاردئون باز */
@media (min-width: 641px) {
	.mlm-download-box__header {
		padding: 14px 18px;
		cursor: pointer;
	}
	
	.mlm-download-box__wrapper {
		display: block;
		background: #fff;
		border: 1px solid var(--dl-border);
		border-radius: 5px;
		margin-bottom: 12px;
		overflow: hidden;
	}
	
	.mlm-download-box__wrapper:last-child {
		margin-bottom: 0;
	}
	
	.mlm-download-box__header {
		border: none;
		border-radius: 0;
	}
	
	.mlm-download-box__toggle-icon {
		display: none !important;
	}
	
	/* دسکتاپ: آکاردئون همیشه باز است */
	.mlm-download-box__content {
		max-height: 200px !important;
		overflow: visible !important;
		display: block !important;
	}
	
	.mlm-download-box__item .mlm-download-box__content {
		max-height: 200px !important;
	}
	
	.mlm-download-box__header-badges {
		display: none !important; /* در دسکتاپ هم بدج‌ها در آکاردئون هستند */
	}
	
	.mlm-download-box__header:hover {
		background: #f9fafb;
	}
	
	/* دسکتاپ: دکمه دانلود و بدج‌ها در یک خط */
	.mlm-download-box__content-inner {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}
}

/* Mobile: آکاردئون فعال */
@media (max-width: 640px) {
	.mlm-download-box {
		padding: 16px;
		gap: 10px;
	}

	.mlm-download-box__wrapper {
		display: block;
		background: #fff;
		border: 1px solid var(--dl-border);
		border-radius: 5px;
		overflow: hidden;
	}

	.mlm-download-box__header {
		padding: 14px 16px;
		border: none;
		border-radius: 0;
		width: 100%;
		justify-content: space-between;
	}
	
	.mlm-download-box__header:hover {
		border-color: transparent;
		background: #f9fafb;
	}

	.mlm-download-box__header-content {
		flex: 1;
		min-width: 0;
		display: flex;
		align-items: center;
		gap: 12px;
	}
	
	.mlm-download-box__header-content .mlm-download-box__cta {
		flex-shrink: 0;
		margin-right: 0;
	}
	
	.mlm-download-box__header-content .mlm-download-box__label {
		font-size: 14px;
		font-weight: 600;
		color: var(--dl-text);
		margin-right: 0;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		flex: 1;
		min-width: 0;
	}
	
	.mlm-download-box__header-content .mlm-download-box__size {
		font-size: 12px;
		color: var(--dl-subtext);
		margin-right: 0;
		white-space: nowrap;
		flex-shrink: 0;
	}

	.mlm-download-box__header-badges {
		display: none !important;
	}

	.mlm-download-box__toggle-icon {
		display: flex !important;
		align-items: center;
		justify-content: center;
		margin-right: 0;
	}

	.mlm-download-box__item.is-open .mlm-download-box__toggle-icon {
		transform: rotate(180deg);
	}

	.mlm-download-box__content {
		border-top: 1px solid var(--dl-border);
	}

	.mlm-download-box__content-inner {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
		padding: 14px 16px;
	}

	.mlm-download-box__status {
		display: flex !important;
		flex-wrap: wrap !important;
		gap: 8px !important;
	}

	.mlm-download-box__badge {
		margin-left: 0 !important;
	}

	.mlm-download-box__download-btn {
		width: 100%;
		justify-content: center;
	}
}
