/* ===========================================================
   Login / Authentication screens — Wadi El-Nil visual identity
   Shared by Login.cshtml, LoginWith2fa.cshtml, LoginWithRecoveryCode.cshtml

   Desktop uses the actual reference artwork
   (wwwroot/images/login-hero.png, 1536x1024) as the literal page
   background, at its native aspect ratio, with the real functional
   card absolutely positioned to land exactly on top of the card
   region baked into that image (measured via pixel analysis:
   left 54.23% / top 7.52% / width 41.67% / height 84.86%). This
   reproduces the reference 1:1 rather than approximating it.

   Mobile/tablet (<900px) cannot use the same 3:2 composite
   sensibly (text/inputs would become unusably small), so it falls
   back to a compact real-logo header + stacked card instead.
   =========================================================== */

:root {
    --nile-navy: #14324f;
    --nile-navy-dark: #0d2338;
    --nile-gold: #bd9a52;
    --nile-gold-light: #e4d3a4;
    --nile-cream: #faf6ee;
    --nile-cream-2: #f2e9d8;
    --nile-gray: #8a8f98;
}

* {
    box-sizing: border-box;
}

.validation-summary-valid {
    display: none;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: var(--nile-cream);
    color: var(--nile-navy);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* ================= Desktop stage (reference image as literal background) ================= */

.login-stage {
    position: relative;
    width: 100%;
    max-width: 1536px;
    aspect-ratio: 1536 / 1024;
    background-image: url('/images/login-hero.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
}

.mobile-header {
    display: none;
}

.login-card-overlay {
    position: absolute;
    left: 54.23%;
    top: 7.52%;
    width: 41.67%;
    height: 84.86%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
    border-radius: 1.4vw;
    padding: 3.2% 6%;
    overflow: auto;
}

/* ================= Card content ================= */

.login-card {
    width: 100%;
}

.login-card h2 {
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--nile-navy);
    margin-bottom: 6px;
}

.login-card .login-subheading {
    color: var(--nile-gray);
    margin-bottom: 30px;
    font-size: .95rem;
}

.login-card .card-icon-mobile {
    display: none;
}

/* ================= Form controls ================= */

.form-label {
    font-weight: 600;
    color: var(--nile-navy);
    font-size: .9rem;
    margin-bottom: 6px;
}

.icon-input-group {
    position: relative;
}

.icon-input-group .field-icon {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    color: var(--nile-gray);
    pointer-events: none;
    font-size: 1.05rem;
}

.icon-input-group input.form-control {
    padding-right: 44px;
}

.icon-input-group.has-toggle input.form-control {
    padding-left: 44px;
}

.password-toggle-btn {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--nile-gray);
    padding: 4px 6px;
    cursor: pointer;
    line-height: 1;
    border-radius: 6px;
}

.password-toggle-btn:hover {
    color: var(--nile-navy);
}

.password-toggle-btn:focus-visible,
.form-control:focus-visible {
    outline: 2px solid var(--nile-gold);
    outline-offset: 1px;
}

.form-control {
    height: 50px;
    border-radius: 12px;
    border: 1px solid #e3ddcf;
    background: #fdfcf9;
    font-size: .95rem;
}

.form-control:focus {
    border-color: var(--nile-gold);
    box-shadow: 0 0 0 .2rem rgba(189, 154, 82, .18);
    background: #fff;
}

.form-check-input:checked {
    background-color: var(--nile-navy);
    border-color: var(--nile-navy);
}

.form-check-input:focus {
    box-shadow: 0 0 0 .2rem rgba(189, 154, 82, .25);
}

.form-check-label {
    color: var(--nile-navy);
    font-size: .9rem;
}

.form-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
}

/* ================= Button ================= */

.login-btn {
    height: 52px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    background: var(--nile-navy);
    border: 1px solid var(--nile-navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .15s ease, transform .1s ease;
}

.login-btn:hover:not(:disabled) {
    background: var(--nile-navy-dark);
    color: #fff;
}

.login-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.login-btn:disabled {
    opacity: .85;
    cursor: progress;
}

.login-btn .btn-spinner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ================= Footer / links ================= */

.login-footer {
    margin-top: 28px;
    text-align: center;
    color: var(--nile-gray);
    font-size: 12.5px;
    line-height: 1.8;
}

.login-footer-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 28px;
}

.login-footer-divider::before,
.login-footer-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--nile-gold-light);
}

.login-footer-divider span {
    width: 6px;
    height: 6px;
    background: var(--nile-gold);
    transform: rotate(45deg);
    flex: none;
}

.login-footer a {
    color: var(--nile-navy);
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    color: var(--nile-gold);
    text-decoration: underline;
}

.otp-input {
    letter-spacing: .55rem;
    font-size: 1.5rem;
    text-align: center;
}

/* ================= Responsive fallback (mobile/tablet) =================
   Below 900px the reference's 3:2 composite can't shrink further
   without making the form unusable, so the layout switches to a
   compact real-logo header + stacked card instead of the image stage. */

@media (max-width: 899.98px) {

    .login-page {
        padding: 0;
        display: block;
    }

    .login-stage {
        max-width: none;
        aspect-ratio: auto;
        background-image: none;
    }

    .mobile-header {
        display: block;
        text-align: center;
        background: linear-gradient(180deg, var(--nile-cream) 0%, var(--nile-cream-2) 100%);
        padding: 28px 20px 20px 20px;
    }

    .mobile-header img {
        width: 96px;
        height: auto;
        margin-bottom: 10px;
        filter: drop-shadow(0 8px 18px rgba(20, 50, 79, .12));
    }

    .mobile-header h1 {
        font-size: 1.25rem;
        font-weight: 800;
        color: var(--nile-navy);
        margin: 0 0 4px 0;
    }

    .mobile-header p {
        font-size: .75rem;
        letter-spacing: .1em;
        text-transform: uppercase;
        color: var(--nile-gray);
        margin: 0;
    }

    .login-card-overlay {
        position: static;
        width: 100%;
        height: auto;
        border-radius: 0;
        padding: 28px 20px 40px 20px;
        background: #fff;
    }
}
