/* Auth pages: dialogs + forgot success (controls match login via shared classes) */

:root {
	--ui-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
	--ui-dur-1: 120ms;
	--ui-dur-2: 180ms;
	--ui-dur-3: 240ms;
	--ui-dur-4: 300ms;
}

#auth_div .auth-join-form {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

#auth_div .auth-field {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0;
}

#auth_div .auth-field__label {
	display: block;
	margin: 0;
	font-size: 14px;
	line-height: 1.35;
	color: #374151;
}

#auth_div .auth-agreements {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 0;
}

#auth_div .auth-agreements .auth-remember-label {
	align-items: flex-start;
}

#auth_div .smart-captcha {
	min-height: 102px;
	margin: 0;
	position: relative;
	z-index: 6;
}

#auth_div .smart-captcha iframe {
	max-width: 100%;
}

#auth_div .auth-captcha-fallback {
	padding: 12px 14px;
	border-radius: 12px;
	background: #fff7ed;
	border: 1px solid #fed7aa;
	color: #9a3412;
	font-size: 13px;
	line-height: 1.45;
}

#auth_div .alert {
	padding: 12px 14px;
	border-radius: 12px;
	background: #eef6ff;
	border: 1px solid #cfe3ff;
	color: #1e3a5f;
	font-size: 14px;
	line-height: 1.45;
}

#auth_div .alert--error {
	background: #fff1f1;
	border-color: #ffc9c9;
	color: #9b1c1c;
}

/* Success state only — form controls reuse login classes */
#auth_div .auth-forgot-success {
	display: none;
	flex-direction: column;
	align-items: stretch;
	width: 100%;
	text-align: center;
	padding: 4px 0 2px;
}

#auth_div .auth-forgot-success:not([hidden]) {
	display: flex;
}

#auth_div.is-success .auth-forgot-success,
#forgot_div.is-success .auth-forgot-success {
	animation: auth-forgot-in var(--ui-dur-4) var(--ui-ease-out) both;
}

#forgot_div.is-success > .text-center,
#reset_div.is-success > .text-center,
#reset_div.is-status > .text-center {
	display: none;
}

#auth_div .auth-forgot-success__mark {
	width: 22px;
	height: 22px;
	flex: 0 0 auto;
	color: #1B6DFF;
}

#auth_div .auth-2fa {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

#auth_div .auth-2fa__head {
	text-align: center;
}

#auth_div .auth-2fa__badge {
	width: 56px;
	height: 56px;
	margin: 0 auto 16px;
	border-radius: 16px;
	display: grid;
	place-items: center;
	color: #1B6DFF;
	background: #eef5ff;
	border: 1px solid #d6e6ff;
}

#auth_div .auth-2fa__badge svg {
	width: 26px;
	height: 26px;
}

#auth_div .auth-2fa__title {
	margin: 0 0 8px;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.25;
	color: #1f2937;
}

#auth_div .auth-2fa__lead {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	color: #6b7280;
}

#auth_div .auth-2fa__lead strong {
	display: inline-block;
	margin-top: 2px;
	font-weight: 650;
	color: #1f2937;
	word-break: break-all;
}

#auth_div .auth-2fa__form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

#auth_div .auth-2fa__label {
	display: block;
	margin: 0;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: #94a3b8;
	text-align: center;
}

#auth_div .auth-2fa-otp {
	position: relative;
	width: 100%;
}

#auth_div .auth-2fa-otp__input {
	position: absolute;
	inset: 0;
	z-index: 2;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	opacity: 0;
	border: 0;
	background: transparent;
	color: transparent;
	caret-color: transparent;
	font-size: 16px;
}

#auth_div .auth-2fa-otp__boxes {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 8px;
	pointer-events: none;
}

#auth_div .auth-2fa-otp__box {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 52px;
	aspect-ratio: 1;
	border: 1.5px solid #e5e7eb;
	border-radius: 12px;
	background: #fff;
	color: #0f172a;
	font-size: 22px;
	font-weight: 650;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	transition:
		border-color var(--ui-dur-2) ease,
		box-shadow var(--ui-dur-2) ease,
		background var(--ui-dur-2) ease;
}

#auth_div .auth-2fa-otp__box.is-filled {
	border-color: #bfdbfe;
	background: #f8fbff;
}

#auth_div .auth-2fa-otp.is-complete .auth-2fa-otp__box {
	border-color: #93c5fd;
}

#auth_div .auth-2fa-otp:focus-within .auth-2fa-otp__box.is-active {
	border-color: #217dff;
	box-shadow: 0 0 0 3px rgba(33, 125, 255, .16);
	background: #fff;
}

#auth_div .auth-2fa-actions {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	margin-top: 4px;
}

#auth_div .auth-2fa__hint {
	margin: 0;
	max-width: 36ch;
	font-size: 13px;
	line-height: 1.45;
	color: #6b7280;
	text-align: center;
}

#auth_div .auth-2fa-resend {
	display: inline;
	padding: 0;
	border: 0;
	background: none;
	color: #217dff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

#auth_div .auth-2fa-resend:hover:not(:disabled) {
	text-decoration: underline;
}

#auth_div .auth-2fa-resend:disabled {
	color: #94a3b8;
	cursor: default;
	text-decoration: none;
}

#auth_div .auth-2fa-cancel {
	padding: 4px 0;
	border: 0;
	background: none;
	color: #217dff;
	font-size: 14px;
	cursor: pointer;
}

#auth_div .auth-2fa-cancel:hover {
	text-decoration: underline;
}

@media (max-width: 380px) {
	#auth_div .auth-2fa-otp__boxes {
		gap: 6px;
	}
	#auth_div .auth-2fa-otp__box {
		min-height: 44px;
		font-size: 18px;
		border-radius: 10px;
	}
}

#auth_div .auth-bg {
	position: fixed;
	inset: 0;
	z-index: 0;
	overflow: hidden;
	pointer-events: none;
}

#auth_div .auth-pass-hints {
	display: flex;
	flex-wrap: wrap;
	align-content: flex-start;
	gap: 6px;
	min-height: 0;
	margin: 0;
}

#auth_div .auth-pass-hints:not(:empty) {
	margin-top: 8px;
}

#auth_div .auth-pass-hint {
	display: inline-flex;
	align-items: center;
	padding: 4px 8px;
	border-radius: 8px;
	font-size: 12px;
	line-height: 1.35;
	font-weight: 500;
}

#auth_div .auth-pass-hint--warn {
	background: #fff7ed;
	border: 1px solid #fed7aa;
	color: #c2410c;
}

#auth_div .auth-pass-match {
	display: block;
	min-height: 0;
	margin: 0;
	font-size: 13px;
	line-height: 1.35;
	color: #6b7280;
}

#auth_div .auth-pass-match:not(:empty) {
	margin-top: 8px;
}

#auth_div .auth-pass-match.is-error {
	color: #dc2626;
}

#auth_div .auth-pass-match.is-ok {
	color: #16a34a;
}

#auth_div .auth-input.is-invalid {
	border-color: #f5a8a8 !important;
}

#auth_div .auth-input.is-valid {
	border-color: #86efac !important;
}

#auth_div .auth-forgot-success__title {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 0 0 10px;
	font-size: 22px;
	font-weight: 600;
	color: #1f2937;
	line-height: 1.25;
}

#auth_div .auth-forgot-success__title--warn {
	color: #9a3412;
}

#auth_div .auth-forgot-success__text {
	margin: 0 auto 8px;
	max-width: 34em;
	width: 100%;
	font-size: 15px;
	line-height: 1.55;
	color: #6b7280;
}

#auth_div .auth-forgot-success__mail {
	width: 100%;
	box-sizing: border-box;
	margin: 0 0 22px;
	padding: 0;
	background: none;
	border: 0;
	text-align: center;
	word-break: break-all;
}

#auth_div .auth-forgot-success__mail span {
	font-size: 14px;
	font-weight: 500;
	color: #6b7280;
}

#auth_div .auth-forgot-success__mail span::after {
	content: " ";
}

#auth_div .auth-forgot-success__mail strong {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	color: #1B6DFF;
}

@keyframes auth-forgot-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	#forgot_div.is-success .auth-forgot-success {
		animation: none;
	}
}

/* Shared auth dialogs */
body.app-modal-open {
	overflow: hidden;
}

div#fade {
	background: rgba(15, 23, 42, .54);
	opacity: 0;
	backdrop-filter: blur(2px);
	transition: opacity var(--ui-dur-3) ease;
}

div#fade.is-visible {
	opacity: 1;
}

.app-modal {
	box-sizing: border-box;
	left: 50% !important;
	top: 50% !important;
	width: min(440px, calc(100vw - 32px));
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 32px);
	margin: 0;
	padding: 24px !important;
	overflow: auto;
	transform: translate(-50%, -50%);
	border: 1px solid #e2e8f0;
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
	color: #172033;
	transition: opacity var(--ui-dur-2) ease;
}

.app-modal[aria-hidden="false"] {
	animation: auth-forgot-in var(--ui-dur-4) var(--ui-ease-out) both;
}

.app-dialog {
	min-width: 0 !important;
}

.app-dialog__header {
	display: grid;
	grid-template-columns: 42px minmax(0, 1fr);
	align-items: start;
	gap: 14px;
}

.app-dialog__header h2 {
	margin: 0;
	color: #172033;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.35;
}

.app-dialog__header p {
	margin: 5px 0 0;
	color: #607087;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.5;
}

.app-dialog__icon {
	display: grid;
	width: 42px;
	height: 42px;
	place-items: center;
	border-radius: 12px;
}

.app-dialog__icon svg {
	width: 22px;
	height: 22px;
}

.app-dialog__icon--info {
	background: #eef6ff;
	color: #217dff;
}

.app-dialog__icon--danger {
	background: #fff0f0;
	color: #dc2626;
}

.app-dialog__actions {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	margin-top: 24px;
}

.app-dialog__button {
	min-width: 112px;
}

.auth-required {
	color: #e5484d;
	font-weight: 700;
}

@media (max-width: 767px) {
	#auth_div .bg-white\/70,
	#auth_div .rounded-2xl {
		border: 0;
		border-radius: 28px;
		box-shadow: 0 12px 40px rgba(15, 23, 42, .12);
	}

	#auth_div button[type="submit"],
	#auth_div .ui-button--primary,
	#auth_div .app-dialog__button,
	#auth_div .auth-login-submit {
		border-radius: 16px;
	}

	#auth_div input[type="text"],
	#auth_div input[type="password"],
	#auth_div input[type="email"],
	#auth_div .auth-input {
		border-radius: 16px;
	}
}
