/* Login Canvas (Loop 6, enhanced by the post-Phase-1 Interface Modernization pass) -
   implements SRS §II literally: exact copy, Aptos weights/sizes/colors/casing, and real
   brand assets, via the tokens Loop 5 established in site.css. Two departures from the
   letter of the SRS, both because following it literally would visibly break the page -
   see the comments at each site below. The modernization pass adds interactive polish
   (password visibility toggle, submit-loading state, smoother focus/hover transitions)
   and fixes a real layout bug (the Remember me / Forgot password row) without touching
   the brand colors, fonts, or the pixel-faithful hero layout. Uses site.css's
   .mip-visually-hidden utility - this file no longer defines its own. */

* {
  box-sizing: border-box;
}

/* SRS §II names "loginpage.mipasset.png" as the Background Asset, but the actual file
   has placeholder/guide rectangles baked into it (an unfinished export from the design
   tool) - real content sitting on top would visibly clash with those shapes. Reproduced
   here as a CSS gradient + grid line pattern instead, matching the same blue tones and
   grid texture the asset otherwise shows. */
.mip-login-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1.5rem 2rem;
  font-family: var(--mip-font-family);
  color: var(--mip-color-white);
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.05) 0,
      rgba(255, 255, 255, 0.05) 1px,
      transparent 1px,
      transparent 40px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.05) 0,
      rgba(255, 255, 255, 0.05) 1px,
      transparent 1px,
      transparent 40px
    ),
    radial-gradient(circle at top, #2f6fb3 0%, #163a63 65%, #0f2542 100%);
}

.mip-login-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mip-login-header__mark {
  width: 56px;
  height: 56px;
}

.mip-login-header__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.mip-login-header__brand {
  font-weight: 700;
  font-size: var(--mip-login-brand-size);
  color: var(--mip-color-white);
}

/* MIP-105: the brand fits a phone */
@media (max-width: 480px) {
  .mip-login-header { max-width: 100%; }
  .mip-login-header__text { min-width: 0; }
  .mip-login-header__brand { font-size: min(var(--mip-login-brand-size), 10vw); }
}

.mip-login-columns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
  width: 100%;
  max-width: 64rem;
}

.mip-login-card {
  flex: 1 1 20rem;
  max-width: 24rem;
  background: rgba(15, 32, 56, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--mip-radius-lg);
  box-shadow: var(--mip-shadow-lg);
  padding: 1.75rem;
  text-align: left;
  align-self: flex-start;
  animation: mip-login-card-in var(--mip-transition);
}

@keyframes mip-login-card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mip-login-card__header {
  margin: 0 0 0.25rem;
  font-weight: 700;
  font-size: var(--mip-login-card-title-size);
  color: var(--mip-color-white);
}

.mip-login-card__subheader {
  margin: 0 0 1.25rem;
  font-weight: 400;
  font-size: var(--mip-login-card-sub-size);
  text-transform: uppercase;
  color: var(--mip-color-white);
}

.mip-login-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--mip-color-white);
  border-radius: var(--mip-radius-sm);
  padding: 0 0.85rem;
  margin-bottom: 1rem;
  transition: box-shadow var(--mip-transition-fast);
}

.mip-login-field img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.mip-login-field input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  padding: 0.75rem 0;
  font-family: var(--mip-font-family);
  font-size: var(--mip-login-input-size);
  color: #1f2933;
}

.mip-login-field input::placeholder {
  color: var(--mip-color-text-placeholder);
}

/* SRS §II: "Requires a 2pt Outline in Primary Blue (#151DA8) when clicked." - applied to
   the field wrapper (not the bare input) so the outline traces the same rounded
   rectangle the white fill already has. Modernized to a soft focus ring + transition
   rather than an instant hard outline snap. */
.mip-login-field:has(input:focus) {
  outline: var(--mip-border-width-focus) solid var(--mip-color-primary-blue);
  box-shadow: 0 0 0 4px rgba(21, 29, 168, 0.18);
}

/* Password visibility toggle (modernization pass) - a plain icon button living inside
   the same field pill, toggled by wwwroot/js/site.js's enhancePasswordToggle(). */
.mip-login-field__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0.25rem;
  margin: 0;
  cursor: pointer;
  color: var(--mip-color-text-placeholder);
  transition: color var(--mip-transition-fast);
}

.mip-login-field__toggle:hover {
  color: var(--mip-color-brand-navy);
}

/* Remember me / Forgot password row (fixed: this used to wrap mid-word at narrower
   viewport widths - justify-content: space-between with no flex-shrink guard let the
   flex items squeeze below their own text's natural width instead of the row wrapping
   as a whole. Now the row wraps as a unit and neither label ever breaks internally. */
.mip-login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;   /* GNRL001 #3: Forgot password? stays inline, right of Remember me */
  row-gap: 0.5rem;
  column-gap: 1rem;
  font-size: var(--mip-login-small-size);
  margin-bottom: 1.5rem;
}

.mip-login-remember {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--mip-color-white);
  flex-shrink: 0;
  white-space: nowrap;
}

.mip-login-remember input {
  accent-color: var(--mip-color-accent-blue);
}

.mip-login-forgot {
  color: var(--mip-color-white);
  text-decoration: none;
  flex-shrink: 0;
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}

.mip-login-forgot:hover,
.mip-login-forgot:focus-visible {
  text-decoration: underline;
}

/* ADR-554: a notice on the sign-in card (the password was reset, the code was sent). */
.mip-login-info {
  background: rgba(46, 160, 67, 0.16);
  border: 1px solid rgba(46, 160, 67, 0.45);
  color: #d9f7df;
  border-radius: var(--mip-radius-sm);
  padding: 0.6rem 0.85rem;
  margin: 0 0 1rem;
  font-size: var(--mip-font-size-3xs);
}

/* SRS §II gives the Login button an explicit "Size specified as 2''" in addition to
   full-width. Taken literally (2in = 192px tall) this visibly conflicts with the
   polished mockup image, which shows a normal slim button - confirmed with the user
   that "2''" is a design-tool measurement artifact, not a literal CSS height. */
.mip-login-submit {
  width: 100%;
  height: 2.75rem;
  border: none;
  border-radius: var(--mip-radius-sm);
  background: var(--mip-color-accent-blue);
  color: var(--mip-color-white);
  font-family: var(--mip-font-family);
  /* Was --mip-font-size-lg (16pt, an absolute unit ~50% bigger than the 13pt inputs
     right above it) - visibly out of proportion next to the rest of the card. A plain
     1rem (tracks the root font-size like every other shared-template button) reads as
     the same button language as .mip-btn elsewhere in the app. */
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter var(--mip-transition-fast), transform var(--mip-transition-fast),
    box-shadow var(--mip-transition-fast);
}

.mip-login-submit:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: var(--mip-shadow-md);
}

.mip-login-submit:active:not(:disabled) {
  transform: translateY(1px);
}

/* Loading state (modernization pass) - wwwroot/js/site.js's enhanceLoadingSubmit()
   disables the button and swaps its label right after a real form submit fires, so a
   slow request can't be double-clicked into two requests and the user gets feedback
   instead of a frozen-looking button. */
.mip-login-submit:disabled {
  cursor: progress;
  opacity: 0.8;
}

.mip-login-error {
  background: rgba(220, 53, 69, 0.15);
  border: 1px solid rgba(220, 53, 69, 0.4);
  color: #ffd7db;
  border-radius: var(--mip-radius-sm);
  padding: 0.6rem 0.85rem;
  margin: 0 0 1rem;
  font-size: var(--mip-font-size-3xs);
}

.mip-login-hint {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
  margin: -0.6rem 0 1rem;
}

.mip-login-hint--ok {
  color: #9be3a8;
}

.mip-login-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--mip-color-white);
  margin-top: 1rem;
}

.mip-login-footer img {
  width: var(--mip-login-powered-width);   /* GNRL001 #3, resized by ADR-514 */
  height: auto;
}

/* ADR-450: the password rule under the Change Password header. */
.mip-login-rule {
  margin: 0 0 1rem;
  font-size: var(--mip-login-small-size);
  color: var(--mip-color-white);
  opacity: 0.9;
}

/* ST Cycle 1 G&A #38 (ADR-526): the Security & Password card's Close (X), top right. */
.mip-login-card--closable {
  position: relative;
}

.mip-login-card__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.75);   /* on the navy card, light and dark alike */
  text-decoration: none;
}

.mip-login-card__close:hover,
.mip-login-card__close:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: var(--mip-color-white);
}

/* ADR-531: the picture challenge after repeated failed sign-ins (the picture keeps its light background in both themes). */
.mip-login-captcha { display: grid; gap: 0.5rem; justify-items: center; margin: 0 0 0.75rem; }
.mip-login-captcha img { border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.35); image-rendering: pixelated; }
.mip-login-captcha .mip-login-field { width: 100%; margin: 0; }

/* ==================================================================================================================================
   MIP-005 (TTS-036 CIS 001): the myinvoiceph sign-in - the approved mockup. Left: white brand side (logo, name, tagline, headline,
   desk photo). Right: blue panel with the steel-blue "Welcome Back" card and "Powered By Qtech" at the bottom. Light design only,
   like every sign-in page. Stacks on narrow screens (panel first, the photo is dropped).
   ================================================================================================================================== */
.mip-login {
  --mip-ink: #1d4f8f;
  --mip-accent: #1f74c4;
  --mip-panel-top: #1564bd;
  --mip-panel-bottom: #1d7fd8;
  --mip-card: rgba(203, 216, 232, 0.94);
  --mip-card-edge: rgba(255, 255, 255, 0.55);
  --mip-button: #3a43e3;
  --mip-button-hover: #2f37c4;
  --mip-field-edge: #9fb5cf;
  margin: 0;
  min-height: 100vh;
  background: #ffffff;
  color: var(--mip-ink);
  font-family: var(--mip-font-family);
}
.mip-login__split {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  min-height: 100vh;
}
.mip-login__brand {
  display: flex;
  flex-direction: column;
  padding: 3rem 0 0 3rem;
  background: #ffffff;
  overflow: hidden;
}
.mip-login__identity {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}
.mip-login__logo {
  width: 7.5rem;
  height: auto;
}
.mip-login__name {
  display: block;
  font-size: 2.15rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--mip-ink);
}
.mip-login__tagline {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mip-accent);
}
.mip-login__headline {
  margin: 2.6rem 0 0 8.6rem;
  font-size: clamp(2rem, 3.4vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  color: #23364f;
}
.mip-login__headline-accent {
  color: var(--mip-accent);
}
.mip-login__subheadline {
  margin: 0.6rem 0 0 8.6rem;
  font-size: 1.35rem;
  color: #23364f;
}
.mip-login__photo {
  flex: 1;
  min-height: 18rem;
  margin-top: 1.5rem;
  background: url("../images/brand/login-desk.jpg") left bottom / cover no-repeat;
}
.mip-login__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem 7rem;
  background:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(160deg, var(--mip-panel-top), var(--mip-panel-bottom));
}
.mip-login__card {
  width: min(100%, 34rem);
  padding: 2.6rem 2.8rem 2.4rem;
  background: var(--mip-card);
  border: 1px solid var(--mip-card-edge);
  border-radius: 0.6rem;
  box-shadow: 0 1.2rem 2.5rem rgba(10, 40, 90, 0.35);
}
.mip-login__card-title {
  margin: 0;
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--mip-ink);
}
.mip-login__card-sub {
  margin: 0.15rem 0 1.8rem;
  font-size: 1rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--mip-ink);
}
.mip-login__form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}
.mip-login__field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.9rem;
  height: 3.3rem;
  background: #ffffff;
  border: 1px solid var(--mip-field-edge);
  border-radius: 0.3rem;
}
.mip-login__field:focus-within {
  border-color: var(--mip-button);
  box-shadow: 0 0 0 3px rgba(58, 67, 227, 0.22);
}
.mip-login__icon {
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  fill: #1e3a5f;
  color: #1e3a5f;
}
.mip-login__field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 1.05rem;
  color: #1f2937;
}
.mip-login__field .mip-login-field__toggle {
  position: static;
  color: #4b5563;
}
.mip-login__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: -0.2rem;
}
.mip-login__check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--mip-ink);
}
.mip-login__forgot {
  color: var(--mip-ink);
  text-decoration: none;
}
.mip-login__forgot:hover,
.mip-login__forgot:focus-visible {
  text-decoration: underline;
}
.mip-login__submit {
  align-self: center;
  min-width: 10rem;
  margin-top: 0.4rem;
  padding: 0.7rem 2.5rem;
  border: 0;
  border-radius: 0.2rem;
  background: var(--mip-button);
  color: #ffffff;
  font: inherit;
  font-size: 1.05rem;
  cursor: pointer;
}
.mip-login__submit:hover,
.mip-login__submit:focus-visible {
  background: var(--mip-button-hover);
}
.mip-login__powered {
  position: absolute;
  bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: #ffffff;
  font-size: 0.8rem;
}
.mip-login__powered img {
  width: 8rem;
  height: auto;
  filter: brightness(0) invert(1);
}
@media (max-width: 900px) {
  .mip-login__split {
    grid-template-columns: minmax(0, 1fr);
  }
  .mip-login__brand {
    padding: 1.5rem 1rem 1rem;
  }
  .mip-login__headline,
  .mip-login__subheadline {
    margin-left: 0;
  }
  .mip-login__photo {
    display: none;
  }
  .mip-login__panel {
    padding: 2rem 1rem 6rem;
  }
  .mip-login__card {
    padding: 1.8rem 1.4rem;
  }
}
