/* Login page on phones and tablets. Loaded only by login.php, together with its viewport tag.
   Undoes the old "zoomed-out phone" block in css/master.css, style.css and the client themes
   copied from it (3em body text, the form pinned to the top, 400px inputs, 40px social buttons).
   Those blocks go by device width (up to max-device-width 1024px: iPads, and iPhones held
   sideways, which keep their portrait device width), so this one does too, plus any window
   up to 600px wide. Inner rules sit under #side_menu so they outrank client rules such as
   "table#side_menu a {font-size: 35px !important}". */
@media (max-width: 600px), (max-device-width: 1024px) {
  html:has(> body.page-login), body.page-login { overflow-x: hidden; }
  body.page-login { font-size: 14px !important; max-width: 100%; }
  body.page-login #container { min-width: 0 !important; max-width: 100% !important; }   /* trianservice-ru: min-width 600px */
  body.page-login #width_limiter, body.page-login #the_cell_with_the_program, body.page-login #side_menu,
  body.page-login #side_menu #FiltersArea { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
  body.page-login #side_menu #FiltersArea {
    margin-left: 0 !important; margin-right: 0 !important; box-sizing: border-box !important;
    padding-left: 8px !important; padding-right: 8px !important;
  }
  /* The login area's own table: a fixed layout keeps its width at the screen's, so padding around
     the form or a long word cannot widen the page (teenindus, client-module, seach at 320px). */
  body.page-login table#side_menu { table-layout: fixed; padding-left: 0 !important; padding-right: 0 !important; }
  /* effective.checker.co.il: 40px side margins on the login cell put the form 22px off a 320px screen. */
  body.page-login #side_menu td.middle-right { margin-left: 0 !important; margin-right: 0 !important; }
  /* The "Or" between the Google/Microsoft buttons and the form inherits the theme's phone size (30px on apmacademy-ar). */
  body.page-login #side_menu .socials .title, body.page-login #side_menu .socials .title * { font-size: 14px !important; }
  body.page-login #side_menu #FiltersArea p, body.page-login #side_menu #FiltersArea > div { font-size: 16px !important; }
  body.page-login .title1, body.page-login .grid_report_td h1 { font-size: 20px !important; }
  body.page-login .pageTitle { font-size: 20px !important; }
  body.page-login .breadcrums, body.page-login .breadcrums * { font-size: 13px !important; }
  /* The title row is written with &nbsp;, so a long company name could not wrap (masterresearch-mx at 320px). */
  body.page-login #logo_and_title td { white-space: normal !important; }
  body.page-login #logo_and_title .pageTitle, body.page-login #logo_and_title .breadcrums {
    white-space: normal !important; overflow-wrap: anywhere; word-break: break-word;
  }
  body.page-login .font-style, body.page-login .contact-td td, body.page-login .bottom-tr td {
    font-size: 12px !important; white-space: normal !important; width: auto !important;
    max-width: 100vw; overflow-wrap: anywhere;
  }

  body.page-login #side_menu form[name=login] {
    position: static !important; display: block !important; width: auto !important; max-width: min(100%, 480px) !important;
    margin: 12px auto !important; padding: 16px 12px !important; box-sizing: border-box !important;
    top: auto !important; bottom: auto !important; left: auto !important; right: auto !important;
  }
  body.page-login #side_menu form[name=login] table {
    width: 100% !important; margin: 0 !important; position: static !important; left: auto !important; right: auto !important;
  }
  body.page-login #side_menu form[name=login] td {
    display: block !important; font-size: 15px !important; text-align: start; padding: 2px 0 !important; width: auto !important;
  }
  /* The cell holding a field is a flex row, so the field takes the room left after the theme's
     own icon: an <img> beside it, or a background image of the cell, which js/login-mobile.js
     marks login-icon-left / login-icon-right (MIS, GfK and the other *_system_v1 themes). */
  body.page-login #side_menu form[name=login] td:has(> input[name=username]),
  body.page-login #side_menu form[name=login] td:has(> input[name=password]) {
    display: flex !important; align-items: center; gap: 6px;
  }
  body.page-login #side_menu form[name=login] td.login-icon-left {
    padding-left: 46px !important; background-position: left 4px center !important; background-size: 34px auto !important;
  }
  body.page-login #side_menu form[name=login] td.login-icon-right {
    padding-right: 46px !important; background-position: right 4px center !important; background-size: 34px auto !important;
  }
  body.page-login #side_menu input[name=username], body.page-login #side_menu input[name=password] {
    width: 100% !important; min-width: 0 !important; max-width: calc(100vw - 64px) !important;
    font-size: 16px !important; padding: 8px !important; box-sizing: border-box !important; height: auto !important;
  }
  body.page-login #side_menu form[name=login] td:has(> input[name=username]) > input[name=username],
  body.page-login #side_menu form[name=login] td:has(> input[name=password]) > input[name=password] {
    flex: 1 1 0 !important; width: 0 !important;
  }
  body.page-login #side_menu form[name=login] [type=submit] {
    font-size: 16px !important; padding: 10px 28px !important; margin-top: 10px !important; min-height: 44px;
    width: auto !important; height: auto !important;
  }
  body.page-login #side_menu a.btn[data-title] {
    font-size: 13px !important; line-height: 16px !important; padding: 12px 16px 12px 48px !important;
    background-size: 24px !important; background-position: left 13px center !important;
    width: auto !important; min-width: 0 !important; height: auto !important;
  }
  body.page-login #side_menu a.login_checkers_link, body.page-login #side_menu a.login_panels_link,
  body.page-login #side_menu #FiltersArea a:not(.btn) { font-size: 16px !important; padding: 6px 0 !important; }
  body.page-login #side_menu .social-link { flex-wrap: wrap !important; gap: 6px; width: auto !important; max-width: 100% !important; }
  body.page-login #side_menu .social-link a.btn[data-title] { margin: 0 !important; }
  body.page-login table#menu_top_level, body.page-login .menu_top_level_wrapper {
    width: 100% !important; max-width: 100vw !important; table-layout: fixed;
  }
  body.page-login #top_title_graphics img, body.page-login #logo_and_title img { max-width: calc(100vw - 16px) !important; height: auto !important; }
  /* Header graphics with a logo and a banner side by side (client-module: 175px + 822px): each image
     in a row of several cells gets at most half the screen, so together they fit. */
  body.page-login #top_title_graphics td:not(:only-child) img { max-width: calc(50vw - 16px) !important; }
  /* Phones get a menu toggle in the title row (template-carmit.phpi, mobile user agents only);
     master.css sizes it 150x150px with 3em text, which stretched the page to ~600px.
     The login page has no menu, so it is hidden here. */
  body.page-login a.fieldset_toggler { display: none !important; }
  body.page-login .g-recaptcha { display: flex; justify-content: center; }
}
@media (max-width: 360px) {
  body.page-login .g-recaptcha { display: block; width: 265px; height: 68px; transform: scale(.87); transform-origin: right top; }
}
