/* ============================
   Value CRM — auth shell
   Sign-in, 2FA, password reset, first-login gates
   ============================

   The split layout (form left, brand photo right) that the Wholesaler Portal,
   Viterra and CMMS sign-in pages share, in Value green. Class names stay
   vw-auth-* so Account views port between the four apps unchanged. Tokens
   mirror crm.css. Linked by _AuthLayout.cshtml and by the standalone
   AcceptTerms page. Sits on Bootstrap 4 (form-control, spinner-border).
   ============================ */

:root {
    --vw-font-display: 'Fraunces', 'Iowan Old Style', Cambria, Georgia, serif;
    --vw-font-body:    'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI Variable', 'Segoe UI', sans-serif;

    --vw-text:        #16325c;   /* primary navy */
    --vw-text-strong: #0e2240;   /* headings, labels */
    --vw-text-muted:  #5e6b7c;   /* secondary copy */

    --vw-surface-sidebar: #fbfaf5;   /* warm cream */
    --vw-surface-content: #ffffff;
    --vw-border:          #e2e0d8;

    --vw-brand:        #2a8f2d;   /* Value green */
    --vw-brand-strong: #1f6f22;
    --vw-brand-bg:     #f1f8ed;

    --vw-danger:      #ea001e;
    --vw-danger-bg:   #fdeff1;
    --vw-danger-text: #a3102a;
    --vw-success-bg:  #edf7ea;
}

html, body { height: 100%; }

body.vw-auth-body {
    margin: 0;
    font-family: var(--vw-font-body);
    color: var(--vw-text);
    background-color: var(--vw-surface-sidebar);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.vw-auth-split {
    display: flex;
    min-height: 100vh;
}

/* ── Left: the form pane ─────────────────────────────────────────────── */
/* Form 5/12, brand 7/12 — the proportions the old ERP login used. */
.vw-auth-left {
    flex: 0 0 41.667%;
    max-width: 41.667%;
    min-width: 420px;
    display: flex;
    flex-direction: column;
    padding: 2.5rem 2rem;
    /* Cream with two very soft green glows — depth without decoration. */
    background-color: var(--vw-surface-sidebar);
    background-image:
        radial-gradient(30rem 22rem at 0% -8%, rgba(42, 143, 45, 0.07), transparent 60%),
        radial-gradient(32rem 24rem at 110% 112%, rgba(42, 143, 45, 0.09), transparent 60%);
}

.vw-auth-panel {
    width: 100%;
    max-width: 460px;
    /* Auto margins center the panel yet still let a tall form (Register) scroll
       from the top; the bottom padding lifts it a touch above true center. */
    margin: auto;
    padding-bottom: 6vh;
}

/* Brand lockup — logo + the product word, shared with the Portal and CMMS. */
.vw-auth-brand {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.4rem;   /* this logo's artwork carries whitespace on its right edge */
    margin-bottom: 1.4rem;
}
.vw-auth-brand img { height: 58px; width: auto; }
/* Sized to read as a peer of the "Value" wordmark, not a caption under it. */
.vw-auth-brand .vw-auth-brand-word {
    font-family: var(--vw-font-display);
    font-weight: 600;
    font-size: 2.5rem;
    line-height: 1;
    color: var(--vw-brand-strong);
    margin-bottom: -1px;   /* drops the word slightly below the logo's baseline */
}

/* The card every auth page renders into. */
.vw-auth-card {
    background: var(--vw-surface-content);
    border: 1px solid var(--vw-border);
    border-top: 3px solid var(--vw-brand);
    border-radius: 16px;
    padding: 2rem 2rem 1.75rem;
    box-shadow: 0 14px 40px rgba(22, 50, 92, 0.08);
}

.vw-auth-title {
    font-family: var(--vw-font-display);
    font-weight: 600;
    font-size: 1.45rem;
    line-height: 1.2;
    color: var(--vw-text-strong);
    margin: 0 0 0.35rem;
}
.vw-auth-sub {
    color: var(--vw-text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1.4rem;
}
.vw-auth-sub strong { color: var(--vw-text-strong); font-weight: 600; }

/* ── Form controls ───────────────────────────────────────────────────── */
.vw-auth-card .form-label {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--vw-text-strong);
    margin-bottom: 0.3rem;
}
/* Label with a right-aligned helper link ("Forgot password?"). */
.vw-auth-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.3rem;
}
.vw-auth-label-row .form-label { margin-bottom: 0; }

.vw-auth-card .form-control {
    height: auto;
    border-color: var(--vw-border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: var(--vw-text);
    font-family: inherit;
}
.vw-auth-card .form-control:focus {
    border-color: var(--vw-brand);
    box-shadow: 0 0 0 0.2rem rgba(42, 143, 45, 0.15);
}
.vw-auth-card .form-control.input-validation-error { border-color: var(--vw-danger); }

/* One-time codes: big, spaced digits. */
.vw-auth-card .vw-auth-code {
    font-size: 1.35rem;
    letter-spacing: 0.3em;
    text-align: center;
    font-variant-numeric: tabular-nums;
    padding: 0.55rem 0.75rem;
}
.vw-auth-card .vw-auth-code::placeholder { color: #c3c9d3; }

.vw-auth-card .form-check-input:checked {
    background-color: var(--vw-brand);
    border-color: var(--vw-brand);
}
.vw-auth-card .form-check-input:focus {
    border-color: var(--vw-brand);
    box-shadow: 0 0 0 0.2rem rgba(42, 143, 45, 0.15);
}
.vw-auth-card .form-check-label { font-size: 0.9rem; }
.vw-auth-card .form-text { font-size: 0.8rem; color: var(--vw-text-muted); }

.vw-auth-card .text-danger { color: var(--vw-danger) !important; }
.vw-auth-card .field-validation-error { display: block; margin-top: 0.25rem; }

/* Inline status box — server errors (TempData, ModelState summary) and AJAX
   failures land here, next to the form, instead of in a toast. */
.vw-auth-alert {
    background: var(--vw-danger-bg);
    border: 1px solid rgba(234, 0, 30, 0.16);
    border-left: 3px solid var(--vw-danger);
    border-radius: 8px;
    color: var(--vw-danger-text);
    font-size: 0.85rem;
    line-height: 1.45;
    padding: 0.6rem 0.8rem;
    margin-bottom: 1rem;
}
.vw-auth-alert.is-success {
    background: var(--vw-success-bg);
    border-color: rgba(42, 143, 45, 0.25);
    border-left-color: var(--vw-brand);
    color: var(--vw-brand-strong);
}
.vw-auth-alert[hidden],
.vw-auth-alert.validation-summary-valid { display: none; }
/* asp-validation-summary renders a <ul>; show it as plain lines. */
.vw-auth-alert ul { list-style: none; margin: 0; padding: 0; }
.vw-auth-alert li + li { margin-top: 0.25rem; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.vw-auth-btn {
    display: block;
    width: 100%;
    background: var(--vw-brand);
    border: 1px solid var(--vw-brand);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.5;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    text-align: center;
    transition: background-color 120ms ease, border-color 120ms ease;
}
.vw-auth-btn:hover, .vw-auth-btn:focus {
    background: var(--vw-brand-strong);
    border-color: var(--vw-brand-strong);
    color: #fff;
    text-decoration: none;
}
.vw-auth-btn:focus { outline: none; box-shadow: 0 0 0 0.2rem rgba(42, 143, 45, 0.25); }

/* Secondary (outlined) action — "Back to sign in" and friends. */
.vw-auth-btn-outline {
    display: block;
    width: 100%;
    background: transparent;
    border: 1px solid var(--vw-brand);
    color: var(--vw-brand);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.5;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    text-align: center;
    transition: background-color 120ms ease, color 120ms ease;
}
.vw-auth-btn-outline:hover, .vw-auth-btn-outline:focus {
    background: var(--vw-brand-bg);
    color: var(--vw-brand-strong);
    text-decoration: none;
}
.vw-auth-btn-outline:focus { outline: none; box-shadow: 0 0 0 0.2rem rgba(42, 143, 45, 0.2); }

/* Third-party sign-in (Microsoft) — quiet white button so the green one stays primary. */
.vw-auth-btn-sso {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: #fff;
    border: 1px solid var(--vw-border);
    color: var(--vw-text);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.5;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    transition: background-color 120ms ease, border-color 120ms ease;
}
.vw-auth-btn-sso:hover, .vw-auth-btn-sso:focus {
    background: var(--vw-surface-sidebar);
    border-color: #cfcdc4;
    color: var(--vw-text-strong);
}
.vw-auth-btn-sso:focus { outline: none; box-shadow: 0 0 0 0.2rem rgba(22, 50, 92, 0.12); }
.vw-auth-btn-sso svg { flex: none; }

.vw-auth-btn:disabled,
.vw-auth-btn-outline:disabled,
.vw-auth-btn-sso:disabled { opacity: 0.65; cursor: not-allowed; }

.vw-auth-spin { margin-right: 0.5rem; vertical-align: -0.125em; }

/* "or" between the password form and the SSO button. */
.vw-auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.1rem 0;
    color: var(--vw-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.vw-auth-divider::before, .vw-auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--vw-border);
}

/* ── Links & hints ───────────────────────────────────────────────────── */
.vw-auth-card a {
    color: var(--vw-brand-strong);
    font-weight: 600;
    text-decoration: none;
}
.vw-auth-card a:hover, .vw-auth-card a:focus { color: var(--vw-brand); text-decoration: underline; }
.vw-auth-link { font-size: 0.83rem; }

.vw-auth-hint {
    text-align: center;
    font-size: 0.83rem;
    line-height: 1.5;
    color: var(--vw-text-muted);
    margin: 1rem 0 0;
}
.vw-auth-hint + .vw-auth-hint { margin-top: 0.4rem; }

/* ── Right: the brand photo pane ─────────────────────────────────────── */
/* Same product shot as the Portal and CMMS logins. Sticky so it stays put
   while a tall form pane scrolls. */
.vw-auth-right {
    flex: 1;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    background: url('/images/Login_bg/dvalue.jpg') center / cover no-repeat;
}
.vw-auth-right::after {
    content: '';
    position: absolute;
    inset: 0;
    /* Navy scrim, heavier at the bottom for the caption — verbatim from the
       Wholesaler Portal's shell so the login pages match. */
    background: linear-gradient(to top,
                rgba(14, 34, 64, 0.72) 0%,
                rgba(14, 34, 64, 0.28) 38%,
                rgba(14, 34, 64, 0.10) 100%);
    z-index: 2;
}

.vw-auth-hero {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 3rem 3.5rem 2.6rem;
}
.vw-auth-hero-title {
    font-family: var(--vw-font-display);
    font-weight: 600;
    font-size: 2.4rem;
    line-height: 1.15;
    color: #fff;
}
.vw-auth-hero-sub {
    color: rgba(255, 255, 255, 0.78);
    font-size: 1rem;
    margin-top: 0.4rem;
}

@media (max-width: 991.98px) {
    /* Brand pane folds away; the form pane becomes the whole page. */
    .vw-auth-right { display: none; }
    .vw-auth-left { flex: 1; max-width: none; min-width: 0; }
}
@media (max-width: 480px) {
    .vw-auth-card { padding: 1.5rem 1.25rem; }
    .vw-auth-left { padding: 1.5rem 1rem; }
}

/* Big monitors: the 460px panel reads tiny in all that space — zoom the whole
   form section (brand + card) so it keeps the laptop-screen proportions. */
@media (min-width: 2200px) { .vw-auth-panel { zoom: 1.3; } }
@media (min-width: 3200px) { .vw-auth-panel { zoom: 1.7; } }

@media (prefers-reduced-motion: reduce) {
    .vw-auth-body * { transition: none !important; }
}
