/* Попап «Онлайн заявка» (#get-free-q, .wa-modal) — 2026-10-28. Разметка: template-parts/popup-order.php, JS: assets/js/wa-modal.js */

/* Montserrat — assets/css/wa-fonts.css (handle wa_fonts) */

html.wa-modal-open { overflow: hidden; }

.wa-modal {
	--wa-green: #7dc91b;
	--wa-green-hover: #6bb20f;
	--wa-green-text: #4d8a00;
	--wa-blue: #4197cb;
	--wa-text: #1d2433;
	--wa-muted: #6b7280;
	--wa-border: #dfe3ea;
	--wa-bg: #ffffff;
	--wa-field-bg: #f6f8fb;
	--wa-error: #d93025;
	--wa-radius: 16px;
	--wa-radius-field: 12px;

	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity .25s ease, visibility .25s ease;
	font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	color: var(--wa-text);
	text-align: left;
}
.wa-modal *, .wa-modal *::before, .wa-modal *::after { box-sizing: border-box; }
.wa-modal.is-open { opacity: 1; visibility: visible; pointer-events: auto; }

.wa-modal__overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, .55);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
}

.wa-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 520px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	background: var(--wa-bg);
	border-radius: var(--wa-radius);
	box-shadow: 0 24px 64px rgba(15, 23, 42, .25);
	transform: translateY(12px) scale(.98);
	transition: transform .25s ease;
	outline: none;
}
.wa-modal.is-open .wa-modal__dialog { transform: none; }

.wa-modal__scroll {
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 32px;
}

.wa-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--wa-muted);
	cursor: pointer;
	transition: background .2s ease, color .2s ease;
}
.wa-modal__close:hover { background: var(--wa-field-bg); color: var(--wa-text); }
.wa-modal__close:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(65, 151, 203, .35); }

.wa-modal .wa-modal__title {
	margin: 0 0 8px;
	padding-right: 40px;
	font-family: "Montserrat", Arial, sans-serif;
	font-weight: 700;
	font-size: 26px;
	line-height: 1.2;
	color: var(--wa-text);
	text-transform: none;
	letter-spacing: 0;
	outline: none;
}
.wa-modal .wa-modal__subtitle {
	margin: 0 0 24px;
	font-size: 15px;
	line-height: 1.5;
	color: var(--wa-muted);
}

/* ---------- Поля ---------- */
.wa-modal .wpcf7 { margin: 0; }
.wa-modal .wpcf7-form p { margin: 0; }
.wa-form .wa-field { margin: 0 0 16px; }
.wa-form .wa-label {
	display: block;
	margin: 0 0 6px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--wa-text);
}
.wa-form .wa-opt { font-weight: 400; color: var(--wa-muted); }
.wa-form .wa-req { color: var(--wa-error); }
.wa-form .wpcf7-form-control-wrap { display: block; position: relative; }

.wa-form input[type="text"],
.wa-form input[type="tel"],
.wa-form input[type="email"],
.wa-form textarea {
	display: block;
	width: 100%;
	height: 48px;
	margin: 0;
	padding: 12px 14px;
	font: inherit;
	font-size: 16px;
	line-height: 1.4;
	color: var(--wa-text);
	background: var(--wa-field-bg);
	border: 1px solid var(--wa-border);
	border-radius: var(--wa-radius-field);
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.wa-form textarea { height: auto; min-height: 88px; resize: vertical; }
.wa-form input::placeholder, .wa-form textarea::placeholder { color: #9aa1ad; opacity: 1; }
.wa-form input:focus, .wa-form textarea:focus {
	outline: none;
	background: #fff;
	border-color: var(--wa-blue);
	box-shadow: 0 0 0 3px rgba(65, 151, 203, .2);
}

/* ---------- Чипы (radio / checkbox) ---------- */
.wa-form .wa-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wa-form .wa-chips .wpcf7-list-item { margin: 0; }
.wa-form .wa-chips label { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.wa-form .wa-chips input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	margin: 0;
	pointer-events: none;
}
.wa-form .wa-chips .wpcf7-list-item-label {
	display: inline-block;
	padding: 8px 14px;
	font-size: 14px;
	line-height: 1.3;
	color: var(--wa-text);
	background: #fff;
	border: 1px solid var(--wa-border);
	border-radius: 999px;
	transition: background .2s ease, border-color .2s ease, color .2s ease;
	user-select: none;
}
.wa-form .wa-chips label:hover .wpcf7-list-item-label { border-color: #c5ccd8; }
.wa-form .wa-chips input:checked + .wpcf7-list-item-label {
	background: rgba(125, 201, 27, .12);
	border-color: var(--wa-green);
	color: var(--wa-green-text);
}
.wa-form .wa-chips input:focus-visible + .wpcf7-list-item-label {
	border-color: var(--wa-blue);
	box-shadow: 0 0 0 3px rgba(65, 151, 203, .2);
}

/* ---------- Ошибки и ответ CF7 ---------- */
.wa-form .wpcf7-not-valid { border-color: var(--wa-error) !important; }
.wa-modal .wpcf7-not-valid-tip {
	position: static;
	display: block;
	margin-top: 4px;
	font-size: 13px;
	line-height: 1.4;
	color: var(--wa-error);
}
.wa-modal .wpcf7 form .wpcf7-response-output {
	margin: 16px 0 0;
	padding: 12px 14px;
	border: none;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.4;
}
.wa-modal .wpcf7 form.invalid .wpcf7-response-output,
.wa-modal .wpcf7 form.unaccepted .wpcf7-response-output,
.wa-modal .wpcf7 form.payment-required .wpcf7-response-output,
.wa-modal .wpcf7 form.failed .wpcf7-response-output,
.wa-modal .wpcf7 form.aborted .wpcf7-response-output,
.wa-modal .wpcf7 form.spam .wpcf7-response-output {
	background: #fdecea;
	color: #b3261e;
}
.wa-modal .wpcf7 form.sent .wpcf7-response-output { display: none; }
.wa-modal .wpcf7-spinner { display: none !important; }

/* ---------- Кнопка ---------- */
.wa-form .wa-submit {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 52px;
	margin: 8px 0 0;
	padding: 0 20px;
	border: 0;
	border-radius: 12px;
	background: var(--wa-green);
	color: #0e2a06; /* тёмный текст на зелёном, как CTA шапки (2026-10-28) */
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: background .2s ease, opacity .2s ease;
}
.wa-form .wa-submit:hover { background: var(--wa-green-hover); }
.wa-form .wa-submit:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(125, 201, 27, .35); }
.wa-submit__loader {
	display: none;
	width: 20px;
	height: 20px;
	border: 2px solid rgba(14, 42, 6, .3);
	border-top-color: #0e2a06;
	border-radius: 50%;
	animation: wa-spin .7s linear infinite;
}
.wa-modal form.submitting .wa-submit { pointer-events: none; opacity: .85; }
.wa-modal form.submitting .wa-submit__text { display: none; }
.wa-modal form.submitting .wa-submit__loader { display: block; }
@keyframes wa-spin { to { transform: rotate(360deg); } }

.wa-form .wa-consent {
	margin: 12px 0 0;
	font-size: 12px;
	line-height: 1.4;
	text-align: center;
	color: var(--wa-muted);
}
.wa-form .wa-consent a { color: inherit; text-decoration: underline; }

.wa-form .wa-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* ---------- Альтернативные контакты ---------- */
.wa-modal__alt {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 12px;
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px solid var(--wa-border);
	font-size: 14px;
	color: var(--wa-muted);
}
.wa-modal__links { display: inline-flex; align-items: center; gap: 12px; }
.wa-modal .wa-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-width: 40px;
	height: 40px;
	padding: 0 10px;
	border-radius: 999px;
	background: var(--wa-field-bg);
	color: var(--wa-blue);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: background .2s ease;
}
.wa-modal .wa-link:hover { background: #e9eef5; }
.wa-modal .wa-link--tg { color: #229ed9; }
.wa-modal .wa-link--vb { color: #7360f2; }
.wa-modal .wa-link--ph { color: var(--wa-text); }

/* ---------- Экран успеха ---------- */
.wa-modal__view--success { text-align: center; }
.wa-modal__view--success .wa-modal__title { padding-right: 0; }
.wa-modal__success-icon { display: flex; justify-content: center; margin: 8px 0 16px; }
.wa-modal__alt--buttons { justify-content: center; border-top: 0; padding-top: 0; margin-top: 0; }
.wa-modal .wa-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 44px;
	padding: 0 18px;
	border-radius: 12px;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background .2s ease, border-color .2s ease;
}
.wa-modal .wa-btn--tg { background: #229ed9; color: #fff; }
.wa-modal .wa-btn--vb { background: #7360f2; color: #fff; }
.wa-modal .wa-btn--tg:hover, .wa-modal .wa-btn--vb:hover { opacity: .9; }
.wa-modal .wa-btn--ghost {
	margin-top: 20px;
	background: transparent;
	color: var(--wa-text);
	border: 1px solid var(--wa-border);
}
.wa-modal .wa-btn--ghost:hover { background: var(--wa-field-bg); }

/* ---------- Мобилка: bottom-sheet ---------- */
@media (max-width: 640px) {
	.wa-modal { align-items: flex-end; padding: 0; }
	.wa-modal__dialog {
		max-width: 100%;
		max-height: 92vh;
		max-height: 92dvh;
		border-radius: 20px 20px 0 0;
		transform: translateY(100%);
	}
	.wa-modal__dialog::before {
		content: "";
		position: absolute;
		top: 8px;
		left: 50%;
		width: 40px;
		height: 4px;
		margin-left: -20px;
		border-radius: 2px;
		background: var(--wa-border);
	}
	.wa-modal__scroll {
		padding: 24px 20px;
		padding-bottom: calc(24px + env(safe-area-inset-bottom));
	}
	.wa-modal .wa-modal__title { font-size: 22px; }
	.wa-modal__alt { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
	.wa-modal, .wa-modal__dialog, .wa-modal * { transition: none !important; animation: none !important; }
	.wa-modal__dialog { transform: none; }
}
