/* ============================================================================
   auth.css  —  shared shell for the BRS entry screens
   default.aspx · SetupMFA.aspx · forgot-password.aspx · Reset.aspx · UserSetup.aspx

   Layered on top of bootstrap5 + IBM Plex (linked per page). Everything is
   scoped under .auth-page so it can't leak into the app. Light theme only —
   the app itself (style2.css) is light, and a dark login into a bright app
   reads as broken.

   Concept: a page from a compliance register. Ruled bands, bottom-rule fields
   like a paper form, monospaced reference stamps. Brand green #198754, no gold.
   ============================================================================ */

.auth-page {
  --surface:     #f1f3f2;
  --card:        #ffffff;
  --ink:         #1f2a25;
  --ink-soft:    #566058;
  --ink-faint:   #7c857e;
  --rule:        #dce1de;
  --rule-faint:  rgba(31, 42, 37, 0.05);
  --green:       #198754;   /* navbar / .btn-success */
  --green-deep:  #146c43;   /* hover */
  --green-tint:  #d8ece2;   /* success-subtle */
  --panel-bg:    #198754;
  --panel-ink:   #f3f7f4;
  --panel-soft:  rgba(243, 247, 244, 0.66);
  --panel-rule:  rgba(243, 247, 244, 0.14);
  --panel-edge:  #115c3a;
  --plate:       #ffffff;
  --plate-ink:   #1c2a23;
  --danger:      #b02a37;
  --danger-bg:   #fbeaec;

  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background-color: var(--surface);
  /*background-image: repeating-linear-gradient(var(--rule-faint) 0 1px, transparent 1px 32px);*/
  color: var(--ink);
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* the postback pages wrap everything in <form runat="server"> — make it a
   transparent layout box, not a visual element */
.auth-page > form { width: 100%; display: flex; justify-content: center; }

.auth-frame {
  width: 100%;
  max-width: 860px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 0 var(--rule), 0 30px 60px -40px rgba(15, 40, 27, 0.42);
  display: grid;
  grid-template-columns: 40% 1fr;
}

/* ── Left: brand / client co-brand ───────────────────────────── */
.auth-panel {
  background: var(--panel-bg);
  /*background-image: repeating-linear-gradient(var(--panel-rule) 0 1px, transparent 1px 32px);*/
  color: var(--panel-ink);
  border-bottom: 2px solid var(--panel-edge);
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}

.auth-cover__mark {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-weight: 600;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0.02em;
}
.auth-cover__rule { width: 38px; border-top: 2px solid var(--panel-soft); margin: 15px 0 11px; }
.auth-cover__sub { font-size: 13px; font-weight: 500; letter-spacing: 0.02em; }

/* client logo "bookplate" (shown on ?Company= entry) */
.auth-plate {
  background: var(--plate);
  color: var(--plate-ink);
  border-radius: 3px;
  padding: 22px 20px;
  text-align: center;
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.4);
}
.auth-plate__tag {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 9px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase;
  color: #7c8a82; margin-bottom: 12px;
}
.auth-plate img { max-width: 100%; max-height: 90px; height: auto; display: block; margin: 0 auto; }
.auth-plate__by { margin-top: 12px; font-size: 10.5px; color: #7c8a82; }

.auth-panel__foot { display: flex; flex-direction: column; gap: 4px; }

.auth-stamp {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 10.5px; font-weight: 500; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--ink-faint);
}
.auth-panel__foot .auth-stamp { color: var(--panel-soft); }

/* ── Right: the form sheet ───────────────────────────────────── */
.auth-sheet { padding: 30px 30px 26px; display: flex; flex-direction: column; }
.auth-sheet__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--rule); margin-bottom: 22px;
}
.auth-sheet__head h1 {
  font-family: "IBM Plex Serif", Georgia, serif; font-weight: 600; font-size: 21px;
  line-height: 1.2; margin: 0; text-wrap: balance;
}
.auth-sheet .lead-note { color: var(--ink-soft); font-size: 13px; margin: -12px 0 20px; }

.auth-field { margin-bottom: 18px; }
.auth-field > label {
  display: block; font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 10px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 7px;
}
.auth-field .hint { margin-top: 7px; font-size: 11.5px; color: var(--ink-faint); }

/* bottom-rule fields — override bootstrap .form-control within the sheet */
.auth-page .auth-sheet .form-control,
.auth-page .auth-sheet .form-select {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  background-color: transparent; background-clip: border-box;
  border: 0; border-bottom: 1.5px solid var(--rule); border-radius: 0;
  padding: 6px 2px; box-shadow: none;
}
.auth-page .auth-sheet .form-control:focus,
.auth-page .auth-sheet .form-select:focus {
  border-bottom-color: var(--green); box-shadow: none; background-color: transparent; color: var(--ink);
}
.auth-page .auth-sheet .form-control::placeholder { color: var(--ink-faint); }
.auth-page .auth-sheet .form-select {
  padding-right: 20px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23198754' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 2px center;
}

/* password field with a show/hide affordance */
.auth-field .pw-wrap { display: flex; align-items: center; border-bottom: 1.5px solid var(--rule); }
.auth-field .pw-wrap:focus-within { border-bottom-color: var(--green); }
.auth-page .auth-sheet .pw-wrap .form-control { border-bottom: 0; flex: 1; }
.auth-field .pw-toggle {
  background: none; border: 0; color: var(--ink-faint); cursor: pointer; padding: 4px 6px; font-size: 14px;
}
.auth-field .pw-toggle:hover { color: var(--green); }

.auth-btn {
  width: 100%; font: inherit; font-weight: 600; font-size: 14px; letter-spacing: 0.01em;
  color: #fff; background: var(--green);
  border: 0; border-radius: 3px; padding: 12px 16px; cursor: pointer; margin-top: 4px;
}
.auth-btn:hover:not(:disabled) { background: var(--green-deep); }
.auth-btn:disabled { opacity: 0.6; cursor: default; }
.auth-btn .spinner-border { width: 0.9em; height: 0.9em; border-width: 2px; vertical-align: -1px; margin-right: 7px; }

.auth-altrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 12.5px;
}
.auth-altrow a, .auth-altrow button {
  color: var(--ink-soft); text-decoration: none; background: none; border: 0;
  border-bottom: 1px solid var(--rule); padding: 0 0 1px; cursor: pointer; font: inherit; font-size: 12.5px;
}
.auth-altrow a:hover, .auth-altrow button:hover { color: var(--ink); border-bottom-color: var(--green); }

/* register / trial secondary action */
.auth-secondary {
  display: block; text-align: center; margin-top: 10px;
  font: inherit; font-weight: 500; font-size: 13px;
  color: var(--green); text-decoration: none;
  border: 1.5px solid var(--rule); border-radius: 3px; padding: 10px 16px;
}
.auth-secondary:hover { border-color: var(--green); background: var(--green-tint); color: var(--green-deep); }

/* messages */
.auth-msg { margin-bottom: 18px; }
.auth-msg .alert {
  border: 0; border-radius: 3px; margin: 0; padding: 11px 14px; font-size: 13px;
  display: flex; align-items: flex-start; gap: 9px;
}
.auth-msg .alert-danger  { background: var(--danger-bg); color: var(--danger); }
.auth-msg .alert-success { background: var(--green-tint); color: #0f5132; }
.auth-msg .alert-warning { background: #fdf3e2; color: #7a4f0e; }

/* single MFA code input */
.auth-page .auth-sheet .auth-code {
  text-align: center; letter-spacing: 0.45em; padding-left: 0.45em;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 20px;
}

/* MFA code cells (unused variant) */
.auth-otp { display: flex; gap: 8px; }
.auth-otp input {
  flex: 1; min-width: 0; text-align: center;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 20px; color: var(--ink);
  background: transparent; border: 0; border-bottom: 1.5px solid var(--rule); border-radius: 0; padding: 8px 0 6px;
}
.auth-otp input:focus { outline: none; border-bottom-color: var(--green); }

/* password strength */
.auth-pwmeter { margin-top: 9px; display: flex; align-items: center; gap: 9px; }
.auth-pwmeter .bars { display: flex; gap: 3px; flex: 1; }
.auth-pwmeter i { height: 3px; flex: 1; background: var(--rule); border-radius: 2px; }
.auth-pwmeter i.on { background: var(--green); }
.auth-pwmeter .lbl {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 10px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--green);
}

/* QR + backup codes (SetupMFA) */
.auth-qr { display: inline-block; padding: 10px; background: #fff; border: 1px solid var(--rule); border-radius: 4px; }
.auth-key {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; letter-spacing: 2px; font-size: 13px;
  background: var(--green-tint); padding: 5px 9px; border-radius: 4px; display: inline-block; word-break: break-all;
}
.auth-backup-codes {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 13px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 14px 18px;
  columns: 2; column-gap: 24px;
}
.auth-steps { display: flex; gap: 8px; font-size: 11px; color: var(--ink-faint); margin-bottom: 18px; }
.auth-steps span.on { color: var(--green); font-weight: 600; }

.auth-step { display: none; }
.auth-step.active { display: block; }

/* full-page loading overlay (forgot-password) */
.auth-overlay {
  position: fixed; inset: 0; z-index: 9999; display: none;
  align-items: center; justify-content: center; background: rgba(20, 32, 27, 0.55);
}
.auth-overlay.show { display: flex; }
.auth-overlay .box {
  background: var(--card); border-radius: 6px; padding: 28px 30px; max-width: 340px; width: 90%; text-align: center;
}

:where(.auth-page) :focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 2px; }

/* ── Responsive: panel becomes a slim brand bar ──────────────── */
@media (max-width: 720px) {
  .auth-frame { grid-template-columns: 1fr; max-width: 460px; }
  .auth-panel {
    flex-direction: row; align-items: center; gap: 16px; padding: 16px 20px;
  }
  .auth-panel__foot { display: none; }
  .auth-cover__rule { display: none; }
  .auth-cover__mark { font-size: 22px; }
  .auth-plate { padding: 10px 14px; }
  .auth-plate__tag, .auth-plate__by { display: none; }
  .auth-plate img { max-height: 40px; }
  .auth-sheet { padding: 24px 22px 22px; }
}

@media (prefers-reduced-motion: no-preference) {
  .auth-frame { animation: authRise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  @keyframes authRise { from { opacity: 0; transform: translateY(10px); } }
}

/* ── UserSetup wizard: let it breathe inside the sheet ───────── */
.auth-page #msform { margin-top: 6px; width: 100%; }
.auth-page #msform .form-control,
.auth-page #msform .form-select { width: 100%; margin-bottom: 12px; }
.auth-page #msform .form-group.row { display: block; }
.auth-page #msform .form-group.row > label { display: block; width: auto; padding: 0; margin-bottom: 4px; font-size: 12px; color: var(--ink-soft); }
.auth-page #msform .form-group.row > .col-sm-3,
.auth-page #msform .form-group.row > .col-sm-9,
.auth-page #msform .form-group.row > .col-sm-12 { width: 100%; max-width: 100%; flex: 0 0 100%; }
.auth-page #msform .row.justify-content-center > .col-12,
.auth-page #msform .row.justify-content-center > [class*="col-md-"] { width: 100%; max-width: 100%; flex: 0 0 100%; }
.auth-page #msform fieldset { padding-bottom: 0; }
.auth-page #msform .btn.btn-success { background: var(--green); border-color: var(--green); width: 100%; }
.auth-page #msform .btn.btn-success:hover { background: var(--green-deep); border-color: var(--green-deep); }
.auth-page #msform #progressbar { margin-bottom: 22px; }
.auth-page #msform #progressbar li { font-size: 10px; }
.auth-page #msform #progressbar li:before { width: 34px; height: 34px; line-height: 30px; font-size: 13px; }
.auth-page #msform #progressbar li:after { top: 17px; }
.auth-page #lblError, .auth-page #lblErrorMsg { margin-top: 12px; }
