﻿/* ============================================================
   Aries Imaging - login / OTP / admin login
   REBUILT: one layout at every width.

   The previous file had a desktop layout (900px two-column table)
   plus a media-query block that tried to undo it with absolute
   positioning. This has no structural media queries at all - the same
   centred card renders on a 320px phone and a 4K monitor, sized with
   clamp(). Nothing to keep in sync, nothing to diverge.

   Works with the EXISTING markup in Login.cshtml, Signin-oidc.cshtml
   and AdminLogin.cshtml - no razor body changes, so nothing that
   login.js / login_otp.js / login_submit.js reference has moved.

   NOTE: this file must be the ONLY copy. Signin-oidc.cshtml and
   AdminLogin.cshtml previously loaded ~/css/app/login/login.css,
   a second copy that never received any of the fixes. Point all three
   pages at ~/css/login.css and delete the other.
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    overflow-x: hidden;
    background: linear-gradient(180deg, #FBFDFE 0%, #ABCDEC 100%) fixed;
    color: #555661;
}

    html:has(.admin) {
        background: linear-gradient(180deg, #4e6d9b 0%, #FBFDFE 100%) fixed;
    }

body {
    margin: 0;
    min-height: 100dvh;
    background: transparent;
    font-family: Roboto, -apple-system, "Segoe UI", sans-serif;
    /* the card is centred by margin:auto rather than align-items, so a
       card taller than the viewport scrolls instead of being clipped */
    display: flex;
    padding: clamp(8px, 2vh, 28px) 12px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ------------------------------------------------------------
   The card
   ------------------------------------------------------------ */

.panel {
    margin: auto;
    width: 100%;
    max-width: 460px;
    background: #FFFFFF;
    border-radius: 10px;
    box-shadow: 0px 30px 90px rgba(19, 88, 138, 0.12);
    padding: clamp(16px, 3vh, 30px);
    text-align: center;
}

    /* Flatten the table scaffolding at every width. The outer table's row
   is column-reverse so the logo (second cell in source) sits above the
   form without touching the markup. */
    .panel > table,
    .panel > table > tbody {
        display: block;
        width: 100%;
    }

        .panel > table > tbody > tr {
            display: flex;
            flex-direction: column-reverse;
            width: 100%;
        }

            .panel > table > tbody > tr > td {
                display: block;
                width: 100%;
            }

    /* the inner table holds the Login button and the help links */
    .panel form table,
    .panel form tbody,
    .panel form tr,
    .panel form td {
        display: block;
        width: 100%;
    }

    /* <br> is the markup's vertical rhythm; margins below replace it */
    .panel br {
        display: none;
    }

/* ------------------------------------------------------------
   Logo / title
   ------------------------------------------------------------ */

.loginlogo {
    text-align: center;
}

    /* max-height in vh lets the art shrink on a short screen (667px
       phone, or landscape) so the card fits without a scrollbar - no
       media query needed, both maxima constrain proportionally. */
    .loginlogo img {
        display: block;
        width: auto;
        max-width: min(230px, 65%);
        max-height: 16vh;
        height: auto;
        margin: 0 auto clamp(4px, 1.2vh, 12px);
        padding: 0;
    }

.title {
    padding: 0;
    margin: 0 0 clamp(10px, 2.2vh, 20px);
    color: #1A1F4D;
    font-weight: 500;
}

    /* original sizes, unchanged */
    .title .header {
        font-size: 28px;
        font-weight: bold;
        line-height: 1.2;
    }

    .title .message {
        font-size: 22px;
        font-weight: 400;
        line-height: 1.3;
        margin-top: 4px;
    }

/* ------------------------------------------------------------
   Fields
   ------------------------------------------------------------ */

form {
    margin: 0;
    color: #555661;
}

.panel form > div {
    text-align: left;
}

label {
    display: block;
    font-family: Roboto;
    font-weight: normal;
    font-size: 18px;
    line-height: 16px;
    color: #555661;
    margin: 0 0 8px;
}

input,
input:-webkit-autofill,
input:-webkit-autofill:focus {
    width: 100%;
    height: 48px;
    background: #F9F9FA;
    border: 1px solid #E7EAF0;
    border-radius: 5px;
    padding: 0 12px;
    margin: 0 0 clamp(8px, 1.6vh, 16px);
    /* original 18px, which is also above the 16px threshold below which
       iOS Safari zooms the page on focus */
    font-size: 18px;
    line-height: normal;
    color: #555661;
    -webkit-text-fill-color: #555661;
    box-shadow: 0 0 0 1000px #F9F9FA inset;
    -webkit-user-select: text;
    user-select: text;
}

    input:-webkit-autofill,
    input:-webkit-autofill:hover,
    input:-webkit-autofill:focus,
    input:-webkit-autofill:active {
        -webkit-animation: autofill 0s forwards;
        animation: autofill 0s forwards;
    }

    textarea:focus,
    input:focus {
        outline: 2px solid #61CFF2;
        outline-offset: 1px;
    }

/* ------------------------------------------------------------
   Buttons / links
   ------------------------------------------------------------ */

.btn {
    width: 100%;
    height: 48px;
    border-radius: 5px;
    font-family: Roboto;
    font-weight: 500;
    font-size: 16px;
    line-height: normal;
    color: #FFFFFF;
    border: none;
    margin: 4px 0 0;
}

    .btn.blue {
        background: #61CFF2;
    }

    .btn.inout {
        background: #FFF;
        border: 2px solid #619BF2;
        color: #619BF2;
    }

        .btn.inout:hover {
            color: #212529;
            text-decoration: none;
        }

.help {
    text-align: center;
    margin-top: clamp(8px, 1.6vh, 16px);
}

    .help div {
        margin-bottom: clamp(6px, 1.1vh, 10px);
    }

a {
    font-family: Roboto;
    font-style: normal;
    font-weight: normal;
    font-size: 16px;
    line-height: 20px;
    text-decoration-line: underline !important;
    color: #A3A4B0 !important;
}

.border-top {
    border: none !important;
}

table {
    border-spacing: 0;
    border-collapse: collapse;
}

/* ------------------------------------------------------------
   OTP dialog - same card, inside the Bootstrap modal so that
   login_otp.js keeps working unchanged
   ------------------------------------------------------------ */

#ota.modal {
    /* Bootstrap writes style="overflow:hidden" onto <body> while a modal
       is open, and an inline style beats any rule here. Scroll the modal
       itself instead, or the Complete button is unreachable on a short
       screen. */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Bootstrap's own centred-dialog arithmetic: margin plus min-height
   add up to exactly the .modal box, so nothing overflows. The previous
   `min-height: 100dvh` plus padding was taller than .modal by the
   padding, which is what produced the scrollbar. */
.modal-dialog {
    display: flex;
    align-items: center;
    min-height: calc(100% - 24px);
    max-width: none;
    margin: 12px;
    padding: 0;
}

    .modal-dialog > div {
        margin: auto;
        width: 100%;
        max-width: 420px;
    }

.loginota {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    background: #FFFFFF;
    border-radius: 10px;
    box-shadow: 0px 30px 90px rgba(19, 88, 138, 0.12);
    padding: clamp(16px, 3vh, 30px);
    text-align: center;
}

    .loginota br {
        display: none;
    }

    .loginota .close {
        position: absolute;
        top: 8px;
        right: 12px;
        background: none;
        border: 0;
        font-size: 26px;
        line-height: 1;
        padding: 2px 6px;
        color: #A3A4B0;
        cursor: pointer;
    }

    /* the avatar, a direct child of .loginota */
    .loginota > img {
        display: block;
        width: auto;
        max-width: 120px;
        max-height: 16vh;
        height: auto;
        margin: 6px auto 10px;
        padding: 0;
    }

.modal-content.loginota button span {
    position: static;
    margin: 0;
}

/* The original 40px was sized for a 500px-wide desktop dialog; in a
   420px card the name runs the full width. 26px keeps the same weight
   and colour at a size that fits. */
.user {
    position: static;
    top: 0;
    font-family: Roboto;
    font-style: normal;
    font-weight: 500;
    font-size: 26px;
    line-height: 1.25;
    color: #1A1F4D;
}

    .user form {
        margin: clamp(8px, 1.6vh, 16px) 0 0;
    }

    /* the brand logo at the foot of the dialog */
    .user img {
        display: block;
        width: auto;
        max-width: 160px;
        max-height: 9vh;
        height: auto;
        margin: clamp(10px, 2vh, 20px) auto 0;
        padding: 0;
    }

#otacode {
    text-align: center;
    margin-bottom: 14px;
}

button[type=submit][name=ok],
button[type=submit][name=resend] {
    width: 100%;
    margin: 0 0 10px;
}

/* ------------------------------------------------------------
   Misc
   ------------------------------------------------------------ */

.panelmode {
    width: 100%;
    max-width: 588px;
    background: #FFFFFF;
    box-shadow: 0px 30px 90px rgba(19, 88, 138, 0.12);
    border-radius: 10px;
    margin: auto;
    padding: clamp(16px, 3vh, 30px);
}

.footer .container {
    position: fixed;
    bottom: 0;
}

.alert {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    margin: 0;
    z-index: 1100;
}

.spinmodal {
    position: fixed;
    z-index: 1000000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: wait;
    display: none;
    background: rgb(255,255,255);
    background: radial-gradient(circle, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 4%, rgba(0,212,255,0) 100%);
}

.sk-circle.sk-center {
    --sk-color: #61CFF2;
    --sk-size: 100px;
}

@keyframes autofill {
    100% {
        background: transparent;
        color: inherit;
        font-size: inherit;
    }
}

@-webkit-keyframes autofill {
    100% {
        background: transparent;
        color: inherit;
        font-size: inherit;
    }
}
