/* ---------------------------------------------------------------------------
 * Mihan Melk — فرم چهارمرحله‌ای ثبت آگهی (بر پایهٔ create-listing-1..4)
 * ------------------------------------------------------------------------ */

/* در طرح، ۱۳۲۰ عرضِ محتواست نه کل ظرف. */
.mm-sf-wrap {
	max-width: calc(1320px + 2 * var(--mm-container-pad));
	padding-bottom: 64px;
}

.mm-sf {
	padding: 24px;
	background: var(--mm-white);
	border-radius: 16px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

/* ---------- سربرگ ---------- */

.mm-sf__head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding-bottom: 24px;
	border-bottom: 1px solid var(--mm-border);
}

.mm-sf__head-icon {
	display: block;
	width: 48px;
	height: 48px;
	flex: none;
}

.mm-sf__head-icon svg,
.mm-sf__head-icon img {
	width: 48px;
	height: 48px;
	display: block;
}

.mm-sf__head-title {
	margin: 0;
	font-size: 20px;
	font-weight: var(--mm-fw-semibold);
	line-height: 32px;
	color: var(--mm-text);
}

/* ---------- نوار مرحله ---------- */

.mm-sf__steps {
	display: flex;
	justify-content: center;
	gap: 0;
	margin: 49px 0 0;
	padding: 0;
	list-style: none;
}

.mm-sf__step {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	width: 214px;
	text-align: center;
}

/* خط رابط بین دو مرحله، از مرکز آیکون تا مرکز آیکون بعدی. */
.mm-sf__step + .mm-sf__step::after {
	content: '';
	position: absolute;
	top: 24px;
	inset-inline-start: calc(50% + 32px);
	width: 150px;
	height: 1px;
	background: var(--mm-border);
}

.mm-sf__step.is-done + .mm-sf__step::after,
.mm-sf__step.is-active + .mm-sf__step::after {
	background: var(--mm-primary);
}

.mm-sf__step-icon {
	display: block;
	width: 48px;
	height: 48px;
	flex: none;
	position: relative;
	z-index: 1;
}

.mm-sf__step-icon svg,
.mm-sf__step-icon img {
	width: 48px;
	height: 48px;
	display: block;
}

.mm-sf__step-label {
	font-size: 16px;
	font-weight: var(--mm-fw-regular);
	line-height: 24px;
	color: var(--mm-text-muted);
	white-space: nowrap;
}

.mm-sf__step.is-active .mm-sf__step-label,
.mm-sf__step.is-done .mm-sf__step-label {
	font-weight: var(--mm-fw-semibold);
	color: var(--mm-text);
}

.mm-sf__step:not(.is-active):not(.is-done) .mm-sf__step-icon {
	filter: grayscale(1) opacity(.55);
}

/* ---------- ستون فرم ---------- */

.mm-sf__panel {
	width: 872px;
	max-width: 100%;
	margin: 32px auto 0;
}

.mm-sf__panel[hidden] {
	display: none !important;
}

.mm-sf__grid {
	display: grid;
	gap: 24px;
	margin-bottom: 24px;
}

.mm-sf__grid--2 { grid-template-columns: repeat(2, 1fr); }
.mm-sf__grid--3 { grid-template-columns: repeat(3, 1fr); }

/* ---------- فیلد ---------- */

.mm-sf__field {
	position: relative;
	margin-bottom: 24px;
}

/*
 * فاصلهٔ دو فیلد پشت‌سرهم در طرح ۳۲ است ولی فاصلهٔ فیلد تا عنوان بخش ۲۴؛
 * با ادغام حاشیه‌ها (margin collapsing) هر دو با همین دو قاعده درمی‌آید.
 */
.mm-sf__field + .mm-sf__field {
	margin-top: 32px;
}

/* داخل شبکه، فاصله را خودِ gap می‌دهد نه حاشیهٔ فیلدها. */
.mm-sf__grid .mm-sf__field,
.mm-sf__grid .mm-sf__field + .mm-sf__field {
	margin-top: 0;
	margin-bottom: 0;
}

.mm-sf__field.is-wide {
	grid-column: 1 / -1;
}

.mm-sf__label {
	position: absolute;
	top: -10px;
	inset-inline-start: 12px;
	z-index: 2;
	padding-inline: 6px;
	background: var(--mm-white);
	font-size: 14px;
	font-weight: var(--mm-fw-semibold);
	line-height: 20px;
	color: var(--mm-text);
	white-space: nowrap;
}

.mm-sf__label i {
	color: var(--mm-danger);
	font-style: normal;
}

.mm-sf .mm-sf__input {
	width: 100%;
	height: 48px;
	padding: 0 12px;
	background: transparent;
	border: 1px solid var(--mm-border);
	border-radius: 12px;
	font-family: inherit;
	font-size: 12px;
	font-weight: var(--mm-fw-light);
	color: var(--mm-text);
	transition: border-color var(--mm-transition);
}

.mm-sf .mm-sf__input::placeholder {
	font-size: 12px;
	font-weight: var(--mm-fw-light);
	color: var(--mm-text-muted);
}

.mm-sf .mm-sf__input:focus {
	outline: none;
	border-color: var(--mm-primary);
}

.mm-sf .mm-sf__input--area {
	display: block;   /* بدون این، فاصلهٔ خط پایه ۸ پیکسل اضافه می‌کند. */
	height: 200px;
	padding: 14px 12px;
	resize: vertical;
	line-height: 24px;
}

select.mm-sf__input {
	cursor: pointer;
	appearance: none;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23828282' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: left 12px center;
	background-size: 16px;
	padding-inline-end: 12px;
	padding-inline-start: 34px;
}

/* ---------- خطا و راهنما ---------- */

.mm-sf__field.has-error .mm-sf__input {
	border-color: var(--mm-danger);
}

.mm-sf__error {
	display: block;
	margin-top: 6px;
	font-size: 12px;
	line-height: 16px;
	color: var(--mm-danger);
}

.mm-sf__hint {
	display: block;
	margin-top: 6px;
	font-size: 12px;
	line-height: 16px;
	color: var(--mm-text-muted);
}

.mm-sf__hint--block {
	margin: 12px 0 0;
	font-size: 14px;
	font-weight: var(--mm-fw-semibold);
	line-height: 20px;
	color: var(--mm-text-muted);
}

.mm-sf__words {
	display: block;
	margin-top: 8px;
	font-size: 14px;
	font-weight: var(--mm-fw-semibold);
	line-height: 20px;
	color: var(--mm-primary);
	min-height: 20px;
}

/* ---------- عنوان بخش ---------- */

.mm-sf__section {
	margin: 24px 0 12px;
	font-size: 20px;
	font-weight: var(--mm-fw-semibold);
	line-height: 32px;
	color: var(--mm-text);
}

.mm-sf__section--first {
	margin-top: 0;
}

/* ---------- تصاویر ---------- */

.mm-sf__images {
	display: flex;
	flex-wrap: wrap-reverse;
	justify-content: flex-start;
	gap: 12px;
}

.mm-sf__addimg {
	width: 88px;
	height: 88px;
	flex: none;
	padding: 0;
	background: none;
	border: 0;
	cursor: pointer;
	order: -1;
}

.mm-sf__addimg svg,
.mm-sf__addimg img {
	width: 88px;
	height: 88px;
	display: block;
}

.mm-sf__thumb {
	position: relative;
	width: 88px;
	height: 88px;
	flex: none;
	border-radius: 8px;
	overflow: hidden;
	background: var(--mm-gray-200);
}

.mm-sf__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.mm-sf__thumb-del,
.mm-sf__thumb-star {
	position: absolute;
	top: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	font-size: 13px;
	line-height: 1;
	cursor: pointer;
	color: var(--mm-white);
}

.mm-sf__thumb-del {
	inset-inline-end: 4px;
	background: var(--mm-danger);
}

.mm-sf__thumb-star {
	inset-inline-start: 4px;
	background: rgba(0, 0, 0, .55);
}

.mm-sf__thumb.is-cover .mm-sf__thumb-star {
	background: var(--mm-accent);
}

.mm-sf__thumb-badge {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	padding: 2px 0;
	background: var(--mm-accent);
	font-size: 10px;
	line-height: 14px;
	text-align: center;
	color: var(--mm-white);
}

.mm-sf__thumb:not(.is-cover) .mm-sf__thumb-badge {
	display: none;
}

/* ---------- ویدئو ---------- */

.mm-sf__video {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	height: 152px;
	padding: 0 24px;
	background: var(--mm-gray-100, #f7f7f7);
	border: 1px solid var(--mm-primary);
	border-radius: 12px;
	cursor: text;
}

.mm-sf__video > span {
	font-size: 16px;
	font-weight: var(--mm-fw-semibold);
	line-height: 24px;
	color: var(--mm-text);
}

.mm-sf .mm-sf__videoinput {
	width: 100%;
	max-width: 420px;
	height: 44px;
	padding: 0 12px;
	background: var(--mm-white);
	border: 1px solid var(--mm-border);
	border-radius: 10px;
	font-family: inherit;
	font-size: 12px;
	color: var(--mm-text);
	direction: ltr;
	text-align: left;
}

/* ---------- گروه چک‌باکس ---------- */

.mm-sf__group {
	margin-bottom: 32px;
}

.mm-sf__grouplabel {
	display: block;
	margin-bottom: 12px;
	font-size: 14px;
	font-weight: var(--mm-fw-semibold);
	line-height: 20px;
	color: var(--mm-text);
}

.mm-sf__checks {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 12px 16px;
}

.mm-sf__checks--4 {
	grid-template-columns: repeat(4, 1fr);
	max-width: 480px;
	margin-inline-start: auto;
}

.mm-sf__check {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 16px;
	font-weight: var(--mm-fw-regular);
	line-height: 24px;
	color: var(--mm-text);
	cursor: pointer;
}

.mm-sf__check input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.mm-sf__checkbox {
	position: relative;
	width: 20px;
	height: 20px;
	flex: none;
	border-radius: 6px;
	box-shadow: inset 0 0 0 1px var(--mm-border);
	transition: background-color var(--mm-transition), box-shadow var(--mm-transition);
}

.mm-sf__check input:checked + .mm-sf__checkbox {
	background: var(--mm-primary);
	box-shadow: inset 0 0 0 1px var(--mm-primary);
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5.5 10.5l3 3 6-6' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-size: 20px 20px;
}

.mm-sf__check input:focus-visible + .mm-sf__checkbox {
	outline: 2px solid var(--mm-primary);
	outline-offset: 2px;
}

/* ---------- نقشه ---------- */

.mm-sf__map {
	padding: 20px;
	background: var(--mm-gray-100, #f7f7f7);
	border-radius: 12px;
}

.mm-sf__maphint {
	margin: 0 0 20px;
	font-size: 14px;
	line-height: 22px;
	color: var(--mm-text-muted);
}

.mm-sf__map .mm-sf__label {
	background: var(--mm-gray-100, #f7f7f7);
}

.mm-sf__geo {
	height: 44px;
	padding: 0 20px;
	background: transparent;
	border: 1px solid var(--mm-primary);
	border-radius: 12px;
	font-family: inherit;
	font-size: 14px;
	color: var(--mm-primary);
	cursor: pointer;
}

.mm-sf__geo:hover {
	background: var(--mm-primary);
	color: var(--mm-white);
}

/* ---------- دکمه‌های پایین ---------- */

.mm-sf__actions {
	display: flex;
	justify-content: space-between;
	gap: 24px;
	margin-top: 24px;
}

.mm-sf__next,
.mm-sf__back {
	width: 312px;
	height: 48px;
	border-radius: 16px;
	font-family: inherit;
	font-size: 16px;
	font-weight: var(--mm-fw-regular);
	line-height: 24px;
	cursor: pointer;
	transition: background-color var(--mm-transition), color var(--mm-transition);
}

.mm-sf__next {
	order: 2;
	background: var(--mm-primary);
	border: 1px solid var(--mm-primary);
	color: var(--mm-white);
}

.mm-sf__next:hover {
	background: var(--mm-primary-hover);
}

.mm-sf__back {
	order: 1;
	background: transparent;
	border: 1px solid var(--mm-border);
	color: var(--mm-primary);
}

.mm-sf__back:hover {
	border-color: var(--mm-primary);
}

/* وقتی دکمهٔ بازگشت نیست، «ادامه» همان جای طرح بماند. */
.mm-sf__actions > .mm-sf__next:only-child {
	margin-inline-end: auto;
}

.mm-sf__next[disabled] {
	opacity: .6;
	pointer-events: none;
}

/* ---------- پیام کلی ---------- */

.mm-sf__editnote {
	margin: 24px 0 0;
	padding: 12px 16px;
	border-radius: 12px;
	background: rgba(234, 179, 8, .1);
	border: 1px solid rgba(234, 179, 8, .35);
	font-size: 14px;
	line-height: 24px;
	color: #a16207;
}

.mm-sf__notice {
	margin: 24px auto 0;
	width: 872px;
	max-width: 100%;
	padding: 12px 16px;
	border-radius: 12px;
	background: rgba(239, 68, 68, .08);
	font-size: 14px;
	line-height: 22px;
	color: var(--mm-danger);
}

.mm-sf__notice.is-ok {
	background: rgba(0, 163, 42, .08);
	color: var(--mm-success);
}

/* ---------- واکنش‌گرا ---------- */

@media (max-width: 1200px) {
	.mm-sf__steps {
		flex-wrap: wrap;
		gap: 16px;
	}

	.mm-sf__step {
		width: auto;
		flex: 1 1 160px;
	}

	.mm-sf__step + .mm-sf__step::after {
		display: none;
	}
}

@media (max-width: 900px) {
	.mm-sf__panel {
		width: 100%;
	}

	.mm-sf__checks {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 767px) {
	.mm-sf {
		padding: 16px;
	}

	.mm-sf__grid--2,
	.mm-sf__grid--3 {
		grid-template-columns: 1fr;
	}

	.mm-sf__checks,
	.mm-sf__checks--4 {
		grid-template-columns: repeat(2, 1fr);
		max-width: none;
	}

	.mm-sf__actions {
		flex-direction: column;
	}

	.mm-sf__next,
	.mm-sf__back {
		width: 100%;
	}
}
