/* ============================================================
 * ui/dusn/auth/login-popover.css
 * Styles for the Tier 1 login popover.
 * ============================================================
 *
 * SCOPE
 *   A small, anchored popover that appears when the user clicks
 *   "Sign In" in the header. Per D-023, login is intentionally
 *   lightweight: two fields, no role chooser, no commitment.
 *
 * DESIGN NOTES
 *   - Uses tokens from dusn/tokens.css.
 *   - Anchored to its trigger button via JavaScript-computed
 *     position. The CSS only defines the panel itself.
 *   - Closes on outside-click or Esc (handled in the JS).
 * ============================================================ */

/* The backdrop is invisible but covers the page so we can
 * detect outside clicks to close the popover. Without it,
 * scrolling could shift things around under the user. */
.dusn-login-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: transparent;
  display: none;
}
.dusn-login-backdrop.open { display: block; }

.dusn-login-popover {
  position: absolute;
  z-index: 901;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(45, 63, 62, 0.16);
  padding: 18px 18px 16px;
  font-family: 'DM Sans', sans-serif;
  animation: dusnLoginPopIn 0.16s ease-out;
}

@keyframes dusnLoginPopIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dusn-login-title {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: 0.01em;
}

.dusn-login-field {
  margin-bottom: 10px;
}
.dusn-login-field label {
  display: block;
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dusn-login-field input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  box-sizing: border-box;
}
.dusn-login-field input:focus {
  outline: none;
  border-color: var(--sage);
  background: var(--bg2);
}

/* Error banner — appears above the form when login fails.
 * Uses the semantic --fail token so it reads correctly across
 * rails. Hidden by default; the JS toggles a .visible class. */
.dusn-login-error {
  display: none;
  font-size: 12px;
  color: var(--fail);
  background: var(--fail-light);
  padding: 7px 9px;
  border-radius: 5px;
  margin-bottom: 10px;
  line-height: 1.4;
}
.dusn-login-error.visible { display: block; }

.dusn-login-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.dusn-login-submit {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.dusn-login-submit:hover:not(:disabled) { background: #c88820; }
.dusn-login-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dusn-login-forgot {
  font-size: 11px;
  color: var(--text3);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-family: 'DM Sans', sans-serif;
}
.dusn-login-forgot:hover { color: var(--sage); }

/* The arrow pointing up at the trigger button. Small visual
 * cue that the popover belongs to the button it's anchored to. */
.dusn-login-arrow {
  position: absolute;
  top: -6px;
  right: 24px;
  width: 12px;
  height: 12px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  transform: rotate(45deg);
}
