/* ============================================
   AUTH UI — form card shared by /auth and the sign-in modal (js/auth-modal.js)
   Everything is scoped under .aa-auth and every property a host page could set
   on bare elements (h2, label, input, button, a) is set explicitly, because the
   modal runs on ~290 public pages with their own stylesheets.
   ============================================ */

.aa-auth {
  --aa-primary: #0a66c2;
  --aa-primary-dark: #004182;
  --aa-text: #0f172a;
  --aa-text-2: #475569;
  --aa-text-3: #64748b;
  --aa-border: #e2e8f0;
  --aa-field: #f8fafc;
  --aa-danger: #b91c1c;
  --aa-radius: 12px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--aa-text);
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
}
.aa-auth *, .aa-auth *::before, .aa-auth *::after { box-sizing: border-box; }

.aa-auth .aa-view { display: none; margin: 0; padding: 0; background: none; }
.aa-auth .aa-view.active { display: block; animation: aaFade .2s ease; }
@keyframes aaFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .aa-auth .aa-view.active { animation: none; } }

.aa-auth .aa-title {
  margin: 0 0 8px; padding: 0;
  font-size: 28px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em;
  color: var(--aa-text); text-align: center; text-transform: none;
  outline: none; border: 0; background: none;
}
.aa-auth .aa-title:focus, .aa-auth .aa-title:focus-visible { outline: none; } /* focused by script on open (screen readers), not interactive */
.aa-auth .aa-sub { margin: 0 auto 22px; max-width: 400px; font-size: 15.5px; line-height: 1.5; color: var(--aa-text-2); text-align: center; }
.aa-auth .aa-sub-tight { margin-bottom: 4px; }
.aa-auth .aa-center { text-align: center; }

/* Google first (jobright-style), full width */
.aa-auth .aa-btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 48px; margin: 0; padding: 12px 20px;
  background: #fff; color: var(--aa-text);
  border: 1px solid #cbd5e1; border-radius: var(--aa-radius);
  font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-transform: none; letter-spacing: normal;
  cursor: pointer; box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  transition: background .15s ease, border-color .15s ease;
}
.aa-auth .aa-btn-google:hover { background: #f8fafc; border-color: #94a3b8; }
.aa-auth .aa-btn-google svg { flex-shrink: 0; }

.aa-auth .aa-divider {
  display: flex; align-items: center; gap: 14px; margin: 20px 0;
  font-size: 12px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: .06em;
}
.aa-auth .aa-divider::before, .aa-auth .aa-divider::after { content: ''; flex: 1; height: 1px; background: var(--aa-border); }

.aa-auth form { margin: 0; padding: 0; border: 0; background: none; box-shadow: none; max-width: none; }
.aa-auth .aa-field { margin: 0 0 14px; padding: 0; }
.aa-auth .aa-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.aa-auth label {
  display: block; margin: 0 0 6px; padding: 0;
  font-size: 14px; font-weight: 600; color: var(--aa-text); text-transform: none; letter-spacing: normal;
}
.aa-auth input[type="text"], .aa-auth input[type="email"], .aa-auth input[type="password"] {
  display: block; width: 100%; height: 48px; margin: 0; padding: 0 14px;
  background: var(--aa-field); color: var(--aa-text);
  border: 1px solid var(--aa-border); border-radius: var(--aa-radius);
  font-family: inherit; font-size: 16px; /* 16px: no iOS zoom on focus */
  box-shadow: none; outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.aa-auth input::placeholder { color: #94a3b8; opacity: 1; }
.aa-auth input:focus { background: #fff; border-color: var(--aa-primary); box-shadow: 0 0 0 3px rgba(10, 102, 194, .15); }
.aa-auth input[aria-invalid="true"] { border-color: var(--aa-danger); box-shadow: 0 0 0 3px rgba(185, 28, 28, .12); }

.aa-auth .aa-pw { position: relative; }
.aa-auth .aa-pw input { padding-right: 48px; }
.aa-auth .aa-pw-toggle {
  position: absolute; top: 4px; right: 4px; width: 40px; height: 40px; margin: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 8px; color: var(--aa-text-3); cursor: pointer;
}
.aa-auth .aa-pw-toggle:hover { color: var(--aa-text); background: #eef2f7; }
.aa-auth .aa-pw-toggle[aria-pressed="true"] { color: var(--aa-primary); }

.aa-auth .aa-hint { display: block; margin: -8px 0 14px; font-size: 12px; color: var(--aa-text-3); }
.aa-auth .aa-check {
  display: flex; align-items: flex-start; gap: 10px; margin: 2px 0 18px;
  font-size: 13px; font-weight: 400; color: var(--aa-text-2); cursor: pointer;
}
.aa-auth .aa-check input { width: 18px; height: 18px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--aa-primary); cursor: pointer; }
.aa-auth .aa-check a { color: var(--aa-primary); text-decoration: underline; text-underline-offset: 2px; }

.aa-auth .aa-row-end { display: flex; justify-content: flex-end; margin: -4px 0 16px; }

.aa-auth .aa-btn-primary {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 48px; margin: 0; padding: 12px 20px;
  background: var(--aa-primary); color: #fff; border: 0; border-radius: var(--aa-radius);
  font-family: inherit; font-size: 15px; font-weight: 700; line-height: 1.2; text-transform: none; letter-spacing: normal;
  cursor: pointer; box-shadow: 0 2px 8px rgba(10, 102, 194, .25);
  transition: background .15s ease, box-shadow .15s ease;
}
.aa-auth .aa-btn-primary:hover { background: var(--aa-primary-dark); }
.aa-auth .aa-btn-primary:disabled { opacity: .65; cursor: progress; }

/* Text buttons that switch views */
.aa-auth .aa-link {
  display: inline; margin: 0; padding: 2px 0; min-height: 0;
  background: none; border: 0; border-radius: 4px; box-shadow: none;
  color: var(--aa-primary); font-family: inherit; font-size: 14px; font-weight: 600; text-decoration: none;
  text-transform: none; letter-spacing: normal; cursor: pointer;
}
.aa-auth .aa-link:hover { text-decoration: underline; }
/* "Already have an account? Sign in" / "New here? Create a free account": a bold, obvious switch */
.aa-auth .aa-switch {
  margin: 20px 0 0; padding: 14px 12px;
  border: 1px solid #dbe6f3; border-radius: var(--aa-radius);
  text-align: center; font-size: 15px; color: var(--aa-text-2); background: #f5f9fe;
}
.aa-auth .aa-switch .aa-link { font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; text-decoration-color: rgba(10, 102, 194, .35); }
.aa-auth .aa-switch .aa-link:hover { text-decoration-color: currentColor; }

/* Sign up | Sign in segmented switch (login + signup views only) */
.aa-auth .aa-seg { display: none; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 0 22px; padding: 4px; background: #eef2f7; border-radius: 14px; }
.aa-auth[data-aa-current="login"] .aa-seg, .aa-auth[data-aa-current="signup"] .aa-seg,
.aa-auth [data-aa-current="login"] > .aa-seg, .aa-auth [data-aa-current="signup"] > .aa-seg { display: grid; }
.aa-auth .aa-seg-btn {
  display: flex; align-items: center; justify-content: center; min-height: 42px; margin: 0; padding: 8px 12px;
  background: transparent; color: var(--aa-text-2); border: 0; border-radius: 10px; box-shadow: none;
  font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-transform: none; letter-spacing: normal; cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.aa-auth .aa-seg-btn:hover { color: var(--aa-text); }
.aa-auth .aa-seg-btn[aria-pressed="true"] { background: #fff; color: var(--aa-primary); font-weight: 700; box-shadow: 0 1px 3px rgba(15, 23, 42, .12), 0 0 0 1px rgba(15, 23, 42, .04); }
.aa-auth .aa-note { margin: 10px 0 0; font-size: 13px; color: var(--aa-text-3); text-align: center; }

.aa-auth :focus-visible { outline: 2px solid var(--aa-primary); outline-offset: 2px; }
.aa-auth input:focus-visible { outline: none; }

/* Inline error (role=alert) */
.aa-auth .aa-alert {
  display: flex; align-items: flex-start; gap: 10px; margin: 0 0 16px; padding: 12px 14px;
  background: #fef2f2; color: var(--aa-danger); border: 1px solid #fecaca; border-radius: 10px;
  font-size: 14px; font-weight: 500; line-height: 1.45;
}
.aa-auth .aa-alert[hidden] { display: none; }
.aa-auth .aa-alert svg { flex-shrink: 0; margin-top: 1px; }

.aa-auth .aa-icon-ok {
  width: 72px; height: 72px; margin: 4px auto 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #dcfce7; color: #15803d;
}
.aa-auth .aa-email { margin: 0 0 14px; font-weight: 700; color: var(--aa-primary); word-break: break-all; text-align: center; }
.aa-auth .aa-center .aa-btn-primary { margin-top: 8px; }

@media (max-width: 380px) {
  .aa-auth .aa-row2 { grid-template-columns: 1fr; gap: 0; }
}

/* ============================================
   MODAL (js/auth-modal.js)
   ============================================ */
.aa-modal-open { overflow: hidden !important; }
.aa-overlay {
  position: fixed; inset: 0; z-index: 2147483000;
  display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: rgba(15, 23, 42, .55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .18s ease;
  overflow-y: auto; overscroll-behavior: contain;
}
.aa-overlay.is-open { opacity: 1; }
.aa-overlay[hidden] { display: none; }
.aa-dialog {
  position: relative; width: 100%; max-width: 520px; margin: auto;
  padding: 26px 44px 30px; background: #fff; border-radius: 24px;
  box-shadow: 0 32px 80px -12px rgba(15, 23, 42, .4), 0 0 0 1px rgba(15, 23, 42, .04);
  transform: translateY(10px) scale(.98); transition: transform .18s ease;
}
.aa-overlay.is-open .aa-dialog { transform: none; }
.aa-dialog:focus { outline: none; }
.aa-close {
  position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; margin: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; color: #0f172a; border: 0; border-radius: 50%; cursor: pointer;
}
.aa-close:hover { background: #e2e8f0; }
.aa-close:focus-visible { outline: 2px solid #0a66c2; outline-offset: 2px; }
.aa-brand { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 0 0 18px; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 16px; font-weight: 800; color: #0f172a; letter-spacing: -.01em; }
.aa-brand img { width: 28px; height: 28px; border-radius: 6px; }
.aa-loading { position: absolute; left: 32px; right: 32px; bottom: 10px; height: 3px; border-radius: 3px; overflow: hidden; background: transparent; }
.aa-loading[hidden] { display: none; }
.aa-loading::after { content: ''; display: block; width: 40%; height: 100%; background: #0a66c2; border-radius: 3px; animation: aaLoad 1s ease-in-out infinite; }
@keyframes aaLoad { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .aa-overlay, .aa-dialog { transition: none; } .aa-loading::after { animation: none; } }

/* Phones: full-screen sheet, scrolls with the keyboard open */
@media (max-width: 560px) {
  .aa-overlay { padding: 0; align-items: stretch; }
  .aa-dialog { max-width: none; min-height: 100%; margin: 0; border-radius: 0; padding: 18px 20px 28px; box-shadow: none; }
  .aa-brand { justify-content: flex-start; margin: 4px 0 20px; min-height: 40px; }
  .aa-auth .aa-title { font-size: 24px; }
}

/* 861-940 px tall (1400x900): the full-size dialog (~871 px) fits once the overlay padding is trimmed
   (24 px top + bottom left 19 px of scroll). */
@media (min-width: 561px) and (max-height: 940px) {
  .aa-overlay { padding: 12px 16px; }
}

/* Laptops (768-860 px tall): the whole sign-up form, CTA and switch fit without scrolling. */
@media (min-width: 561px) and (max-height: 860px) {
  .aa-overlay { padding: 12px 16px; }
  .aa-dialog { padding: 18px 40px 20px; }
  .aa-brand { margin-bottom: 12px; }
  .aa-auth .aa-seg { margin-bottom: 14px; }
  .aa-auth .aa-seg-btn { min-height: 38px; }
  .aa-auth .aa-title { font-size: 24px; margin-bottom: 4px; }
  .aa-auth .aa-sub { margin-bottom: 14px; font-size: 14.5px; }
  .aa-auth .aa-btn-google, .aa-auth .aa-btn-primary { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
  .aa-auth .aa-divider { margin: 12px 0; }
  .aa-auth .aa-field { margin-bottom: 10px; }
  .aa-auth label { margin-bottom: 4px; }
  .aa-auth input[type="text"], .aa-auth input[type="email"], .aa-auth input[type="password"] { height: 42px; }
  .aa-auth .aa-pw-toggle { top: 1px; }
  .aa-auth .aa-hint { margin: -6px 0 8px; }
  .aa-auth .aa-check { margin-bottom: 12px; }
  .aa-auth .aa-note { margin-top: 6px; }
  .aa-auth .aa-switch { margin-top: 12px; padding: 10px 12px; }
}

/* 1280×720-class windows (≤ 760 px tall, D6 2026-10-20): the sign-up dialog was 17 px taller than
   the viewport. Tighter rhythm so the whole form (every field kept) fits; the overlay still
   scrolls if a smaller window needs it. */
@media (min-width: 561px) and (max-height: 760px) {
  .aa-overlay { padding: 8px 16px; }
  .aa-dialog { padding: 14px 40px 14px; }
  .aa-close { top: 8px; right: 8px; width: 36px; height: 36px; }
  .aa-brand { margin-bottom: 8px; font-size: 15px; }
  .aa-brand img { width: 24px; height: 24px; }
  .aa-auth .aa-seg { margin-bottom: 10px; }
  .aa-auth .aa-seg-btn { min-height: 36px; }
  .aa-auth .aa-title { font-size: 22px; margin-bottom: 2px; }
  .aa-auth .aa-sub { margin-bottom: 10px; font-size: 14px; }
  .aa-auth .aa-btn-google, .aa-auth .aa-btn-primary { min-height: 42px; padding-top: 9px; padding-bottom: 9px; }
  .aa-auth .aa-divider { margin: 10px 0; }
  .aa-auth .aa-field { margin-bottom: 8px; }
  .aa-auth label { margin-bottom: 3px; font-size: 13.5px; }
  .aa-auth input[type="text"], .aa-auth input[type="email"], .aa-auth input[type="password"] { height: 40px; }
  .aa-auth .aa-pw-toggle { top: 0; }
  .aa-auth .aa-hint { margin: -4px 0 6px; }
  .aa-auth .aa-check { margin-bottom: 10px; }
  .aa-auth .aa-switch { margin-top: 10px; padding: 8px 12px; }
}
