/* ===== Модалки: регистрация, success, error ===== */

.fancybox__backdrop {
	background: rgba(0, 0, 0, 0.82);
}

.fancybox__slide {
	padding: 24px;
}

/* свой крестик вместо стандартного fancybox */
.fancybox__content > .f-button.is-close-btn,
.popup .f-button.is-close-btn {
	display: none;
}

.popup {
	display: none;
}

.popup__wrapper {
	position: relative;
}

.popup__close {
	position: absolute;
	top: 28px;
	right: 28px;
	z-index: 3;
	display: flex;
	padding: 0;
	border: none;
	background: none;
	color: var(--accent);
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.popup__close:hover {
	opacity: 0.65;
}

/* ---------- форма регистрации ---------- */

.popup--form {
	width: 100%;
	max-width: 880px;
	padding: 48px;
	border-radius: 24px;
	background-color: #0d0d0e;
	border: 1px solid rgba(255, 255, 255, 0.08);
	color: var(--white);
}

.popup__title {
	margin-bottom: 40px;
	font-family: "VK Sans Display Expanded";
	font-weight: 700;
	font-size: 44px;
	line-height: 1.1;
	text-align: center;
	color: var(--accent);
}

.form__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px 24px;
	margin-bottom: 28px;
}

.form__item--wide {
	grid-column: 1 / -1;
}

.form__label {
	margin-bottom: 10px;
	font-family: "VK Sans Display";
	font-weight: 500;
	font-size: 16px;
	line-height: 1.2;
	color: var(--accent);
}

.form__input {
	width: 100%;
	padding: 14px 16px;
	border: 1px solid transparent;
	border-radius: 8px;
	background-color: var(--white);
	font-family: "VK Sans Display";
	font-size: 16px;
	color: #0d0d0e;
	transition: border-color 0.2s ease;
}

.form__input::placeholder {
	color: #ced2d4;
}

.form__input:focus {
	outline: none;
	border-color: var(--accent);
}

/* телефон с флагом */
.form__phone {
	position: relative;
}

.form__phone-flag {
	position: absolute;
	left: 16px;
	top: 50%;
	z-index: 1;
	transform: translateY(-50%);
	font-size: 18px;
	line-height: 1;
	pointer-events: none;
}

.form__input--phone {
	padding-left: 48px;
}

/* ---------- кастомный select ---------- */

.select {
	position: relative;
	width: 100%;
}

.select__field {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.select__btn {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 14px 16px;
	border: 1px solid transparent;
	border-radius: 8px;
	background-color: var(--white);
	cursor: pointer;
	transition: border-color 0.2s ease;
}

.select__btn-text {
	flex: 1;
	overflow: hidden;
	font-family: "VK Sans Display";
	font-size: 16px;
	color: #ced2d4;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.select__caret {
	display: flex;
	flex-shrink: 0;
	color: var(--accent);
	transition: transform 0.2s ease;
}

.select_open .select__btn {
	border-color: var(--accent);
}

.select_open .select__caret {
	transform: rotate(180deg);
}

/* выбранный select — тёмный текст значения */
.select_filled .select__btn-text {
	color: #0d0d0e;
}

.select_filled .select__caret {
	color: #0d0d0e;
}

.select__body {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 6;
	width: 100%;
	max-height: 220px;
	overflow-y: auto;
	padding: 8px;
	border-radius: 12px;
	background-color: var(--white);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.select_open .select__body {
	opacity: 1;
	visibility: visible;
	transform: none;
}

.select__item {
	padding: 12px 14px;
	border-radius: 8px;
	font-family: "VK Sans Display";
	font-size: 16px;
	color: #0d0d0e;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.select__item:hover {
	background-color: rgba(255, 57, 133, 0.12);
}

.select__item_disabled {
	display: none;
}

/* ---------- чекбоксы ---------- */

.form__checkbox {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	margin-top: 18px;
	cursor: pointer;
}

.checkbox__input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.checkbox__box {
	position: relative;
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	border: 1.5px solid rgba(255, 255, 255, 0.4);
	border-radius: 6px;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.checkbox__input:checked + .checkbox__box {
	background-color: var(--accent);
	border-color: var(--accent);
}

.checkbox__input:checked + .checkbox__box::after {
	content: "";
	position: absolute;
	left: 8px;
	top: 4px;
	width: 6px;
	height: 11px;
	border: solid var(--white);
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.checkbox__input:focus-visible + .checkbox__box {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.checkbox__text {
	font-family: "VK Sans Display";
	font-size: 14px;
	line-height: 1.45;
	color: #d6d6da;
}

.checkbox__text a {
	color: var(--accent);
	text-decoration: none;
}

.checkbox__text a:hover {
	text-decoration: underline;
}

/* ---------- ошибки/сообщение/сабмит ---------- */

.form__message {
	display: none;
	margin-top: 18px;
	font-family: "VK Sans Display";
	font-size: 14px;
	color: #ff6c6c;
}

.form_error .form__message {
	display: block;
}

.form_error .form__input:required:invalid,
.form_error .select__field:required:invalid ~ .select__btn {
	border-color: #ff2d55;
	background-color: #ffe9f2;
	box-shadow: 0 0 0 2px rgba(255, 45, 85, 0.45);
}

.form_error .checkbox__input:required:not(:checked) + .checkbox__box {
	border-color: #ff2d55;
	box-shadow: 0 0 0 3px rgba(255, 45, 85, 0.45);
}

.form__submit {
	display: block;
	margin: 28px auto 0;
	padding: 18px 48px;
	border: none;
	border-radius: 100px;
	background-color: var(--accent);
	font-family: "VK Sans Display";
	font-weight: 600;
	font-size: 18px;
	color: var(--white);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.form__submit:hover {
	background-color: #ff5a9c;
}

/* ---------- success / error попапы ---------- */

.popup--success,
.popup--error {
	position: relative;
	width: 100%;
	overflow: hidden;
	border-radius: 24px;
	background-color: #0d0d0e;
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
	color: var(--white);
	container-type: inline-size;
}

.popup--success {
	max-width: 872px;
	aspect-ratio: 872 / 463;
	background-image: url(../img/form/bg-success.png);
}

.popup--error {
	max-width: 872px;
	aspect-ratio: 872 / 756;
	background-image: url(../img/form/bg-error.png);
}

.popup--success .popup__close,
.popup--error .popup__close {
	top: 2.29cqw;
	right: 2.29cqw;
}

.popup--success .popup__close svg,
.popup--error .popup__close svg {
	width: 4.13cqw;
	height: 4.13cqw;
}

/* success */
.success__title {
	position: absolute;
	left: 5.5cqw;
	top: 7.8cqw;
	width: 44.7cqw;
	margin: 0;
	font-family: "VK Sans Display Expanded";
	font-weight: 700;
	font-size: 3.9cqw;
	line-height: 1.1;
	letter-spacing: -0.11cqw;
	text-transform: uppercase;
}

.success__desc {
	position: absolute;
	left: 5.5cqw;
	top: 27.06cqw;
	width: 44.7cqw;
	margin: 0;
	font-family: "VK Sans Display";
	font-weight: 400;
	font-size: 1.6cqw;
	line-height: 1.1;
	color: var(--white);
}

.success__socials {
	position: absolute;
	left: 5.5cqw;
	top: 40.25cqw;
	display: flex;
	gap: 2.75cqw;
}

.success__social img {
	display: block;
	width: 4.13cqw;
	height: 4.13cqw;
}

.success__tv {
	position: absolute;
	left: 48.28cqw;
	top: 2.64cqw;
	width: 45.07cqw;
	height: auto;
}

/* error */
.error-state__tv {
	position: absolute;
	left: 25.57cqw;
	top: 15.6cqw;
	width: 48.74cqw;
	height: auto;
}

.error-state__text {
	position: absolute;
	left: 23.39cqw;
	top: 60.78cqw;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.92cqw;
	width: 53.21cqw;
	text-align: center;
}

.error-state__title {
	margin: 0;
	font-family: "VK Sans Display";
	font-weight: 500;
	font-size: 3.67cqw;
	line-height: 1.2;
	color: var(--accent);
}

.error-state__desc {
	margin: 0;
	font-family: "VK Sans Display";
	font-weight: 400;
	font-size: 2.29cqw;
	line-height: 1.2;
	color: var(--white);
}

/* ---------- адаптив ---------- */

@media screen and (max-width: 767px) {
	.fancybox__slide {
		padding: 12px;
	}

	.popup--form {
		padding: 32px 18px;
		border-radius: 16px;
	}

	.popup__close {
		top: 16px;
		right: 16px;
	}

	.popup__title {
		margin-bottom: 28px;
		padding: 0 36px;
		font-size: 22px;
	}

	.form__grid {
		grid-template-columns: 1fr;
		gap: 16px;
	}

	.form__item--wide {
		grid-column: auto;
	}

	.form__submit {
		width: 100%;
	}

	/* success/error: убираем абсолют, делаем читаемый столбец */
	.popup--success,
	.popup--error {
		display: flex;
		flex-direction: column;
		align-items: center;
		aspect-ratio: auto;
		container-type: normal;
		max-width: 480px;
		padding: 40px 18px 32px;
		background-color: #0d0d0e;
		background-image: url(../img/form/bg-error.png);
		text-align: center;
	}

	.success__title,
	.success__desc,
	.success__socials,
	.success__tv,
	.error-state__tv,
	.error-state__text {
		position: static;
		left: auto;
		top: auto;
		width: auto;
	}

	.popup--success .popup__close svg,
	.popup--error .popup__close svg {
		width: 26px;
		height: 26px;
	}

	.success__title {
		margin-bottom: 16px;
		font-size: 26px;
		letter-spacing: -0.5px;
	}

	.success__desc {
		margin-bottom: 24px;
		font-size: 14px;
		line-height: 1.4;
	}

	.success__socials {
		justify-content: center;
		gap: 16px;
		margin-bottom: 28px;
	}

	.success__social img {
		width: 36px;
		height: 36px;
	}

	.success__tv {
		width: 220px;
	}

	.error-state__tv {
		width: 240px;
		margin-bottom: 16px;
	}

	.error-state__text {
		gap: 8px;
	}

	.error-state__title {
		font-size: 22px;
	}

	.error-state__desc {
		font-size: 14px;
	}
}
