/* Prevent zooming and scrolling */
html, body {
    overflow: hidden !important;
    touch-action: none;
    max-width: 100%;
    height: 100%;
    position: fixed;
    width: 100%;
}

body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: none;
}

@viewport {
    zoom: 1.0;
    min-zoom: 1.0;
    max-zoom: 1.0;
    user-zoom: fixed;
}

/* For iOS Safari */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
        -webkit-text-size-adjust: 100%;
    }
}

/* Prevent zoom on input focus in iOS */
input, textarea, select {
    font-size: 16px !important;
    max-width: 100%;
}

/* =====================================================================
   MES Login — theme tokens
   Palette is built from the app's existing brand accent (#2790a5) plus
   a dark industrial navy for the manufacturing-themed visual panel.

   NOTE: every rule below is scoped with the `#m_login` id. The bundled
   theme (style.bundle.css, ".m-login--5" skin) ships long chained-class
   selectors (e.g. ".m-login.m-login--5 .m-login__wrapper-2 .m-login__contanier
   .m-login__form .m-login__form-action .btn") that would otherwise beat
   plain class selectors here and silently override this layout.
   ===================================================================== */
#m_login {
    --mes-primary: #2790a5;
    --mes-primary-dark: #1c6b7a;
    --mes-primary-light: #5fb6c3;
    --mes-navy-900: #0b1f27;
    --mes-navy-800: #123340;
    --mes-navy-700: #1c4d5b;
    --mes-ink: #1f2d33;
    --mes-muted: #7c8a90;
    --mes-border: #e3e9eb;
    --mes-success: #3ec776;

    font-family: 'Poppins', 'Roboto', Arial, Helvetica, sans-serif;
    background: linear-gradient(135deg, var(--mes-navy-900) 0%, var(--mes-navy-800) 100%);
    width: 100%;
    height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#m_login * {
    box-sizing: border-box;
}

/* ---------------------------------------------------------------------
   Page shell
   --------------------------------------------------------------------- */
#m_login .mes-login-shell {
    position: relative;
    z-index: 2;
    display: flex;
    width: 100%;
    max-width: 1080px;
    height: min(88vh, 660px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 30px 70px -20px rgba(4, 20, 26, 0.55);
    overflow: hidden;
}

/* ---------------------------------------------------------------------
   Left — manufacturing / industrial visual panel
   --------------------------------------------------------------------- */
#m_login .mes-login-visual {
    position: relative;
    flex: 1 1 54%;
    min-width: 0;
    background: linear-gradient(160deg, var(--mes-navy-900) 0%, var(--mes-navy-800) 55%, var(--mes-navy-700) 100%);
    color: #eef6f8;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px 48px;
    overflow: hidden;
}

/* login_img.png kept only as a faint, blended watermark — the login form
   stays the visual focus, not the photo */
#m_login .mes-login-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image: url("../../../img/login_img.png");
    background-size: cover;
    background-position: center;
    opacity: 0.16;
    mix-blend-mode: luminosity;
    pointer-events: none;
}

/* subtle technical grid pattern for an industrial-tech feel */
#m_login .mes-visual-pattern {
    position: absolute;
    inset: 0;
    z-index: 1;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 42px 42px;
    -webkit-mask-image: radial-gradient(ellipse at 30% 20%, black 0%, transparent 75%);
            mask-image: radial-gradient(ellipse at 30% 20%, black 0%, transparent 75%);
    pointer-events: none;
}

#m_login .mes-visual-glow {
    position: absolute;
    z-index: 1;
    width: 420px;
    height: 420px;
    right: -140px;
    bottom: -160px;
    background: radial-gradient(circle, rgba(95, 182, 195, 0.35) 0%, rgba(95, 182, 195, 0) 70%);
    pointer-events: none;
}

#m_login .mes-visual-content {
    position: relative;
    z-index: 2;
}

#m_login .mes-visual-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
}

#m_login .mes-visual-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(95, 182, 195, 0.18);
    border: 1px solid rgba(95, 182, 195, 0.4);
    color: var(--mes-primary-light);
    font-size: 18px;
}

#m_login .mes-visual-brand-name {
    font-weight: 600;
    letter-spacing: 0.4px;
    font-size: 15px;
    color: #eef6f8;
}

#m_login .mes-visual-title {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 16px;
    color: #ffffff;
    max-width: 380px;
}

#m_login .mes-visual-subtitle {
    font-size: 14.5px;
    line-height: 1.7;
    color: rgba(238, 246, 248, 0.75);
    max-width: 360px;
    margin: 0 0 36px;
}

#m_login .mes-feature-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

#m_login .mes-feature-list li {
    display: flex;
    align-items: center;
    gap: 12px;
}

#m_login .mes-feature-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--mes-primary-light);
    font-size: 15px;
}

#m_login .mes-feature-text {
    font-size: 13.5px;
    color: rgba(238, 246, 248, 0.9);
    font-weight: 500;
}

#m_login .mes-visual-footer {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: rgba(238, 246, 248, 0.65);
}

#m_login .mes-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mes-success);
    box-shadow: 0 0 0 3px rgba(62, 199, 118, 0.25);
}

/* ---------------------------------------------------------------------
   Right — login form panel
   --------------------------------------------------------------------- */
#m_login .mes-login-formside {
    flex: 1 1 46%;
    min-width: 0;
    height: auto;
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    overflow-y: auto;
}

#m_login .mes-login-card {
    width: 100%;
    max-width: 340px;
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    position: static;
}

#m_login .mes-card-head {
    text-align: center;
    margin: 0 0 28px;
}

#m_login .mes-card-logo {
    display: block;
    width: auto;
    height: auto;
    max-width: 200px;
    max-height: 48px;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
    margin: 0 auto 18px;
}

#m_login .mes-card-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--mes-ink);
    margin: 0 0 6px;
}

#m_login .mes-card-subtitle {
    font-size: 13.5px;
    color: var(--mes-muted);
    margin: 0;
}

#m_form {
    margin-top: 0;
    position: static;
    top: auto;
}

#m_login .form-group {
    position: relative;
    margin-bottom: 20px;
}

#m_login .form-group input {
    width: 100%;
    height: 48px;
    padding: 0 44px;
    border-radius: 10px;
    border: 1.5px solid var(--mes-border);
    font-size: 14.5px;
    outline: none;
    color: var(--mes-ink);
    background: #f8fafb;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

#m_login .form-group input::placeholder {
    color: #aab4b8;
    font-size: 13.5px;
    font-weight: 500;
}

#m_login .form-group input:focus {
    border-color: var(--mes-primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(39, 144, 165, 0.14);
}

#m_login .form-group i {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    color: #a6b0b4;
    font-size: 17px;
    pointer-events: none;
}

#m_login .eye-icon {
    left: auto;
    right: 15px;
    cursor: pointer;
    pointer-events: auto;
}

#m_login .form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--mes-muted);
    margin-bottom: 26px;
}

#m_login .mes-remember {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--mes-muted);
    font-weight: 500;
    margin: 0;
    cursor: pointer;
}

#m_login .mes-remember input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--mes-primary);
    cursor: pointer;
}

#m_login .mes-forgot {
    text-decoration: none;
    color: var(--mes-primary);
    font-weight: 600;
    font-size: 13px;
}

#m_login .mes-forgot:hover {
    color: var(--mes-primary-dark);
    text-decoration: underline;
}

#m_login .login-btn {
    width: 100%;
    height: 48px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--mes-primary) 0%, var(--mes-primary-dark) 100%);
    color: #ffffff;
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: 0.4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    box-shadow: 0 10px 24px -8px rgba(28, 107, 122, 0.55);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

#m_login .login-btn:hover {
    filter: brightness(1.06);
    box-shadow: 0 12px 28px -8px rgba(28, 107, 122, 0.65);
}

#m_login .login-btn:active {
    transform: translateY(1px);
    box-shadow: 0 6px 16px -8px rgba(28, 107, 122, 0.55);
}

#m_login .login-btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

/* Error / success alert banner injected by login.js */
#m_form .m-alert {
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 18px;
}

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
.mes-login-footer.m-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    height: auto;
    min-height: 0;
    padding: 10px 30px;
    background: transparent;
}

.mes-login-footer.m-footer .m-footer__copyright {
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
}

/* ---------------------------------------------------------------------
   Responsive behaviour
   --------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    #m_login .mes-login-shell {
        max-width: 640px;
        height: auto;
        min-height: min(90vh, 620px);
    }

    #m_login .mes-login-visual {
        display: none;
    }

    .mes-login-footer.m-footer {
        display: none;
    }
}

@media (max-width: 575.98px) {
    #m_login {
        padding: 0;
    }

    #m_login .mes-login-shell {
        max-width: 100%;
        height: 100vh;
        min-height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }

    #m_login .mes-login-formside {
        padding: 28px 24px;
    }
}
