/* ==========================================================================
   ArenCRM — Apple-style glass auth screens (internal login + customer portal
   login). Full-bleed configurable background photo/video, single centered
   frosted-glass card. Shared by Views/Account/Login.cshtml and
   Views/CustomerPortal/Login.cshtml.
   ========================================================================== */

html, body.auth-glass-body {
    height: 100%;
    margin: 0;
}

body.auth-glass-body {
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    color: #f4f7fc;
    overflow-x: hidden;
}

.auth-glass-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-color: #0b1220;
    transform: scale(1.02);
    /* Softer, more muted rendition of whatever photo/video is configured —
       lower saturation and a touch less contrast/brightness so the glass
       card and its text always sit comfortably on top. */
    filter: saturate(.8) brightness(.9) contrast(.96);
}

.auth-glass-bg video.auth-glass-bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-glass-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 20%, rgba(15, 23, 42, .15), rgba(7, 12, 24, .55) 62%),
        linear-gradient(180deg, rgba(6, 11, 22, .55) 0%, rgba(6, 11, 22, .35) 45%, rgba(6, 11, 22, .72) 100%);
}

.auth-glass-shell {
    position: relative;
    z-index: 2;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 18px;
}

.auth-glass-card {
    width: 100%;
    max-width: 408px;
    background: rgba(255, 255, 255, .12);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    backdrop-filter: blur(28px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, .32);
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .25);
    padding: 34px 30px 30px;
    animation: authGlassIn .5s cubic-bezier(.19, 1, .22, 1);
}

@keyframes authGlassIn {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-glass-brand { text-align: center; margin-bottom: 22px; }
.auth-glass-logo {
    display: block;
    width: 58px; height: 58px; object-fit: contain; border-radius: 16px;
    background: rgba(255, 255, 255, .92); padding: 8px; margin: 0 auto 14px;
    box-shadow: 0 12px 26px rgba(0, 0, 0, .25);
}
.auth-glass-brand h1 { margin: 0 0 6px; font-size: 1.28rem; font-weight: 900; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .3); }
.auth-glass-brand p { margin: 0; font-size: .84rem; color: rgba(255, 255, 255, .78); line-height: 1.7; }
.auth-glass-kicker {
    display: inline-block; margin-bottom: 8px; padding: .28rem .85rem; border-radius: 999px;
    background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28);
    font-size: .68rem; font-weight: 800; letter-spacing: .02em; color: #e2e8f0;
}

.auth-glass-message {
    margin-bottom: 16px; padding: 10px 14px; border-radius: 14px; font-size: .82rem; font-weight: 700;
    background: rgba(34, 197, 94, .16); border: 1px solid rgba(74, 222, 128, .35); color: #dcfce7; text-align: center;
}

.auth-glass-info-box {
    margin-bottom: 16px; padding: 12px 14px; border-radius: 14px; font-size: .82rem; font-weight: 700;
    background: rgba(96, 165, 250, .16); border: 1px solid rgba(147, 197, 253, .38); color: #dbeafe;
    display: flex; flex-direction: column; gap: 4px;
}
.auth-glass-info-box strong { color: #fff; }
.auth-glass-info-box small { font-weight: 600; color: rgba(219, 234, 254, .82); }

.auth-glass-form .validation-summary,
.auth-glass-form .cp-validation {
    color: #fecaca; font-size: .8rem; font-weight: 700; margin-bottom: 6px;
}
.auth-glass-form .validation-summary ul { margin: 0; padding-inline-start: 18px; }
.auth-glass-lock-alert {
    margin-bottom: 12px; padding: 10px 14px; border-radius: 14px; font-size: .78rem; font-weight: 700;
    background: rgba(248, 113, 113, .16); border: 1px solid rgba(248, 113, 113, .38); color: #fecaca; text-align: center;
}

.auth-glass-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.auth-glass-field span.auth-glass-field-label { font-size: .78rem; font-weight: 700; color: rgba(255, 255, 255, .82); }
.auth-glass-field input {
    width: 100%; box-sizing: border-box; height: 46px; padding: 0 16px; border-radius: 14px;
    background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .28);
    color: #fff; font: inherit; font-size: .92rem; outline: none;
    transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.auth-glass-field input::placeholder { color: rgba(255, 255, 255, .5); }
.auth-glass-field input:focus {
    background: rgba(255, 255, 255, .18); border-color: rgba(147, 197, 253, .7);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, .22);
}
.auth-glass-field .field-validation-error,
.auth-glass-field small.field-validation-error {
    color: #fca5a5; font-size: .74rem; font-weight: 700;
}

.auth-glass-captcha {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 14px; padding: 10px 14px; margin-bottom: 4px;
}
.auth-glass-captcha .captcha-title { display: block; font-size: .68rem; color: rgba(255, 255, 255, .65); font-weight: 700; }
.auth-glass-captcha strong { font-size: .92rem; color: #fff; font-weight: 900; }
.auth-glass-captcha input {
    width: 84px; height: 40px; text-align: center; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .3);
    background: rgba(255, 255, 255, .14); color: #fff; font: inherit; font-weight: 800; outline: none;
}
.auth-glass-captcha input::placeholder { color: rgba(255, 255, 255, .5); }

.auth-glass-options {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin: 14px 0 18px; font-size: .78rem;
}
.auth-glass-options label { display: flex; align-items: center; gap: 6px; color: rgba(255, 255, 255, .82); font-weight: 700; cursor: pointer; }
.auth-glass-options input[type="checkbox"] { accent-color: #60a5fa; width: 16px; height: 16px; }
.auth-glass-options a { color: #bfdbfe; font-weight: 700; text-decoration: none; }
.auth-glass-options a:hover { text-decoration: underline; }

.auth-glass-submit {
    width: 100%; height: 48px; border: 0; border-radius: 14px; cursor: pointer;
    background: linear-gradient(135deg, #2563eb, #0ea5e9); color: #fff; font: inherit;
    font-size: .96rem; font-weight: 900; box-shadow: 0 16px 34px rgba(37, 99, 235, .38);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.auth-glass-submit:hover { transform: translateY(-1px); box-shadow: 0 20px 40px rgba(37, 99, 235, .46); filter: brightness(1.04); }
.auth-glass-submit:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.auth-glass-switch {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 18px; padding: 12px 16px; border-radius: 14px;
    background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18);
    color: #fff; text-decoration: none; text-align: center; transition: background .16s ease;
}
.auth-glass-switch:hover { background: rgba(255, 255, 255, .14); }
.auth-glass-switch strong { font-size: .84rem; font-weight: 800; }
.auth-glass-switch em { font-style: normal; font-size: .72rem; color: rgba(255, 255, 255, .68); }

.auth-glass-footer { margin-top: 18px; text-align: center; font-size: .7rem; color: rgba(255, 255, 255, .5); }

/* responsive */
@media (max-width: 600px) {
    .auth-glass-shell { padding: 16px 12px; align-items: flex-end; }
    .auth-glass-card { max-width: 100%; padding: 26px 18px 22px; border-radius: 24px; }
    .auth-glass-logo { width: 50px; height: 50px; }
    .auth-glass-brand h1 { font-size: 1.14rem; }
    .auth-glass-brand p { font-size: .8rem; }

    /* Captcha row is the tightest fit on a phone — let it wrap onto two
       lines instead of squeezing the answer box into nothing. */
    .auth-glass-captcha { flex-wrap: wrap; justify-content: flex-start; }
    .auth-glass-captcha .captcha-input-wrap { width: 100%; }
    .auth-glass-captcha input { width: 100%; box-sizing: border-box; }

    .auth-glass-options { flex-wrap: wrap; gap: 8px 14px; }

    .auth-glass-switch { flex-direction: column; gap: 2px; text-align: center; }
}

@media (max-width: 360px) {
    .auth-glass-card { padding: 22px 14px 18px; }
    .auth-glass-brand h1 { font-size: 1.02rem; }
    .auth-glass-field input,
    .auth-glass-submit { height: 44px; font-size: .88rem; }
}

/* Short/landscape phones: the card can exceed the viewport height, so let
   the shell scroll instead of clipping the bottom of the form. */
@media (max-height: 700px) {
    .auth-glass-shell { align-items: center; padding-top: 20px; padding-bottom: 20px; overflow-y: auto; }
}

/* dark/light are irrelevant here — the card is always translucent-dark for
   legibility over a photo, regardless of the app-wide theme toggle. */


/* ===== R6.9.164 Phase 1 - Login Glass UI Modernization =====
   هدف:
   - کاهش تیرگی و کدری تصویر بک‌گراند صفحه ورود
   - افزایش خوانایی فرم ورود بدون پوشاندن تصویر
   - Glass UI شفاف‌تر، شیک‌تر و تمیزتر
   - سازگاری بهتر با موبایل و دارک‌مد
   ========================================================================== */

.auth-glass-bg {
    transform: scale(1.01);
    filter: saturate(1.04) brightness(1.02) contrast(1.02);
}

.auth-glass-bg::after {
    background:
        radial-gradient(circle at 50% 18%, rgba(15, 23, 42, .05), rgba(7, 12, 24, .22) 64%),
        linear-gradient(180deg, rgba(6, 11, 22, .22) 0%, rgba(6, 11, 22, .12) 46%, rgba(6, 11, 22, .36) 100%);
}

.auth-glass-card {
    max-width: 424px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, .11));
    -webkit-backdrop-filter: blur(18px) saturate(175%);
    backdrop-filter: blur(18px) saturate(175%);
    border: 1px solid rgba(255, 255, 255, .42);
    border-top-color: rgba(255, 255, 255, .62);
    box-shadow:
        0 28px 70px rgba(2, 8, 23, .34),
        0 8px 26px rgba(15, 23, 42, .18),
        inset 0 1px 0 rgba(255, 255, 255, .42);
}

.auth-glass-card::before {
    content: "";
    display: block;
    position: absolute;
    pointer-events: none;
}

.auth-glass-brand h1 {
    color: #ffffff;
    text-shadow: 0 2px 14px rgba(0, 0, 0, .36);
}

.auth-glass-brand p {
    color: rgba(255, 255, 255, .88);
    text-shadow: 0 1px 8px rgba(0, 0, 0, .28);
}

.auth-glass-kicker {
    background: rgba(255, 255, 255, .20);
    border-color: rgba(255, 255, 255, .38);
    color: rgba(255, 255, 255, .92);
}

.auth-glass-logo {
    width: 62px;
    height: 62px;
    background: rgba(255, 255, 255, .96);
    box-shadow:
        0 16px 34px rgba(0, 0, 0, .22),
        inset 0 1px 0 rgba(255, 255, 255, .85);
}

.auth-glass-field label.auth-glass-field-label,
.auth-glass-field span.auth-glass-field-label {
    font-size: .8rem;
    font-weight: 850;
    color: rgba(255, 255, 255, .92);
    text-shadow: 0 1px 8px rgba(0, 0, 0, .20);
}

.auth-glass-field input,
.auth-glass-captcha input {
    background: rgba(255, 255, 255, .19);
    border-color: rgba(255, 255, 255, .38);
    color: #ffffff;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .18),
        0 8px 18px rgba(15, 23, 42, .10);
}

.auth-glass-field input::placeholder,
.auth-glass-captcha input::placeholder {
    color: rgba(255, 255, 255, .66);
}

.auth-glass-field input:focus,
.auth-glass-captcha input:focus {
    background: rgba(255, 255, 255, .25);
    border-color: rgba(191, 219, 254, .90);
    box-shadow:
        0 0 0 4px rgba(96, 165, 250, .25),
        0 12px 24px rgba(15, 23, 42, .16),
        inset 0 1px 0 rgba(255, 255, 255, .22);
}

.auth-glass-captcha {
    background: rgba(255, 255, 255, .16);
    border-color: rgba(255, 255, 255, .32);
}

.auth-glass-captcha .captcha-title {
    color: rgba(255, 255, 255, .78);
}

.auth-glass-captcha strong {
    color: #ffffff;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .24);
}

.auth-glass-options label {
    color: rgba(255, 255, 255, .90);
}

.auth-glass-options a {
    color: #dbeafe;
    text-shadow: 0 1px 8px rgba(0, 0, 0, .18);
}

.auth-glass-submit {
    height: 50px;
    border-radius: 16px;
    background:
        linear-gradient(135deg, #1d4ed8 0%, #2563eb 42%, #0ea5e9 100%);
    box-shadow:
        0 18px 38px rgba(37, 99, 235, .38),
        inset 0 1px 0 rgba(255, 255, 255, .24);
}

.auth-glass-submit:hover {
    transform: translateY(-2px);
    box-shadow:
        0 24px 48px rgba(37, 99, 235, .48),
        inset 0 1px 0 rgba(255, 255, 255, .30);
}

.auth-glass-submit:active {
    transform: translateY(0);
}

.auth-glass-switch {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .28);
}

.auth-glass-switch:hover {
    background: rgba(255, 255, 255, .19);
    border-color: rgba(255, 255, 255, .38);
}

/* موبایل: تصویر بک‌گراند هنوز دیده شود، اما فرم خوانا بماند */
@media (max-width: 600px) {
    .auth-glass-bg {
        transform: scale(1);
        filter: saturate(1.02) brightness(1.01) contrast(1.01);
    }

    .auth-glass-bg::after {
        background:
            radial-gradient(circle at 50% 18%, rgba(15, 23, 42, .08), rgba(7, 12, 24, .28) 66%),
            linear-gradient(180deg, rgba(6, 11, 22, .18) 0%, rgba(6, 11, 22, .14) 44%, rgba(6, 11, 22, .42) 100%);
    }

    .auth-glass-shell {
        align-items: center;
        padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
    }

    .auth-glass-card {
        padding: 24px 18px 22px;
        border-radius: 24px;
        background:
            linear-gradient(145deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, .13));
        -webkit-backdrop-filter: blur(16px) saturate(165%);
        backdrop-filter: blur(16px) saturate(165%);
    }

    .auth-glass-field input,
    .auth-glass-captcha input,
    .auth-glass-submit {
        font-size: 16px;
    }
}

/* دارک‌مد سیستم: فرم کمی پررنگ‌تر شود ولی تصویر همچنان له نشود */
@media (prefers-color-scheme: dark) {
    .auth-glass-card {
        background:
            linear-gradient(145deg, rgba(15, 23, 42, .36), rgba(15, 23, 42, .20));
        border-color: rgba(255, 255, 255, .36);
    }

    .auth-glass-bg::after {
        background:
            radial-gradient(circle at 50% 18%, rgba(15, 23, 42, .08), rgba(7, 12, 24, .28) 64%),
            linear-gradient(180deg, rgba(6, 11, 22, .26) 0%, rgba(6, 11, 22, .14) 46%, rgba(6, 11, 22, .42) 100%);
    }
}


/* ===== R6.9.192 — login method tabs (password / SMS code) + SMS code step =====
   Same white-on-glass language as the rest of the card; theme-independent card, with a slightly
   deeper variant for dark system/app theme. */
.auth-method-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin: 0 0 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .26);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
}
.auth-method-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    border-radius: 12px;
    color: rgba(255, 255, 255, .84);
    font-size: .86rem;
    font-weight: 800;
    text-decoration: none;
    transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.auth-method-tab svg { width: 17px; height: 17px; flex: none; }
.auth-method-tab:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.auth-method-tab.is-active {
    color: #0f172a;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .18);
}
.auth-method-tab:focus-visible { outline: 2px solid #bfdbfe; outline-offset: 2px; }

.auth-sms-mobile { text-align: left; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.auth-sms-mobile::placeholder { text-align: left; }
.auth-sms-sent {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .26);
    color: rgba(255, 255, 255, .9);
    font-size: .84rem;
    font-weight: 700;
}
.auth-sms-sent bdi { font-weight: 900; color: #fff; letter-spacing: .05em; }
.auth-sms-change { margin-inline-start: auto; color: #dbeafe; font-weight: 800; text-decoration: none; }
.auth-sms-change:hover { text-decoration: underline; }
.auth-sms-dev {
    margin: 0 0 12px;
    padding: 9px 12px;
    border-radius: 12px;
    background: rgba(250, 204, 21, .18);
    border: 1px dashed rgba(250, 204, 21, .6);
    color: #fef9c3;
    font-size: .8rem;
    font-weight: 700;
}
.auth-sms-dev b { font-size: 1rem; letter-spacing: .2em; }
.auth-glass-field input.auth-sms-code {
    height: 58px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: .55em;
    padding-inline-start: .55em;
    font-variant-numeric: tabular-nums;
}
.auth-glass-field input.auth-sms-code::placeholder { letter-spacing: .4em; color: rgba(255, 255, 255, .45); }
.auth-sms-resend { display: flex; justify-content: center; margin: 12px 0 0; }
.auth-sms-resend button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .3);
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font: inherit;
    font-size: .84rem;
    font-weight: 800;
    cursor: pointer;
}
.auth-sms-resend button:hover:not(:disabled) { background: rgba(255, 255, 255, .18); }
.auth-sms-resend button:disabled { opacity: .6; cursor: default; }
.auth-sms-timer [hidden], .auth-sms-timer[hidden] { display: none !important; }
.auth-glass-submit.is-busy { opacity: .75; cursor: progress; }

@media (max-width: 600px) {
    .auth-method-tab { min-height: 44px; font-size: .84rem; }
    .auth-glass-field input.auth-sms-code { height: 56px; font-size: 1.45rem; letter-spacing: .45em; }
}

@media (prefers-color-scheme: dark) {
    .auth-method-tabs { background: rgba(15, 23, 42, .28); border-color: rgba(255, 255, 255, .2); }
    .auth-method-tab.is-active { background: rgba(226, 232, 240, .95); color: #0b1220; }
    .auth-sms-sent { background: rgba(15, 23, 42, .3); }
}
html[data-theme="dark"] .auth-glass-card {
    background: linear-gradient(145deg, rgba(15, 23, 42, .4), rgba(15, 23, 42, .22));
}
html[data-theme="dark"] .auth-method-tabs { background: rgba(15, 23, 42, .3); border-color: rgba(255, 255, 255, .2); }
html[data-theme="dark"] .auth-method-tab.is-active { background: rgba(226, 232, 240, .95); color: #0b1220; }
html[data-theme="dark"] .auth-sms-sent { background: rgba(15, 23, 42, .32); }

@media (prefers-reduced-motion: reduce) {
    .auth-method-tab { transition: none; }
}

/* Screen-reader-only labels (e.g. the captcha answer label) were rendering visibly on the auth pages. */
.auth-glass-card .sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* SMS login: account chooser when one mobile is registered for several staff accounts */
.auth-sms-accounts { display: grid; gap: 10px; }
.auth-sms-account {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 8px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .32);
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: background-color .18s ease, border-color .18s ease;
}
.auth-sms-account:hover, .auth-sms-account:focus-visible { background: rgba(255, 255, 255, .26); border-color: rgba(191, 219, 254, .9); outline: none; }
.auth-sms-account-avatar {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #0ea5e9); font-weight: 900; font-size: 1.05rem;
}
.auth-sms-account-text { display: grid; gap: 2px; min-width: 0; }
.auth-sms-account-text strong { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-sms-account-text small { font-size: .78rem; color: rgba(255, 255, 255, .78); text-align: right; }
.auth-sms-account svg { width: 18px; height: 18px; opacity: .8; }
.auth-sms-accounts-back { margin: 4px auto 0; }
@media (prefers-color-scheme: dark) { .auth-sms-account { background: rgba(15, 23, 42, .3); } }
html[data-theme="dark"] .auth-sms-account { background: rgba(15, 23, 42, .32); }
