/* Shared look for the sign-in, forgot-password and new-password screens:
   one card, one kind of field, one gold button, purple links and focus ring. */

:root {
  --auth-bg: #0e0c14;
  --auth-card: #17141f;
  --auth-line: #2b2538;
  --auth-ink: #ece9f4;
  --auth-muted: #a39db8;
  --auth-field: #0e0c14;
  --auth-field-line: #3d3554;
  --auth-purple: #a78bfa;      /* links and the focus ring */
  --auth-gold: #e8b84a;
  --auth-gold-hover: #f2c661;
  --auth-gold-ink: #1d1530;
  --auth-danger: #ff9a9a;
  --auth-ok: #7bd88f;
}
:root[data-theme="light"] {
  --auth-bg: #f7f5fb;
  --auth-card: #ffffff;
  --auth-line: #ddd6ec;
  --auth-ink: #1f1b2e;
  --auth-muted: #5f5978;
  --auth-field: #ffffff;
  --auth-field-line: #b9b0d0;
  --auth-purple: #5b34c2;
  --auth-gold: #e8b84a;
  --auth-gold-hover: #dba936;
  --auth-danger: #b42318;
  --auth-ok: #15803d;
}

/* The page (standalone pages) or the overlay (inside the chat app) */
.auth-page, .auth {
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  background: var(--auth-bg);
  color: var(--auth-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.auth-page { margin: 0; min-height: 100vh; min-height: 100dvh; }
.auth { position: fixed; inset: 0; z-index: 50; overflow-y: auto; }
.auth[hidden], .auth-card [hidden] { display: none !important; }
.auth-page *, .auth * { box-sizing: border-box; }

.auth-card {
  width: 100%;
  max-width: 400px;
  margin: auto;                 /* centred, and still scrollable on short screens */
  padding: 32px 28px 24px;
  background: var(--auth-card);
  border: 1px solid var(--auth-line);
  border-radius: 16px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--auth-ink);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  border-radius: 8px;
}
.auth-brand img { width: 36px; height: 36px; display: block; }

.auth-title { margin: 24px 0 6px; font-size: 1.5rem; line-height: 1.2; font-weight: 700; }
/* headings are focused from script so screen readers announce a new step */
.auth-title:focus { outline: none; }
.auth-sub { margin: 0 0 22px; color: var(--auth-muted); font-size: 0.95rem; line-height: 1.5; }
.auth-sub strong { color: var(--auth-ink); font-weight: 600; overflow-wrap: anywhere; }

/* Fields: the label always sits above a full-width input */
.auth-form { margin: 0; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field + .auth-field { margin-top: 16px; }
.auth-field label { font-size: 0.875rem; font-weight: 500; color: var(--auth-ink); }
.auth-field input {
  display: block;
  width: 100%;
  height: 46px;
  margin: 0;
  padding: 0 14px;
  font: inherit;
  font-size: 1rem;              /* 16px: phones do not zoom in on focus */
  color: var(--auth-ink);
  background: var(--auth-field);
  border: 1px solid var(--auth-field-line);
  border-radius: 10px;
  appearance: none;
  -webkit-appearance: none;
}
.auth-field input::placeholder { color: var(--auth-muted); opacity: 0.7; }
.auth-field input[aria-invalid="true"] { border-color: var(--auth-danger); }
.auth-hint { margin: 0; font-size: 0.8rem; color: var(--auth-muted); }
.auth-field-error { margin: 0; font-size: 0.8rem; color: var(--auth-danger); }
.auth-field-error:empty { display: none; }
.auth-row-end { display: flex; justify-content: flex-end; margin-top: 8px; }

/* One visible purple focus ring everywhere, for keyboard and mouse */
.auth-field input:focus,
.auth-card a:focus-visible,
.auth-card button:focus-visible {
  outline: 2px solid var(--auth-purple);
  outline-offset: 2px;
}
.auth-field input:focus { border-color: var(--auth-purple); }

.auth-message { margin: 14px 0 0; font-size: 0.9rem; line-height: 1.45; color: var(--auth-danger); }
.auth-message:empty { margin: 0; }
.auth-message.ok { color: var(--auth-ok); }

.auth-submit {
  display: block;
  width: 100%;
  height: 46px;
  margin-top: 20px;
  padding: 0 16px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 46px;
  text-align: center;
  text-decoration: none;
  color: var(--auth-gold-ink);
  background: var(--auth-gold);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.auth-submit:hover { background: var(--auth-gold-hover); }
.auth-submit:disabled { opacity: 0.6; cursor: default; }

.auth-secondary {
  display: block;
  width: 100%;
  height: 46px;
  margin-top: 10px;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 44px;
  text-align: center;
  text-decoration: none;
  color: var(--auth-ink);
  background: transparent;
  border: 1px solid var(--auth-field-line);
  border-radius: 10px;
  cursor: pointer;
}
.auth-secondary:hover { border-color: var(--auth-purple); }

/* Links are purple; link-style buttons look the same as links */
.auth-link {
  padding: 0;
  font: inherit;
  font-size: inherit;
  font-weight: 500;
  color: var(--auth-purple);
  background: none;
  border: 0;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
}
.auth-link:hover { text-decoration: underline; }

.auth-alt { margin: 20px 0 0; text-align: center; font-size: 0.9rem; color: var(--auth-muted); }
.auth-legal { margin: 14px 0 0; text-align: center; font-size: 0.8rem; line-height: 1.5; color: var(--auth-muted); }

/* "or" + Continue with Google */
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; font-size: 0.8rem; color: var(--auth-muted); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--auth-line); }
.auth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 46px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #1f1f1f;
  background: #ffffff;
  border: 1px solid #747775;
  border-radius: 10px;
  text-decoration: none;
}
.auth-google:hover { background: #f2f2f2; }

@media (max-width: 420px) {
  .auth-page, .auth { padding: 16px 12px; }
  .auth-card { padding: 24px 20px 20px; }
  .auth-title { font-size: 1.35rem; }
}
