/* ============================================================
   auth-shell.css — shared "Auth Shell" for pages/login.html and
   pages/register.html (see auth-layout-suggestion.md).

   One skeleton, two panels of the same account console. Loaded
   AFTER css/series-shell.css (for the neutral --ss-* token scale)
   so login/register use exactly the same frame, rows, buttons and
   focus states as series / global-search / settings.

   No purple, no gradients, no blur, no entrance animation.
   Spacing scale: 4 / 8 / 12 / 16 / 24 / 32 only.
   ============================================================ */

/* ---------- Shell frame ---------- */
.au-shell {
  max-width: var(--ss-max, 1120px);
  margin: 0 auto;
  padding: 0 16px 48px;
  color: var(--ss-text);
  background: var(--ss-bg);
}
.au-shell *,
.au-shell *::before,
.au-shell *::after { box-sizing: border-box; }
.au-shell a { color: inherit; }

body.au-body { background: var(--ss-bg); }

/* ---------- 1. Identity strip ---------- */
.au-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 0 12px;
}
.au-identity .au-logo { display: inline-flex; align-items: center; }
.au-identity .au-logo img { height: 28px; width: auto; display: block; }
.au-h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--ss-text);
}
.au-back {
  font-size: 14px;
  color: var(--ss-text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color var(--ss-transition, 120ms ease);
}
.au-back:hover { color: var(--ss-text); }

/* ---------- 2. Sticky switch (Sign in / Create account) ---------- */
.au-switch {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 4px 0 0;
  margin-bottom: 24px;
  background: var(--ss-bg);
  border-bottom: 1px solid var(--ss-border);
}
.au-tab {
  appearance: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ss-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color var(--ss-transition, 120ms ease),
              border-color var(--ss-transition, 120ms ease);
}
.au-tab:hover { color: var(--ss-text); }
.au-tab.is-active {
  color: var(--ss-text);
  border-bottom-color: var(--ss-text);
}

/* ---------- 3. Split: form column + quiet aside ---------- */
.au-split {
  display: grid;
  grid-template-columns: minmax(0, 460px) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.au-main { min-width: 0; }

.au-aside {
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius, 8px);
  box-shadow: var(--ss-shadow);
  padding: 24px;
}
.au-aside-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ss-text-muted);
}
.au-aside ul { list-style: none; margin: 0; padding: 0; }
.au-aside li {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ss-text);
  padding: 12px 0;
  border-top: 1px solid var(--ss-border);
}
.au-aside li:first-child { border-top: 0; padding-top: 0; }
.au-aside li:last-child { padding-bottom: 0; }

/* ---------- 4. Panel head + alert ---------- */
.au-panelhead { margin-bottom: 16px; }
.au-panelhead .au-h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ss-text);
}
.au-sub {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--ss-text-muted);
}

/* Reused by #authAlert — a fixed home for messages, above the form. */
.au-alert {
  display: none;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius, 8px);
  background: var(--ss-surface-2);
  color: var(--ss-text);
  font-size: 13px;
  line-height: 1.5;
}
.au-alert.show { display: flex; }
.au-alert i { margin-top: 2px; }
.au-alert.error { border-color: #b91c1c; color: #dc2626; }
[data-theme="dark"] .au-alert.error { border-color: #7f1d1d; color: #fca5a5; }
.au-alert.success { border-color: #15803d; color: #15803d; }
[data-theme="dark"] .au-alert.success { border-color: #166534; color: #86efac; }

/* ---------- 5. Panel + groups ---------- */
.au-panel {
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius, 8px);
  box-shadow: var(--ss-shadow);
  padding: 24px;
}
.au-group + .au-group { margin-top: 32px; }
.au-group-title {
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ss-text-muted);
}

/* ---------- 6. One field shape ---------- */
.au-field + .au-field { margin-top: 16px; }
.au-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ss-text);
}
.au-control { position: relative; }
.au-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ss-text);
  background: var(--ss-bg);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius, 8px);
  box-shadow: none;
  transition: border-color var(--ss-transition, 120ms ease);
}
.au-input::placeholder { color: var(--ss-text-muted); }
.au-input:hover { border-color: var(--ss-border-strong); }
.au-input:focus {
  border-color: var(--ss-border-strong);
  box-shadow: none;
  outline: none;
}
.au-input:focus-visible {
  border-color: var(--ss-border-strong);
  outline: 2px solid var(--ss-border-strong);
  outline-offset: 1px;
}
/* Room for the eye / availability icon */
.au-control.has-action .au-input { padding-right: 44px; }

.au-eye {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--ss-radius, 8px);
  background: transparent;
  color: var(--ss-text-muted);
  cursor: pointer;
  transition: color var(--ss-transition, 120ms ease),
              background-color var(--ss-transition, 120ms ease);
}
.au-eye:hover { color: var(--ss-text); background: var(--ss-surface-2); }

/* Username / email availability tick (script toggles .is-valid/.is-invalid) */
.au-control .validity {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ss-transition, 120ms ease);
}
.au-control.is-valid .validity { color: #16a34a; opacity: 1; }
.au-control.is-invalid .validity { color: #dc2626; opacity: 1; }

.au-hint {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ss-text-muted);
}

/* Reserved error slot — never shifts the layout when a message appears. */
.au-error {
  display: block;
  min-height: 18px;
  margin-top: 4px;
  font-size: 13px;
  line-height: 18px;
  color: #dc2626;
}
[data-theme="dark"] .au-error { color: #fca5a5; }
.au-error:empty { color: transparent; }

/* ---------- 7. Password strength (one inline line + chips) ---------- */
.au-pw { margin-top: 8px; }
.au-pw-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--ss-text-muted);
}
.au-pw-track {
  height: 4px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--ss-surface-2);
  overflow: hidden;
}
.au-pw-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--ss-text-muted);
  transition: width 120ms ease;
}
.au-pw[data-score="1"] .au-pw-fill { width: 25%; }
.au-pw[data-score="2"] .au-pw-fill { width: 50%; }
.au-pw[data-score="3"] .au-pw-fill { width: 75%; }
.au-pw[data-score="4"] .au-pw-fill { width: 100%; background: var(--ss-text); }

.au-pw-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.au-pw-rules .pw-hint {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius-chip, 6px);
  background: var(--ss-bg);
  color: var(--ss-text-muted);
}
.au-pw-rules .pw-hint.ok {
  border-color: var(--ss-border-strong);
  color: var(--ss-text);
}

/* ---------- 8. Inline rows (remember / forgot, terms) ---------- */
.au-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  font-size: 14px;
}
.au-check {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ss-text);
  cursor: pointer;
  line-height: 1.4;
}
.au-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  flex-shrink: 0;
  accent-color: var(--ss-primary-bg);
}
.au-link {
  color: var(--ss-text);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.au-link:hover { color: var(--ss-text-muted); }

/* Turnstile — bare widget, no box, no icon */
.au-turnstile { min-height: 65px; }
.au-turnstile iframe { border-radius: var(--ss-radius, 8px); }

/* ---------- 9. Buttons: map 1:1 to gs-btn-* ---------- */
.au-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--ss-radius, 8px);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color var(--ss-transition, 120ms ease),
              border-color var(--ss-transition, 120ms ease),
              color var(--ss-transition, 120ms ease);
}
.au-btn i { font-size: 16px; }
.au-btn:disabled { opacity: .55; cursor: not-allowed; }
.au-btn-full { width: 100%; }

.au-btn-primary {
  background: var(--ss-primary-bg);
  color: var(--ss-primary-fg);
}
.au-btn-primary:hover:not(:disabled) { background: var(--ss-primary-bg-hover); }

.au-btn-secondary {
  background: var(--ss-secondary-bg);
  color: var(--ss-secondary-fg);
  border-color: var(--ss-secondary-border);
}
.au-btn-secondary:hover:not(:disabled) { background: var(--ss-secondary-bg-hover); }

.au-btn-ghost { background: transparent; color: var(--ss-ghost-fg); }
.au-btn-ghost:hover:not(:disabled) { background: var(--ss-ghost-bg-hover); color: var(--ss-text); }

/* ---------- 10. Actions + footer ---------- */
.au-actions {
  margin-top: 16px;
  padding: 16px;
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius, 8px);
  box-shadow: var(--ss-shadow);
}
.au-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
  font-size: 13px;
  color: var(--ss-text-muted);
}
.au-or::before,
.au-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ss-border);
}
.au-footer {
  margin-top: 16px;
  font-size: 14px;
  color: var(--ss-text-muted);
}
.au-footer a {
  color: var(--ss-text);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- 11. Responsive: one breakpoint each ---------- */
@media (max-width: 900px) {
  .au-split { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .au-aside { display: none; }
}

@media (max-width: 480px) {
  .au-shell { padding-bottom: 96px; }
  .au-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    border-radius: var(--ss-radius, 8px) var(--ss-radius, 8px) 0 0;
    border-bottom: 0;
  }
}

/* ---------- 12. Forgot-password modal, same tokens ---------- */
.au-modal .modal {
  background: var(--ss-surface);
  border: 1px solid var(--ss-border);
  border-radius: var(--ss-radius, 8px);
  box-shadow: var(--ss-shadow);
  color: var(--ss-text);
}
.au-modal .modal-title { font-size: 16px; font-weight: 600; color: var(--ss-text); }
.au-modal .modal-header,
.au-modal .modal-footer { border-color: var(--ss-border); }
.au-modal .modal-close { color: var(--ss-text-muted); }
.au-modal .modal-close:hover { color: var(--ss-text); }

/* Inline submit spinner inherits the button's own text colour so it stays
   visible on both the light and dark primary button. */
.au-btn .spinner {
  border-color: currentColor !important;
  border-top-color: transparent !important;
}
