/* =========================
   Musin Bros Lead Modal
   Модальное окно заявки
   ========================= */

body.mb-lead-modal-open {
	overflow: hidden;
}

.mb-lead-modal {
	position: fixed;
	inset: 0;
	z-index: 999998;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition:
		opacity 0.22s ease,
		visibility 0s linear 0.22s;
}

.mb-lead-modal.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transition:
		opacity 0.22s ease,
		visibility 0s linear 0s;
}

.mb-lead-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgb(10 13 18 / 72%);
}

.mb-lead-modal__dialog {
	position: relative;
	z-index: 1;
	width: min(640px, 100%);
	max-height: calc(100vh - 48px);
	display: flex;
	flex-direction: column;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 18px;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
	box-sizing: border-box;
	overflow: hidden;
	transform: translateY(12px) scale(0.985);
	transition: transform 0.22s ease;
	outline: none;
}

.mb-lead-modal.is-open .mb-lead-modal__dialog {
	transform: translateY(0) scale(1);
}

.mb-lead-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 24px 28px 18px;
	border-bottom: 1px solid #eef0f3;
	box-sizing: border-box;
}

.mb-lead-modal__title {
	margin: 0;
	font-size: 26px;
	line-height: 1.18;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: #111827;
}

.mb-lead-modal__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: #f3f4f6;
	color: #374151;
	cursor: pointer;
	transition:
		background 0.18s ease,
		color 0.18s ease,
		transform 0.18s ease;
}

.mb-lead-modal__close svg {
	display: block;
	width: 22px;
	height: 22px;
}

.mb-lead-modal__close:hover {
	background: #e5e7eb;
	color: #111827;
}

.mb-lead-modal__close:focus-visible {
	outline: 3px solid rgba(0, 125, 235, 0.28);
	outline-offset: 2px;
}

.mb-lead-modal__body {
	padding: 22px 28px 28px;
	overflow-y: auto;
	box-sizing: border-box;
}

.mb-lead-modal__intro {
	margin: 0 0 20px;
	font-size: 16px;
	line-height: 1.55;
	color: #4b5563;
}

.mb-lead-modal__notice {
	padding: 16px 18px;
	border: 1px solid #fde68a;
	border-radius: 12px;
	background: #fffbeb;
	color: #92400e;
	font-size: 15px;
	line-height: 1.5;
}

.mb-lead-modal__body form {
	margin-top: 0;
}

.mb-lead-modal__body form > *:last-child {
	margin-bottom: 0;
}

/* AJAX-состояние отправки */
.mb-lead-modal__body form.is-sending {
	opacity: 0.72;
	pointer-events: none;
}

/* Ошибка AJAX */
.mb-lead-modal__ajax-error {
	margin-bottom: 16px;
	padding: 14px 16px;
	border: 1px solid #f0d0cd;
	border-radius: 10px;
	background: #fff3f2;
	color: #8b2c25;
	font-size: 15px;
	line-height: 1.5;
}

.mb-lead-modal__ajax-error strong {
	display: block;
	margin-bottom: 6px;
	font-weight: 700;
}

.mb-lead-modal__ajax-error ul {
	margin: 0;
	padding-left: 20px;
}

.mb-lead-modal__ajax-error li {
	margin: 3px 0;
}

/* На всякий случай отключаем взаимодействие со скрытым anti-spam полем */
.mb-lead-modal .mbl-form-row-hidden input {
	pointer-events: none;
}

/* =========================
   Success-состояние после отправки формы
   ========================= */

.mb-lead-modal[data-mb-lead-success="1"] .mb-lead-modal__header {
	display: none;
}

.mb-lead-modal[data-mb-lead-success="1"] .mb-lead-modal__dialog {
	width: min(640px, 100%);
	min-height: 330px;
	max-height: calc(100vh - 48px);
}

.mb-lead-modal[data-mb-lead-success="1"] .mb-lead-modal__body {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 44px 28px;
	overflow: hidden;
}

.mb-lead-modal__success {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 240px;
	padding: 0;
	text-align: center;
	box-sizing: border-box;
}

.mb-lead-modal__success-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin: 0 auto 24px;
	border-radius: 999px;
	background: #d6ebdc;
	color: #14843b;
}

.mb-lead-modal__success-icon svg {
	display: block;
	width: 34px;
	height: 34px;
}

.mb-lead-modal__success-title {
	margin: 0 0 10px;
	font-size: 24px;
	line-height: 1.22;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: #111827;
}

.mb-lead-modal__success-text {
	max-width: 460px;
	margin: 0 auto;
	font-size: 16px;
	line-height: 1.55;
	color: #4b5563;
}

.mb-lead-modal__success-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-top: 24px;
	padding: 12px 22px;
	border: 0;
	border-radius: 10px;
	background: #007deb;
	color: #ffffff;
	font-size: 15px;
	line-height: 1.2;
	font-weight: 600;
	cursor: pointer;
	transition:
		background 0.18s ease,
		transform 0.18s ease;
}

.mb-lead-modal__success-close:hover {
	background: #006fd3;
	color: #ffffff;
}

.mb-lead-modal__success-close:focus-visible {
	outline: 3px solid rgba(0, 125, 235, 0.28);
	outline-offset: 3px;
}

/* =========================
   Мобильная версия
   ========================= */

@media (max-width: 767px) {
	.mb-lead-modal {
		align-items: flex-start;
		padding: 12px;
	}

	.mb-lead-modal__dialog {
		width: 100%;
		max-height: calc(100dvh - 24px);
		border-radius: 16px;
	}

	.mb-lead-modal__header {
		padding: 20px 20px 16px;
	}

	.mb-lead-modal__title {
		font-size: 23px;
	}

	.mb-lead-modal__close {
		width: 40px;
		height: 40px;
	}

	.mb-lead-modal__close svg {
		width: 21px;
		height: 21px;
	}

	.mb-lead-modal__body {
		padding: 18px 20px 22px;
	}

	.mb-lead-modal__intro {
		font-size: 15px;
	}

	.mb-lead-modal[data-mb-lead-success="1"] .mb-lead-modal__dialog {
		min-height: 300px;
	}

	.mb-lead-modal[data-mb-lead-success="1"] .mb-lead-modal__body {
		padding: 36px 20px;
	}

	.mb-lead-modal__success {
		min-height: 220px;
	}

	.mb-lead-modal__success-icon {
		width: 60px;
		height: 60px;
		margin-bottom: 20px;
	}

	.mb-lead-modal__success-icon svg {
		width: 32px;
		height: 32px;
	}

	.mb-lead-modal__success-title {
		font-size: 21px;
	}

	.mb-lead-modal__success-text {
		font-size: 15px;
	}

	.mb-lead-modal__success-close {
		margin-top: 22px;
		padding: 12px 20px;
		font-size: 15px;
	}
}

/* =========================
   Уважение к настройкам пользователя
   ========================= */

@media (prefers-reduced-motion: reduce) {
	.mb-lead-modal,
	.mb-lead-modal__dialog,
	.mb-lead-modal__close,
	.mb-lead-modal__success-close {
		transition: none;
	}
}