/* The identity server's own pages: the MFLC design system's sign-in layout, fields, buttons, error summary and
   environment bar, drawn from its tokens alone (mflc-tokens.css), light and dark. No colour is written here. */
@import url("../design/mflc-tokens.css");

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--mflc-background);
  color: var(--mflc-foreground);
  font-family: var(--mflc-font-sans);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--mflc-link); text-underline-offset: 2px; }
a:hover { color: var(--mflc-link-hover); }

:focus-visible { outline: 2px solid var(--mflc-ring); outline-offset: 2px; }

.mflc-skip-link {
  position: absolute;
  left: 16px;
  top: 8px;
  padding: 8px 14px;
  border-radius: var(--mflc-radius-button);
  background: var(--mflc-primary-hover);
  color: var(--mflc-primary-foreground);
  transform: translateY(-200%);
}
.mflc-skip-link:focus { transform: none; color: var(--mflc-primary-foreground); }

.mflc-env-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 26px;
  padding: 0 16px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
.mflc-env-bar-label { font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.mflc-env-bar-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mflc-env-bar[data-env="development"] { background: var(--mflc-env-development); color: var(--mflc-env-development-text); }
.mflc-env-bar[data-env="test"] { background: var(--mflc-env-test); color: var(--mflc-env-test-text); }
.mflc-env-bar[data-env="production"] {
  background: repeating-linear-gradient(135deg, var(--mflc-env-production) 0 14px, var(--mflc-env-production-stripe) 14px 28px);
  color: var(--mflc-env-production-text);
}

.mflc-layout-auth {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - var(--mflc-env-bar-height, 0px));
  padding: 24px;
}
:root:has(.mflc-env-bar) { --mflc-env-bar-height: 26px; }

.mflc-auth-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 400px;
  padding: 32px;
  border-radius: var(--mflc-radius-card);
  background: var(--mflc-card);
  color: var(--mflc-card-foreground);
}
.mflc-auth-heading { display: flex; flex-direction: column; gap: 8px; }
.mflc-auth-title { margin: 0; font-family: var(--mflc-font-display); font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.mflc-auth-text { margin: 0; font-size: 14px; line-height: 21px; color: var(--mflc-muted-foreground); }
.mflc-auth-foot { margin: 0; text-align: center; font-size: 12px; color: var(--mflc-subtle-foreground); }

.mflc-logo { display: block; width: 100px; height: 28px; }
.mflc-logo .fill-logo-ink { fill: var(--mflc-logo-ink); }
.mflc-logo .fill-logo-tiller { fill: var(--mflc-logo-tiller); }

.mflc-form { display: flex; flex-direction: column; gap: 20px; margin: 0; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; }
.field .hint { margin: 0; font-size: 12px; color: var(--mflc-muted-foreground); }
.mflc-required { color: var(--mflc-danger-text); }

.input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--mflc-field-edge);
  border-radius: var(--mflc-radius-field);
  background: var(--mflc-field);
  color: var(--mflc-foreground);
  font: inherit;
}
.input:hover { border-color: var(--mflc-line-strong); }
.input:focus { outline: none; border-color: var(--mflc-ring); }
.input[aria-invalid="true"] { border-color: var(--mflc-danger-text); }

.mflc-field-error { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--mflc-danger-text); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--mflc-radius-button);
  background: var(--mflc-primary-hover);
  color: var(--mflc-primary-foreground);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--mflc-primary); box-shadow: var(--mflc-elev-hover); color: var(--mflc-primary-foreground); }
.btn:active { background: var(--mflc-primary-active); box-shadow: none; }
.btn[data-variant="raised"] { border: 1px solid var(--mflc-input); background: transparent; color: var(--mflc-foreground); }
.btn[data-variant="raised"]:hover { border-color: var(--mflc-muted-foreground); }

.mflc-error-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border-radius: var(--mflc-radius-banner);
  background: var(--mflc-danger-surface);
  color: var(--mflc-danger-on-surface);
}
.mflc-error-summary:focus { outline: none; }
.mflc-error-summary-title { margin: 0; font-size: 14px; font-weight: 500; }
.mflc-error-summary ul { margin: 0; padding-left: 16px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.mflc-error-summary a { color: var(--mflc-danger-on-surface); }

.mflc-banner {
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--mflc-radius-banner);
  background: var(--mflc-info-surface);
  color: var(--mflc-info-on-surface);
  font-size: 13px;
}
.mflc-code { font-family: var(--mflc-font-mono); font-size: 16px; font-weight: 500; letter-spacing: 0.1em; }

.btn:disabled { cursor: not-allowed; opacity: 0.6; }
.btn[aria-busy="true"] { cursor: progress; opacity: 1; }
.btn[aria-busy="true"]::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: mflc-spin 0.8s linear infinite;
}
@keyframes mflc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .btn[aria-busy="true"]::before { animation: none; }
}

.mflc-password { position: relative; }
.mflc-password .input { padding-right: 44px; }
.mflc-password-toggle {
  position: absolute;
  top: 50%;
  right: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  transform: translateY(-50%);
  border: 0;
  border-radius: var(--mflc-radius-field);
  background: transparent;
  color: var(--mflc-muted-foreground);
  cursor: pointer;
}
.mflc-password-toggle:hover { color: var(--mflc-foreground); }
.mflc-password-toggle:focus-visible { outline: 2px solid var(--mflc-ring); outline-offset: -2px; }
.mflc-password-icon[hidden] { display: none; }
.mflc-password-toggle[hidden] { display: none; }
