/* نسخهٔ پویای نمونهٔ بام‌یار: فقط حالت‌های لازم برای پویایی؛ ظاهر اصلی از register.css می‌آید. */

/* بدون JS دیده می‌شود؛ با JS تا لحظهٔ شروع انیمیشن ورود پنهان می‌ماند (جلوگیری از پرش) */
.js-auth #formCard { opacity: 0; animation: auth-reveal 0s 3s forwards; }
@keyframes auth-reveal { to { opacity: 1; } }
.js-auth.auth-ready #formCard { opacity: 1; }

/* کارت می‌تواند بلندتر از صفحه شود (فرم ثبت‌نام پویا): صفحه اسکرول می‌خورد، نه برش */
.sec-register { height: auto; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; overflow-y: auto; }
.sec-register > .container-fluid { padding-block: 16px; }
.sec-register .left { max-height: 93vh; }



.right-form > .register-form[hidden] { display: none; }

/* پیام سطح فرم (خطای کلی/سرور) */
.auth-alert {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: 14px;
    background: rgba(239, 68, 68, .08); color: #b91c1c;
    font-size: 13px; font-weight: 600; line-height: 1.7;
}
.auth-alert[hidden] { display: none; }
.auth-alert svg { flex: 0 0 18px; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.auth-alert.is-info { background: color-mix(in srgb, var(--primary) 6%, transparent); color: var(--primary); }

/* وضعیت فیلد (CSS خالص تا بدون GSAP هم کار کند) */
.input-box.is-invalid .input-field,
.input-box.is-invalid .input-field:focus { border-color: #ef4444; }
.input-box.is-invalid .input-label { color: #ef4444; }
.input-box.is-invalid .input-icon svg { stroke: #ef4444; }
.input-box.is-invalid .input-message { display: flex; color: #ef4444; }
.input-box.is-valid .input-field { border-color: #10b981; }
.input-box.is-valid .input-label { color: #10b981; }
.input-box.is-valid .input-icon svg { stroke: #10b981; }
.input-box .input-field:focus { border-color: var(--primary); }
.input-box:focus-within .input-label { color: var(--primary); }
.input-box:focus-within .input-icon svg { stroke: var(--primary); }
.input-box.is-locked .input-field { background: #f8fafc; color: #475569; }
.input-box.is-locked .input-icon svg { stroke: #10b981; }
.input-box[hidden] { display: none; }
.input-label small { font-weight: 500; color: var(--text-muted); }
.input-hint { margin: 6px 8px 0 0; font-size: 11.5px; font-weight: 500; color: var(--text-muted); line-height: 1.7; }
.input-hint.is-verified { color: #059669; font-weight: 600; }
.input-hint a { color: var(--primary); font-weight: 600; text-decoration: none; }
.input-hint a:hover { text-decoration: underline; }
.input-field[type="file"] { padding: 14px 20px 0 54px; height: 60px; font-size: 13px; line-height: 1.6; }

.shake { animation: auth-shake .46s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes auth-shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-8px); }
    40%, 60% { transform: translateX(8px); }
}

/* خط لینک کمکی زیر دکمه (ورود با موبایل/کد ملی) */
.register-footer p a { cursor: pointer; }

/* OTP */
.otp-single-box.is-error { border-color: #ef4444; background: rgba(239, 68, 68, .05); }
.resend-link-wrap a.is-disabled { pointer-events: none; color: var(--text-muted); text-decoration: none; }
.otp-boxes-wrapper.shake { animation-name: auth-shake; }

/* حالت موفقیت */
.auth-success { align-items: center; text-align: center; gap: 14px; padding-block: 18px; }
.auth-success .register-header { justify-content: center; }
.auth-success__check { width: 84px; height: 84px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.auth-success__ring { stroke: #10b981; stroke-width: 2.5; stroke-dasharray: 145; stroke-dashoffset: 145; }
.auth-success__tick { stroke: #10b981; stroke-width: 3.2; stroke-dasharray: 40; stroke-dashoffset: 40; }
.auth-success.is-play .auth-success__ring { animation: auth-draw .7s cubic-bezier(.65, 0, .35, 1) forwards; }
.auth-success.is-play .auth-success__tick { animation: auth-draw .45s .55s cubic-bezier(.65, 0, .35, 1) forwards; }
@keyframes auth-draw { to { stroke-dashoffset: 0; } }
.auth-success__bar { width: 100%; max-width: 220px; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--primary) 10%, transparent); overflow: hidden; margin-top: 6px; }
.auth-success__bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--primary); }
.auth-success.is-play .auth-success__bar i { animation: auth-fill 1.2s .3s ease-out forwards; }
@keyframes auth-fill { to { width: 100%; } }

@media (prefers-reduced-motion: reduce) {
    .shake { animation: none; }
    .auth-success.is-play .auth-success__ring,
    .auth-success.is-play .auth-success__tick { animation-duration: .01s; animation-delay: 0s; }
}

/* بازیابی رمز: سؤال‌های هویتی */
.auth-questions { display: flex; flex-direction: column; gap: 22px; width: 100%; }
.auth-q__title { font-size: 13.5px; font-weight: 700; color: #0f172a; margin-bottom: 10px; }
.auth-q__list { display: flex; flex-wrap: wrap; gap: 10px; }
.auth-chip {
    border: 2px solid var(--border-color); background: #fff; color: #334155;
    border-radius: 14px; padding: 10px 16px; font-size: 14px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: border-color .25s ease, background-color .25s ease, color .25s ease, transform .25s ease;
}
.auth-chip:hover { border-color: var(--primary); transform: translateY(-2px); }
.auth-chip.is-picked { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); color: var(--primary); }
.auth-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* قفل صفحه */
.auth-lock-head { gap: 14px; }
.auth-avatar {
    flex: 0 0 56px; width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center;
    background: color-mix(in srgb, var(--primary) 8%, transparent); color: var(--primary); font-weight: 800; font-size: 22px;
}
.auth-avatar img { width: 100%; height: 100%; object-fit: cover; }


/* ==========================================================================
   موبایل، برند و جزئیات UX (تم از تنظیمات پنل tenant)
   ========================================================================== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.js-auth a, .js-auth button, .js-auth input, .js-auth label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* فونت ورودی‌ها ≥۱۶px؛ iOS زیر این مقدار هنگام فوکوس صفحه را زوم می‌کند */
.sec-register .input-wrap .input-field,
.sec-register .otp-single-box { font-size: 16px; }
.sec-register .input-field[type="file"] { font-size: 16px; }

/* برند (لوگو + نام پنل) بالای کارت در موبایل/تبلت؛ در دسکتاپ داخل ستون چپ */
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0 auto 22px; text-align: center; width: 100%; }
.auth-brand img { max-width: 160px; max-height: 48px; width: auto; height: auto; object-fit: contain; }
.auth-brand-name { font-size: 16px; font-weight: 800; color: var(--color-heading, #0E2D61); line-height: 1.5; }
.auth-brand-aside { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.auth-brand-aside img { max-width: 160px; max-height: 64px; width: auto; object-fit: contain; }
.auth-brand-aside img.has-badge { background: #fff; border-radius: 18px; padding: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.auth-brand-aside .auth-brand-name { color: #fff; font-size: 17px; }


/* راهنمای ثابت زیر عنوان مرحله و هشدار Caps Lock */
.auth-help { margin: -8px 0 0; font-size: 12.5px; line-height: 1.9; }
.caps-hint { display: block; margin: 6px 8px 0 0; font-size: 12px; font-weight: 600; color: #b45309; }

/* حذف حرکت CSS دکمه در لحظهٔ تعویض مرحله (تداخل با GSAP) و نامرئی‌ماندن پنل ورودی تا شروع انیمیشن */
.is-transitioning .register-button,
.auth-entering .register-button { transition: none; will-change: auto; }
.auth-entering, .auth-entering * { transition: none !important; }

/* موبایل: کارت کامل، فاصلهٔ امن از لبه و ناچ، بدون ارتفاع ثابت */
@media (max-width: 1199.98px) {
    .sec-register .right { flex-direction: column; align-items: center; justify-content: center; }
    .sec-register { min-height: 100dvh; display: flex; align-items: center; }
    .sec-register > .container-fluid { width: 100%; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); padding-bottom: max(16px, env(safe-area-inset-bottom)); }
}
@media (max-width: 575.98px) {
    .sec-register .right .right-form { box-shadow: none; }
    .auth-brand { margin-bottom: 16px; }
    .register-form .register-header h1 { line-height: 1.7; }
}
@media (prefers-reduced-motion: reduce) {
    .js-auth #formCard { transition: none; }
}

/* «قدرت گرفته از بمداد · نسخه» — موبایل: زیر کارت (روی پس‌زمینهٔ تیره، رنگ روشن)؛ دسکتاپ: کنار کپی‌رایت */
.auth-powered { margin: 22px 0 0; text-align: center; font-size: 11px; color: rgba(100, 116, 139, .45); letter-spacing: .2px; }
.auth-footer-info { flex-direction: column; align-items: flex-end; gap: 2px; }
.auth-footer-info h5 { margin: 0; }
.auth-powered-text { color: rgba(255, 255, 255, .6); font-size: 11.5px; }

/* دسکتاپ: کارت فرم وسط ستون راست */
@media (min-width: 1200px) {
    .sec-register .right { justify-content: center; }
}
/* موبایل: عنوان خوش‌آمد فقط برای صفحه‌خوان (ارتفاع کمتر، اسکرول کمتر) */
@media (max-width: 575.98px) {
    .auth-greet { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* ردیف زیر رمز: «ورود با موبایل/کد ملی» و «فراموشی رمز» کنار هم؛ فوتر فشرده‌تر */
.forgot-password-wrap { justify-content: space-between; gap: 12px; padding-left: 0; padding-right: 8px; }
.register-form .register-footer { gap: 12px; margin-top: 4px; }

/* لینک‌های راهنما داخل هشدار (ثبت‌نام با همین شماره / ورود / بازیابی) */
.auth-alert__cta { display: inline-block; margin-inline-start: 12px; font-weight: 700; color: var(--primary); text-decoration: none; white-space: nowrap; }
.auth-alert__cta:hover { text-decoration: underline; }

/* راهنمای کوتاه بولتی (فراموشی رمز) */
.auth-bullets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.auth-bullets li { position: relative; padding-inline-start: 26px; font-size: 13px; line-height: 1.8; color: #475569; }
.auth-bullets li::before {
    content: ""; position: absolute; inset-inline-start: 0; top: 7px; width: 14px; height: 14px; border-radius: 50%;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 14px var(--primary);
}

/* ستارهٔ قرمز فیلد الزامی */
.req-star { color: #dc2626; font-weight: 800; margin-inline-start: 4px; }

/* شمارهٔ در حال ثبت‌نام زیر عنوان تکمیل ثبت‌نام */
.auth-reg-mobile { margin: 0 0 4px; text-align: center; }
.auth-reg-mobile strong { color: var(--primary); }
.auth-reg-mobile a { color: var(--primary); font-weight: 600; text-decoration: none; margin-inline-start: 6px; }
.auth-reg-mobile a:hover { text-decoration: underline; }

/* انتخابگر آواتار (هم‌سبک پروفایل: پیش‌نمایش دایره‌ای + دکمهٔ کیت) */
.auth-avatar-picker { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.auth-avatar-preview {
    flex: none; width: 72px; height: 72px; padding: 0; border-radius: 50%; overflow: hidden; cursor: pointer;
    display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 6%, transparent);
    border: 2px dashed color-mix(in srgb, var(--primary) 35%, transparent); transition: border-color .2s ease;
}
.auth-avatar-preview:hover, .auth-avatar-preview:focus-visible { border-color: var(--primary); outline: none; }
.auth-avatar-preview svg { width: 30px; height: 30px; fill: none; stroke: var(--primary); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.auth-avatar-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auth-avatar-preview img[hidden], .auth-avatar-preview svg[hidden] { display: none; }
.auth-avatar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.auth-avatar-actions small { flex-basis: 100%; font-size: 11.5px; color: var(--text-muted); }
.auth-avatar-btn {
    padding: 6px 14px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
    background: color-mix(in srgb, var(--primary) 8%, transparent); color: var(--primary); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.auth-avatar-btn.is-muted { background: transparent; border-color: #e2e8f0; color: #64748b; }
.auth-avatar-btn:hover { border-color: var(--primary); }
.auth-avatar-btn[hidden] { display: none; }
