html,
body {
	height: 100%;
	margin: 0;
}

html {
	font-size: 16px;
	background-image: linear-gradient(to bottom right, #eff6ff, #ffffff, #faf5ff);
}

body {
	min-height: 100vh;
	min-height: 100dvh;
	padding: 0 1rem;
	justify-content: center;
	align-items: center;
	display: flex;
	margin: 0;
	box-sizing: border-box;
}

.slog-wrap {
	max-width: 27rem;
	width: 100%;
	box-sizing: border-box;
}

.slog-wrap *,
.slog-wrap *::before,
.slog-wrap *::after {
	box-sizing: border-box;
}

.slog-login-box {
	padding: 2rem;
	background-color: rgb(255 255 255 / 0.8);
	border-radius: 1rem;
	border: 1px solid #e0e0e2;
	transition-duration: 500ms;
	transition-property: all;
	transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
}

.slog-logo {
	display: flex;
	justify-content: center;
	margin-bottom: 1.5rem;
}

.slog-logo img {
	max-width: 160px;
	height: auto;
	display: block;
}

.slog-form-title h2 {
	color: transparent;
	font-weight: 700;
	font-size: 1.2rem;
	line-height: 2.25rem;
	-webkit-background-clip: text;
	background-clip: text;
	background-color: #0c0c0c;
	margin: 0;
}

.slog-form-title p {
	color: rgb(107 114 128 / 1);
	margin-top: 1.5rem;
	margin-bottom: 0;
}

.slog-form-row {
	position: relative;
	margin-top: 1.5rem;
}

/* پایه اینپوت‌ها */
.slog-wrap input {
	transition-property: all;
	transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
	transition-duration: 150ms;
	background-color: rgb(255 255 255 / 0.5);
	border-color: rgb(229 231 235 / 1);
	border-width: 2px;
	border-radius: 0.75rem;
	font-family: inherit;
	line-height: inherit;
	color: inherit;
	border-style: solid;
	width: 100%;
	font-size: 1rem;
	padding: 0.75rem 1rem;
}

/* اینپوت‌های متنی عمومی در RTL */
.slog-login-form input:not([name="mobile"]):not([name="otp_code"]):not(.slog-otp-fields input):not(.slog-mobile-input):not(.login-input) {
	padding-right: 1rem;
	padding-left: 2.5rem;
	text-align: right;
}

/*
 * شماره موبایل:
 * direction:ltr = ترتیب ارقام درست
 * text-align:right = ظاهر سمت راست در UI فارسی
 */
.slog-wrap input[name="mobile"],
.slog-wrap input.slog-mobile-input,
.slog-wrap .login-input {
	direction: ltr;
	unicode-bidi: isolate;
	text-align: right;
	letter-spacing: 0.02em;
	padding-left: 1rem;
	padding-right: 1rem;
}

.slog-wrap input[name="mobile"]::placeholder,
.slog-wrap input.slog-mobile-input::placeholder,
.slog-wrap .login-input::placeholder {
	text-align: right;
	direction: rtl;
	opacity: 0.7;
}

/*
 * ماسک موبایل صفحه OTP:
 * بدون bdi/isolate در متن فارسی برعکس می‌شود
 */
.slog-mobile-mask,
.slog-mobile-display,
.slog-masked-mobile,
.slog-otp-mobile,
#slog-otp-form .slog-form-title p span,
#slog-otp-form .mobile-masked {
	direction: ltr !important;
	unicode-bidi: isolate;
	display: inline-block;
	text-align: left;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.03em;
	font-weight: 600;
	color: #111827;
}

.slog-mobile-mask bdi,
.slog-mobile-display bdi,
.slog-masked-mobile bdi {
	direction: ltr;
	unicode-bidi: isolate;
}

.slog-wrap input:focus {
	box-shadow: 0 0 0 0 #fff, 0 0 0 2px #ef4056, 0 0 #0000;
	outline: 2px solid transparent;
	outline-offset: 2px;
	border-color: transparent;
}

.slog-button {
	transition: all 0.2s ease;
	margin-top: 1.5rem;
	padding-top: 0.75rem;
	padding-bottom: 0.75rem;
	color: rgb(255 255 255 / 1);
	background-color: #f6434b;
	border-width: 0;
	border-radius: 0.75rem;
	width: 100%;
	font-size: 100%;
	font-family: inherit;
	line-height: inherit;
	cursor: pointer;
}

.slog-button:hover {
	filter: brightness(0.97);
}

.slog-button:disabled,
.slog-button.is-disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

.slog-text {
	color: rgb(75 85 99 / 1);
	font-size: 0.875rem;
	line-height: 1.25rem;
	margin-top: 1.5rem;
	margin-bottom: 0;
}

.slog-text a {
	color: #0C4DA2;
	font-weight: 600;
	text-decoration: none;
}

.slog-text a:hover {
	text-decoration: underline;
}

/* دکمه ویرایش شماره */
.slog-edit-mobile,
.slog-change-mobile {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	margin-top: 0.75rem;
	padding: 0;
	border: 0;
	background: transparent;
	color: #0C4DA2;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
}

.slog-edit-mobile:hover,
.slog-change-mobile:hover {
	text-decoration: underline;
}

/* OTP */
.slog-otp-fields {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	direction: ltr;
	unicode-bidi: isolate;
}

.slog-otp-fields input {
	width: 3rem;
	height: 3rem;
	padding: 0;
	text-align: center;
	font-size: 1.5rem;
	background-color: rgb(241 245 249 / 1);
	border-width: 0;
	border-radius: 0.5rem;
	direction: ltr;
	unicode-bidi: isolate;
	font-variant-numeric: tabular-nums;
}

.slog-otp-fields input:focus {
	box-shadow: 0 0 0 2px #ef4056;
	outline: none;
}

/* فیلد واحد OTP */
.slog-wrap input[name="otp_code"],
.slog-wrap input.slog-otp-input {
	direction: ltr;
	unicode-bidi: isolate;
	text-align: center;
	letter-spacing: 0.35em;
	font-variant-numeric: tabular-nums;
}

#slog-otp-form {
	display: none;
}

/* resend / cooldown */
.slog-resend-wrap {
	margin-top: 1rem;
	text-align: center;
	font-size: 0.875rem;
	color: rgb(75 85 99 / 1);
}

.slog-resend-wrap .slog-resend-btn {
	border: 0;
	background: transparent;
	color: #0C4DA2;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
	padding: 0;
}

.slog-resend-wrap .slog-resend-btn:disabled {
	color: rgb(156 163 175 / 1);
	cursor: not-allowed;
	text-decoration: none;
}

/* notification */
.slog-notification {
	position: fixed;
	top: 1rem;
	right: 1rem;
	background: #2563eb;
	color: #fff;
	padding: 1rem 1.5rem;
	border-radius: 0.5rem;
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
	font-size: 0.95rem;
	z-index: 9999;
	opacity: 0;
	transform: translateY(-20px);
	transition: all 0.4s ease;
	max-width: min(22rem, calc(100vw - 2rem));
	direction: rtl;
	text-align: right;
}

.slog-notification.show {
	opacity: 1;
	transform: translateY(0);
}

.slog-notification.error {
	background: #dc2626;
}

.slog-notification.success {
	background: #16a34a;
}

/* loading button */
.slog-wrap form button.is-loading {
	padding-right: 2.5rem;
	opacity: 0.7;
	cursor: wait;
	pointer-events: none;
	position: relative;
}

.slog-wrap form button.is-loading::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 1.25rem;
	width: 1rem;
	height: 1rem;
	border: 2px solid rgb(255 255 255 / 0.9);
	border-top-color: transparent;
	border-radius: 50%;
	transform: translateY(-50%);
	animation: slog-spin 0.8s linear infinite;
}

@keyframes slog-spin {
	from {
		transform: translateY(-50%) rotate(0deg);
	}
	to {
		transform: translateY(-50%) rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.slog-wrap form button.is-loading::after {
		animation-duration: 1.6s;
	}

	.slog-notification,
	.slog-button,
	.slog-wrap input,
	.slog-login-box {
		transition: none;
	}
}

/* form helpers */
.sms-login-form,
.slog-login-form {
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

.login-input {
	width: 100%;
	max-width: 100%;
}

/* reCAPTCHA */
.recaptcha-box,
.slog-recaptcha-box {
	display: flex;
	justify-content: center;
	margin-top: 1rem;
	width: 100%;
	overflow: auto;
}

.recaptcha-box > div,
.slog-recaptcha-box > div {
	transform: scale(1);
	transform-origin: center;
}

/* terms */
.slog-terms-row {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin-top: 1rem;
	font-size: 0.875rem;
	color: rgb(75 85 99 / 1);
	line-height: 1.5;
}

.slog-terms-row input[type="checkbox"] {
	width: auto;
	margin-top: 0.2rem;
	accent-color: #f6434b;
}

/* موبایل کوچک */
@media (max-width: 420px) {
	.slog-login-box {
		padding: 1.25rem;
	}

	.slog-otp-fields input {
		width: 2.5rem;
		height: 2.5rem;
		font-size: 1.25rem;
	}

	.slog-notification {
		right: 0.75rem;
		left: 0.75rem;
		top: 0.75rem;
		max-width: none;
	}
}
