@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --navy-950: #06111f;
    --navy-900: #0a192a;
    --blue: #1479ff;
    --blue-dark: #0864d7;
    --blue-light: #2d9cff;
    --gold: #d5a84a;
    --text: #f8fafc;
    --muted: #9cafc3;
    --ink: #142033;
    --surface: #f8fafc;
    --surface-2: #ffffff;
    --line: #dfe6ee;
    --field: #ffffff;
    --toolbar: #657387;
    --soft: #718096;
}

    :root[data-theme='dark'] {
        --surface: #101b2a;
        --surface-2: #162438;
        --ink: #f3f7fb;
        --line: #2c4058;
        --field: #122236;
        --toolbar: #b6c4d4;
        --soft: #9cafc3;
    }

* {
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--navy-950);
}

.login-page {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0,1.08fr) minmax(420px,.92fr);
    width: 100vw;
    min-height: 100vh;
    margin-left: calc(50% - 50vw);
    overflow: hidden;
    background: var(--navy-950);
}

.login-showcase {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: clamp(38px,6vw,88px);
    overflow: hidden;
    background: radial-gradient(circle at 15% 20%,rgba(20,121,255,.18),transparent 30%),linear-gradient(145deg,rgba(10,25,42,.98),rgba(6,17,31,.99));
}

    .login-showcase::before, .login-showcase::after {
        content: '';
        position: absolute;
        z-index: -1;
        width: 440px;
        height: 440px;
        border: 1px solid rgba(45,156,255,.14);
        border-radius: 50%;
        pointer-events: none;
    }

    .login-showcase::before {
        top: -190px;
        left: -150px;
        box-shadow: 0 0 0 55px rgba(20,121,255,.025),0 0 0 110px rgba(20,121,255,.02);
    }

    .login-showcase::after {
        right: -250px;
        bottom: -280px;
        width: 620px;
        height: 620px;
        border-color: rgba(213,168,74,.12);
    }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: max-content;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.brand-logo {
    display: block;
    width: auto;
    max-width: 180px;
    max-height: 58px;
    object-fit: contain;
}

.brand-fallback {
    display: block;
    color: var(--text);
}

    .brand-fallback small {
        display: block;
        margin-top: 4px;
        color: var(--muted);
        font-size: 10px;
        font-weight: 500;
        letter-spacing: .04em;
        text-transform: none;
    }

.showcase-content {
    max-width: 600px;
    margin: auto 0;
}

.eyebrow {
    margin: 0 0 18px;
    color: var(--gold);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.showcase-content h1 {
    max-width: 570px;
    margin: 0;
    color: #fff;
    font-size: clamp(36px,5vw,68px);
    line-height: 1.08;
    letter-spacing: -.045em;
}

    .showcase-content h1 em {
        color: var(--blue-light);
        font-style: normal;
    }

.showcase-content p:not(.eyebrow) {
    max-width: 510px;
    margin: 24px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.8;
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 12px 18px;
    max-width: 520px;
    margin: 34px 0 0;
    padding: 0;
    list-style: none;
    color: #d9e6f2;
    font-size: 13px;
}

    .feature-list li::before {
        content: '✓';
        display: inline-grid;
        width: 21px;
        height: 21px;
        margin-right: 8px;
        place-items: center;
        border: 1px solid rgba(213,168,74,.45);
        border-radius: 50%;
        color: var(--gold);
        font-size: 11px;
    }

.showcase-footer {
    display: flex;
    gap: 28px;
    color: #6f8499;
    font-size: 12px;
}

.login-form-panel {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 48px clamp(28px,6vw,90px);
    background: var(--surface);
    color: var(--ink);
    transition: background .25s,color .25s;
}

.login-card {
    width: min(100%,390px);
}

.login-toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-bottom: clamp(48px,10vh,110px);
}

.toolbar-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--toolbar);
    background: transparent;
    font: inherit;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s,border-color .2s,color .2s;
}

    .toolbar-button:hover {
        border-color: var(--blue);
        color: var(--blue);
        background: rgba(20,121,255,.07);
    }

.theme-icon {
    font-size: 16px;
    line-height: 1;
}

.theme-icon-dark {
    display: none;
}

:root[data-theme='dark'] .theme-icon-light {
    display: none;
}

:root[data-theme='dark'] .theme-icon-dark {
    display: inline;
}

.login-kicker {
    margin: 0 0 12px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.login-card h2 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(30px,4vw,42px);
    letter-spacing: -.045em;
}

.login-subtitle {
    margin: 12px 0 34px;
    color: var(--soft);
    font-size: 14px;
    line-height: 1.6;
}

.form-group {
    margin-bottom: 19px !important;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--soft);
    font-size: 13px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    border: 1px solid var(--line) !important;
    border-radius: 10px !important;
    outline: none;
    background: var(--field) !important;
    color: var(--ink) !important;
    box-shadow: none !important;
    transition: border-color .2s,box-shadow .2s;
}

    .form-control:focus {
        border-color: var(--blue) !important;
        box-shadow: 0 0 0 4px rgba(20,121,255,.12) !important;
    }

.input-group .form-control {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.password-toggle {
    min-width: 52px;
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 10px 10px 0;
    color: var(--toolbar);
    background: var(--field);
}

    .password-toggle:hover {
        color: var(--blue);
    }

.text-danger, .field-validation-error {
    display: block;
    margin-top: 6px;
    font-size: 12px;
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 26px;
    color: var(--soft);
    font-size: 12px;
}

    .login-options .form-check {
        margin: 0;
    }

    .login-options .form-check-label {
        color: var(--soft);
    }

    .login-options input {
        accent-color: var(--blue);
    }

.forgot-link {
    color: var(--blue);
    text-decoration: none;
}

    .forgot-link:hover {
        text-decoration: underline;
    }

.login-actions {
    display: grid;
    gap: 10px;
}

.login-submit {
    width: 100%;
    min-height: 52px;
    border: 0 !important;
    border-radius: 10px !important;
    color: #fff !important;
    background: linear-gradient(135deg,#167cfb,#0864d7) !important;
    font-weight: 700;
    box-shadow: 0 12px 25px rgba(20,121,255,.22);
    transition: transform .2s,filter .2s,box-shadow .2s;
}

    .login-submit:hover {
        transform: translateY(-2px);
        filter: brightness(1.06);
        box-shadow: 0 16px 30px rgba(20,121,255,.28);
    }

.login-cancel {
    min-height: 48px;
    border-radius: 10px !important;
}

.login-note {
    margin: 28px 0 0;
    color: var(--soft);
    font-size: 11px;
    line-height: 1.7;
    text-align: center;
}

.external-login {
    margin-top: 28px;
}

    .external-login h5 {
        color: var(--ink);
        font-size: 14px;
    }

.provider-button {
    margin: 4px;
    border-radius: 9px;
}

[dir='rtl'] .login-page {
    margin-right: calc(50% - 50vw);
    margin-left: 0;
}

[dir='rtl'] .showcase-content, [dir='rtl'] .login-form-panel {
    text-align: right;
}

[dir='rtl'] .login-toolbar {
    justify-content: flex-start;
}

[dir='rtl'] .feature-list li::before {
    margin-right: 0;
    margin-left: 8px;
}

[dir='rtl'] .input-group .form-control {
    border-radius: 0 10px 10px 0 !important;
}

[dir='rtl'] .password-toggle {
    border-right: 0;
    border-left: 1px solid var(--line);
    border-radius: 10px 0 0 10px;
}

@media (max-width:900px) {
    .login-page {
        display: block;
        width: 100%;
        margin-left: 0;
    }

    [dir='rtl'] .login-page {
        margin-right: 0;
    }

    .login-showcase {
        min-height: auto;
        padding: 32px 24px 42px;
    }

    .showcase-content {
        margin-top: 74px;
    }

        .showcase-content h1 {
            font-size: clamp(36px,10vw,58px);
        }

    .showcase-footer {
        margin-top: 48px;
    }

    .login-form-panel {
        min-height: auto;
        padding: 52px 24px 70px;
    }

    .login-toolbar {
        margin-bottom: 56px;
    }
}

@media (max-width:430px) {
    .feature-list {
        grid-template-columns: 1fr;
    }

    .login-options {
        align-items: flex-start;
        flex-direction: column;
    }

    .toolbar-label {
        display: none;
    }
}


/* =========================================================
   إزالة رأس ABP الافتراضي في صفحة الدخول المخصصة فقط
   GetAccountLayout() يضيف هذه العناصر قبل .login-page:
   .lpx-logo-container + card + language dropdown
   ========================================================= */
body:has(.login-page) .lpx-logo-container,
body:has(.login-page) .lpx-content > .container > .row > [class*='col-'] > .card {
    display: none !important;
}

/* إزالة الفراغات والحاويات التي كان يضيفها AccountLayout */
body:has(.login-page) .lpx-scroll-container,
body:has(.login-page) #lpx-wrapper,
body:has(.login-page) .lpx-content-container,
body:has(.login-page) .lpx-content,
body:has(.login-page) .lpx-content > .container,
body:has(.login-page) .lpx-content > .container > .row,
body:has(.login-page) .lpx-content > .container > .row > [class*='col-'] {
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

body:has(.login-page) .lpx-content {
    overflow: visible !important;
}

body:has(.login-page) .login-page {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
}

/* حل احتياطي للمتصفحات التي لا تدعم :has */
body.abp-account-layout:has(.login-page) {
    padding-top: 0 !important;
}


/* قائمة اللغة الفعلية */
.language-menu {
    position: relative;
}

.language-dropdown {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    min-width: 145px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    box-shadow: 0 14px 35px rgba(0, 0, 0, .16);
}

    .language-dropdown.is-open {
        display: grid;
    }

.language-option {
    display: block;
    padding: 9px 10px;
    border-radius: 7px;
    color: var(--ink);
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
}

    .language-option:hover,
    .language-option.active {
        color: var(--blue);
        background: rgba(20, 121, 255, .1);
    }

[dir='rtl'] .language-dropdown {
    right: auto;
    left: 0;
}


/* تمركز محتوى لوحة الـ ERP */
.login-showcase {
    position: relative;
    justify-content: center;
    align-items: center;
    text-align: center;
}

    .login-showcase .brand {
        position: absolute;
        top: clamp(28px, 5vw, 70px);
        right: clamp(28px, 5vw, 70px);
        left: clamp(28px, 5vw, 70px);
        justify-content: center;
    }

    .login-showcase .showcase-content {
        width: min(100%, 760px);
        margin: 0 auto;
    }

        .login-showcase .showcase-content p:not(.eyebrow) {
            margin-right: auto;
            margin-left: auto;
        }

    .login-showcase .feature-list {
        margin-right: auto;
        margin-left: auto;
        text-align: start;
    }

    .login-showcase .showcase-footer {
        position: absolute;
        right: clamp(28px, 5vw, 70px);
        bottom: clamp(25px, 4vw, 55px);
        left: clamp(28px, 5vw, 70px);
        justify-content: center;
    }

@media (max-width: 900px) {
    .login-showcase {
        align-items: stretch;
        text-align: center;
    }

        .login-showcase .brand {
            position: static;
            margin-bottom: 34px;
        }

        .login-showcase .showcase-content {
            margin: auto;
        }

        .login-showcase .showcase-footer {
            position: static;
            margin-top: 42px;
        }
}


/* وضع اللوجو في المنتصف فوق محتوى الـ ERP */
.login-showcase .brand {
    position: static;
    align-self: center;
    margin: 0 auto 34px;
    justify-content: center;
}

.login-showcase .brand-logo {
    width: 190px;
    height: 95px;
    max-width: 100%;
    max-height: none;
    object-fit: contain;
    object-position: center;
}

@media (max-width: 900px) {
    .login-showcase .brand {
        margin: 0 auto 34px;
    }
}


/* تنسيق لوحة ERP حسب التصميم المرجعي */
.login-showcase .brand {
    margin-bottom: 12px;
}

.login-showcase .showcase-content {
    width: min(100%, 930px);
    max-width: none;
    margin: 0 auto;
}

.login-showcase .eyebrow {
    margin: 0 auto 22px;
    text-align: center;
    white-space: nowrap;
}

.login-showcase .showcase-content h1 {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    font-size: clamp(34px, 4.35vw, 66px);
    line-height: 1.08;
    text-align: center;
    white-space: nowrap;
}

    .login-showcase .showcase-content h1 .title-line {
        display: block;
        white-space: nowrap;
    }

.login-showcase .showcase-content p:not(.eyebrow) {
    max-width: 680px;
    margin: 26px auto 0;
    text-align: center;
}

.login-showcase .feature-list {
    width: min(100%, 610px);
    margin: 32px auto 0;
}

@media (max-width: 900px) {
    .login-showcase .showcase-content h1 {
        font-size: clamp(34px, 8vw, 58px);
    }
}

@media (max-width: 620px) {
    .login-showcase .eyebrow,
    .login-showcase .showcase-content h1 .title-line {
        white-space: normal;
    }
}


/* إصلاح خلفية حقول الدخول عند استخدام Autofill من المتصفح */
.login-form,
.login-form input,
.login-form .form-control {
    color-scheme: light;
}

    .login-form input.form-control,
    .login-form input.form-control:focus,
    .login-form input.form-control:hover {
        background-color: #ffffff !important;
        color: #142033 !important;
        -webkit-text-fill-color: #142033 !important;
    }

        .login-form input.form-control:-webkit-autofill,
        .login-form input.form-control:-webkit-autofill:hover,
        .login-form input.form-control:-webkit-autofill:focus,
        .login-form input.form-control:-webkit-autofill:active {
            border: 1px solid var(--line) !important;
            -webkit-text-fill-color: #142033 !important;
            -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
            box-shadow: 0 0 0 1000px #ffffff inset !important;
            background-color: #ffffff !important;
            caret-color: #142033 !important;
        }

        .login-form input.form-control:-moz-autofill {
            background-color: #ffffff !important;
            color: #142033 !important;
        }

:root[data-theme='dark'] .login-form,
:root[data-theme='dark'] .login-form input,
:root[data-theme='dark'] .login-form .form-control {
    color-scheme: dark;
}

    :root[data-theme='dark'] .login-form input.form-control,
    :root[data-theme='dark'] .login-form input.form-control:focus,
    :root[data-theme='dark'] .login-form input.form-control:hover {
        background-color: #122236 !important;
        color: #f3f7fb !important;
        -webkit-text-fill-color: #f3f7fb !important;
    }

        :root[data-theme='dark'] .login-form input.form-control:-webkit-autofill,
        :root[data-theme='dark'] .login-form input.form-control:-webkit-autofill:hover,
        :root[data-theme='dark'] .login-form input.form-control:-webkit-autofill:focus,
        :root[data-theme='dark'] .login-form input.form-control:-webkit-autofill:active {
            -webkit-text-fill-color: #f3f7fb !important;
            -webkit-box-shadow: 0 0 0 1000px #122236 inset !important;
            box-shadow: 0 0 0 1000px #122236 inset !important;
            background-color: #122236 !important;
            caret-color: #f3f7fb !important;
        }
