/* ------------------------------------------------------------------
	Капча на формах заявок — виджет «Нажмите, чтобы продолжить»
	Разметка: template/default/html/form/_captcha.php
	Логика:   core/send/Captcha.php (сервер) + template/default/js/form/_captcha.js
------------------------------------------------------------------ */
.dcaptcha {
	--dc-border: #d6d6d6;
	--dc-border-hover: #a9b6c2;
	--dc-bg: #fbfbfb;
	--dc-text: #3a3a3a;
	--dc-accent: #0a5aa8;
	--dc-error: #c8342b;
	display: block;
	width: 100%;
	max-width: 520px;
	margin: 14px 0 6px;
	box-sizing: border-box;
	font-family: "Roboto", Arial, sans-serif;
}

.dcaptcha__box {
	position: relative;
	display: flex;
	align-items: center;
	gap: 16px;
	min-height: 76px;
	padding: 12px 18px;
	background: var(--dc-bg);
	border: 1px solid var(--dc-border);
	border-radius: 6px;
	box-sizing: border-box;
	cursor: pointer;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.dcaptcha__box:hover {
	border-color: var(--dc-border-hover);
	background: #fff;
	box-shadow: 0 1px 6px rgba(0, 0, 0, .07);
}

.dcaptcha__box:focus-visible {
	outline: 2px solid rgba(10, 90, 168, .45);
	outline-offset: 2px;
}

/* квадрат-чекбокс */
.dcaptcha__check {
	position: relative;
	flex: 0 0 28px;
	width: 28px;
	height: 28px;
	box-sizing: border-box;
	background: #fff;
	border: 2px solid #c4c4c4;
	border-radius: 3px;
	transition: border-color .18s ease, background-color .18s ease;
}

.dcaptcha__box:hover .dcaptcha__check {
	border-color: #9fb0bf;
}

/* текст */
.dcaptcha__text {
	flex: 1 1 auto;
	font-size: 15px;
	line-height: 1.25;
	color: var(--dc-text);
	text-align: left;
}

/* бренд сервиса */
.dcaptcha__badge {
	display: flex;
	flex: 0 0 auto;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	padding-left: 10px;
}

.dcaptcha__badge-icon {
	display: block;
	width: 24px;
	height: 28px;
}

.dcaptcha__badge-name {
	font-size: 9px;
	font-weight: 500;
	line-height: 1;
	letter-spacing: .02em;
	color: var(--dc-accent);
	white-space: nowrap;
}

.dcaptcha--hidden {
	display: none;
}

/* ------------------------------------------------------------------
	пазл: картинка с прорезью + ползунок
------------------------------------------------------------------ */
.dcaptcha__puzzle {
	margin: 12px 0 4px;
}

.dcaptcha__puzzle-view {
	position: relative;
	width: 100%;
	line-height: 0;
	overflow: hidden;
	border: 1px solid var(--dc-border);
	border-radius: 6px;
	background: #eef1f4;
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;
}

.dcaptcha__puzzle-bg {
	display: block;
	width: 100%;
	height: auto;
	pointer-events: none;
}

.dcaptcha__puzzle-piece {
	position: absolute;
	left: 0;
	display: block;
	pointer-events: none;
	filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .35));
	z-index: 2;
}

.dcaptcha__puzzle-controls {
	margin-top: 10px;
}

.dcaptcha__puzzle-track {
	position: relative;
	height: 42px;
	border: 1px solid var(--dc-border);
	border-radius: 21px;
	background: #eef1f4;
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;
	overflow: hidden;
}

.dcaptcha__puzzle-fill {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 0;
	background: rgba(10, 90, 168, .16);
}

.dcaptcha__puzzle-handle {
	position: absolute;
	top: 50%;
	left: 2px;
	width: 36px;
	height: 36px;
	margin-top: -18px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	border: 1px solid #c9ced4;
	border-radius: 50%;
	background: #fff;
	color: var(--dc-accent);
	font-size: 18px;
	line-height: 1;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
	cursor: grab;
	touch-action: none;
	z-index: 2;
}

.dcaptcha__puzzle-handle:active {
	cursor: grabbing;
}

.dcaptcha__puzzle-handle:focus-visible {
	outline: 2px solid rgba(10, 90, 168, .45);
	outline-offset: 2px;
}

.dcaptcha__puzzle-hint {
	margin-top: 6px;
	font-size: 12px;
	line-height: 1.35;
	color: #7a828a;
}

.dcaptcha--error .dcaptcha__puzzle-view {
	border-color: var(--dc-error);
}

/* ------------------------------------------------------------------
	модальное окно с пазлом по центру экрана
------------------------------------------------------------------ */
.dcaptcha__puzzle-src {
	display: none !important;
}

body.dcaptcha-modal-open {
	overflow: hidden;
}

.dcaptcha-modal {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.dcaptcha-modal__backdrop {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: rgba(17, 22, 28, .55);
	opacity: 0;
	transition: opacity .18s ease;
}

.dcaptcha-modal__dialog {
	position: relative;
	z-index: 2;
	width: 100%;
	max-width: 388px;
	box-sizing: border-box;
	padding: 22px 22px 18px;
	background: #fff;
	border-radius: 10px;
	box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
	opacity: 0;
	transform: translateY(10px) scale(.98);
	transition: opacity .2s ease, transform .2s ease;
}

.dcaptcha-modal--show .dcaptcha-modal__backdrop {
	opacity: 1;
}

.dcaptcha-modal--show .dcaptcha-modal__dialog {
	opacity: 1;
	transform: none;
}

.dcaptcha-modal__close {
	position: absolute;
	top: 8px;
	right: 10px;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #8a929a;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	transition: color .15s ease;
}

.dcaptcha-modal__close:hover,
.dcaptcha-modal__close:focus {
	color: #333;
}

.dcaptcha-modal__title {
	margin: 0 30px 14px 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	color: #222;
}

.dcaptcha-modal__body .dcaptcha__puzzle {
	margin: 0;
}

.dcaptcha-modal__loading {
	display: none;
	padding: 46px 0;
	text-align: center;
	font-size: 13px;
	color: #7a828a;
}

.dcaptcha-modal--loading .dcaptcha-modal__body,
.dcaptcha-modal--loading .dcaptcha-modal__error {
	display: none;
}

.dcaptcha-modal--loading .dcaptcha-modal__loading {
	display: block;
}

.dcaptcha-modal__error {
	display: none;
	margin-top: 10px;
	font-size: 13px;
	line-height: 1.35;
	color: var(--dc-error);
}

.dcaptcha-modal__error:not(:empty) {
	display: block;
}

@media (max-width: 480px) {
	.dcaptcha-modal {
		padding: 10px;
	}

	.dcaptcha-modal__dialog {
		max-width: 100%;
		padding: 18px 14px 14px;
	}

	.dcaptcha-modal__title {
		font-size: 15px;
	}
}

/* ------------------------------------------------------------------
	состояния
------------------------------------------------------------------ */
.dcaptcha--busy .dcaptcha__box {
	cursor: progress;
}

.dcaptcha--busy .dcaptcha__check {
	border-color: transparent;
	background: transparent;
}

.dcaptcha--busy .dcaptcha__check::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 22px;
	height: 22px;
	margin: -11px 0 0 -11px;
	box-sizing: border-box;
	border: 2px solid rgba(10, 90, 168, .18);
	border-top-color: var(--dc-accent);
	border-radius: 50%;
	animation: dcaptcha-spin .8s linear infinite;
}

@keyframes dcaptcha-spin {
	to {
		transform: rotate(360deg);
	}
}

.dcaptcha--ok .dcaptcha__box {
	border-color: rgba(10, 90, 168, .35);
	background: #fff;
}

.dcaptcha--ok .dcaptcha__check {
	border-color: var(--dc-accent);
	background: var(--dc-accent);
}

.dcaptcha--ok .dcaptcha__check::after {
	content: "";
	position: absolute;
	left: 8px;
	top: 3px;
	width: 6px;
	height: 12px;
	border: 2px solid #fff;
	border-top: 0;
	border-left: 0;
	transform: rotate(45deg);
}

.dcaptcha--error .dcaptcha__box {
	border-color: var(--dc-error);
	background: #fff7f6;
}

.dcaptcha--error .dcaptcha__check {
	border-color: var(--dc-error);
}

.dcaptcha__error {
	display: none;
	margin: 6px 0 0;
	font-size: 13px;
	line-height: 1.35;
	color: var(--dc-error);
}

.dcaptcha--error .dcaptcha__error {
	display: block;
}

/* ------------------------------------------------------------------
	внутри плотных форм (карточки авто, трейд-ин, тайм-форма)
------------------------------------------------------------------ */
.time-form__form .dcaptcha,
.form-card .dcaptcha,
.form-help__form .dcaptcha,
.form-diler .dcaptcha {
	margin: 12px 0 4px;
}

.time-form__form .dcaptcha__box,
.form-card .dcaptcha__box {
	min-height: 64px;
	padding: 10px 14px;
	gap: 12px;
}

.form-card .dcaptcha__text,
.time-form__form .dcaptcha__text {
	font-size: 14px;
}

.dcaptcha__box .form__pole--checkbox {
	margin: 0;
}

/* мобильные */
@media (max-width: 600px) {
	.dcaptcha__box {
		min-height: 64px;
		padding: 10px 12px;
		gap: 12px;
	}

	.dcaptcha__text {
		font-size: 14px;
	}

	.dcaptcha__check {
		flex: 0 0 24px;
		width: 24px;
		height: 24px;
	}

	.dcaptcha__badge-icon {
		width: 20px;
		height: 24px;
	}
}
