/*
 * ورود / ثبت‌نام بلج — مودال هدر و صفحهٔ ورود (pages/auth/auth_view.php)
 * فونت سایت فقط وزن 400 دارد؛ پررنگ فقط برای عنوان و دکمه (بقیه 400/500).
 */

.bj-auth,
.bj-auth-page {
    --bj-red: #e8202a;
    --bj-red-600: #c8161f;
    --bj-red-50: #fff1f1;
    --bj-green: #15803d;
    --bj-green-50: #effcf3;
    --bj-teal: #18b4c6;
    --bj-text: #1f2937;
    --bj-text-2: #4b5563;
    --bj-muted: #6b7280;
    --bj-border: #d5d9e0;
    --bj-soft: #f7f8fa;
}

.bj-auth {
    direction: rtl;
    color: var(--bj-text);
    font-size: 14px;
    line-height: 1.8;
    text-align: right;
}

.bj-auth *,
.bj-auth *::before,
.bj-auth *::after {
    box-sizing: border-box;
}

.bj-auth__step {
    position: relative;
    display: none;
    flex-direction: column;
    gap: 8px;
    margin: 0;
}

.bj-auth__step.is-active {
    display: flex;
    animation: bj-auth-in .22s ease;
}

@keyframes bj-auth-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.bj-auth__logo {
    align-self: center;
    width: auto;
    height: 36px;
    margin: 4px 0 14px;
}

.bj-auth__title {
    margin: 0;
    color: var(--bj-text);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.6;
}

.bj-auth__sub {
    margin: 0 0 10px;
    color: var(--bj-muted);
    font-size: 13px;
    line-height: 2;
}

.bj-auth__sub b {
    color: var(--bj-text);
    font-weight: 700;
}

.bj-auth__label {
    margin: 4px 0 0;
    color: var(--bj-text-2);
    font-size: 13px;
    font-weight: 500;
}

.bj-auth__label small {
    color: var(--bj-muted);
    font-size: 12px;
}

.bj-auth__input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--bj-border);
    border-radius: 12px;
    background: #fff;
    color: var(--bj-text);
    font: inherit;
    font-size: 15px;
    transition: border-color .15s, box-shadow .15s;
}

.bj-auth__input:focus {
    border-color: var(--bj-teal);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(24, 180, 198, .15);
}

.bj-auth__input.is-invalid,
.bj-auth__digit.is-invalid {
    border-color: var(--bj-red);
    background: var(--bj-red-50);
}

/* فیلدهای LTR (موبایل، رمز): متن عددی چپ‌به‌راست، ولی placeholder فارسی راست‌چین */
.bj-auth__input[dir="ltr"] {
    text-align: right;
}

.bj-auth__input[dir="ltr"]:placeholder-shown {
    direction: rtl;
}

.bj-auth input::placeholder {
    color: #9aa1ab !important;
    font-size: 13px !important;
    opacity: 1;
}

.bj-auth__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.bj-auth__row > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bj-auth__pass {
    position: relative;
}

.bj-auth__pass .bj-auth__input {
    padding-left: 48px;
}

.bj-auth__eye {
    position: absolute;
    top: 50%;
    left: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--bj-muted);
    transform: translateY(-50%);
    cursor: pointer;
}

.bj-auth__eye.is-on,
.bj-auth__eye:hover {
    color: var(--bj-text);
}

.bj-auth__otp {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 6px 0 4px;
    direction: ltr;
}

.bj-auth__digit {
    width: 56px;
    height: 56px;
    padding: 0;
    border: 1px solid var(--bj-border);
    border-radius: 14px;
    background: #fff;
    color: var(--bj-text);
    font: inherit;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    transition: border-color .15s, box-shadow .15s;
}

.bj-auth__digit:focus {
    border-color: var(--bj-teal);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(24, 180, 198, .15);
}

.bj-auth__welcome {
    margin: 8px 0 2px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bj-soft);
    color: var(--bj-text-2);
    font-size: 13px;
    line-height: 2;
}

.bj-auth__msg {
    margin: 2px 0 0;
    color: var(--bj-red);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.9;
}

.bj-auth__msg.is-info {
    color: var(--bj-green);
}

.bj-auth__btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
    margin-top: 10px;
    border: 0;
    border-radius: 12px;
    background: var(--bj-red);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(232, 32, 42, .22);
    transition: background .15s;
}

.bj-auth__btn:hover {
    background: var(--bj-red-600);
}

.bj-auth__btn[disabled] {
    cursor: wait;
    opacity: .85;
}

.bj-auth__btn.is-loading {
    color: transparent;
}

.bj-auth__btn.is-loading::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bj-auth-spin .7s linear infinite;
}

@keyframes bj-auth-spin {
    to { transform: rotate(360deg); }
}

.bj-auth__link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--bj-teal);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.bj-auth__link:hover {
    text-decoration: underline;
}

.bj-auth__link[disabled] {
    opacity: .5;
}

.bj-auth__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    margin-top: 6px;
    color: var(--bj-muted);
    font-size: 13px;
}

.bj-auth__meta--center {
    justify-content: center;
}

.bj-auth__meta [hidden] {
    display: none !important;
}

.bj-auth__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    width: 40px;
    height: 40px;
    margin: -4px -8px 2px 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--bj-text-2);
    cursor: pointer;
}

.bj-auth__back:hover {
    background: var(--bj-soft);
}

/* در صفحهٔ ورود، فلش سربرگ کارت همین کار را می‌کند (bjAuthLeave) */
.bj-auth[data-mode="page"] .bj-auth__back {
    display: none;
}

.bj-auth :focus-visible {
    outline: 2px solid var(--bj-teal);
    outline-offset: 2px;
}

.bj-auth [hidden] {
    display: none !important;
}

@media (max-width: 359px) {
    .bj-auth__digit {
        width: 48px;
        height: 50px;
    }

    .bj-auth__row {
        grid-template-columns: 1fr;
    }
}

/* ── قاب مودال (pages/header.php) ───────────────────────────────────────── */
.bj-auth-modal .modal-dialog {
    max-width: 420px;
}

.bj-auth-modal .modal-content {
    position: relative;
    padding: 28px 24px 24px;
    border: 0;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(16, 24, 40, .2);
}

.bj-auth-modal__close {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--bj-muted, #6b7280);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.bj-auth-modal__close:hover {
    background: #f3f4f6;
}

@media (max-width: 575px) {
    .bj-auth-modal .modal-dialog {
        margin: 12px;
    }

    .bj-auth-modal .modal-content {
        padding: 24px 18px 20px;
    }
}

/* ── صفحهٔ ورود (pages/login.php) ───────────────────────────────────────── */
.bj-auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* موبایل: بالای صفحه تا باز شدن کیبورد فرم را جابه‌جا نکند */
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 24px 16px;
    background: #fff;
}

.bj-auth-card {
    width: 100%;
    max-width: 400px;
}

.bj-auth-card__head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-bottom: 28px;
}

.bj-auth-card__logo img {
    height: 38px;
    width: auto;
}

.bj-auth-card__back {
    position: absolute;
    top: 50%;
    right: -8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #4b5563;
    transform: translateY(-50%);
    cursor: pointer;
}

.bj-auth-card__back:hover {
    background: #f3f4f6;
}

.bj-auth-page__foot {
    margin: 22px 0 0;
    color: #9ca3af;
    font-size: 12px;
    text-align: center;
}

@media (min-width: 576px) {
    .bj-auth-page {
        justify-content: center;
        background: #f5f6f8;
    }

    .bj-auth-card {
        padding: 32px 32px 28px;
        border: 1px solid #e7e9ee;
        border-radius: 18px;
        background: #fff;
        box-shadow: 0 2px 10px rgba(16, 24, 40, .05);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bj-auth__step.is-active,
    .bj-auth__btn.is-loading::after {
        animation: none;
    }
}
