/*
 * "ganaDOS Command" auth pages — sign in, sign up, password recovery.
 * Tokens sourced from docs/design.md (colors, typography, spacing, shape).
 */

:root {
  --ge-primary: #1b3022;
  --ge-primary-deep: #061b0e;
  --ge-on-primary: #ffffff;
  --ge-on-primary-container: #819986;
  --ge-secondary: #fed65b;
  --ge-on-secondary-container: #745c00;
  --ge-tertiary: #e47326;
  --ge-error: #ba1a1a;
  --ge-error-container: #ffdad6;
  --ge-on-error-container: #93000a;
  --ge-surface: #f9f9fc;
  --ge-surface-container-lowest: #ffffff;
  --ge-on-surface: #1a1c1e;
  --ge-on-surface-variant: #434843;
  --ge-outline: #737973;
  --ge-outline-variant: #c3c8c1;
}

body.auth-body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--ge-surface);
  color: var(--ge-on-surface);
}

/* --- Shared signed-in app shell (topbar), used by the onboarding and account layouts --- */

body.app-shell {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--ge-surface);
  color: var(--ge-on-surface);
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--ge-outline-variant);
  background: var(--ge-surface-container-lowest);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Hanken Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--ge-primary);
  text-decoration: none;
}

.app-brand .mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.375rem;
  background: var(--ge-secondary);
  color: var(--ge-primary-deep);
}

.app-topbar .signout {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ge-on-surface-variant);
  text-decoration: none;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.app-topbar .signout:hover { color: var(--ge-on-surface); }

.app-topbar-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.app-topbar-nav a, .app-topbar-nav .signout {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ge-on-surface-variant);
  text-decoration: none;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.app-topbar-nav a:hover, .app-topbar-nav .signout:hover { color: var(--ge-on-surface); }

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr);
  min-height: 100vh;
}

/* --- Visual panel (left) --------------------------------------------- */

.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  color: var(--ge-on-primary);
}

/* No photo supplied (password pages) — the original gradient + dot-grid "Command Center" texture. */
.auth-visual--pattern {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.08) 1px, transparent 0),
    linear-gradient(160deg, var(--ge-primary-deep) 0%, var(--ge-primary) 55%, #2f3133 100%);
  background-size: 28px 28px, cover;
}

.auth-visual--pattern::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(228, 115, 38, 0.16), transparent 55%);
  pointer-events: none;
}

/* Photo supplied (login/sign up) — a dark scrim keeps the logo and copy legible over the image. */
.auth-visual--photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 27, 14, 0.35) 0%, rgba(6, 27, 14, 0.25) 38%, rgba(6, 27, 14, 0.95) 100%);
  pointer-events: none;
}

.auth-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Hanken Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
}

.auth-brand .mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: var(--ge-secondary);
  color: var(--ge-primary-deep);
}

.auth-visual-stats {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.auth-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--ge-on-primary);
}

.auth-stat-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: var(--ge-tertiary);
  box-shadow: 0 0 0 3px rgba(228, 115, 38, 0.25);
}

.auth-visual-body {
  position: relative;
  z-index: 1;
  max-width: 30rem;
}

.auth-visual-body h1 {
  font-family: "Hanken Grotesk", sans-serif;
  font-weight: 700;
  font-size: 2.25rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

.auth-visual-body p {
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
}

.auth-steps {
  position: relative;
  z-index: 1;
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
}

.auth-step {
  display: flex;
  gap: 0.75rem;
  padding: 0.625rem 0;
}

.auth-step + .auth-step {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-step .num {
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 500;
}

.auth-step h3 {
  margin: 0 0 0.125rem;
  font-family: "Hanken Grotesk", sans-serif;
  font-weight: 600;
  font-size: 0.9375rem;
}

.auth-step p {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.68);
}

/* --- Form panel (right) ----------------------------------------------- */

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  background: var(--ge-surface-container-lowest);
}

.auth-panel-inner {
  width: 100%;
  max-width: 24rem;
}

.auth-panel-inner h1 {
  font-family: "Hanken Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  margin: 0 0 0.25rem;
  color: var(--ge-on-surface);
}

.auth-subtitle {
  font-size: 0.9375rem;
  color: var(--ge-on-surface-variant);
  margin: 0 0 2rem;
}

.auth-field {
  margin-bottom: 1.125rem;
}

.auth-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.375rem;
}

.auth-field label {
  font-family: "Hanken Grotesk", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ge-on-surface-variant);
}

.auth-field-head a {
  font-size: 0.8125rem;
  color: var(--ge-on-surface);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-wrap svg {
  position: absolute;
  left: 0.75rem;
  width: 1rem;
  height: 1rem;
  color: var(--ge-outline);
  pointer-events: none;
}

.auth-input-wrap input {
  width: 100%;
  padding: 0.75rem 0.875rem 0.75rem 2.5rem;
  border: 1px solid var(--ge-outline-variant);
  border-radius: 0.25rem;
  background: var(--ge-surface);
  font-family: "Inter", sans-serif;
  font-size: 0.9375rem;
  color: var(--ge-on-surface);
}

.auth-input-wrap input:focus {
  outline: 2px solid var(--ge-primary);
  outline-offset: 1px;
  background: var(--ge-surface-container-lowest);
}

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--ge-on-surface-variant);
  margin-bottom: 1.5rem;
}

.auth-checkbox input { width: 1rem; height: 1rem; }

.auth-submit {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--ge-secondary);
  color: var(--ge-on-secondary-container);
  font-family: "Hanken Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.auth-submit:hover { filter: brightness(0.96); }
.auth-submit svg { width: 1rem; height: 1rem; }

.auth-links {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--ge-on-surface-variant);
}

.auth-links a {
  color: var(--ge-on-surface);
  font-weight: 600;
  text-decoration: none;
}

.auth-links a:hover { text-decoration: underline; }

.btn-link-inline {
  background: none;
  border: none;
  padding: 0;
  color: var(--ge-on-surface);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-link-inline:hover { text-decoration: underline; }

.auth-footnote {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ge-outline-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--ge-outline);
}

.auth-footnote svg { width: 0.875rem; height: 0.875rem; }

.auth-hint {
  font-size: 0.75rem;
  color: var(--ge-on-surface-variant);
  margin-top: 0.375rem;
  display: block;
}

.auth-flash {
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.auth-flash.notice { background: #e8f4ea; color: var(--ge-primary); }
.auth-flash.alert { background: var(--ge-error-container); color: var(--ge-on-error-container); }

#error_explanation {
  background: var(--ge-error-container);
  border: 1px solid var(--ge-error);
  color: var(--ge-on-error-container);
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  margin-bottom: 1.25rem;
  font-size: 0.8125rem;
}

.field_with_errors input { border-color: var(--ge-error) !important; }

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { min-height: 240px; }
  .auth-steps { display: none; }
}
