/*
 * مودال ورود و ثبت‌نام.
 *
 * این فایل روی همه‌ی صفحه‌ها بار می‌شود — حتی پنل، که theme.css و
 * widgets.css را ندارد. پس هرچه مودال لازم دارد (فیلد، دکمه، تیک)
 * همین‌جا و زیر .sl-authmodal تعریف شده تا همه‌جا یک شکل باشد.
 */

.sl-authmodal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	direction: rtl;
	font-family: var(--sl-font, "Yekan Bakh FaNum", "YekanBakh", "Vazirmatn", Tahoma, sans-serif);
}

.sl-authmodal[hidden] { display: none; }

.sl-authmodal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(4, 4, 4, .45);
	animation: sl-auth-fade .18s ease;
}

.sl-authmodal__card {
	position: relative;
	width: 100%;
	max-width: 480px;
	max-height: calc(100vh - 48px);
	overflow: auto;
	padding: 40px;
	background: #fff;
	border: 1px solid var(--sl-border, #EDEDED);
	border-radius: var(--sl-r-lg, 20px);
	box-shadow: 0 24px 64px rgba(0, 0, 0, .18);
	animation: sl-auth-in .2s ease;
}

@keyframes sl-auth-fade { from { opacity: 0; } }
@keyframes sl-auth-in { from { opacity: 0; transform: translateY(12px); } }

@media (prefers-reduced-motion: reduce) {
	.sl-authmodal__backdrop,
	.sl-authmodal__card { animation: none; }
}

/* دکمه‌ی بستن، گوشه‌ی چپِ بالا (در راست‌چین یعنی انتهای سطر). */
.sl-authmodal__x {
	position: absolute;
	inset-block-start: 24px;
	inset-inline-end: 24px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 1px solid var(--sl-line, #F3F3F3);
	border-radius: 50%;
	background: #fff;
	color: var(--sl-muted, #828282);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: color .18s ease, border-color .18s ease;
}

.sl-authmodal__x:hover { color: var(--sl-ink, #040404); border-color: var(--sl-field-line, #949494); }

.sl-authmodal__title {
	margin: 0 0 12px;
	padding-inline-end: 40px;   /* rtl-ok: جا برای دکمه‌ی بستن */
	color: var(--sl-ink, #040404);
	font-size: 22px;
	font-weight: 700;
	line-height: 34px;
}

.sl-authmodal__lead {
	margin: 0 0 28px;
	color: var(--sl-muted, #828282);
	font-size: 14px;
	line-height: 26px;
}

/* ---- فرم داخل مودال: مستقل از widgets.css ---- */

.sl-authmodal .sl-auth {
	display: flex;
	flex-direction: column;
	gap: 20px;
	direction: rtl;
	text-align: start;
}

.sl-authmodal .sl-auth__form { display: flex; flex-direction: column; gap: 20px; }

.sl-authmodal .sl-field { display: flex; flex-direction: column; gap: 8px; }

.sl-authmodal .sl-field__label {
	color: var(--sl-ink, #040404);
	font-size: 14px;
	font-weight: 600;
	line-height: 20px;
}

.sl-authmodal .sl-field input {
	width: 100%;
	height: 56px;
	padding: 0 16px;
	background: #fff;
	border: 1px solid var(--sl-field-line, #949494);
	border-radius: var(--sl-r-sm, 12px);
	color: var(--sl-ink, #040404);
	font: inherit;
	font-size: 14px;
	outline: none;
	transition: border-color .18s ease;
}

.sl-authmodal .sl-field input:focus { border-color: var(--sl-teal, #00897B); }
.sl-authmodal .sl-field input::placeholder { color: var(--sl-muted, #828282); }

.sl-authmodal .sl-field input[readonly],
.sl-authmodal .sl-field input:disabled {
	background: #F9FAFC;
	color: var(--sl-muted, #828282);
	cursor: not-allowed;
}

.sl-authmodal .sl-check {
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	cursor: pointer;
}

.sl-authmodal .sl-check input {
	width: 18px;
	height: 18px;
	margin: 0;
	flex: none;
	accent-color: var(--sl-teal, #00897B);
}

.sl-authmodal .sl-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 12px 32px;
	border: 1px solid transparent;
	border-radius: var(--sl-r-pill, 1000px);
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 24px;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .18s ease;
}

.sl-authmodal .sl-btn--primary { background: var(--sl-teal, #00897B); color: #fff; }
.sl-authmodal .sl-btn--primary:hover { background: var(--sl-teal-600, #00796B); color: #fff; }

.sl-authmodal .sl-auth__submit {
	justify-content: center;
	width: 100%;
	min-height: 56px;
	margin-block-start: 4px;
}

.sl-authmodal .sl-auth__remember { font-size: 14px; color: var(--sl-muted, #828282); }

.sl-authmodal .sl-auth__error,
.sl-authmodal .sl-auth__ok {
	margin: 0;
	padding: 12px 16px;
	border-radius: var(--sl-r-sm, 12px);
	font-size: 14px;
	line-height: 24px;
}

.sl-authmodal .sl-auth__error { background: #FDECEC; color: #B42318; }
.sl-authmodal .sl-auth__ok { background: #E6F3F2; color: var(--sl-teal, #00897B); }
.sl-authmodal .sl-auth__ok code { font-size: 16px; font-weight: 700; letter-spacing: 2px; }

.sl-authmodal .sl-auth__again {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
	font-size: 14px;
}

.sl-authmodal .sl-auth__again button,
.sl-authmodal .sl-auth__again a {
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	color: var(--sl-teal, #00897B);
	cursor: pointer;
	text-decoration: none;
}

.sl-authmodal .sl-auth__again button:hover,
.sl-authmodal .sl-auth__again a:hover { text-decoration: underline; }

.sl-authmodal .sl-auth__terms,
.sl-authmodal .sl-auth__hint {
	margin: 0;
	color: var(--sl-muted, #828282);
	font-size: 14px;
	line-height: 26px;
}

.sl-authmodal .sl-auth__terms a { color: var(--sl-teal, #00897B); text-decoration: none; font-weight: 600; }
.sl-authmodal .sl-auth__terms a:hover { text-decoration: underline; }

.sl-authmodal .sl-auth__foot {
	margin: 4px 0 0;
	padding-block-start: 20px;
	border-block-start: 1px solid var(--sl-line, #F3F3F3);
	color: var(--sl-muted, #828282);
	font-size: 14px;
	text-align: center;
}

.sl-authmodal .sl-auth__foot a { color: var(--sl-teal, #00897B); font-weight: 700; text-decoration: none; }
.sl-authmodal .sl-auth__foot a:hover { text-decoration: underline; }

/* وقتی مودال باز است، صفحه‌ی زیرش نباید اسکرول شود. */
body.sl-authmodal-open { overflow: hidden; }

@media (max-width: 575px) {
	.sl-authmodal { padding: 12px; }
	.sl-authmodal__card { padding: 28px 20px; }
	.sl-authmodal__x { inset-block-start: 16px; inset-inline-end: 16px; }
	.sl-authmodal__title { font-size: 20px; line-height: 32px; }
	.sl-authmodal__lead { margin-block-end: 24px; }
}
