/*
 * Dedicated styles for the /loginv2 page only.
 * Scoped under .login-v2-page so nothing here leaks into /login, /register,
 * the dashboard, or any other page.
 */
.login-v2-page,
.login-v2-page * {
    box-sizing: border-box;
}

.login-v2-page {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 24px;
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: url('../images/auth-bg.png') center/cover no-repeat;
}

/* position:fixed (not absolute): these decorative shapes are large and
 * deliberately positioned mostly off-screen, clipped by this page's own
 * overflow:hidden. .login-v2-page fills the viewport exactly (width:100%,
 * min-height:100vh), so fixed vs. absolute renders pixel-identical here —
 * but unlike absolute, a fixed-position element is excluded from its
 * ancestor's scrollable-overflow calculation entirely, which is the actual
 * root cause of document.documentElement/body.scrollWidth exceeding the
 * viewport on this page at every width (mobile AND desktop): overflow:hidden
 * stops it from ever being visibly/functionally scrollable, but an absolutely
 * positioned box's full extent — including the part sitting off-screen at a
 * negative inset — still counts toward scrollWidth regardless of clipping. */
.login-v2-page:before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: url('../images/filter-bg.png') center/cover no-repeat;
    opacity: .2;
}

.login-v2-page:after {
    content: none;
}

.login-v2-card {
    width: 480px;
    max-width: 100%;
    background: #fff;
    border-radius: 30px;
    padding: 30px 24px 24px;
    position: relative;
    z-index: 2;
    box-shadow: 0 25px 60px rgba(0, 36, 120, .20);
}

.login-v2-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    color: #0759df;
}

.login-v2-logo img {
    max-height: 32px;
    width: auto;
}

.login-v2-card h1 {
    color: #464c5a;
    font-size: 38px;
    line-height: 1.3;
    font-weight: 900;
    -webkit-text-stroke: 1.4px currentColor;
    margin-bottom: 26px;
}

.login-v2-alert {
    background: #fff3cd;
    border: 1px solid #ffe69c;
    color: #664d03;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 14px;
    margin-bottom: 20px;
}

.login-v2-field {
    margin-bottom: 22px;
}

.login-v2-field label {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #4b4f59;
    margin-bottom: 8px;
}

.login-v2-input-wrapper {
    position: relative;
}

.login-v2-input-wrapper input {
    width: 100%;
    height: 48px;
    border: 1px solid #c9d4e6;
    border-radius: 28px;
    background: #fff;
    color: #4b5563;
    font-size: 16px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.login-v2-input-wrapper input:focus {
    border-color: #1764e8;
    box-shadow: 0 0 0 3px rgba(23, 100, 232, .10);
}

.login-v2-input-wrapper input::placeholder {
    color: #8a94a6;
}

/* This page is Arabic/RTL-only: the START of an RTL input is its RIGHT
   edge, so the decorative icon (envelope / lock) sits there — physically
   right, never logical, so it can never flip. */
#loginv2-email {
    padding-right: 48px;
    padding-left: 20px;
}

/* Password needs clearance on both physical edges: the lock on the right
   (start) and the eye toggle on the left (end). */
#loginv2-password {
    padding-right: 48px;
    padding-left: 45px;
}

.login-v2-input-icon {
    position: absolute;
    right: 17px;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    color: #52627a;
    font-size: 16px;
    pointer-events: none;
}

/* Password visibility toggle — fixed physical left edge (the END of
   this RTL page's inputs). */
.login-v2-password-toggle {
    position: absolute;
    left: 11px;
    right: auto;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #8a97ad;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    line-height: 1;
}

.login-v2-password-toggle:hover {
    color: #52627a;
}

.login-v2-error {
    color: #dc3545;
    font-size: 13px;
    font-weight: 600;
    margin-top: 6px;
    margin-bottom: 0;
}

.login-v2-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 600;
    color: #4b4f59;
}

.login-v2-remember input {
    width: 16px;
    height: 16px;
    accent-color: #0860ff;
}

.login-v2-forgot {
    margin-top: -8px;
    margin-bottom: 28px;
    text-align: end;
}

.login-v2-forgot a {
    color: #465061;
    font-size: 14px;
    text-decoration: underline;
    font-weight: 600;
}

.login-v2-options {
    display: contents;
}

.login-v2-btn {
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 28px;
    background: #0860ff;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: .2s;
}

.login-v2-btn:hover {
    background: #0758ed;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(8, 96, 255, .25);
}

.login-v2-btn i {
    font-size: 15px;
}

.login-v2-register {
    text-align: center;
    margin-top: 25px;
    color: #515866;
    font-size: 15px;
    font-weight: 600;
}

.login-v2-register a {
    color: #0759df;
    font-weight: 800;
    text-decoration: underline;
}

.login-v2-admin-entry {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e3e9f2;
    color: #515866;
    font-size: 14px;
    font-weight: 600;
}

.login-v2-admin-entry a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #0759df;
    font-weight: 800;
    text-decoration: none;
}

.login-v2-admin-entry a:hover {
    color: #0649b9;
    text-decoration: underline;
}

/* Dedicated admin authentication layout. The normal /loginv2 page keeps
   every rule above unchanged; these rules only apply to /admin/login. */
.admin-login-page {
    display: block;
    overflow: auto;
    padding: 0;
    background: #fff;
}

.admin-login-page::before,
.admin-login-page::after {
    content: none;
}

.admin-login-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0 auto;
    padding: 32px;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: clamp(32px, 5vw, 72px);
    direction: ltr;
}

.admin-login-visual {
    position: relative;
    width: 100%;
    height: calc(100vh - 64px);
    max-width: none;
    aspect-ratio: 728 / 966;
    justify-self: start;
    overflow: hidden;
    border-radius: 28px;
}

.admin-login-visual-bg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.admin-login-visual-logo {
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 51%;
    width: clamp(180px, 46%, 250px);
    height: auto;
    transform: translate(-50%, -50%);
    filter: brightness(0) invert(1);
}

.admin-login-page .login-v2-card {
    width: 100%;
    max-width: 520px;
    justify-self: end;
    padding: 30px 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    direction: rtl;
}

.admin-login-mobile-logo {
    display: none;
}

.admin-login-page .login-v2-card h1 {
    margin: 0 0 8px;
    color: #0057ff;
    font-size: clamp(28px, 2.4vw, 34px);
    font-weight: 800;
    line-height: 1.25;
    -webkit-text-stroke: 0;
}

.admin-login-subtitle {
    margin: 0 0 28px;
    color: #45464d;
    font-size: 15px;
    line-height: 1.8;
}

.admin-login-page .login-v2-field {
    margin-bottom: 18px;
}

.admin-login-page .login-v2-field label {
    color: #45464d;
    font-size: 14px;
    font-weight: 600;
}

.admin-login-page .login-v2-input-wrapper input {
    height: 50px;
    border-color: #d8dde6;
    color: #45464d;
    box-shadow: none;
}

.admin-login-page .login-v2-input-wrapper input:focus {
    border-color: #0057ff;
    box-shadow: 0 0 0 3px rgba(0, 87, 255, .1);
}

.admin-login-page .login-v2-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 2px 0 24px;
}

.admin-login-page .login-v2-remember,
.admin-login-page .login-v2-forgot {
    margin: 0;
}

.admin-login-page .login-v2-forgot a,
.admin-login-page .login-v2-remember {
    color: #45464d;
    font-size: 13px;
}

.admin-login-page .login-v2-btn {
    height: 50px;
    background: linear-gradient(90deg, #263b93 0%, #0057ff 100%);
}

.admin-login-page .login-v2-btn:hover {
    background: linear-gradient(90deg, #1f327f 0%, #004de3 100%);
}

.admin-login-security-note {
    margin: 16px 0 0;
    color: #8a8d96;
    font-size: 13px;
    text-align: center;
}

@media (max-width: 820px) {
    .admin-login-page {
        min-height: 100vh;
        min-height: 100dvh;
        padding: 24px;
        background: linear-gradient(rgba(15, 42, 92, .28), rgba(15, 42, 92, .28)),
            url('../images/admin-auth-bg.png') center/cover no-repeat;
        overflow-x: hidden;
    }

    .admin-login-shell {
        width: 100%;
        min-height: calc(100vh - 48px);
        min-height: calc(100dvh - 48px);
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
    }

    .admin-login-visual {
        display: none;
    }

    .admin-login-page .login-v2-card {
        width: calc(100vw - 48px);
        max-width: 520px;
        min-width: 0;
        flex: 0 1 auto;
        padding: 30px 24px 26px;
        border: 1px solid rgba(255, 255, 255, .82);
        border-radius: 24px;
        background: rgba(255, 255, 255, .94);
        box-shadow: 0 24px 64px rgba(0, 32, 96, .22);
        backdrop-filter: blur(12px);
    }

    .admin-login-mobile-logo {
        display: block;
        margin-bottom: 24px;
    }

    .admin-login-mobile-logo img {
        display: block;
        width: 150px;
        max-width: 45%;
        height: auto;
    }
}

@media (max-width: 480px) {
    .admin-login-page {
        padding: 14px;
    }

    .admin-login-shell {
        min-height: calc(100vh - 28px);
        min-height: calc(100dvh - 28px);
    }

    .admin-login-page .login-v2-card {
        width: calc(100vw - 28px);
        max-width: calc(100vw - 28px);
        padding: 26px 18px 22px;
        border-radius: 20px;
    }

    .admin-login-page .login-v2-card h1 {
        font-size: 27px;
    }

    .admin-login-subtitle {
        font-size: 14px;
        margin-bottom: 22px;
    }
}

@media (max-width:600px) {
    .login-v2-page {
        padding: 20px;
    }

    .login-v2-card {
        width: 100%;
        max-width: 480px;
        border-radius: 25px;
        padding: 25px 20px 22px;
    }

    .login-v2-card h1 {
        font-size: 32px;
        margin-bottom: 22px;
    }

    .login-v2-field {
        margin-bottom: 20px;
    }

    .login-v2-input-wrapper input {
        font-size: 14px;
    }
}

@media (max-width:380px) {
    .login-v2-page {
        padding: 12px;
    }

    .login-v2-card {
        padding: 22px 16px;
    }

    .login-v2-card h1 {
        font-size: 28px;
    }
}

@media (max-width: 600px) {
    .login-v2-page.admin-login-page {
        padding: 14px;
    }
}
