/*
 * فرم یکپارچه‌ی ورود / ثبت‌نام (Course Manager)
 * طراحی: الهام‌گرفته از فرم حساب مشتری قالب «خشکشویی آوات» —
 * کارت نرم و گرد، تب‌های قرصی با گرادیان، فیلدهای گرد با حلقه‌ی فوکوس و دکمه‌ی گرادیانی.
 * برای هماهنگ‌کردن با رنگ سایت فقط همین چند متغیر را در CSS قالب عوض کنید:
 *   :root { --cmx-brand:#3c9e64; --cmx-brand-2:#3c9e64; --cmx-brand-3:#3c9e64; }
 */
.cmx-auth {
	--cmx-brand: #3c9e64;
	--cmx-brand-2: #3c9e64;
	--cmx-brand-3: #3c9e64;
	--cmx-navy: #1a3c2c;
	--cmx-ink: #2b3a32;
	--cmx-muted: #6b7a71;
	--cmx-line: rgba(60, 158, 100, .16);
	--cmx-soft: #eaf6ee;
	--cmx-grad: linear-gradient(135deg, #3c9e64 0%, #3c9e64 100%);
	--cmx-err: #e5484d;
	--cmx-ok: #1a7a35;
	--cmx-ease: .3s cubic-bezier(.4, 0, .2, 1);

	direction: rtl;
	text-align: right;
	font-family: inherit;
	color: var(--cmx-ink);
	width: 100%;
	max-width: 520px;
	margin: 0 auto;
	box-sizing: border-box;
}
.cmx-auth *, .cmx-auth *::before, .cmx-auth *::after { box-sizing: border-box; }
.cmx-auth [hidden] { display: none !important; }

/* ---------- کارت ---------- */
.cmx-card {
	position: relative;
	overflow: hidden;
	padding: 30px 28px 26px;
	border-radius: 30px;
	background: rgba(255, 255, 255, .96);
	border: 1px solid var(--cmx-line);
	box-shadow: 0 18px 44px rgba(60, 158, 100, .16), 0 2px 6px rgba(20, 40, 30, .04);
}
.cmx-card::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 5px;
	background: var(--cmx-grad);
}
.cmx-card--center { text-align: center; }

/* ---------- سرتیتر ---------- */
.cmx-head { text-align: center; margin-bottom: 20px; }
.cmx-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 62px;
	height: 62px;
	margin-bottom: 12px;
	border-radius: 22px;
	background: var(--cmx-grad);
	color: #fff;
	font-size: 26px;
	box-shadow: 0 12px 26px rgba(60, 158, 100, .32);
}
.cmx-title {
	margin: 0 0 6px;
	padding: 0;
	font-size: 22px;
	font-weight: 900;
	line-height: 1.5;
	color: var(--cmx-navy);
	border: 0;
}
.cmx-sub { margin: 0; font-size: 13.5px; line-height: 1.9; color: var(--cmx-muted); }

/* ---------- تب‌ها ---------- */
.cmx-tabs {
	display: flex;
	gap: 6px;
	padding: 5px;
	margin: 0 0 20px;
	border-radius: 100px;
	background: var(--cmx-soft);
}
.cmx-tab {
	flex: 1;
	height: 44px;
	margin: 0;
	padding: 0 10px;
	border: 0;
	border-radius: 100px;
	background: transparent;
	color: var(--cmx-navy);
	font-family: inherit;
	font-size: 14.5px;
	font-weight: 800;
	cursor: pointer;
	transition: var(--cmx-ease);
}
.cmx-tab:hover { color: var(--cmx-brand); }
.cmx-tab.is-active {
	background-image: var(--cmx-grad);
	color: #fff;
	box-shadow: 0 10px 22px rgba(60, 158, 100, .3);
}

/* ---------- فرم و فیلدها ---------- */
.cmx-form { display: grid; gap: 0; margin: 0; padding: 0; }
.cmx-field { display: grid; gap: 8px; margin: 0 0 16px; cursor: text; }
.cmx-label { font-size: 13.5px; font-weight: 800; color: var(--cmx-navy); line-height: 1.6; }
.cmx-label em { font-style: normal; font-weight: 600; color: var(--cmx-muted); font-size: 12px; }
.cmx-math { display: inline-block; padding: 1px 10px; border-radius: 10px; background: var(--cmx-soft); color: var(--cmx-brand); direction: rtl; }
.cmx-hint { font-size: 12px; line-height: 1.8; color: var(--cmx-muted); font-weight: 500; }
.cmx-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.cmx-input { position: relative; display: block; }
.cmx-input > i:first-child {
	position: absolute;
	inset-inline-start: 16px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 15px;
	color: var(--cmx-brand);
	opacity: .75;
	pointer-events: none;
	transition: var(--cmx-ease);
}
.cmx-input input {
	display: block;
	width: 100%;
	height: 50px;
	margin: 0;
	padding: 0 46px;
	border-radius: 16px;
	border: 2px solid var(--cmx-line);
	background: #fff;
	box-shadow: none;
	color: var(--cmx-ink);
	font-family: inherit;
	font-size: 14.5px;
	font-weight: 600;
	outline: none;
	transition: var(--cmx-ease);
	-webkit-appearance: none;
	appearance: none;
}
.cmx-input input[dir="ltr"] { text-align: left; }
.cmx-input input[dir="ltr"]::placeholder { text-align: left; }
.cmx-input input::placeholder { color: #a3b0a8; font-weight: 500; }
.cmx-input input:hover { border-color: rgba(60, 158, 100, .35); }
.cmx-input input:focus {
	border-color: var(--cmx-brand);
	box-shadow: 0 0 0 4px rgba(60, 158, 100, .15);
}
.cmx-input:focus-within > i:first-child { opacity: 1; }
.cmx-input input[aria-invalid="true"] { border-color: var(--cmx-err); box-shadow: 0 0 0 4px rgba(229, 72, 77, .12); }
.cmx-input input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px #fff inset; -webkit-text-fill-color: var(--cmx-ink); }

.cmx-eye {
	position: absolute;
	inset-inline-end: 8px;
	top: 50%;
	transform: translateY(-50%);
	width: 36px;
	height: 36px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: transparent;
	color: var(--cmx-muted);
	font-size: 15px;
	cursor: pointer;
	transition: var(--cmx-ease);
}
.cmx-eye:hover { background: var(--cmx-soft); color: var(--cmx-brand); }
.cmx-input:has(.cmx-eye) input[type="password"],
.cmx-input:has(.cmx-eye) input[type="text"] { padding-inline-end: 50px; }

/* فیلد تله‌ی ربات */
.cmx-hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }

/* ---------- پیام خطا / موفقیت ---------- */
.cmx-msg {
	margin: 0 0 14px;
	padding: 11px 14px;
	border-radius: 14px;
	background: rgba(229, 72, 77, .09);
	border: 1px solid rgba(229, 72, 77, .25);
	color: var(--cmx-err);
	font-size: 13.5px;
	font-weight: 800;
	line-height: 1.8;
}
.cmx-msg.is-ok { background: rgba(26, 122, 53, .09); border-color: rgba(26, 122, 53, .25); color: var(--cmx-ok); }

/* ---------- دکمه ---------- */
.cmx-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	height: 52px;
	margin: 0;
	padding: 0 22px;
	border: 0;
	border-radius: 100px;
	background-image: var(--cmx-grad);
	color: #fff;
	font-family: inherit;
	font-size: 15.5px;
	font-weight: 900;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 0 12px 28px rgba(60, 158, 100, .34);
	transition: var(--cmx-ease);
}
.cmx-btn:hover { transform: translateY(-3px); background-image: linear-gradient(135deg, #348c58, #348c58); box-shadow: 0 18px 34px rgba(60, 158, 100, .4); color: #fff; }
.cmx-btn:active { transform: translateY(0); }
.cmx-btn:disabled { opacity: .65; cursor: progress; transform: none; }
.cmx-btn.is-loading span::after {
	content: "";
	display: inline-block;
	width: 15px;
	height: 15px;
	margin-inline-start: 10px;
	border: 2px solid rgba(255, 255, 255, .45);
	border-top-color: #fff;
	border-radius: 50%;
	vertical-align: -2px;
	animation: cmx-spin .7s linear infinite;
}
@keyframes cmx-spin { to { transform: rotate(360deg); } }

.cmx-switch { margin: 16px 0 0; text-align: center; font-size: 13.5px; color: var(--cmx-muted); }
.cmx-switch button {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--cmx-brand);
	font-family: inherit;
	font-size: inherit;
	font-weight: 900;
	cursor: pointer;
}
.cmx-switch button:hover { text-decoration: underline; }

/* ---------- حالت صفحه: فاصله‌ی منظم از بالا/پایین ---------- */
.cmx-auth--page { margin: 20px auto 40px; padding: 0 14px; }
.cmx-auth--page .cmx-card { box-shadow: 0 22px 54px rgba(60, 158, 100, .18); }

/* در صفحه‌ی ورود/ثبت‌نام، پس‌زمینه‌ی روشن مثل قالب آوات */
body.cm-auth-page-body {
	background:
		radial-gradient(48% 38% at 8% 4%, rgba(60, 158, 100, .22) 0, transparent 70%),
		radial-gradient(45% 34% at 96% 16%, rgba(60, 158, 100, .16) 0, transparent 70%),
		radial-gradient(50% 36% at 0% 70%, rgba(60, 158, 100, .12) 0, transparent 70%),
		linear-gradient(180deg, #f3faf6 0%, #eaf6ee 100%) fixed !important;
}

/* ---------- حالت مودال (دکمه‌ی عضویت | ورود هدر) ---------- */
.cm-modal.cm-modal--auth {
	max-width: 500px;
	width: 94%;
	padding: 0;
	background: transparent;
	border-radius: 30px;
	overflow: visible;
	max-height: 92vh;
}
.cm-modal--auth .cmx-auth { max-width: none; }
.cm-modal--auth .cmx-card { max-height: 88vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(20, 40, 30, .45); }
.cm-modal--auth .cm-modal-close {
	top: 14px;
	left: 16px;
	z-index: 3;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--cmx-soft, #eaf6ee);
	color: #3c9e64;
	font-size: 22px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: .3s;
}
.cm-modal--auth .cm-modal-close:hover { background: #3c9e64; color: #fff; }

/* ---------- حالت پروفایل ---------- */
.cmx-auth--dashboard { margin: 10px auto 50px; padding: 0 12px; }

/* ---------- موبایل ---------- */
@media (max-width: 560px) {
	.cmx-card { padding: 24px 18px 22px; border-radius: 24px; }
	.cmx-row { grid-template-columns: 1fr; }
	.cmx-title { font-size: 19px; }
	.cmx-badge { width: 54px; height: 54px; font-size: 23px; border-radius: 19px; }
	.cmx-auth--page, .cmx-auth--dashboard { padding: 0 10px; }
}
@media (prefers-reduced-motion: reduce) {
	.cmx-auth * { transition: none !important; animation: none !important; }
}
