/* =========================================================
   NUSUON WORKSTATION PORTAL

   FILE:
   crm/assets/css/signin.css

   VERSION:
   4.0 - CONNECTED AUTHENTICATION STYLING

   PURPOSE:
   - Preserve existing authentication selectors
   - Preserve JavaScript and PHP connections
   - Support public portal two-column layout
   - Use centralized theme.css colors
   - Preserve password visibility styling
   - Preserve errors, warnings and success messages
   - Maintain responsive authentication layout

   IMPORTANT:
   - CSS ONLY
   - No changes to authentication logic
   - No changes to MFA
   - No changes to sign-in JavaScript
   - No changes to Workstation shell
========================================================= */


/* =========================================================
   01 — AUTHENTICATION CONTAINER

   IMPORTANT:
   No full-screen positioning.
   entrance.css controls the portal layout.
========================================================= */

.crm-auth {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-width: 0;
    max-width: 100%;

    min-height: 0;
    height: auto;

    margin: 0;
    padding: 0;

    background: transparent;
}


/* =========================================================
   02 — AUTHENTICATION PANEL
========================================================= */

.crm-auth-panel {
    display: flex;
    flex-direction: column;

    width: 100%;
    min-width: 0;
    max-width: 450px;

    margin: 0;
    padding: 0;

    overflow: hidden;

    background: var(--nw-white, #FFFFFF);

    border:
        1px solid var(--nw-border, #DCE8E1);

    border-radius:
        var(--nw-radius, 12px);

    box-shadow:
        var(
            --nw-shadow,
            0 10px 32px rgba(18, 63, 115, 0.08)
        );
}


/* =========================================================
   03 — WELCOME HEADER
========================================================= */

.crm-auth-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 7px;

    width: 100%;

    margin: 0;
    padding: 25px 20px;

    background:
        var(--nw-green, #15965C);

    text-align: center;
}

.crm-auth-header h1 {
    margin: 0;

    color: var(--nw-white, #FFFFFF);

    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.4px;
}

.crm-auth-header p {
    margin: 0;

    color: var(--nw-white, #FFFFFF);

    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}


/* =========================================================
   04 — SIGN-IN FORM

   Preserves:
   .crm-signin-form
   #crm-signin-form
========================================================= */

.crm-signin-form {
    display: flex;
    flex-direction: column;

    gap: 16px;

    width: 100%;
    min-width: 0;

    margin: 0;
    padding: 26px 28px 18px;

    background:
        var(--nw-white, #FFFFFF);
}


/* =========================================================
   05 — FIELD GROUPS
========================================================= */

.crm-field {
    display: flex;
    flex-direction: column;

    gap: 7px;

    width: 100%;
    min-width: 0;

    margin: 0;
}

.crm-field label {
    display: block;

    color:
        var(--nw-blue, #123F73);

    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1px;
}


/* =========================================================
   06 — INPUT FIELDS

   Preserves:
   #screen_name
   #password
========================================================= */

.crm-field input {
    display: block;

    width: 100%;
    min-width: 0;
    max-width: 100%;

    min-height: 46px;

    margin: 0;
    padding: 11px 13px;

    background:
        var(--nw-white, #FFFFFF);

    color:
        var(--nw-text, #243449);

    border:
        1px solid var(--nw-border, #DCE8E1);

    border-radius:
        var(--nw-radius-small, 8px);

    font-size: 13px;

    outline: none;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.crm-field input::placeholder {
    color:
        var(--nw-muted, #64748B);

    opacity: 0.85;
}

.crm-field input:hover:not(:disabled) {
    border-color:
        var(--nw-green, #15965C);
}

.crm-field input:focus {
    border-color:
        var(--nw-green, #15965C);

    box-shadow:
        0 0 0 3px
        rgba(21, 150, 92, 0.12);
}

.crm-field input:disabled {
    background: #F4F6F5;
    color: var(--nw-muted, #64748B);
    cursor: not-allowed;
}


/* =========================================================
   07 — PASSWORD VISIBILITY

   Retains existing JavaScript-facing selector:
   .crm-password-toggle

   JavaScript behavior remains unchanged.
========================================================= */

.crm-password-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    align-self: flex-end;

    width: auto;

    margin: 0;
    padding: 0;

    border: 0;

    background: transparent;

    color:
        var(--nw-blue, #123F73);

    font-size: 12px;
    font-weight: 600;

    cursor: pointer;
}

.crm-password-toggle:hover {
    color:
        var(--nw-green-dark, #107A4B);

    text-decoration: underline;
}

.crm-password-toggle:focus-visible {
    outline:
        2px solid var(--nw-green, #15965C);

    outline-offset: 3px;
}


/* =========================================================
   08 — SIGN-IN BUTTON

   Preserves:
   .crm-signin-button
========================================================= */

.crm-signin-button {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 46px;

    margin: 0;
    padding: 12px 18px;

    border: 0;

    border-radius:
        var(--nw-radius-small, 8px);

    background:
        var(--nw-green, #15965C);

    color:
        var(--nw-white, #FFFFFF);

    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.2px;

    cursor: pointer;

    transition:
        background 0.15s ease,
        box-shadow 0.15s ease,
        transform 0.15s ease;
}

.crm-signin-button:hover:not(:disabled) {
    background:
        var(--nw-green-dark, #107A4B);

    box-shadow:
        0 5px 14px
        rgba(21, 150, 92, 0.16);
}

.crm-signin-button:active:not(:disabled) {
    transform: translateY(1px);
}

.crm-signin-button:focus-visible {
    outline:
        3px solid var(--nw-blue, #123F73);

    outline-offset: 3px;
}

.crm-signin-button:disabled {
    opacity: 0.65;
    cursor: wait;
}


/* =========================================================
   09 — AUTHENTICATION MESSAGES

   Preserves:
   .crm-auth-message
   [role="alert"]
   .is-pending
   .is-success
========================================================= */

.crm-auth-message {
    margin: 0;

    color:
        var(--nw-muted, #64748B);

    font-size: 11px;
    line-height: 1.6;
    text-align: center;
}

.crm-auth-message[role="alert"] {
    padding: 12px 14px;

    border: 1px solid #F4D5D2;
    border-left: 4px solid #D92D20;
    border-radius: 7px;

    background: #FFF7F6;
    color: #B42318;

    font-size: 12px;
    font-weight: 600;
    text-align: left;
}

.crm-auth-message.is-pending {
    padding: 12px 14px;

    border: 1px solid #F1E3B4;
    border-left: 4px solid #B77900;
    border-radius: 7px;

    background: #FFF9E7;
    color: #865A00;

    font-size: 12px;
    text-align: left;
}

.crm-auth-message.is-success {
    padding: 12px 14px;

    border: 1px solid #CDEBD4;
    border-left: 4px solid #188038;
    border-radius: 7px;

    background: #EFFAF1;
    color: #188038;

    font-size: 12px;
    text-align: left;
}


/* =========================================================
   10 — LEGACY AUTHENTICATION FOOTER

   Retained for compatibility with existing
   authentication pages.
========================================================= */

.crm-auth-footer {
    margin: 0;
    padding: 18px 20px;

    border-top:
        1px solid var(--nw-border, #DCE8E1);

    color:
        var(--nw-muted, #64748B);

    font-size: 11px;
    letter-spacing: 0.2px;
    text-align: center;
}

.crm-auth-footer::after {
    content: "";

    display: block;

    width: 38px;
    height: 3px;

    margin: 12px auto 0;

    border-radius: 3px;

    background:
        var(--nw-green, #15965C);
}


/* =========================================================
   11 — SECURITY OPTIONS

   These are presentation-only until the
   corresponding backend routes are implemented.
========================================================= */

.nw-security {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;

    gap: 8px 14px;

    width: 100%;

    padding: 0 20px 16px;

    color:
        var(--nw-blue, #123F73);

    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

.nw-security span {
    display: inline-block;
}


/* =========================================================
   12 — ENCRYPTED PORTAL LABEL
========================================================= */

.nw-secure-label {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    width: 100%;
    min-height: 49px;

    padding: 13px 15px;

    background:
        var(--nw-green-light, #EFF9F3);

    border-top:
        1px solid var(--nw-border, #DCE8E1);

    color:
        var(--nw-green-dark, #107A4B);

    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.035em;
    text-align: center;
}


/* =========================================================
   13 — TABLET
========================================================= */

@media (max-width: 768px) {

    .crm-auth-panel {
        max-width: 420px;
    }

    .crm-signin-form {
        padding: 24px 22px 18px;
    }

    .crm-auth-header {
        padding: 24px 18px;
    }

}


/* =========================================================
   14 — MOBILE
========================================================= */

@media (max-width: 480px) {

    .crm-auth-panel {
        max-width: 100%;
        border-radius: 10px;
    }

    .crm-auth-header {
        padding: 22px 16px;
    }

    .crm-auth-header h1 {
        font-size: 22px;
    }

    .crm-auth-header p {
        font-size: 11px;
    }

    .crm-signin-form {
        gap: 14px;
        padding: 22px 18px 16px;
    }

    .crm-field input {
        font-size: 16px;
    }

    .crm-signin-button {
        min-height: 48px;
    }

    .nw-security {
        gap: 8px 12px;
        padding: 0 12px 15px;
    }

}


/* =========================================================
   15 — ACCESSIBILITY
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .crm-field input,
    .crm-signin-button {
        transition: none;
    }

}


/* =========================================================
   END — SIGNIN.CSS V4.0
========================================================= */