/* ============================================================
   ISORIGHT — Sign in page
   Depends on isoright-tokens.css for design tokens.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--fg-primary);
  background: var(--bg-page);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The server-side <form> plays the role of the design's .page wrapper. */
.page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ASP.NET emits its hidden fields as a sibling of the card. */
.page > .aspNetHidden { display: none; }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  box-shadow: var(--shadow-high);
  padding: 48px 44px 40px;
  width: 100%;
  max-width: 420px;
}

.view { animation: fadein 200ms ease; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Logo ---- */
.logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 36px;
}

.logo-wrap img {
  height: 36px;
  width: auto;
}

/* ---- Header ---- */
.form-header { margin-bottom: 28px; }

.form-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--fg-primary);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.form-header p {
  font-size: 14px;
  color: var(--fg-secondary);
  line-height: 1.5;
}

/* ---- Fields ---- */
.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-primary);
  margin-bottom: 6px;
}

.input-wrap { position: relative; }

.input-wrap > .field-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-tertiary);
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--fg-primary);
  background: var(--bg-surface);
  transition: border-color 150ms ease, box-shadow 150ms ease;
  outline: none;
}

.input-wrap.has-toggle input { padding-right: 40px; }

.input-wrap input::placeholder { color: var(--fg-tertiary); }

/* Read-only fields are shown for context, not for editing. */
.input-wrap input[readonly] {
  background: var(--bg-subtle);
  color: var(--fg-secondary);
  cursor: default;
}

.input-wrap input[readonly]:focus {
  border-color: var(--border-default);
  box-shadow: none;
}

.input-wrap input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(143, 175, 126, 0.18);
}

.input-wrap input.error {
  border-color: var(--status-error);
  box-shadow: 0 0 0 3px rgba(212, 64, 64, 0.10);
}

/* ---- Show/hide password ---- */
.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg-tertiary);
  display: flex;
  align-items: center;
  padding: 2px;
  transition: color 150ms;
}

.toggle-pw:hover { color: var(--fg-secondary); }

.toggle-pw:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.field-error {
  font-size: 12px;
  color: var(--status-error);
  margin-top: 5px;
}

/* ---- Forgot password ---- */
.forgot-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.link {
  font-size: 13px;
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 150ms;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.link:hover { color: var(--brand-hover); text-decoration: underline; }

/* ---- Primary button ---- */
.btn-primary {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: 24px;
  background: var(--brand-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, transform 100ms ease, box-shadow 150ms ease;
  box-shadow: 0 1px 3px rgba(143, 175, 126, 0.18);
  letter-spacing: -0.01em;
  -webkit-appearance: none;
  appearance: none;
}

.btn-primary:hover {
  background: var(--brand-hover);
  box-shadow: 0 4px 16px rgba(106, 143, 90, 0.22);
}

.btn-primary:active {
  transform: scale(0.98);
  background: var(--color-green-700);
}

/* Anchors that act as the primary action need the label centred themselves. */
a.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

a.btn-primary:hover,
a.btn-primary:focus { color: #fff; text-decoration: none; }

.btn-primary:disabled,
.btn-primary.is-loading {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

/* ---- Forgot password: back link ---- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-secondary);
  padding: 0;
  margin-bottom: 28px;
  text-decoration: none;
  transition: color 150ms;
}

.back-btn:hover,
.back-btn:focus { color: var(--fg-primary); text-decoration: none; }

.back-btn svg { flex-shrink: 0; }

/* ---- Forgot password: sent confirmation ---- */
.success-box {
  background: var(--bg-accent);
  border: 1px solid var(--color-green-100);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 20px;
}

.success-box svg {
  color: var(--brand-primary);
  flex-shrink: 0;
  margin-top: 1px;
}

.success-box p {
  font-size: 14px;
  color: var(--color-green-800);
  line-height: 1.5;
}

.success-box p + p { margin-top: 10px; }

.success-box a {
  color: var(--color-green-800);
  font-weight: 500;
  text-decoration: underline;
}

/* ---- ASP.NET MVC validation summary, styled as the design's error callout ---- */
.validation-summary-valid { display: none; }

.validation-summary-errors {
  background: var(--color-error-bg);
  border: 1px solid #F5C6C2;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--color-error-text);
}

.validation-summary-errors ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.validation-summary-errors li + li { margin-top: 4px; }

/* ---- Server-side failure message ---- */
.alert-error {
  background: var(--color-error-bg);
  border: 1px solid #F5C6C2;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--color-error-text);
}

.alert-error svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--status-error);
}

/* The global reset zeroes list padding, so restore it for bullets. */
.alert-error .reason-list {
  margin: 0;
  padding-left: 18px;
}

.alert-error .reason-list li + li { margin-top: 3px; }

/* ---- Narrow screens ---- */
@media (max-width: 420px) {
  .page { padding: 16px; }
  .card { padding: 36px 24px 28px; }
  .logo-wrap { margin-bottom: 28px; }
}
