/* ================================================================
   UMS Auth Screens - "split panorama" sign-in
   Photo panel with the logo and product pitch on the left, plain white
   form panel on the right; below 900px the photo stacks on top.
   Scoped entirely to .ums-auth-body so nothing here can leak into
   the application shell. Loaded by ~/Views/Shared/_AuthLayout.cshtml
   AFTER the core style bundle so it wins on specificity ties.

   Everything below is expressed in the framework's --xg-* design
   tokens (Content/css/ums-tokens.css, already in ~/content/core) so
   the sign-in screen reads as the same product as the app behind it.
   The --ua-* names are kept as local aliases: they document intent
   and give every value a literal fallback if the token file ever
   stops loading first.
   ================================================================ */

.ums-auth-body {
    /* Framework palette */
    --ua-primary:          var(--xg-blue,   #2563eb);
    --ua-primary-dark:     var(--xg-blue-d, #1d4ed8);
    --ua-primary-darker:   #1e40af;
    --ua-primary-container:var(--xg-blue-l, #eff6ff);
    --ua-on-primary:       var(--xg-white,  #ffffff);
    --ua-error:            var(--xg-red,    #dc2626);
    --ua-error-container:  var(--xg-red-l,  #fee2e2);
    --ua-on-error-cont:    #991b1b;
    --ua-surface:          var(--xg-white,  #ffffff);
    --ua-surface-dim:      var(--xg-s50,    #f8fafc);
    --ua-on-surface:       var(--xg-s900,   #0f172a);
    --ua-on-surface-str:   var(--xg-s800,   #1e293b);
    --ua-on-surface-lbl:   var(--xg-s700,   #334155);
    --ua-on-surface-var:   var(--xg-s500,   #64748b);
    --ua-on-surface-faint: var(--xg-s400,   #94a3b8);
    --ua-outline:          var(--xg-s400,   #94a3b8);
    --ua-outline-variant:  var(--xg-s200,   #e2e8f0);
    --ua-field:            var(--xg-s100,   #f1f5f9);

    /* Brand accents - the only non-framework colours on the page, all on
       the photo panel, which is identity rather than interface.
       --ua-bg-tint is laid over the greyscale photo; 71% brand blue
       reproduces the MeterX sign-in background. --ua-bg-shade is the navy
       wash on top of that, darkest at the bottom behind the pitch text.
       --ua-brand-bg is the photo's average grey, shown while it loads. */
    --ua-bg-tint:      rgba(0,131,202,.71);
    --ua-bg-shade:     linear-gradient(180deg, rgba(0,27,77,.35) 0%, rgba(0,27,77,.25) 45%, rgba(0,27,77,.78) 100%);
    --ua-brand-bg:     #737373;
    --ua-on-brand:     #ffffff;
    --ua-on-brand-acc: #9adcf5;
    --ua-on-brand-var: #dbeafc;

    --ua-r-sm:   var(--xg-r-sm, 6px);
    --ua-focus:  0 0 0 3px rgba(37,99,235,.15);
}

/* ── Page shell ───────────────────────────────────────────────── */
html.ums-auth-html,
.ums-auth-body { height: 100%; }

.ums-auth-body {
    margin: 0;
    background: var(--ua-surface);
    color: var(--ua-on-surface);
    font-family: var(--xg-font, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

.ums-auth-body *,
.ums-auth-body *::before,
.ums-auth-body *::after { box-sizing: border-box; }

.ums-auth-body :focus-visible { outline: 2px solid var(--ua-primary); outline-offset: 2px; }

/* Two panels side by side; each stretches to the full height. */
.ums-auth-wrap {
    display: flex;
    min-height: 100vh;
    background: var(--ua-surface);
}

/* Photo panel. Logo at the top, pitch at the bottom. */
.ums-auth-brand {
    position: relative;
    flex: 1 1 44%;
    max-width: 620px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    padding: 56px;
    color: var(--ua-on-brand);
    /* Same city-network photo as the MeterX sign-in screen, kept in
       greyscale and tinted by ::before below. The image itself is set
       inline by _AuthLayout via Url.Content: a relative url() here would
       resolve against /content/core when this file is served from the
       bundle. */
    background-color: var(--ua-brand-bg);
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
}

/* Brand-blue tint, with the navy wash on top of it. */
.ums-auth-brand::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: var(--ua-bg-shade), linear-gradient(var(--ua-bg-tint), var(--ua-bg-tint));
    pointer-events: none;
}

.ums-auth-brand > * { position: relative; }

.ums-auth-logo {
    display: block;
    width: 200px;
    height: auto;
}

.ums-auth-pitch {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 460px;
}

.ums-auth-pitch p { margin: 0; }

.ums-auth-pitch-eyebrow {
    font-size: var(--xg-font-lg, 14px);
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ua-on-brand-acc);
}

.ums-auth-pitch-head {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.25;
}

.ums-auth-pitch-sub {
    font-size: var(--xg-font-xl, 16px);
    line-height: 1.6;
    color: var(--ua-on-brand-var);
}

/* Form panel */
.ums-auth-main {
    flex: 1 1 56%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.ums-auth-card {
    width: 100%;
    max-width: 400px;
}

/* ── Form header ──────────────────────────────────────────────── */
.ums-auth-eyebrow {
    margin: 0 0 8px;
    font-size: var(--xg-font-md, 13px);
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ua-on-surface-var);
}

.ums-auth-card .ums-auth-title {
    margin: 0 0 8px;
    /* smartadmin/bootstrap style bare h1-h4 with Open Sans and -1px tracking,
       which beats inheriting the body font. Take it back. */
    font-family: inherit;
    letter-spacing: normal;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--ua-on-surface);
}

.ums-auth-sub {
    margin: 0 0 24px;
    font-size: var(--xg-font-lg, 14px);
    line-height: 1.45;
    color: var(--ua-on-surface-var);
}

.ums-auth-sub strong {
    font-weight: 600;
    color: var(--ua-on-surface-lbl);
}

/* ── Fields ───────────────────────────────────────────────────── */
.ums-auth-field { margin-bottom: 24px; }

.ums-auth-card label {
    display: block;
    margin-bottom: 6px;
    font-size: var(--xg-font-lg, 14px);
    font-weight: 600;
    color: var(--ua-on-surface-str);
}

.ums-auth-card .ums-auth-input {
    display: block;
    width: 100%;
    /* Same recipe as the framework's .ums-input, one size up: 12px is
       right inside a dense grid but not for the one field a tech types
       on a tablet, and anything under 16px makes iOS Safari zoom the
       page on focus. Filled grey until focused. */
    height: 44px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    color: var(--ua-on-surface-str);
    background: var(--ua-field);
    border: 1px solid var(--ua-outline);
    border-radius: var(--ua-r-sm);
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}

.ums-auth-card .ums-auth-input::-webkit-input-placeholder { color: var(--ua-on-surface-faint); }
.ums-auth-card .ums-auth-input::placeholder { color: var(--ua-on-surface-faint); }

.ums-auth-card .ums-auth-input:focus {
    outline: none;
    background: var(--ua-surface);
    border-color: var(--ua-primary);
    box-shadow: var(--ua-focus);
}

/* Select — .ums-auth-input plus the framework's .ums-select chevron. The native
   control is deliberate: it gives the mobile picker on a tablet, and it keeps the
   auth shell free of Kendo's theme CSS, which _Layout links but this one does not. */
.ums-auth-card .ums-auth-select {
    padding-right: 32px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2364748B'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

.ums-auth-card .ums-auth-select::-ms-expand { display: none; }

/* Project search on site selection. The structure and look come from the
   framework's .ums-dropdown (ums-ui.css); these rules bring it up to the
   card's 40px / 16px controls and give the keyboard-highlighted row the
   same fill as the hovered one. */
.ums-auth-card .ums-auth-combo .ums-dropdown-input {
    padding-right: 32px;
    cursor: text;
}

.ums-auth-card .ums-auth-combo .ums-dropdown-caret { width: 32px; }

.ums-auth-card .ums-auth-combo .ums-dropdown-panel {
    max-height: 240px;
    padding: 4px;
    z-index: 5;
}

.ums-auth-card .ums-auth-combo .ums-dropdown-item,
.ums-auth-card .ums-auth-combo .ums-dropdown-empty {
    padding: 8px 10px;
    font-size: var(--xg-font-lg, 14px);
    line-height: 1.4;
    border-radius: 4px;
}

.ums-auth-card .ums-auth-combo .ums-dropdown-item.is-active { background: var(--ua-primary-container); }

/* Matched part of the name while searching */
.ums-auth-card .ums-auth-combo mark {
    padding: 0;
    background: none;
    color: inherit;
    font-weight: 600;
}

/* Password reveal */
.ums-auth-pw { position: relative; }
.ums-auth-pw .ums-auth-input { padding-right: 64px; }

.ums-auth-reveal {
    position: absolute;
    right: 6px;
    top: 6px;
    height: 32px;
    padding: 0 10px;
    border: 0;
    background: transparent;
    color: var(--ua-on-surface-var);
    font-family: inherit;
    font-size: var(--xg-font-sm, 11px);
    font-weight: 600;
    letter-spacing: .3px;
    text-transform: uppercase;
    border-radius: var(--ua-r-sm);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.ums-auth-reveal:hover {
    background: var(--ua-primary-container);
    color: var(--ua-primary);
}

/* ── Row / links / button ─────────────────────────────────────── */
.ums-auth-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin: 0 0 24px;
}

.ums-auth-card a.ums-auth-link {
    color: var(--ua-primary);
    font-size: var(--xg-font-md, 13px);
    font-weight: 500;
    text-decoration: none;
}

.ums-auth-card a.ums-auth-link:hover { text-decoration: underline; }

/* Same recipe as .ums-btn + .ums-btn-primary, sized up to a full-width
   primary action. */
.ums-auth-card .ums-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 0 12px;
    font-family: inherit;
    font-size: var(--xg-font-lg, 14px);
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--ua-r-sm);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}

.ums-auth-card .ums-auth-btn-primary {
    background: var(--ua-primary);
    border-color: var(--ua-primary);
    color: var(--ua-on-primary);
}

.ums-auth-card .ums-auth-btn-primary:hover,
.ums-auth-card .ums-auth-btn-primary:focus {
    background: var(--ua-primary-dark);
    border-color: var(--ua-primary-dark);
    color: var(--ua-on-primary);
}

.ums-auth-card .ums-auth-btn-primary:active {
    background: var(--ua-primary-darker);
    border-color: var(--ua-primary-darker);
}

/* Matches .ums-btn:disabled */
.ums-auth-card .ums-auth-btn:disabled {
    opacity: .5;
    cursor: default;
    pointer-events: none;
}

/* ── Access / copyright note (below the form) ────────────────── */
.ums-auth-note {
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid var(--ua-outline-variant);
    font-size: var(--xg-font-md, 13px);
    line-height: 1.6;
    color: var(--ua-on-surface-var);
}

.ums-auth-note p { margin: 0; }

/* ── Validation ───────────────────────────────────────────────── */
/* Shaped like .ums-callout-danger: tinted fill, 3px accent rule, square
   on the flat edge. */
.ums-auth-card .alert {
    display: block;
    margin: 0 0 20px;
    padding: 10px 12px;
    border: 0;
    border-left: 3px solid var(--ua-error);
    border-radius: 0 var(--ua-r-sm) var(--ua-r-sm) 0;
    background: var(--ua-error-container);
    color: var(--ua-on-error-cont);
    font-size: var(--xg-font-md, 13px);
    font-weight: 500;
    line-height: 1.45;
}

.ums-auth-card .alert ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ums-auth-card .alert li + li { margin-top: 4px; }

.ums-auth-card .alert .close {
    float: right;
    margin-left: 12px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 16px;
    line-height: 1;
    opacity: .6;
    cursor: pointer;
}

.ums-auth-card .alert .close:hover { opacity: 1; }

/* jquery.validate field messages — matches .ums-field-error */
.ums-auth-card label.error {
    margin: 4px 0 0;
    font-size: var(--xg-font-sm, 11px);
    font-weight: 400;
    line-height: 1.4;
    color: var(--ua-error);
}

.ums-auth-card .ums-auth-input.error { border-color: var(--ua-error); }

.ums-auth-card .ums-auth-input.error:focus {
    border-color: var(--ua-error);
    box-shadow: 0 0 0 3px rgba(220,38,38,.15);
}

/* ── Narrow screens: photo stacks on top ──────────────────────── */
@media (max-width: 900px) {
    /* The form is anchored to the bottom of the screen, within thumb reach on
       a tall phone: the photo takes up whatever height is spare. svh = the
       screen height with the browser toolbar shown, so the form's bottom edge
       is never hidden under it; vh is the fallback. */
    .ums-auth-wrap {
        flex-direction: column;
        min-height: 100vh;
        min-height: 100svh;
    }
    .ums-auth-brand {
        flex: 1 0 auto;
        max-width: none;
        min-height: 280px;
        gap: 24px;
        padding: 24px;
    }
    .ums-auth-logo { width: 140px; }
    .ums-auth-pitch-head { font-size: 22px; }
    .ums-auth-pitch-sub { display: none; }
    .ums-auth-main {
        flex: 0 0 auto;
        padding: 28px 24px;
    }
    /* With the form at the bottom there is no room below the project search,
       so its list opens upward over the photo. That is also the part of the
       screen left visible when the on-screen keyboard is up. */
    .ums-auth-card .ums-auth-combo .ums-dropdown-panel {
        top: auto;
        bottom: 100%;
        margin: 0 0 4px;
    }
}

/* Short phones (iPhone SE class): the form alone nearly fills the screen, so
   the photo shrinks to a logo strip rather than push Sign in off the bottom. */
@media (max-width: 900px) and (max-height: 700px) {
    .ums-auth-brand { min-height: 0; }
    .ums-auth-pitch { display: none; }
}

@media (max-width: 480px) {
    /* Finger-sized rows: about 40px each */
    .ums-auth-card .ums-auth-combo .ums-dropdown-item,
    .ums-auth-card .ums-auth-combo .ums-dropdown-empty { padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .ums-auth-body * {
        transition: none !important;
        animation: none !important;
    }
}
