/* ==========================================================================
   ML Agency Auth - "Aurora Glass" design system
   صفحات ورود / ثبت‌نام / فراموشی پسورد - مستقل از قالب سایت
   ========================================================================== */

:root {
	--ml-primary: #4338ca;
	--ml-primary-light: #6366f1;
	--ml-cyan: #22d3ee;
	--ml-violet: #a855f7;
	--ml-amber: #f59e0b;
	--ml-navy: #0b1023;
	--ml-navy-soft: #131a33;
	--ml-danger: #ef4444;
	--ml-success: #22c55e;
	--ml-ink: #1e2433;
	--ml-muted: #6b7280;
	--ml-border: #e6e8f0;
	--ml-radius-lg: 22px;
	--ml-radius-md: 12px;
}

* {
	font-family: "Vazirmatn", Tahoma, sans-serif !important;
	box-sizing: border-box;
}

html, body {
	height: 100%;
}

body.ml-auth-body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--ml-navy);
	color: var(--ml-ink);
	padding: 28px 16px;
	position: relative;
	overflow-x: hidden;
}

/* ---------------------------------------------------------------------
   پس‌زمینه‌ی Aurora - چند بلاب گرادیانی محو و در حال شناوری آهسته
   --------------------------------------------------------------------- */

.ml-aurora {
	position: fixed;
	inset: 0;
	overflow: hidden;
	z-index: 0;
	pointer-events: none;
}

.ml-aurora::after {
	content: "";
	position: absolute;
	inset: 0;
	background-image:
		radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0);
	background-size: 26px 26px;
	opacity: 0.5;
}

.ml-aurora-blob {
	position: absolute;
	border-radius: 50%;
	filter: blur(70px);
	opacity: 0.55;
	mix-blend-mode: screen;
	will-change: transform;
}

.ml-blob-1 {
	width: 520px;
	height: 520px;
	top: -160px;
	right: -120px;
	background: radial-gradient(circle, var(--ml-primary-light), transparent 70%);
	animation: mlFloat1 22s ease-in-out infinite;
}

.ml-blob-2 {
	width: 460px;
	height: 460px;
	bottom: -140px;
	left: -100px;
	background: radial-gradient(circle, var(--ml-violet), transparent 70%);
	animation: mlFloat2 26s ease-in-out infinite;
}

.ml-blob-3 {
	width: 380px;
	height: 380px;
	top: 40%;
	left: 46%;
	background: radial-gradient(circle, var(--ml-cyan), transparent 70%);
	opacity: 0.35;
	animation: mlFloat3 30s ease-in-out infinite;
}

@keyframes mlFloat1 {
	0%, 100% { transform: translate(0, 0) scale(1); }
	50%      { transform: translate(-40px, 50px) scale(1.08); }
}

@keyframes mlFloat2 {
	0%, 100% { transform: translate(0, 0) scale(1); }
	50%      { transform: translate(50px, -30px) scale(1.1); }
}

@keyframes mlFloat3 {
	0%, 100% { transform: translate(-50%, -50%) scale(1); }
	50%      { transform: translate(-45%, -55%) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
	.ml-aurora-blob { animation: none; }
}

/* ---------------------------------------------------------------------
   شل و کارت اصلی
   --------------------------------------------------------------------- */

.ml-auth-shell {
	position: relative;
	z-index: 1;
	width: 100%;
	display: flex;
	justify-content: center;
}

.ml-auth-card {
	width: 100%;
	max-width: 460px;
	background: #ffffff;
	border-radius: var(--ml-radius-lg);
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
	overflow: hidden;
	animation: mlCardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.ml-auth-card-wide {
	max-width: 760px;
}

.ml-auth-card-split {
	max-width: 880px;
	display: flex;
	min-height: 560px;
}

@keyframes mlCardIn {
	from { opacity: 0; transform: translateY(26px) scale(0.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* پنل تصویری سمت راست (فقط دسکتاپ) */

.ml-auth-visual {
	flex: 0 0 42%;
	position: relative;
	background: linear-gradient(155deg, var(--ml-primary) 0%, #3730a3 45%, #1e1b4b 100%);
	color: #fff;
	padding: 40px 32px;
	display: flex;
	align-items: center;
	overflow: hidden;
}

.ml-auth-visual::before,
.ml-auth-visual::after {
	content: "";
	position: absolute;
	border-radius: 50%;
	filter: blur(40px);
}

.ml-auth-visual::before {
	width: 220px;
	height: 220px;
	background: rgba(34, 211, 238, 0.35);
	top: -60px;
	left: -60px;
	animation: mlFloat3 18s ease-in-out infinite;
}

.ml-auth-visual::after {
	width: 260px;
	height: 260px;
	background: rgba(168, 85, 247, 0.3);
	bottom: -80px;
	right: -60px;
	animation: mlFloat2 24s ease-in-out infinite;
}

.ml-auth-visual-inner {
	position: relative;
	z-index: 1;
	animation: mlFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

.ml-auth-visual-icon {
	width: 58px;
	height: 58px;
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.18);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 26px;
	margin-bottom: 22px;
	animation: mlBreathe 4s ease-in-out infinite;
}

.ml-auth-visual-inner h2 {
	font-size: 22px;
	font-weight: 800;
	margin-bottom: 10px;
}

.ml-auth-visual-inner p {
	font-size: 13.5px;
	line-height: 2;
	color: rgba(255, 255, 255, 0.78);
	margin-bottom: 26px;
}

.ml-auth-visual-points {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.ml-auth-visual-points li {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 12.5px;
	color: rgba(255, 255, 255, 0.85);
}

.ml-auth-visual-points i {
	width: 26px;
	height: 26px;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.14);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 13px;
	flex-shrink: 0;
}

@keyframes mlBreathe {
	0%, 100% { transform: scale(1); }
	50%      { transform: scale(1.06); }
}

/* پنل فرم */

.ml-auth-form-panel {
	flex: 1 1 auto;
	padding: 40px 36px;
	min-width: 0;
}

.ml-auth-card:not(.ml-auth-card-split) .ml-auth-form-panel {
	padding: 38px 32px;
}

@media (max-width: 767.98px) {
	.ml-auth-card-split { flex-direction: column; }
	.ml-auth-visual { display: none; }
	.ml-auth-form-panel { padding: 32px 22px; }
}

/* برند موبایل (فقط وقتی پنل تصویری مخفیه) */

.ml-auth-brand-mobile {
	display: none;
	align-items: center;
	gap: 10px;
	justify-content: center;
	color: var(--ml-primary);
	font-weight: 800;
	font-size: 15px;
	margin-bottom: 20px;
}

@media (max-width: 767.98px) {
	.ml-auth-brand-mobile { display: flex; }
}

.ml-auth-card:not(.ml-auth-card-split) .ml-auth-brand-mobile {
	display: flex;
}

/* ---------------------------------------------------------------------
   محتوای مرحله (fade-up staggered)
   --------------------------------------------------------------------- */

.ml-auth-step {
	animation: mlFadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes mlFadeUp {
	from { opacity: 0; transform: translateY(14px); }
	to   { opacity: 1; transform: translateY(0); }
}

.ml-auth-form > *,
.ml-auth-form .row > * {
	animation: mlFadeUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ml-auth-form > *:nth-child(1) { animation-delay: 0.02s; }
.ml-auth-form > *:nth-child(2) { animation-delay: 0.07s; }
.ml-auth-form > *:nth-child(3) { animation-delay: 0.12s; }
.ml-auth-form > *:nth-child(4) { animation-delay: 0.17s; }
.ml-auth-form > *:nth-child(5) { animation-delay: 0.22s; }
.ml-auth-form > *:nth-child(6) { animation-delay: 0.27s; }
.ml-auth-form > *:nth-child(7) { animation-delay: 0.32s; }

.ml-auth-title {
	font-size: 22px;
	font-weight: 800;
	display: flex;
	align-items: center;
	gap: 9px;
	color: var(--ml-ink);
	margin-bottom: 5px;
	letter-spacing: -0.2px;
}

.ml-auth-title i {
	color: var(--ml-primary);
	font-size: 20px;
}

.ml-auth-sub {
	color: var(--ml-muted);
	font-size: 13.5px;
	margin-bottom: 22px;
}

/* ---------------------------------------------------------------------
   نشانگر پیشرفت مرحله‌ها (ورود / فراموشی پسورد)
   --------------------------------------------------------------------- */

.ml-step-indicator {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 26px;
}

.ml-step-dot {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #eef0f7;
	color: var(--ml-muted);
	font-size: 12px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.ml-step-dot.active {
	background: var(--ml-primary);
	color: #fff;
	box-shadow: 0 0 0 5px rgba(67, 56, 202, 0.15);
}

.ml-step-dot.done {
	background: var(--ml-success);
	color: #fff;
}

.ml-step-line {
	flex: 1 1 auto;
	height: 3px;
	border-radius: 2px;
	background: #eef0f7;
	position: relative;
	overflow: hidden;
}

.ml-step-line::after {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--ml-success);
	transform: scaleX(0);
	transform-origin: right;
	transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.ml-step-line.filled::after {
	transform: scaleX(1);
}

/* ---------------------------------------------------------------------
   فرم / اینپوت‌ها
   --------------------------------------------------------------------- */

.ml-auth-form .form-label {
	font-size: 12.5px;
	font-weight: 700;
	color: #374151;
	margin-bottom: 6px;
}

.ml-auth-form .form-control,
.ml-auth-form .form-select {
	border-radius: var(--ml-radius-md);
	padding: 11px 15px;
	border: 1.5px solid var(--ml-border);
	background: #fafbff;
	transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
	font-size: 14px;
}

.ml-auth-form .form-control:hover {
	border-color: #c7cbe8;
}

/* شماره موبایل: عدد باید چپ‌به‌راست و خوانا تایپ شود، ولی در چیدمان RTL
   صفحه سر جای خودش (سمت راست) بماند — پس فقط direction عوض می‌شود، نه
   جهتِ متن‌محورِ کادر. فاصله‌ی حروف کمی باز شده تا ۱۱ رقم راحت خوانده شود. */
.ml-auth-form .ml-ltr-input {
	direction: ltr;
	text-align: right;
	letter-spacing: 0.06em;
	font-variant-numeric: tabular-nums;
}

.ml-auth-form .form-control:focus {
	background: #fff;
	border-color: var(--ml-primary-light);
	box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14);
}

/* حالت نامعتبرِ فیلد اجباری - پیام فارسی جایگزین Tooltip پیش‌فرض مرورگر
   (assets/js/auth.js، رویداد 'invalid'). display بلوک/مخفی رو خودِ
   بوت‌استرپ با .is-invalid ~ .invalid-feedback مدیریت می‌کنه. */
.ml-auth-form .form-control.is-invalid,
.ml-auth-form .form-select.is-invalid {
	border-color: #dc2626 !important;
	box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.14) !important;
	animation: mlShake 0.3s ease;
}

.ml-auth-form .invalid-feedback.ml-invalid-feedback {
	color: #dc2626;
	font-size: 12.5px;
	font-weight: 600;
	margin-top: 6px;
}

.ml-auth-submit {
	border: none;
	border-radius: var(--ml-radius-md);
	padding: 12px;
	font-weight: 700;
	font-size: 14.5px;
	background: linear-gradient(135deg, var(--ml-primary) 0%, var(--ml-primary-light) 100%);
	background-size: 160% 160%;
	background-position: 0% 50%;
	position: relative;
	transition: transform 0.15s ease, box-shadow 0.25s ease, background-position 0.5s ease;
	box-shadow: 0 10px 24px -8px rgba(67, 56, 202, 0.55);
}

.ml-auth-submit:hover {
	background-position: 100% 50%;
	transform: translateY(-2px);
	box-shadow: 0 16px 32px -10px rgba(67, 56, 202, 0.6);
	color: #fff;
}

.ml-auth-submit:active {
	transform: translateY(0);
}

/* ---------------------------------------------------------------------
   حالت «در حال پردازش» (ضدِ ارسال تکراری)
   منطقش در assets/js/auth.js است؛ این‌جا فقط ظاهر.
   --------------------------------------------------------------------- */

/* دکمه‌ی قفل‌شده نباید افکت hover/active بدهد — وگرنه کاربر فکر می‌کند
   هنوز قابل کلیک است و باز هم فشار می‌دهد. */
.ml-auth-submit:disabled,
.ml-auth-submit.is-loading {
	opacity: 0.92;
	cursor: progress;
	transform: none !important;
	box-shadow: 0 10px 24px -8px rgba(67, 56, 202, 0.4);
	background-position: 0% 50% !important;
}

/* ⚠️ color: transparent و نه visibility روی فرزندان: محتوای دکمه هم
   عنصر <i> است هم یک متنِ خام. سلکتور `> *` متنِ خام را نمی‌گیرد و
   روی اسپینر می‌افتاد. رنگ شفاف هر دو را با هم می‌پوشاند و چون
   ابعاد دست‌نخورده می‌ماند، دکمه هم نمی‌پرد. */
.ml-auth-submit.is-loading {
	color: transparent !important;
}

.ml-auth-submit.is-loading::after {
	content: '';
	position: absolute;
	inset-block-start: 50%;
	inset-inline-start: 50%;
	width: 18px;
	height: 18px;
	margin-block-start: -9px;
	margin-inline-start: -9px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	animation: mlAuthSpin 0.65s linear infinite;
}

@keyframes mlAuthSpin {
	to { transform: rotate(360deg); }
}

/* دکمه‌ی «ارسال مجدد کد» هم قفل می‌شود (همان فرم، همان مشکل) */
.ml-auth-resend-btn:disabled {
	opacity: 0.55;
	cursor: progress;
}

/* پوشش ظریف روی خودِ کارت — نه کل صفحه، تا برندینگ و بلاب‌های
   پس‌زمینه دیده بمانند. pointer-events کلیک روی فیلدها را هم می‌بندد،
   یعنی حتی Enter زدن روی یک ورودی هم دیگر submit نمی‌کند. */
.ml-auth-card.is-busy,
.ml-auth-form-panel.is-busy {
	position: relative;
}

.ml-auth-card.is-busy::after,
.ml-auth-form-panel.is-busy::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 5;
	border-radius: inherit;
	background: rgba(255, 255, 255, 0.35);
	backdrop-filter: blur(1.5px);
	animation: mlAuthVeil 0.2s ease;
	cursor: progress;
}

@keyframes mlAuthVeil {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.ml-auth-submit.is-loading::after { animation-duration: 2s; }
	.ml-auth-card.is-busy::after,
	.ml-auth-form-panel.is-busy::after { animation: none; }
}

/* رمز عبور + دکمه‌ی چشم */

.ml-password-wrap {
	position: relative;
}

.ml-password-wrap .form-control {
	padding-left: 44px;
}

.ml-password-toggle {
	position: absolute;
	left: 4px;
	top: 4px;
	bottom: 4px;
	width: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: transparent;
	color: #9aa0b4;
	border-radius: 8px;
	cursor: pointer;
	transition: color 0.15s ease, background 0.15s ease;
}

.ml-password-toggle:hover {
	color: var(--ml-primary);
	background: rgba(67, 56, 202, 0.08);
}

.ml-password-toggle i {
	pointer-events: none;
	transition: transform 0.2s ease;
}

.ml-password-toggle.is-visible i {
	transform: scale(1.05);
}

.ml-password-strength {
	height: 5px;
	border-radius: 3px;
	background: #eef0f7;
	margin-top: 9px;
	overflow: hidden;
}

.ml-password-strength-bar {
	height: 100%;
	width: 0%;
	border-radius: 3px;
	background: var(--ml-danger);
	transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s ease;
}

/* کپچا */

.ml-captcha-row .ml-captcha-preview {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.ml-captcha-code-input {
	max-width: 160px;
}

.ml-captcha-img-wrap {
	position: relative;
	border-radius: 10px;
	overflow: hidden;
	border: 1.5px solid var(--ml-border);
	background: #f3f4fb;
	height: 52px;
	flex: 0 0 auto;
}

.ml-captcha-img {
	height: 52px;
	width: 150px;
	display: block;
	object-fit: cover;
	transition: opacity 0.25s ease, filter 0.25s ease;
}

.ml-captcha-img.is-loading {
	opacity: 0.15;
	filter: blur(2px);
}

.ml-captcha-refresh {
	width: 42px;
	height: 42px;
	border-radius: 10px;
	border: 1.5px solid var(--ml-border);
	background: #fff;
	color: var(--ml-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.ml-captcha-refresh:hover {
	background: rgba(67, 56, 202, 0.08);
	border-color: rgba(67, 56, 202, 0.3);
}

.ml-captcha-refresh i {
	transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ml-captcha-refresh.is-spinning i {
	transform: rotate(360deg);
}

/* ---------------------------------------------------------------------
   ورودی OTP (۶ باکس مجزا)
   --------------------------------------------------------------------- */

.ml-otp-boxes {
	display: flex;
	gap: 9px;
	justify-content: center;
	margin-bottom: 6px;
}

.ml-otp-box {
	width: 46px;
	height: 54px;
	text-align: center;
	font-size: 22px;
	font-weight: 800;
	border-radius: 12px;
	border: 1.5px solid var(--ml-border);
	background: #fafbff;
	color: var(--ml-ink);
	transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.ml-otp-box:focus {
	outline: none;
	border-color: var(--ml-primary-light);
	background: #fff;
	box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16);
	transform: translateY(-2px);
}

.ml-otp-box.is-filled {
	border-color: var(--ml-primary);
}

@media (max-width: 380px) {
	.ml-otp-box { width: 38px; height: 48px; font-size: 18px; }
	.ml-otp-boxes { gap: 6px; }
}

/* یادداشت کهربایی داخل فرم‌های احراز هویت (مثل «ورود رمز عبور ندارد»).
   همان زبانِ بصریِ ml-share-note در داشبورد، ولی با توکن‌های auth.css. */
.ml-auth-note {
	display: flex;
	gap: 9px;
	align-items: flex-start;
	margin: 14px 0 0;
	padding: 11px 13px;
	border-radius: var(--ml-radius-md, 12px);
	background: rgba(245, 158, 11, 0.09);
	border-inline-start: 3px solid #f59e0b;
	color: var(--ml-body, #384152);
	font-size: 12.5px;
	line-height: 1.85;
}

.ml-auth-note i {
	color: #d97706;
	font-size: 15px;
	line-height: 1.5;
	flex: 0 0 auto;
}

.ml-otp-hint {
	text-align: center;
	color: var(--ml-muted);
	font-size: 12.5px;
	margin-bottom: 20px;
}

.ml-otp-hint strong {
	color: var(--ml-ink);
	font-weight: 700;
}

@keyframes mlShake {
	10%, 90% { transform: translateX(-1px); }
	20%, 80% { transform: translateX(2px); }
	30%, 50%, 70% { transform: translateX(-4px); }
	40%, 60% { transform: translateX(4px); }
}

.ml-shake {
	animation: mlShake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ---------------------------------------------------------------------
   پیام‌ها / لینک‌ها
   --------------------------------------------------------------------- */

.ml-auth-alert {
	font-size: 13px;
	padding: 11px 15px;
	margin-bottom: 18px;
	border-radius: var(--ml-radius-md);
	border: none;
	display: flex;
	align-items: flex-start;
	gap: 9px;
	animation: mlFadeUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.alert-success.ml-auth-alert {
	background: #ecfdf3;
	color: #056a3a;
}

.alert-danger.ml-auth-alert {
	background: #fef2f2;
	color: #a3130f;
	animation: mlShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.ml-auth-resend-form {
	text-align: center;
	margin-top: 6px;
}

.ml-auth-resend-btn {
	font-size: 12.5px;
	text-decoration: none;
	color: var(--ml-primary);
	font-weight: 600;
	transition: opacity 0.15s ease;
}

.ml-auth-resend-btn:disabled {
	color: #b3b7c9;
	pointer-events: none;
}

.ml-auth-back-link,
.ml-auth-links {
	display: block;
	text-align: center;
	margin-top: 20px;
	font-size: 13px;
}

.ml-auth-links a,
.ml-auth-back-link {
	color: var(--ml-primary);
	text-decoration: none;
	font-weight: 600;
	transition: color 0.15s ease;
}

.ml-auth-back-link i,
.ml-auth-links a i {
	transition: transform 0.2s ease;
	display: inline-block;
}

.ml-auth-back-link:hover i {
	transform: translateX(-3px);
}

.ml-auth-links a:hover,
.ml-auth-back-link:hover {
	color: var(--ml-primary-light);
}

.ml-auth-sep {
	color: #d1d5db;
	margin: 0 8px;
}

/* ---------------------------------------------------------------------
   ثبت‌نام - گروه‌بندی بخش‌ها
   --------------------------------------------------------------------- */

.ml-form-section {
	margin-bottom: 22px;
}

.ml-form-section-title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12.5px;
	font-weight: 800;
	color: var(--ml-primary);
	text-transform: uppercase;
	letter-spacing: 0.4px;
	margin-bottom: 14px;
	padding-bottom: 8px;
	border-bottom: 1px dashed var(--ml-border);
}

.ml-form-section-title i {
	font-size: 14px;
}

@media (max-width: 420px) {
	.ml-auth-form-panel { padding: 28px 18px; }
}