/* ============================================================
   VS Login Page — new design
   ============================================================ */

body.vs-login-body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background:
        url('../image/footer-signon-1920x310.png') center bottom / 100% 110px no-repeat,
        linear-gradient(180deg, #f2f1ef 0%, #eaeae7 50%, #e4e4e1 100%);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Main area ── */
.vs-login-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 16px clamp(80px, 21vh, 170px);
    min-height: 0;
    overflow: hidden;
}

/* ── Login card — full background image ── */
.vs-login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 0;
    overflow: visible;
    background-image: url('../image/login-screen-card-721x468.png');
    background-size: 100% 100%;
    background-position: left center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(20px, 3vh, 36px) clamp(40px, 8%, 80px) clamp(24px, 3.5vh, 40px);
    flex-shrink: 0;
}

/* ── Logo ── */
.vs-login-card__logo {
    width: 45%;
    max-width: 200px;
    height: auto;
    display: block;
    margin-bottom: clamp(12px, 2vh, 24px);
}

/* ── Form elements ── */
.vs-login-card form,
.vs-login-card > form {
    width: 75%;
}

.vs-login-card label {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    color: #fff;
    display: block;
    margin-bottom: 4px;
}

.vs-login-card input[type="text"],
.vs-login-card input[type="password"] {
    width: 100% !important;
    padding: 8px 10px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    margin-bottom: 12px;
    background: #fff;
    color: #333;
    font-family: Arial, Helvetica, sans-serif;
    display: block;
    box-sizing: border-box !important;
}

/* Dojo dijit widget containers — override dijitInline so they stretch full width */
.vs-login-card .dijitTextBox,
.vs-login-card .dijitSelect {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 12px;
    border-radius: 4px !important;
    overflow: hidden;
    border: none !important;
    background: #fff !important;
}
/* Remove dijit's own inner border so only the container shows */
.vs-login-card .dijitTextBox .dijitInputContainer,
.vs-login-card .dijitTextBox .dijitButtonNode {
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
}
/* Override claro.css padding on dijitInputInner */
.vs-login-card .dijitTextBox .dijitInputInner {
    padding: 3px !important;
}

.vs-login-card input[type="text"]:focus,
.vs-login-card input[type="password"]:focus {
    outline: 2px solid rgba(255,255,255,0.6);
}

/* Forgot password link */
.vs-login-card a {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #f0d0d0;
    text-decoration: none;
    display: block;
    margin-bottom: 14px;
}
.vs-login-card a:hover { text-decoration: underline; color: #fff; }

/* Forgot password submit button gap */
.vs-login-card input[type="submit"] {
    margin-top: 12px;
}

/* Login button — matches existing system btn btn-large style */
.vs-login-card .btn-login {
    display: block;
    width: 37%;
    padding: 8px 24px;
    background: #e6e6e6;
    background-image: linear-gradient(to bottom, #f5f5f5, #e6e6e6);
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 17px;
    font-family: Arial, Helvetica, sans-serif;
    cursor: pointer;
    color: #333;
    text-shadow: 0 1px 1px rgba(255,255,255,0.75);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.05);
    transition: background 0.2s;
}
.vs-login-card .btn-login:hover {
    background: #d9d9d9;
    background-image: linear-gradient(to bottom, #e6e6e6, #d9d9d9);
}

/* ── Dojo validation overrides ── */
/* Yellow border on required-field error instead of red */
body.claro .dijitTextBoxError,
body.claro .dijitTextBoxError .dijitButtonNode,
body.claro .dijitTextBoxError .dijitInputContainer,
body.claro .dijitSelectError,
body.claro .dijitSelectError .dijitButtonContents {
    border-color: #FFD700 !important;
    border-width: 2px !important;
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.7) !important;
}
/* Hide the red error icon on the right side of input */
body.claro .dijitValidationTextBoxError .dijitValidationContainer {
    display: none !important;
}
/* Hide Dojo validation tooltip message */
.dijitTooltip,
.dijitTooltipContainer { display: none !important; }

/* ── Browser / Contact pages: allow scrolling when content is taller than viewport ── */
body.vs-login-body--content {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}
body.vs-login-body--content .vs-login-wrap {
    overflow: visible;
    justify-content: center;
    padding-top: clamp(20px, 4vh, 40px);
    padding-bottom: clamp(80px, 12vh, 140px);
}

/* ── Browser / Contact page content ── */
.vs-login-content {
    width: 100%;
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    line-height: 1.6;
}
.vs-login-content p {
    margin-bottom: 10px;
}
.vs-login-content strong {
    color: #fff;
}
.vs-login-content a {
    color: #f0d0d0;
    display: inline;
    margin-bottom: 0;
}
.vs-login-content a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Flash/alert messages */
.vs-login-card .alert {
    font-size: 13px;
    margin-bottom: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: Arial, Helvetica, sans-serif;
    width: 100%;
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ── Footer text ── */
.vs-login-footer-text {
    text-align: center;
    padding: clamp(6px, 1.2vh, 14px) 16px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #444;
    flex-shrink: 0;
    max-width: 840px;
    width: 100%;
    margin: 0 auto;
}
.vs-login-footer-text p { margin-bottom: 8px; line-height: 1.6; }
.vs-login-footer-text a { color: #444; text-decoration: none; display: inline; vertical-align: middle; }
.vs-login-footer-text a:hover { text-decoration: underline; }

.vs-login-footer-text .midwire-line { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; line-height: 1; margin-bottom: 8px; }
.vs-login-footer-text .midwire-line a { display: inline-flex !important; align-items: center !important; margin-bottom: 0 !important; vertical-align: middle; line-height: 1; }
.vs-login-footer-text .midwire-line img.midwire { margin-top: -15px; }

/* ── Environment details ── */
.vs-login-env {
    font-size: 11px;
    font-weight: bold;
    color: #555;
    text-align: center;
    padding: 4px 16px;
    font-family: Arial, Helvetica, sans-serif;
    flex-shrink: 0;
}

/* ── Windows Display Scale 125% — desktop only (excludes phones with DPR 2+) ── */
@media (-webkit-min-device-pixel-ratio: 1.25) and (-webkit-max-device-pixel-ratio: 1.49),
       (min-resolution: 120dpi) and (max-resolution: 143dpi) {
    .vs-login-wrap {
        justify-content: center;
        padding-top: 40px;
    }
}

/* ── Windows Display Scale 150% — desktop only (excludes phones with DPR 2+) ── */
@media (-webkit-min-device-pixel-ratio: 1.45) and (-webkit-max-device-pixel-ratio: 1.65),
       (min-resolution: 144dpi) and (max-resolution: 160dpi) {
    .vs-login-wrap {
        justify-content: center;
        padding-top: 60px;
    }
}

/* ── Windows Display Scale 150% — desktop only (excludes tablets/phones with DPR 2+) ── */
@media (-webkit-min-device-pixel-ratio: 1.45) and (-webkit-max-device-pixel-ratio: 1.65) and (min-width: 768px) {
    body.vs-login-body {
        height: 115vh;
    }
}
/* ── Responsive ── */
@media (max-width: 900px) {
    .vs-login-card { max-width: 380px; }
    .vs-login-wrap { padding: clamp(30px, 14vh, 90px) 16px clamp(80px, 21vh, 193px); }
    .vs-login-footer-text .midwire-line img.midwire { margin-top: -15px; }
    .vs-login-card__logo { width: 60%; }
    .vs-login-footer-text { max-width: 380px; padding-left: 0; padding-right: 0; }
}

@media (max-width: 600px) {
    body.vs-login-body {
        height: auto;
        min-height: 100vh;
        min-height: 100dvh; /* uses dynamic viewport on Chrome/Safari iOS — excludes address bar */
        overflow-y: auto;
        overflow-x: hidden;
        background-size: 100% 90px, auto;
    }
    .vs-login-wrap { overflow: visible; clamp(30px, 14vh, 90px) 16px clamp(80px, 21vh, 193px); }
    .vs-login-card { max-width: 92%; background-size: 100% 100%; padding-left: 32px; padding-right: 32px; }
    .vs-login-card__logo { width: 60%; }
    .vs-login-card form,
    .vs-login-card > form { width: 50%; }
    .vs-login-card .btn-login { width: 65%; }
    .vs-login-footer-text { max-width: 92%; padding-left: 0; padding-right: 0; }
    /* Midwire line — break logo onto its own line on mobile */
    .vs-login-footer-text .midwire-line { flex-direction: column; align-items: center; gap: 4px; }
    .vs-login-footer-text .midwire-line img.midwire { height: 20px; width: auto; margin-top: 0; }
}

@media (max-width: 400px) {
    .vs-login-card__logo { width: 65%; }
    .vs-login-card { max-width: 96%; padding-left: 20px; padding-right: 20px; }
    .vs-login-wrap { overflow: visible; clamp(30px, 14vh, 90px) 16px clamp(80px, 21vh, 193px); }
}

/* ── Small phones: iPhone SE (375px), Samsung Galaxy S8+ (360px) ── */
@media (max-width: 375px) {
    body.vs-login-body {
        padding-top: 50px;
        padding-bottom: 50px;
    }
    .vs-login-card .btn-login {
        width: 65%;
    }
}

/* ── Windows Display Scale 125% ── */
@media (-webkit-min-device-pixel-ratio: 1.25) and (-webkit-max-device-pixel-ratio: 1.49),
       (min-resolution: 120dpi) and (max-resolution: 143dpi) {
    .vs-login-wrap,
    body.vs-login-body--content .vs-login-wrap {
        padding-top: 60px;
    }
}

/* ── Windows Display Scale 150% — desktop only (excludes phones with DPR 2+) ── */
@media (-webkit-min-device-pixel-ratio: 1.45) and (-webkit-max-device-pixel-ratio: 1.65),
       (min-resolution: 144dpi) and (max-resolution: 160dpi) {
    .vs-login-wrap,
    body.vs-login-body--content .vs-login-wrap {
        padding-top: 80px;
    }
}

/* ── Short wide screens: Nest Hub (1024x600) and similar ── */
@media (max-height: 650px) and (min-width: 768px) {
    body.vs-login-body {
        overflow-y: auto;
    }
    .vs-login-wrap {
        justify-content: flex-start;
        padding-top: 20px;
    }
    .vs-login-card {
        background-size: cover;
        background-position: center top;
    }
    body.vs-login-body {
        height: 110vh;
    }
}
