/* ==========================================================================
   صفحات ورود، ثبت‌نام و بازیابی رمز
   ========================================================================== */

body.nw-auth-body {
    margin: 0;
    background: var(--nw-bg);
    color: var(--nw-text);
    font-family: var(--nw-font);
    font-size: 15px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}
body.nw-auth-body h1, body.nw-auth-body h2, body.nw-auth-body h3,
body.nw-auth-body button, body.nw-auth-body input, body.nw-auth-body .btn { font-family: var(--nw-font); }
:where(body.nw-auth-body) a { color: var(--nw-accent); text-decoration: none; }
:where(body.nw-auth-body) a:hover { color: var(--nw-accent-hover); }

/* ---------- چیدمان ---------- */
.auth {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main";
}

.auth__brand { grid-area: brand; display: none; }
.auth__main { grid-area: main; display: flex; flex-direction: column; min-width: 0; }

@media (min-width: 992px) {
    .auth {
        grid-template-columns: minmax(0, 1fr) minmax(380px, 44%);
        grid-template-areas: "main brand";
    }
    .auth__brand { display: block; padding: 16px; }
    .auth__logo--compact { visibility: hidden; }
}

/* ---------- پنل برند ---------- */
.auth__brand-inner {
    position: sticky;
    top: 16px;
    height: calc(100vh - 32px);
    min-height: 560px;
    border-radius: 28px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(56, 189, 248, .35), transparent 60%),
        radial-gradient(90% 70% at 0% 100%, rgba(99, 102, 241, .45), transparent 60%),
        linear-gradient(160deg, #1e3a8a 0%, #1d4ed8 55%, #1e40af 100%);
}
.auth__brand .auth__logo { color: #fff !important; }
.auth__brand .auth__logo img { background: #fff; }

.auth__pitch h2 { font-size: 30px; font-weight: 700; line-height: 1.5; margin: 0 0 12px; color: #fff; }
.auth__pitch p { font-size: 16px; opacity: .85; margin: 0 0 28px; max-width: 420px; }
.auth__features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth__features li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; }
.auth__features i {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .14); font-size: 15px;
}
.auth__map { width: 100%; max-width: 440px; height: auto; color: #e0f2fe; align-self: center; }

/* ---------- بخش فرم ---------- */
.auth__logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 17px;
    color: var(--nw-text) !important;
}
.auth__logo img { width: 40px; height: 40px; border-radius: 12px; object-fit: contain; padding: 4px; background: var(--nw-surface); border: 1px solid var(--nw-border); }
.auth__logo--compact img { width: 36px; height: 36px; }

.auth__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px clamp(16px, 4vw, 40px);
}
.auth__top-actions { display: flex; align-items: center; gap: 6px; }
.auth__home-link { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--nw-muted) !important; padding: 8px 10px; border-radius: 10px; }
.auth__home-link:hover { background: var(--nw-surface); color: var(--nw-text) !important; }
.auth__icon-btn {
    width: 40px; height: 40px; border-radius: 10px; border: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; color: var(--nw-muted);
}
.auth__icon-btn:hover { background: var(--nw-surface); color: var(--nw-text); }
.auth__theme-dark { display: none; }
[data-bs-theme="dark"] .auth__theme-dark { display: inline; }
[data-bs-theme="dark"] .auth__theme-light { display: none; }

.auth__content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px 24px;
}
.auth__card {
    width: 100%;
    max-width: 440px;
    background: var(--nw-surface);
    border: 1px solid var(--nw-border);
    border-radius: 24px;
    padding: clamp(24px, 5vw, 36px);
    box-shadow: 0 24px 48px -28px rgba(16, 24, 40, .25);
}

.auth__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px clamp(16px, 4vw, 40px) 24px;
    font-size: 12.5px;
    color: var(--nw-muted);
}
.auth__app {
    display: inline-flex; align-items: center; gap: 12px;
    padding: 8px 14px 8px 12px;
    border-radius: 14px;
    border: 1px solid var(--nw-border);
    background: var(--nw-surface);
    color: var(--nw-text) !important;
}
.auth__app:hover { border-color: var(--nw-accent); }
.auth__app-icon {
    width: 34px; height: 34px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(18, 183, 106, .12); color: #12b76a; font-size: 18px;
}
.auth__app-text { display: flex; flex-direction: column; line-height: 1.4; }
.auth__app-text small { color: var(--nw-muted); font-size: 11.5px; }
.auth__app > .fa-chevron-left { font-size: 11px; color: var(--nw-muted); }

@media (max-width: 575.98px) {
    .auth__content { align-items: flex-start; padding: 0 12px 16px; }
    .auth__card { border-radius: 20px; box-shadow: none; }
    .auth__home-link span, .auth__home-link { font-size: 0; gap: 0; }
    .auth__home-link i { font-size: 15px; }
    .auth__footer { justify-content: center; text-align: center; }
}

/* ---------- محتوای کارت ---------- */
.auth-head { margin-bottom: 24px; }
.auth-head__icon {
    width: 56px; height: 56px; border-radius: 16px; margin-bottom: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--nw-accent-soft); color: var(--nw-accent); font-size: 22px;
}
.auth-head__icon--success { background: var(--nw-success-soft); color: var(--nw-success); }
.auth-head__icon--danger { background: var(--nw-danger-soft); color: var(--nw-danger); }
.auth-head h1 { font-size: 23px; font-weight: 700; margin: 0 0 6px; color: var(--nw-text); }
.auth-head p { margin: 0; color: var(--nw-muted); font-size: 14px; }
.auth-head p strong { color: var(--nw-text); }
.auth-head--center { text-align: center; }

/* سوییچ نوع ورود */
.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 20px;
    border-radius: 14px;
    background: var(--nw-surface-2);
    border: 1px solid var(--nw-border);
}
.auth-tabs button {
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--nw-muted);
    font-size: 14px;
    font-weight: 500;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.auth-tabs button.is-active { background: var(--nw-surface); color: var(--nw-text); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.auth-tabs button:focus-visible { outline: 2px solid var(--nw-accent); outline-offset: 1px; }

/* فیلدها */
.auth-field { margin-bottom: 18px; }
.auth-field__label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 13.5px; font-weight: 500; color: var(--nw-text); }
.auth-field__label a { font-weight: 400; font-size: 13px; }
.auth-field__hint { margin-top: 6px; font-size: 12.5px; color: var(--nw-muted); }

.auth-input { position: relative; display: flex; align-items: stretch; }
.auth-input > i {
    position: absolute; top: 50%; right: 16px; transform: translateY(-50%);
    color: var(--nw-muted); pointer-events: none; font-size: 15px;
}
.auth-input input {
    flex: 1;
    min-width: 0;
    height: 52px;
    padding: 0 46px 0 16px;
    border: 1px solid var(--nw-border-strong);
    border-radius: 14px;
    background: var(--nw-surface);
    color: var(--nw-text);
    font-size: 16px; /* جلوگیری از بزرگ‌نمایی خودکار در iOS */
    transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-input input::placeholder { color: #98a2b3; }
.auth-input input:focus { outline: none; border-color: var(--nw-accent); box-shadow: 0 0 0 4px var(--nw-accent-soft); }
.auth-input input[dir="ltr"] { text-align: left; }
.auth-input input[dir="ltr"]::placeholder { text-align: left; }
.auth-input--action input { padding-left: 56px; }
.auth-input__action {
    position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
    height: 40px; min-width: 40px; padding: 0 10px;
    border: 0; border-radius: 10px;
    background: transparent; color: var(--nw-muted);
}
.auth-input__action:hover { background: var(--nw-surface-2); color: var(--nw-text); }

.auth-input input.input-validation-error,
.auth-input input.is-invalid { border-color: var(--nw-danger); }
.auth-input input.input-validation-error:focus { box-shadow: 0 0 0 4px var(--nw-danger-soft); }
.auth-input input.is-valid { border-color: var(--nw-success); }

.field-validation-error { display: block; margin-top: 6px; color: var(--nw-danger); font-size: 12.5px; }
.field-validation-valid { display: none; }

/* کد تایید */
.auth-code {
    width: 100%;
    height: 60px;
    border: 1px solid var(--nw-border-strong);
    border-radius: 14px;
    background: var(--nw-surface);
    color: var(--nw-text);
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: .5em;
    padding-left: .5em;
    direction: ltr;
    font-variant-numeric: tabular-nums;
}
.auth-code::placeholder { color: var(--nw-border-strong); letter-spacing: .5em; }
.auth-code:focus { outline: none; border-color: var(--nw-accent); box-shadow: 0 0 0 4px var(--nw-accent-soft); }

.auth-code-row { display: flex; gap: 8px; }
.auth-code-row .auth-code { flex: 1; min-width: 0; }

.auth-resend {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-top: 10px; font-size: 13px; color: var(--nw-muted);
}
.auth-link-btn { border: 0; background: none; padding: 0; color: var(--nw-accent); font-weight: 500; font-size: 13px; }
.auth-link-btn:disabled { color: var(--nw-muted); cursor: default; }
.auth-timer { font-variant-numeric: tabular-nums; direction: ltr; display: inline-block; }

/* پیام‌ها */
.auth-alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px; margin-bottom: 18px;
    border-radius: 14px;
    font-size: 13.5px; line-height: 1.7;
}
.auth-alert i { margin-top: 4px; }
.auth-alert--error, .validation-summary-errors {
    background: var(--nw-danger-soft); color: #b42318;
}
.auth-alert--info { background: var(--nw-accent-soft); color: var(--nw-accent); }
.auth-alert--success { background: var(--nw-success-soft); color: #067647; }
[data-bs-theme="dark"] .auth-alert--error, [data-bs-theme="dark"] .validation-summary-errors { color: #fda29b; }
[data-bs-theme="dark"] .auth-alert--success { color: #75e0a7; }
.validation-summary-errors ul { margin: 0; padding: 0; list-style: none; }
.validation-summary-valid { display: none; }
.auth-status { min-height: 22px; margin-top: 8px; font-size: 13px; }
.auth-status.is-error { color: var(--nw-danger); }
.auth-status.is-success { color: var(--nw-success); }

/* گزینه‌ها */
.auth-check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--nw-text); cursor: pointer; user-select: none; }
.auth-check input { width: 18px; height: 18px; accent-color: var(--nw-accent); }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }

.auth-note {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; margin-bottom: 20px;
    border-radius: 14px; border: 1px dashed var(--nw-border-strong);
    color: var(--nw-muted); font-size: 13px; line-height: 1.8;
}
.auth-note i { color: var(--nw-accent); margin-top: 4px; }

/* دکمه‌ها */
.auth-btn {
    width: 100%;
    height: 52px;
    border: 0;
    border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    font-size: 15.5px; font-weight: 700;
    background: var(--nw-accent); color: #fff !important;
    box-shadow: 0 10px 24px -12px rgba(37, 99, 235, .8);
    transition: background-color .15s ease, transform .1s ease;
}
.auth-btn:hover { background: var(--nw-accent-hover); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:disabled { opacity: .55; box-shadow: none; cursor: not-allowed; }
.auth-btn--ghost { background: var(--nw-surface-2); color: var(--nw-text) !important; border: 1px solid var(--nw-border); box-shadow: none; }
.auth-btn--ghost:hover { background: var(--nw-border); }
.auth-btn--secondary {
    width: auto; height: 52px; padding: 0 16px; flex-shrink: 0;
    background: var(--nw-surface-2); color: var(--nw-text) !important; border: 1px solid var(--nw-border-strong);
    box-shadow: none; font-size: 14px; font-weight: 500;
}
.auth-btn--secondary:hover { background: var(--nw-border); }
.auth-btn + .auth-btn { margin-top: 10px; }

.auth-alt { margin-top: 22px; text-align: center; font-size: 14px; color: var(--nw-muted); }
.auth-alt a { font-weight: 700; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--nw-muted); font-size: 12.5px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--nw-border); }

/* قدرت رمز عبور */
.auth-strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.auth-strength span { height: 5px; border-radius: 3px; background: var(--nw-border); transition: background-color .2s ease; }
.auth-strength[data-level="1"] span:nth-child(-n+1) { background: var(--nw-danger); }
.auth-strength[data-level="2"] span:nth-child(-n+2) { background: var(--nw-warning); }
.auth-strength[data-level="3"] span:nth-child(-n+3) { background: #84cc16; }
.auth-strength[data-level="4"] span { background: var(--nw-success); }

@media (prefers-reduced-motion: reduce) {
    .auth-btn, .auth-input input, .auth-tabs button { transition: none; }
}
