/* ==========================================================
   Vizaje-Nica Auth Drawer
   ========================================================== */

html.auth-drawer-lock,
html.auth-drawer-lock body {
	overflow: hidden;
}

/* ==========================================================
   Root
   ========================================================== */

.auth-drawer {
	position: fixed;
	inset: 0;
	z-index: 1000000;

	display: block;

	visibility: hidden;
	pointer-events: none;
}

.auth-drawer.is-open {
	visibility: visible;
	pointer-events: auto;
}

/* ==========================================================
   Overlay
   ========================================================== */

.auth-drawer__overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	width: 100%;
	height: 100%;
	padding: 0;

	border: 0;
	border-radius: 0;
	outline: none;

	background: rgba(13, 13, 13, 0.54);

	opacity: 0;
	cursor: default;

	-webkit-appearance: none;
	appearance: none;
}

/* ==========================================================
   Panel
   ========================================================== */

.auth-drawer__panel {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 2;

	display: flex;
	width: min(520px, 42vw);
	height: 100%;
	height: 100dvh;
	flex-direction: column;

	overflow: hidden;

	background: #ffffff;
	color: #111111;

	box-shadow: 24px 0 70px rgba(0, 0, 0, 0.12);

	/*
	 * Не задаём translateX здесь.
	 * Положение панели полностью контролирует GSAP.
	 */
	transform: none;
	will-change: transform;
}

/* ==========================================================
   Close
   ========================================================== */

.auth-drawer__close {
	position: absolute;
	top: 28px;
	right: 28px;
	z-index: 20;

	display: block;
	width: 32px;
	height: 32px;
	padding: 0;

	border: 0;
	border-radius: 0;
	outline: none;

	background: transparent;
	color: #111111;

	cursor: pointer;

	transition:
		opacity 180ms ease,
		transform 180ms ease;

	-webkit-appearance: none;
	appearance: none;
}

.auth-drawer__close:hover {
	opacity: 0.58;
	transform: rotate(3deg);
}

.auth-drawer__close span {
	position: absolute;
	top: 50%;
	left: 50%;

	display: block;
	width: 20px;
	height: 1px;

	background: currentColor;

	transform-origin: center;
}

.auth-drawer__close span:first-child {
	transform: translate(-50%, -50%) rotate(45deg);
}

.auth-drawer__close span:last-child {
	transform: translate(-50%, -50%) rotate(-45deg);
}

/* ==========================================================
   Content and screens
   ========================================================== */

.auth-drawer__content {
	position: relative;

	flex: 1;
	width: 100%;
	height: 100%;

	overflow: hidden;
}

.auth-drawer__screen {
	position: absolute;
	inset: 0;

	display: none;
	width: 100%;
	height: 100%;

	overflow: hidden auto;

	background: #ffffff;

	opacity: 0;
	visibility: hidden;
	pointer-events: none;

	scrollbar-width: thin;
	scrollbar-color: #d7d7d7 transparent;

	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.auth-drawer__screen::-webkit-scrollbar {
	width: 5px;
}

.auth-drawer__screen::-webkit-scrollbar-track {
	background: transparent;
}

.auth-drawer__screen::-webkit-scrollbar-thumb {
	border-radius: 99px;
	background: #d7d7d7;
}

.auth-drawer__screen.is-active {
	display: block;

	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* ==========================================================
   Main layout
   ========================================================== */

.auth-drawer__main {
	display: flex;
	width: 100%;
	min-height: 100%;
	flex-direction: column;

	padding: 92px 48px 48px;
}

.auth-drawer__header {
	width: 100%;
	max-width: 376px;
}

.auth-drawer__eyebrow {
	margin: 0 0 14px;

	color: #8a8a8a;

	font-size: 11px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.auth-drawer__title {
	margin: 0;

	color: #111111;

	font-family: inherit;
	font-size: 30px;
	font-weight: 600;
	line-height: 1.08;
	letter-spacing: -0.035em;
}

.auth-drawer__description {
	max-width: 356px;
	margin: 20px 0 0;

	color: #666666;

	font-size: 13px;
	font-weight: 400;
	line-height: 1.55;
}

.auth-drawer__description strong {
	display: block;
	margin-top: 4px;

	color: #111111;
	font-weight: 500;
}

/* ==========================================================
   Back
   ========================================================== */

.auth-drawer__back {
	display: inline-flex;
	width: fit-content;
	align-items: center;
	gap: 10px;

	margin: -18px 0 38px;
	padding: 0;

	border: 0;
	border-radius: 0;

	background: transparent;
	color: #666666;

	font-family: inherit;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.3;

	cursor: pointer;

	transition: color 180ms ease;

	-webkit-appearance: none;
	appearance: none;
}

.auth-drawer__back:hover {
	color: #111111;
}

.auth-drawer__back span {
	font-size: 19px;
	font-weight: 300;
	line-height: 1;
}

/* ==========================================================
   Form
   ========================================================== */

.auth-drawer__form {
	display: flex;
	width: 100%;
	max-width: 376px;
	flex-direction: column;

	margin-top: 38px;
}

.auth-drawer__field {
	width: 100%;
	margin-bottom: 24px;
}

.auth-drawer__label {
	display: block;
	margin-bottom: 9px;

	color: #111111;

	font-size: 12px;
	font-weight: 500;
	line-height: 1.3;
}

.auth-drawer__input {
	display: block;
	width: 100%;
	height: 48px;
	padding: 0 14px;

	border: 1px solid #d0d0d0;
	border-radius: 0;
	outline: none;

	background: #ffffff;
	color: #111111;

	font-family: inherit;
	font-size: 14px;
	font-weight: 400;
	line-height: 1;

	box-shadow: none;

	transition:
		border-color 180ms ease,
		box-shadow 180ms ease,
		background-color 180ms ease;

	-webkit-appearance: none;
	appearance: none;
}

.auth-drawer__input::placeholder {
	color: #a4a4a4;
	opacity: 1;
}

.auth-drawer__input:hover {
	border-color: #a8a8a8;
}

.auth-drawer__input:focus {
	border-color: #111111;

	box-shadow: 0 0 0 1px #111111;
}

.auth-drawer__input:-webkit-autofill,
.auth-drawer__input:-webkit-autofill:hover,
.auth-drawer__input:-webkit-autofill:focus {
	-webkit-text-fill-color: #111111;
	-webkit-box-shadow: 0 0 0 1000px #ffffff inset;

	transition: background-color 9999s ease-in-out 0s;
}

/* ==========================================================
   Phone
   ========================================================== */

.auth-phone {
	display: grid;
	width: 100%;
	grid-template-columns: 112px minmax(0, 1fr);
	gap: 8px;
}

.auth-phone__prefix {
	display: flex;
	height: 48px;
	align-items: center;
	justify-content: center;
	gap: 6px;

	border: 1px solid #d0d0d0;

	background: #ffffff;
	color: #111111;

	font-size: 12px;
	font-weight: 400;
	line-height: 1;

	user-select: none;
}

.auth-phone__prefix span:first-child {
	font-weight: 500;
}

.auth-phone__prefix svg {
	margin-left: 2px;

	color: #666666;
}

.auth-phone__input {
	min-width: 0;
}

/* ==========================================================
   Password
   ========================================================== */

.auth-password {
	position: relative;

	width: 100%;
}

.auth-password__input {
	padding-right: 48px;
}

.auth-password__toggle {
	position: absolute;
	top: 0;
	right: 0;

	display: grid;
	width: 48px;
	height: 48px;
	padding: 0;

	border: 0;
	border-radius: 0;

	background: transparent;
	color: #777777;

	cursor: pointer;
	place-items: center;

	transition:
		color 180ms ease,
		opacity 180ms ease;

	-webkit-appearance: none;
	appearance: none;
}

.auth-password__toggle:hover,
.auth-password__toggle.is-active {
	color: #111111;
}

.auth-password__toggle:focus-visible {
	outline: 1px solid #111111;
	outline-offset: -4px;
}

/* ==========================================================
   Form meta and links
   ========================================================== */

.auth-drawer__form-meta {
	display: flex;
	justify-content: flex-end;

	margin: -9px 0 38px;
}

.auth-drawer__text-button,
.auth-drawer__text-link {
	width: fit-content;
	padding: 0;

	border: 0;
	border-radius: 0;

	background: transparent;
	color: #666666;

	font-family: inherit;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.35;
	text-decoration: underline;
	text-underline-offset: 3px;

	cursor: pointer;

	transition: color 180ms ease;

	-webkit-appearance: none;
	appearance: none;
}

.auth-drawer__text-button:hover,
.auth-drawer__text-link:hover {
	color: #111111;
}

.auth-drawer__text-link {
	align-self: center;

	margin-top: 24px;
}

/* ==========================================================
   Buttons
   ========================================================== */

.auth-drawer__primary-button,
.auth-drawer__secondary-button {
	position: relative;

	display: flex;
	width: 100%;
	min-height: 48px;
	align-items: center;
	justify-content: center;

	padding: 13px 18px;

	border-radius: 0;

	font-family: inherit;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.25;
	text-align: center;
	letter-spacing: 0.01em;

	cursor: pointer;

	transition:
		background-color 180ms ease,
		color 180ms ease,
		border-color 180ms ease,
		opacity 180ms ease;

	-webkit-appearance: none;
	appearance: none;
}

.auth-drawer__primary-button {
	border: 1px solid #111111;

	background: #111111;
	color: #ffffff;
}

.auth-drawer__primary-button:hover {
	border-color: #292929;

	background: #292929;
}

.auth-drawer__secondary-button {
	margin-top: 12px;

	border: 1px solid #111111;

	background: #ffffff;
	color: #111111;
}

.auth-drawer__secondary-button:hover {
	background: #f3f3f3;
}

.auth-drawer__primary-button:disabled,
.auth-drawer__secondary-button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

/* ==========================================================
   Loading
   ========================================================== */

.auth-drawer__primary-button.is-loading {
	color: transparent;

	cursor: wait;
	pointer-events: none;
}

.auth-drawer__primary-button.is-loading::after {
	content: '';

	position: absolute;
	top: 50%;
	left: 50%;

	width: 18px;
	height: 18px;

	border: 1.5px solid rgba(255, 255, 255, 0.38);
	border-top-color: #ffffff;
	border-radius: 50%;

	transform: translate(-50%, -50%);

	animation: auth-drawer-button-loading 700ms linear infinite;
}

@keyframes auth-drawer-button-loading {
	to {
		transform: translate(-50%, -50%) rotate(360deg);
	}
}

/* ==========================================================
   Switch login/register
   ========================================================== */

.auth-drawer__switch {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;

	margin: 28px 0 0;

	color: #909090;

	font-size: 12px;
	line-height: 1.4;
	text-align: center;
}

.auth-drawer__switch button {
	padding: 0;

	border: 0;
	border-radius: 0;

	background: transparent;
	color: #111111;

	font-family: inherit;
	font-size: inherit;
	font-weight: 400;
	line-height: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;

	cursor: pointer;

	-webkit-appearance: none;
	appearance: none;
}

/* ==========================================================
   Messages
   ========================================================== */

.auth-drawer__message {
	display: none;
	width: 100%;

	margin: 0 0 22px;
	padding: 12px 14px;

	border: 1px solid transparent;

	font-size: 12px;
	line-height: 1.45;
}

.auth-drawer__message.is-visible,
.auth-drawer__message:not(:empty) {
	display: block;
}

.auth-drawer__message--error {
	border-color: #dfb6b6;

	background: #fff7f7;
	color: #9c2424;
}

.auth-drawer__message--success {
	border-color: #b8d4bc;

	background: #f6fbf7;
	color: #2f6738;
}

/* ==========================================================
   Checkboxes
   ========================================================== */

.auth-drawer__checks {
	display: flex;
	flex-direction: column;
	gap: 14px;

	margin: 2px 0 30px;
}

.auth-drawer__check {
	position: relative;

	display: grid;
	grid-template-columns: 16px minmax(0, 1fr);
	gap: 10px;

	align-items: start;

	cursor: pointer;
}

.auth-drawer__check input {
	position: absolute;

	width: 1px;
	height: 1px;

	overflow: hidden;
	clip: rect(0, 0, 0, 0);

	white-space: nowrap;
}

.auth-drawer__check-box {
	position: relative;

	display: block;
	width: 14px;
	height: 14px;
	margin-top: 1px;

	border: 1px solid #bdbdbd;

	background: #ffffff;

	transition:
		border-color 180ms ease,
		background-color 180ms ease;
}

.auth-drawer__check input:checked + .auth-drawer__check-box {
	border-color: #111111;
	background: #111111;
}

.auth-drawer__check input:checked + .auth-drawer__check-box::after {
	content: '';

	position: absolute;
	top: 2px;
	left: 4px;

	width: 4px;
	height: 7px;

	border-right: 1.5px solid #ffffff;
	border-bottom: 1.5px solid #ffffff;

	transform: rotate(45deg);
}

.auth-drawer__check input:focus-visible + .auth-drawer__check-box {
	outline: 1px solid #111111;
	outline-offset: 2px;
}

.auth-drawer__check-text {
	color: #555555;

	font-size: 11px;
	font-weight: 400;
	line-height: 1.55;
}

.auth-drawer__check-text a {
	color: #111111;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ==========================================================
   SMS code
   ========================================================== */

.auth-code {
	width: 100%;
	margin-top: 2px;
}

.auth-code__inputs {
	display: grid;
	width: 100%;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 10px;
}

.auth-code__input {
	display: block;
	width: 100%;
	height: 54px;
	padding: 0;

	border: 1px solid #cfcfcf;
	border-radius: 0;
	outline: none;

	background: #ffffff;
	color: #111111;

	font-family: inherit;
	font-size: 20px;
	font-weight: 500;
	line-height: 1;
	text-align: center;

	transition:
		border-color 180ms ease,
		box-shadow 180ms ease,
		transform 180ms ease;

	-webkit-appearance: none;
	appearance: none;
}

.auth-code__input:hover {
	border-color: #999999;
}

.auth-code__input:focus {
	border-color: #111111;

	box-shadow: 0 0 0 1px #111111;

	transform: translateY(-2px);
}

.auth-code__timer {
	margin: 24px 0 0;

	color: #8c8c8c;

	font-size: 11px;
	font-weight: 400;
	line-height: 1.5;
}

.auth-code__timer strong {
	color: #111111;
	font-weight: 500;
}

.auth-code__resend {
	display: inline-block;
	margin-top: 10px;
	padding: 0;

	border: 0;
	border-radius: 0;

	background: transparent;
	color: #111111;

	font-family: inherit;
	font-size: 11px;
	line-height: 1.4;
	text-decoration: underline;
	text-underline-offset: 3px;

	cursor: pointer;

	-webkit-appearance: none;
	appearance: none;
}

.auth-code__resend:disabled {
	display: none;
}

/* ==========================================================
   Status screens
   ========================================================== */

.auth-drawer__status {
	display: flex;
	width: 100%;
	max-width: 376px;
	min-height: calc(100dvh - 184px);
	flex-direction: column;
	align-items: center;
	justify-content: center;

	margin: 0 auto;

	text-align: center;
}

.auth-drawer__status-icon {
	display: grid;
	width: 76px;
	height: 76px;

	margin-bottom: 28px;

	border: 1px solid #dddddd;
	border-radius: 50%;

	color: #111111;

	place-items: center;
}

.auth-drawer__status .auth-drawer__title {
	font-size: 27px;
	text-align: center;
}

.auth-drawer__status .auth-drawer__description {
	margin: 16px auto 0;

	text-align: center;
}

.auth-drawer__status .auth-drawer__primary-button {
	margin-top: 40px;
}

.auth-drawer__status-link {
	display: inline-block;
	margin-top: 22px;

	color: #111111;

	font-size: 11px;
	line-height: 1.4;
	text-decoration: underline;
	text-underline-offset: 4px;

	cursor: pointer;
}

/* ==========================================================
   Register screen
   ========================================================== */

.auth-drawer__screen[data-auth-screen='register'] .auth-drawer__main {
	padding-top: 72px;
	padding-bottom: 40px;
}

.auth-drawer__screen[data-auth-screen='register'] .auth-drawer__form {
	margin-top: 32px;
}

.auth-drawer__screen[data-auth-screen='register'] .auth-drawer__field {
	margin-bottom: 18px;
}

/* ==========================================================
   Forgot screens
   ========================================================== */

.auth-drawer__screen[data-auth-screen='forgot'] .auth-drawer__form {
	margin-top: 34px;
}

.auth-drawer__screen[data-auth-screen='sms-code'] .auth-drawer__form {
	margin-top: 34px;
}

/* ==========================================================
   Focus
   ========================================================== */

.auth-drawer button:focus-visible,
.auth-drawer a:focus-visible {
	outline: 1px solid #111111;
	outline-offset: 3px;
}

/* ==========================================================
   Tablet
   ========================================================== */

@media (max-width: 1199px) {
	.auth-drawer__panel {
		width: min(500px, 52vw);
	}
}

/* ==========================================================
   Mobile
   ========================================================== */

@media (max-width: 767px) {
	.auth-drawer__panel {
		width: 100%;
		max-width: none;

		box-shadow: none;
	}

	.auth-drawer__close {
		top: 18px;
		right: 16px;

		width: 32px;
		height: 32px;
	}

	.auth-drawer__main {
		padding: 72px 18px calc(32px + env(safe-area-inset-bottom));
	}

	.auth-drawer__header,
	.auth-drawer__form {
		max-width: none;
	}

	.auth-drawer__title {
		font-size: 27px;
	}

	.auth-drawer__description {
		max-width: 320px;

		font-size: 12px;
	}

	.auth-drawer__back {
		margin: -8px 0 32px;
	}

	.auth-drawer__form {
		margin-top: 32px;
	}

	.auth-drawer__field {
		margin-bottom: 21px;
	}

	.auth-phone {
		grid-template-columns:
			104px
			minmax(0, 1fr);
	}

	.auth-phone__prefix,
	.auth-drawer__input,
	.auth-password__toggle {
		height: 48px;
	}

	.auth-code__inputs {
		gap: 8px;
	}

	.auth-code__input {
		height: 50px;

		font-size: 18px;
	}

	.auth-drawer__status {
		min-height: calc(100dvh - 144px);
	}

	.auth-drawer__screen[data-auth-screen='register'] .auth-drawer__main {
		padding-top: 62px;
	}
}

/* ==========================================================
   Small mobile
   ========================================================== */

@media (max-width: 374px) {
	.auth-drawer__main {
		padding-inline: 14px;
	}

	.auth-code__inputs {
		gap: 6px;
	}

	.auth-code__input {
		height: 46px;

		font-size: 17px;
	}

	.auth-phone {
		grid-template-columns:
			98px
			minmax(0, 1fr);
	}

	.auth-drawer__switch {
		flex-wrap: wrap;
	}
}

/* ==========================================================
   Reduced motion
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
	.auth-drawer *,
	.auth-drawer *::before,
	.auth-drawer *::after {
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}
}
