/* =========================================================
   Login Page — حساب‌یار سراج
   ========================================================= */

.login-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1.1fr;   /* RTL: راست = فرم */
    background: var(--c-bg);
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-8) var(--sp-6);
}

.login-box {
    width: 100%;
    max-width: 420px;
    animation: loginFade .5s ease both;
}

@keyframes loginFade { 
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Brand موبایل ---------- */
.login-mobile-brand {
    display: none;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-6);
}
.login-mobile-brand .logo-icon {
    width: 46px; height: 46px;
    border-radius: var(--radius-md);
    background: var(--c-primary-50);
    color: var(--c-primary-600);
    display: grid; place-items: center;
    font-size: 22px;
}
.login-mobile-brand .logo-text {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--c-text);
}
.login-mobile-brand .logo-text span { color: var(--c-primary-600); }

/* ---------- سرتیتر ---------- */
.login-title {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 6px;
    color: var(--c-text);
}
.login-sub {
    color: var(--c-text-muted);
    font-size: var(--fs-md);
    margin: 0 0 var(--sp-6);
}

/* ---------- Segmented control (نوع ورود) ---------- */
.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 4px;
    margin-bottom: var(--sp-5);
}
.segmented label { cursor: pointer; position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    padding: 9px;
    font-size: var(--fs-sm);
    font-weight: 500;
    border-radius: var(--radius-sm);
    color: var(--c-text-soft);
    transition: all var(--t-fast);
    white-space: nowrap;
}
.segmented span i { font-size: 12px; opacity: .8; }
.segmented input:checked + span {
    background: var(--c-surface);
    color: var(--c-primary-700);
    box-shadow: var(--shadow-xs);
}
[data-theme="dark"] .segmented input:checked + span {
    background: var(--c-primary-50);
    color: var(--c-primary-600);
}

/* ---------- Fields ---------- */
.field { margin-bottom: var(--sp-4); }
.field > label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--c-text-soft);
    margin-bottom: 6px;
}
.field .control { position: relative; }
.field .control > i.field-icon {
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--c-text-muted);
    font-size: 13px;
    pointer-events: none;
    transition: color var(--t-fast);
}
.field .control:focus-within > i.field-icon { color: var(--c-primary-600); }
.field .form-input {
    height: 46px;
    padding-right: 40px;
    font-size: var(--fs-md);
}

/* دکمه نمایش رمز */
.toggle-pass {
    position: absolute;
    left: 8px; top: 50%;
    transform: translateY(-50%);
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    display: grid; place-items: center;
    color: var(--c-text-muted);
    transition: all var(--t-fast);
}
.toggle-pass:hover { background: var(--c-surface-2); color: var(--c-text); }

/* ---------- دکمه ورود ---------- */
.btn-login {
    width: 100%;
    height: 48px;
    margin-top: var(--sp-2);
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--c-primary-600), var(--c-primary-700));
    color: #fff;
    font-size: var(--fs-lg);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 6px 16px rgba(61,95,143,.28);
    transition: all var(--t-base);
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(61,95,143,.35); }
.btn-login:active { transform: translateY(0); }
.btn-login:disabled { opacity: .65; cursor: not-allowed; transform: none; box-shadow: none; }

/* لینک فراموشی */
.forgot-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: var(--sp-4);
    font-size: var(--fs-sm);
    color: var(--c-primary-600);
    font-weight: 500;
    transition: color var(--t-fast);
}
.forgot-link:hover { color: var(--c-primary-700); text-decoration: underline; }

/* ---------- پنل برند ---------- */
.login-brand {
    position: relative;
    overflow: hidden;
    background: linear-gradient(150deg, #2f4a72 0%, #1d2d46 100%);
    color: #fff;
    padding: var(--sp-10);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.login-brand::before,
.login-brand::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.login-brand::before {
    width: 420px; height: 420px; top: -140px; left: -120px;
    background: radial-gradient(circle, rgba(255,255,255,.06), transparent 70%);
}
.login-brand::after {
    width: 520px; height: 520px; bottom: -200px; right: -140px;
    background: radial-gradient(circle, rgba(201,164,90,.10), transparent 70%);
}

.brand-head {
    display: flex; align-items: center; gap: 12px;
    position: relative; z-index: 1;
}
.brand-head .logo {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.18);
    display: grid; place-items: center;
    font-size: 22px;
    color: #fff;
}
.brand-head .txt strong { display: block; font-size: var(--fs-lg); font-weight: 700; }
.brand-head .txt small  { color: rgba(255,255,255,.7); font-size: var(--fs-xs); }

.brand-body { position: relative; z-index: 1; }
.brand-body h1 {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.5;
    margin: 0 0 var(--sp-4);
}
.brand-body h1 .hl { color: var(--c-accent); }
.brand-body p {
    color: rgba(255,255,255,.75);
    font-size: var(--fs-md);
    line-height: 1.9;
    max-width: 460px;
    margin: 0 0 var(--sp-8);
}

.brand-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3);
    max-width: 460px;
}
.feat {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: var(--radius-md);
    font-size: var(--fs-sm);
    color: rgba(255,255,255,.85);
    transition: all var(--t-fast);
}
.feat:hover { background: rgba(255,255,255,.09); transform: translateY(-2px); }
.feat i {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: rgba(201,164,90,.15);
    color: var(--c-accent);
    display: grid; place-items: center;
    font-size: 12px;
    flex-shrink: 0;
}

.brand-foot {
    position: relative; z-index: 1;
    color: rgba(255,255,255,.55);
    font-size: var(--fs-xs);
    display: flex; justify-content: space-between; align-items: center;
}
/* =========================================================
   OTP Login Section
   ========================================================= */

/* form-hint */
.login-box .form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--c-text-muted);
    line-height: 1.6;
}
.login-box .form-hint i {
    font-size: 10px;
    color: var(--c-primary-500);
    margin-left: 3px;
}

/* ---------- کادر اطلاعیه ---------- */
.otp-sent-info {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    background: rgba(63,138,106,.08);
    border: 1px solid rgba(63,138,106,.22);
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-4);
}
.otp-sent-info > i {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(63,138,106,.15);
    color: var(--c-success);
    display: grid; place-items: center;
    font-size: 15px;
    flex-shrink: 0;
}
.otp-sent-info > div { flex: 1; min-width: 0; }
.otp-sent-info strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 2px;
}
.otp-sent-info small {
    font-size: 12px;
    color: var(--c-text-soft);
    line-height: 1.6;
    display: block;
}
.otp-sent-info small strong {
    display: inline;
    color: var(--c-primary-700);
    font-size: 12.5px;
}

/* =========================================================
   OTP: Hidden input + Visual boxes (Best for mobile autofill)
   ========================================================= */
.otp-inputs-wrap {
    margin-bottom: var(--sp-4);
}
.otp-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--c-text-muted);
    margin-bottom: 8px;
    text-align: right;
}

.otp-code-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    cursor: text;
}

/* input مخفی که واقعاً تایپ/autofill می‌شود */
.otp-code-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    border: none;
    background: transparent;
    font-size: 16px;    /* جلوگیری از zoom خودکار iOS */
    color: transparent;
    caret-color: transparent;
    cursor: text;
    z-index: 2;
    outline: none;
    padding: 0;
    /* جلوگیری از دیده‌شدن اسکرول */
    overflow: hidden;
    white-space: nowrap;
}

/* باکس‌های نمایشی */
.otp-boxes {
    display: flex;
    gap: 8px;
    pointer-events: none;
    direction: ltr;
}
.otp-box {
    width: 46px;
    height: 54px;
    border: 2px solid var(--c-border);
    border-radius: 10px;
    background: var(--c-surface);
    color: var(--c-text);
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 700;
    font-family: 'Yekan Bakh', sans-serif;
    transition: all .15s;
}
.otp-box.filled {
    border-color: var(--c-primary-300);
    background: var(--c-primary-50);
}
.otp-box.active {
    border-color: var(--c-primary-500);
    box-shadow: 0 0 0 3px rgba(61,95,143,.15);
}

/* ---------- Timer row ---------- */
.otp-timer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    margin-bottom: var(--sp-4);
    flex-wrap: wrap;
}
.otp-timer {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--c-text-muted);
}
.otp-timer i {
    font-size: 12px;
    color: var(--c-warning);
}
.otp-timer strong {
    color: var(--c-primary-700);
    font-weight: 700;
    min-width: 24px;
    text-align: center;
    direction: rtl;
}

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--c-primary-600);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
}
.link-btn:hover:not(:disabled) {
    background: var(--c-primary-50);
    color: var(--c-primary-700);
}
.link-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}
.link-btn i { font-size: 11px; }

/* ---------- Actions row ---------- */
.otp-actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
    flex-wrap: wrap;
}
.otp-actions-row .btn { min-height: 44px; }
.otp-actions-row .btn-sm {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 12.5px;
}
.btn-login-sm {
    flex: 1;
    min-height: 44px;
}
/* ---------- OTP Status (در حال ورود خودکار) ---------- */
.otp-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--c-primary-50);
    border: 1px solid var(--c-primary-200);
    border-radius: var(--radius-md);
    color: var(--c-primary-700);
    font-size: var(--fs-sm);
    font-weight: 500;
    margin-bottom: var(--sp-3);
}
.otp-status[hidden] { display: none; }
.otp-status i {
    color: var(--c-primary-600);
    font-size: 13px;
}
/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .login-wrap { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .login-mobile-brand { display: flex; }
    .login-panel { padding: var(--sp-6) var(--sp-4); }
}

@media (max-width: 400px) {
    .otp-boxes { gap: 6px; }
    .otp-box {
        width: 38px;
        height: 48px;
        font-size: 18px;
        border-radius: 8px;
    }
}
@media (max-width: 340px) {
    .otp-boxes { gap: 4px; }
    .otp-box {
        width: 34px;
        height: 44px;
        font-size: 16px;
    }
}