html.wag-auth-open {
	overflow: hidden;
}

/* Auth modal — styled like search modal */
.auth-form--modal {
	transition: opacity .25s ease, visibility .25s ease;
	overflow: hidden;
	z-index: 1000;
	position: fixed;
	inset: 0;
	visibility: hidden;
	opacity: 0;
	-webkit-backdrop-filter: saturate(180%) blur(10px);
	backdrop-filter: saturate(180%) blur(10px);
}

.auth-form--modal.is-visible {
	visibility: visible;
	opacity: 1;
	background-color: rgba(255, 250, 255, 0.78);
}

.auth-form--modal.is-visible .auth-form__inner {
	animation: wagAuthModalIn .42s cubic-bezier(.22, 1, .36, 1);
}

@keyframes wagAuthModalIn {
	from {
		opacity: 0;
		transform: translateY(18px) scale(.96);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.auth-form__inner {
	position: absolute;
	inset: 0;
	margin: auto;
	width: min(420px, calc(100% - 32px));
	height: fit-content;
	max-height: calc(100vh - 48px);
	overflow: hidden;
	padding: 0;
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.94);
	-webkit-backdrop-filter: saturate(180%) blur(18px);
	backdrop-filter: saturate(180%) blur(18px);
	border: 1px solid rgba(255, 255, 255, 0.85);
	box-shadow:
		0 20px 50px rgba(0, 0, 0, 0.12),
		0 0 0 1px rgba(255, 255, 255, 0.35) inset;
	display: flex;
	flex-direction: column;
}

.auth-form__head {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	position: relative;
	padding: 12px 12px 0 20px;
	background: transparent;
	border-bottom: none;
}

.auth-form__head::after {
	display: none;
}

.auth-form__tabs {
	display: flex;
	flex: 1;
	gap: 28px;
	margin: 0;
	min-width: 0;
	position: relative;
	padding: 0;
	justify-content: flex-start;
	align-items: center;
}

.auth-form__tabs::before {
	content: "";
	position: absolute;
	left: var(--auth-tab-indicator-left, 0);
	width: var(--auth-tab-indicator-width, 50%);
	bottom: 0;
	height: 2px;
	border-radius: 2px;
	background: var(--theme-skin, #505050);
	box-shadow: none;
	transition: left .28s cubic-bezier(.22, 1, .36, 1), width .28s cubic-bezier(.22, 1, .36, 1);
	pointer-events: none;
	z-index: 1;
}

.auth-form--modal .auth-form__tab,
.auth-form--modal .auth_close {
	-webkit-appearance: none;
	appearance: none;
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
	outline: none;
}

.auth-form__tab {
	flex: 0 0 auto;
	border: none;
	background: transparent;
	color: #888;
	font-size: 15px;
	font-weight: 600;
	padding: 0 2px 12px;
	border-radius: 0;
	cursor: pointer;
	transition: color .2s ease;
	position: relative;
	letter-spacing: 0.02em;
	z-index: 0;
	line-height: 1.4;
}

.auth-form__tab:hover:not(:disabled) {
	color: #555;
	background: transparent !important;
}

.auth-form__tab.is-active {
	color: var(--theme-skin, #505050);
	background: transparent !important;
}

.auth-form__tab.is-active::after {
	display: none;
}

.auth-form__tab:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.auth_close {
	position: relative;
	flex-shrink: 0;
	align-self: center;
	width: 28px;
	height: 28px;
	margin: 0 0 0 4px;
	border: none;
	border-radius: 0;
	background: transparent !important;
	cursor: pointer;
	padding: 0;
	z-index: 2;
	transition: opacity .2s ease, transform .2s ease;
}

.auth-form--modal .auth_close:hover,
.auth-form--modal .auth_close:active,
.auth-form--modal .auth_close:focus {
	background: transparent !important;
	box-shadow: none !important;
	border: none !important;
}

.auth_close:hover {
	opacity: 0.72;
}

.auth_close:active {
	transform: scale(0.94);
}

.auth_close::after,
.auth_close::before {
	background-color: #888;
	position: absolute;
	content: "";
	width: 14px;
	height: 2px;
	top: 13px;
	left: 7px;
	border-radius: 1px;
}

.auth_close::after {
	transform: rotate(45deg);
}

.auth_close::before {
	transform: rotate(-45deg);
}

.auth-form__content {
	padding: 20px 24px 24px;
	overflow: auto;
	max-height: calc(100vh - 120px);
	background: transparent;
}

.auth-form__panels {
	position: relative;
	min-height: 120px;
}

.auth-form__panel {
	display: none;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity .24s ease, transform .24s ease;
}

.auth-form__panel.is-active {
	display: block;
	opacity: 1;
	transform: translateY(0);
}

.auth-form__notice {
	margin: 0;
	padding: 24px 0;
	text-align: center;
	font-size: 14px;
	color: #888;
	line-height: 1.6;
}

.auth-form__body {
	display: grid;
	gap: 14px;
}

.auth-field {
	display: grid;
	gap: 6px;
}

.auth-field__label {
	font-size: 13px;
	color: #666;
	font-weight: 600;
}

.auth-field__control {
	position: relative;
	display: flex;
	align-items: center;
}

.auth-field__icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: #aaa;
	font-size: 14px;
	pointer-events: none;
	transition: color .2s ease;
}

.auth-field__control:focus-within .auth-field__icon {
	color: var(--theme-skin, #505050);
}

.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"] {
	width: 100%;
	box-sizing: border-box;
	border: 1px solid rgba(0, 0, 0, 0.06);
	border-radius: 12px;
	padding: 11px 14px 11px 40px;
	font-size: 14px;
	background: rgba(248, 249, 251, 0.95);
	transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.auth-field__control:has(.auth-field__toggle) input {
	padding-right: 42px;
}

.auth-field input::placeholder {
	color: #b0b0b0;
}

.auth-field input:focus {
	outline: none;
	border-color: var(--theme-skin, #505050);
	background: #fff;
	box-shadow: 0 0 0 3px rgba(80, 80, 80, 0.12);
}

.auth-field__toggle {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	width: 30px;
	height: 30px;
	border: none;
	border-radius: 8px;
	background: transparent;
	color: #999;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: color .2s ease, background .2s ease;
}

.auth-field__toggle:hover {
	color: var(--theme-skin, #505050);
	background: rgba(0, 0, 0, 0.04);
}

.auth-captcha-row {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	padding: 10px;
	border-radius: 12px;
	background: rgba(248, 249, 251, 0.95);
	border: 1px solid rgba(0, 0, 0, 0.06);
}

.auth-captcha-row input[type="text"] {
	flex: 1;
	min-width: 120px;
	padding-left: 12px;
	background: #fff;
}

.auth-captcha-img {
	border-radius: 8px;
	cursor: pointer;
	border: 1px solid rgba(0, 0, 0, 0.06);
	transition: opacity .2s ease, transform .2s ease;
}

.auth-captcha-img.is-loading {
	opacity: 0.45;
}

.auth-captcha-img:hover {
	opacity: 0.88;
	transform: scale(1.02);
}

.auth-form__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}

.auth-checkbox {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: #666;
	cursor: pointer;
	user-select: none;
}

.auth-checkbox input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.auth-checkbox span {
	position: relative;
	padding-left: 22px;
}

.auth-checkbox span::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	border-radius: 5px;
	border: 1px solid #d9d9d9;
	background: #fff;
	transition: border-color .2s ease, background .2s ease;
}

.auth-checkbox input:checked + span::before {
	border-color: var(--theme-skin, #505050);
	background: var(--theme-skin, #505050);
}

.auth-checkbox input:checked + span::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 50%;
	width: 5px;
	height: 9px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: translateY(-62%) rotate(45deg);
}

.auth-link {
	border: none;
	background: none;
	padding: 0;
	color: var(--theme-skin, #505050);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
}

.auth-link--muted {
	color: #888;
	font-weight: 500;
}

.auth-link:hover {
	opacity: 0.85;
}

.auth-submit {
	width: 100%;
	border: none;
	border-radius: 12px;
	padding: 12px 14px;
	font-size: 15px;
	font-weight: 700;
	color: #fff;
	background: linear-gradient(135deg, var(--theme-skin-matching, var(--theme-skin, #505050)) 0%, var(--theme-skin, #505050) 100%);
	box-shadow: 0 8px 20px rgba(80, 80, 80, 0.22);
	cursor: pointer;
	transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.auth-submit:hover:not(:disabled) {
	transform: translateY(-1px);
	box-shadow: 0 10px 24px rgba(80, 80, 80, 0.28);
}

.auth-submit:active:not(:disabled) {
	transform: translateY(0);
}

.auth-submit:disabled,
.auth-submit.is-loading {
	opacity: 0.72;
	cursor: wait;
	transform: none;
}

.auth-submit.is-loading {
	position: relative;
	color: transparent;
}

.auth-submit.is-loading::after {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	animation: wagAuthSpin .7s linear infinite;
}

@keyframes wagAuthSpin {
	to { transform: rotate(360deg); }
}

.auth-form__switch {
	display: none;
}

.auth-form__panel.is-active {
	display: block;
}

.auth-form__social {
	margin-top: 4px;
	padding-top: 4px;
}

.auth-form__divider {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 18px 0 12px;
	color: #aaa;
	font-size: 12px;
}

.auth-form__divider::before,
.auth-form__divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: #eee;
}

.auth-form__social .wag-auth-social--qq {
	border-top: none;
	padding-top: 0;
	margin-top: 0;
}

.auth-form__social .wag-auth-qq-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 10px 14px;
	border-radius: 12px;
	border: 1px solid #12b7f5;
	background: #12b7f5;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: opacity 0.15s, background 0.15s;
	box-sizing: border-box;
	box-shadow: 0 6px 16px rgba(18, 183, 245, 0.22);
}

.auth-form__social .wag-auth-qq-btn:hover {
	opacity: 0.92;
	color: #fff;
	background: #0ea8e3;
}

.auth-form__social .wag-auth-qq-icon {
	display: inline-flex;
	line-height: 0;
}

.wag-auth-status {
	margin: 0 0 14px;
	padding: 10px 12px;
	border-radius: 12px;
	font-size: 13px;
	line-height: 1.5;
	animation: wagAuthStatusIn .25s ease;
}

.wag-auth-status.is-success {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	font-size: 14px;
	font-weight: 500;
	background: #f6ffed;
	color: #389e0d;
	border: 1px solid #b7eb8f;
}

.wag-auth-status__icon {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
	line-height: 1;
}

.wag-auth-status__text {
	flex: 1;
	min-width: 0;
}

.auth-form--modal.is-success-state .auth-form__panels,
.auth-form--modal.is-success-state .auth-form__social {
	opacity: 0.42;
	pointer-events: none;
	transition: opacity .28s ease;
}

.auth-form--modal.is-success-state .auth-form__head {
	opacity: 0.72;
	transition: opacity .28s ease;
}

@keyframes wagAuthStatusIn {
	from { opacity: 0; transform: translateY(-4px); }
	to { opacity: 1; transform: translateY(0); }
}

.wag-auth-status.is-error {
	background: #fff1f0;
	color: #cf1322;
	border: 1px solid #ffa39e;
}

body.dark .wag-auth-status.is-success {
	background: rgba(56, 158, 13, 0.12);
	color: #95de64;
	border-color: rgba(149, 222, 100, 0.28);
}

body.dark .auth-form--modal.is-visible {
	background-color: rgba(12, 12, 16, 0.78);
}

body.dark .auth-form__inner {
	background: rgba(28, 28, 32, 0.92);
	border-color: rgba(255, 255, 255, 0.08);
	box-shadow:
		0 20px 50px rgba(0, 0, 0, 0.35),
		0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

body.dark .auth-form__head {
	background: transparent;
	border-bottom: none;
}

body.dark .auth-form__content {
	background: transparent;
}

body.dark .auth-form__title {
	color: #f0f0f0;
}

body.dark .auth-field input {
	background: rgba(255, 255, 255, 0.06);
	border-color: rgba(255, 255, 255, 0.1);
	color: #eee;
}

body.dark .auth-field input:focus {
	background: rgba(255, 255, 255, 0.08);
	border-color: var(--theme-skin, #505050);
}

body.dark .auth-captcha-row {
	background: rgba(255, 255, 255, 0.04);
	border-color: rgba(255, 255, 255, 0.08);
}

body.dark .auth-field__toggle:hover {
	background: rgba(255, 255, 255, 0.06);
}

body.dark .auth-checkbox span::before {
	background: rgba(255, 255, 255, 0.06);
	border-color: rgba(255, 255, 255, 0.18);
}

body.dark .auth-form__tab {
	background: transparent;
	color: rgba(255, 255, 255, 0.5);
}

body.dark .auth-form__tab:hover:not(:disabled) {
	color: rgba(255, 255, 255, 0.78);
}

body.dark .auth-form__tab.is-active {
	color: #fff;
	background: transparent !important;
}

body.dark .auth_close::after,
body.dark .auth_close::before {
	background-color: #bbb;
}

body.dark .auth-form--modal .auth_close:hover {
	background: transparent !important;
	opacity: 0.72;
}

@media (max-width: 860px) {
	.auth-form__content {
		padding: 18px 16px 20px;
	}

	.auth-form__head {
		padding: 10px 10px 0 16px;
	}

	.auth-form__tabs {
		gap: 22px;
	}

	.auth-form__tab {
		font-size: 14px;
		padding-bottom: 10px;
	}
}
