/**
 * OncFlow authentication screens ONLY (login / register / logout / password reset).
 * Loaded exclusively from users/auth_base.html — does not depend on main.css or style2.css.
 */

:root {
  --oa-primary: #0066a1;
  --oa-accent: #0e7490;
  --oa-bg: #f8fcfe;
  --oa-text: #2c3e50;
  --oa-surface: #ffffff;
  --oa-border: #c8e4ed;
  --oa-muted: #5b6f84;
  --oa-shadow: 0 16px 48px rgba(0, 102, 161, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body.oncflow-auth-app {
  margin: 0;
  min-height: 100%;
  background-color: var(--oa-bg);
  color: var(--oa-text);
  font-family: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Kill any stray inherited margins from browser defaults on headings inside auth */
body.oncflow-auth-app h1,
body.oncflow-auth-app h2,
body.oncflow-auth-app h3 {
  font-family: inherit;
}

/* ----- Global Django messages ----- */
.onc-auth-global-msgs {
  position: relative;
  z-index: 10;
  padding: 1rem 1.25rem 0;
  max-width: 900px;
  margin: 0 auto;
}

.onc-auth-global-msgs .alert {
  border-radius: 10px;
}

/* ----- Split shell (~60% | ~40%) ----- */
.onc-auth-shell {
  --onc-auth-primary: var(--oa-primary);
  --onc-auth-accent: var(--oa-accent);
  --onc-auth-bg: var(--oa-bg);
  --onc-auth-text: var(--oa-text);
  --onc-auth-surface: var(--oa-surface);
  --onc-auth-border: var(--oa-border);
  --onc-auth-muted: var(--oa-muted);
  --onc-auth-shadow: var(--oa-shadow);

  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  min-height: 100vh;
  width: 100%;
  align-items: stretch;
}

.onc-auth-brand {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.12), transparent 42%),
    radial-gradient(circle at 88% 78%, rgba(20, 184, 166, 0.35), transparent 48%),
    linear-gradient(118deg, #05445e 0%, #0066a1 42%, #0d9488 92%);
  padding: 3rem 3rem 3rem 3.5rem;
  display: flex;
  align-items: center;
}

.onc-auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.2;
  pointer-events: none;
}

.onc-auth-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 520px;
  color: #f8fbff;
  animation: oncAuthFadeIn 380ms ease-out;
}

.onc-auth-logo-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.onc-auth-logo-mark {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.onc-auth-logo-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.onc-auth-product-name {
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.onc-auth-product-tm {
  font-size: 0.55em;
  font-weight: 500;
  line-height: 0;
  vertical-align: super;
  margin-left: 0.05em;
  opacity: 0.88;
}

.onc-auth-product-byline {
  color: rgba(248, 251, 255, 0.72);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.onc-auth-logo-img {
  height: 44px;
  width: auto;
  max-width: min(240px, 100%);
  object-fit: contain;
}

.onc-auth-kicker {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.15rem;
}

.onc-auth-brand h1 {
  font-size: clamp(1.55rem, 2.2vw, 2.15rem);
  line-height: 1.25;
  margin-bottom: 1rem;
  color: #ffffff;
  font-weight: 700;
}

.onc-auth-subtitle {
  color: rgba(248, 251, 255, 0.94);
  margin-bottom: 0.85rem;
  max-width: 54ch;
  font-size: 0.97rem;
  line-height: 1.58;
}

.onc-auth-subtitle-secondary {
  margin-bottom: 1.15rem;
  color: rgba(248, 251, 255, 0.86);
  font-size: 0.93rem;
}

.onc-auth-guidelines-line {
  margin: 0 0 1.1rem;
  font-size: 0.86rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.84);
  max-width: 48ch;
}

.onc-auth-story {
  margin: 0 0 1rem;
  padding-left: 0.85rem;
  border-left: 3px solid rgba(255, 255, 255, 0.35);
  font-size: 0.88rem;
  line-height: 1.52;
  color: rgba(255, 255, 255, 0.88);
}

.onc-auth-story strong {
  color: #ffffff;
  font-weight: 600;
}

.onc-auth-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.onc-auth-stats.onc-auth-stats-stack {
  grid-template-columns: 1fr;
  gap: 0.55rem;
  max-width: 280px;
  margin-top: 0.15rem;
}

.onc-auth-stats-stack .onc-auth-stat-card {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
}

.onc-auth-stats-stack .onc-auth-stat-card h3 {
  min-width: 4.5rem;
  margin: 0;
  font-size: 1.05rem;
}

.onc-auth-stats-stack .onc-auth-stat-card p {
  font-size: 0.82rem;
  line-height: 1.35;
}

.onc-auth-stat-card {
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(2px);
}

.onc-auth-stat-card h3 {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #ffffff;
  margin: 0 0 0.2rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.onc-auth-stat-info-wrap {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  transform: translateY(-1px);
}

.onc-auth-stat-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.95rem;
  height: 0.95rem;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.62rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
}

.onc-auth-stat-info:hover,
.onc-auth-stat-info:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 1px;
}

.onc-auth-stat-info-wrap.is-open .onc-auth-stat-info {
  background: rgba(255, 255, 255, 0.24);
}

.onc-auth-stat-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 0.4rem);
  z-index: 6;
  width: max-content;
  max-width: 15rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  background: rgba(4, 36, 56, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  color: rgba(248, 251, 255, 0.95);
  font-size: 0.72rem;
  font-weight: 500;
  font-style: normal;
  font-family: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  line-height: 1.4;
  text-align: left;
}

.onc-auth-stat-card p {
  margin: 0;
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.9);
}

.onc-auth-trust,
.onc-auth-tagline {
  margin: 0.85rem 0 0;
  font-size: 0.9rem;
  color: rgba(248, 251, 255, 0.93);
}

.onc-auth-trust {
  letter-spacing: 0.02em;
}

.onc-auth-login .onc-auth-trust {
  margin-top: 1rem;
}

.onc-auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--onc-auth-bg);
}

.onc-auth-shell > aside,
.onc-auth-shell > main {
  min-width: 0;
}

.onc-auth-card {
  width: 100%;
  max-width: 460px;
  border-radius: 18px;
  border: 1px solid var(--onc-auth-border);
  box-shadow: var(--onc-auth-shadow);
  background: var(--onc-auth-surface);
  padding: 2rem 1.8rem;
  animation: oncAuthUp 420ms ease-out;
}

.onc-auth-card-lg {
  max-width: 560px;
}

.onc-auth-card h2 {
  margin-bottom: 0.25rem;
  color: var(--onc-auth-text);
  font-size: 1.6rem;
  font-weight: 700;
}

.onc-auth-card-subtitle {
  color: var(--onc-auth-muted);
  margin-bottom: 1.2rem;
}

.onc-auth-form hr {
  margin: 1.2rem 0;
  border-color: #e9eff6;
}

.onc-auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.onc-auth-field label,
.onc-auth-card .form-label {
  font-weight: 600;
  color: #324155;
}

.onc-auth-field input,
.onc-auth-field select,
.onc-auth-field textarea,
.onc-auth-card .form-control {
  min-height: 48px;
  border-radius: 10px;
  border-color: #c9d8e7;
}

.onc-auth-field input:focus,
.onc-auth-field select:focus,
.onc-auth-field textarea:focus,
.onc-auth-card .form-control:focus {
  border-color: rgba(14, 116, 144, 0.7);
  box-shadow: 0 0 0 0.2rem rgba(14, 116, 144, 0.16);
}

.onc-auth-links a,
.onc-auth-form a {
  color: var(--onc-auth-primary);
  font-weight: 600;
  text-decoration: none;
}

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

.onc-auth-footnote {
  font-size: 0.9rem;
  color: var(--onc-auth-muted);
  margin: 0;
}

.onc-auth-footnote a {
  color: var(--onc-auth-primary);
  font-weight: 600;
}

.password-field {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 14px;
  top: 44px;
  border: 0;
  background: transparent;
  color: #60758a;
  cursor: pointer;
  transition: color 0.2s ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--onc-auth-accent);
  outline: none;
}

.onc-auth-btn {
  width: 100%;
  min-height: 46px;
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-weight: 600;
  background: linear-gradient(135deg, #0066a1, #0e7490);
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.onc-auth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(11, 79, 140, 0.25);
  opacity: 0.98;
  color: #fff;
}

.onc-auth-btn:focus-visible {
  outline: 3px solid rgba(14, 116, 144, 0.35);
  outline-offset: 2px;
}

.onc-auth-btn.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.9;
}

.onc-auth-btn.is-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-bottom-color: transparent;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.55rem;
  animation: oncAuthSpin 0.8s linear infinite;
}

.onc-auth-panel .alert {
  border-radius: 10px;
}

@keyframes oncAuthSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes oncAuthFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes oncAuthUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .onc-auth-shell {
    grid-template-columns: 1fr;
  }

  .onc-auth-brand {
    min-height: auto;
    padding: 2rem 1.5rem;
    order: 2;
  }

  .onc-auth-panel {
    padding: 1.5rem 1.25rem;
    order: 1;
  }

  .onc-auth-stats.onc-auth-stats-stack {
    max-width: none;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .onc-auth-stats.onc-auth-stats-stack .onc-auth-stat-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }

  .onc-auth-stats.onc-auth-stats-stack .onc-auth-stat-card h3 {
    min-width: 0;
  }
}

@media (max-width: 767px) {
  .onc-auth-brand {
    display: flex;
    padding: 1.5rem 1.1rem 2rem;
  }

  .onc-auth-brand-inner {
    max-width: none;
  }

  .onc-auth-stats.onc-auth-stats-stack {
    grid-template-columns: 1fr;
  }

  .onc-auth-card,
  .onc-auth-card-lg {
    max-width: 100%;
    padding: 1.3rem 1rem;
    border-radius: 14px;
  }

  .onc-auth-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .onc-auth-brand-inner,
  .onc-auth-card,
  .onc-auth-btn,
  .onc-auth-btn.is-loading::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ----- Self-registration: live password rules + match feedback ----- */
#onc-register-form #hint_id_password1 {
  display: none !important;
}

.onc-pw-rules {
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: #f0f7fb;
  border: 1px solid var(--oa-border);
}

.onc-pw-rules-title {
  margin: 0;
  font-weight: 600;
  color: var(--oa-text);
}

.onc-pw-rules-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.onc-pw-rules-list .onc-pw-rule {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  color: var(--oa-muted);
}

.onc-pw-rules-list .onc-pw-rule:last-child {
  margin-bottom: 0;
}

.onc-pw-rules-list .onc-pw-rule.is-met {
  color: #0f766e;
}

.onc-pw-rules-list .onc-pw-rule.is-unmet {
  color: #64748b;
}

.onc-pw-rule-icon {
  flex-shrink: 0;
  width: 1.15rem;
  text-align: center;
  font-weight: 700;
  line-height: 1.35;
}

.onc-pw-rules-list .onc-pw-rule.is-met .onc-pw-rule-icon::before {
  content: "✓";
  color: #0f766e;
}

.onc-pw-rules-list .onc-pw-rule.is-unmet .onc-pw-rule-icon::before {
  content: "○";
  color: #94a3b8;
  font-weight: 400;
}

.onc-pw-rules-note {
  margin-top: 0.65rem;
  font-size: 0.8rem;
  color: var(--oa-muted);
  line-height: 1.4;
}

.onc-pw-match-feedback {
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 1.35rem;
}

.onc-pw-match-feedback.is-match {
  color: #0f766e;
}

.onc-pw-match-feedback.is-mismatch {
  color: #b91c1c;
}

.onc-register-pw2 input.form-control.is-valid {
  border-color: #14b8a6;
}

.onc-register-pw2 input.form-control.is-invalid {
  border-color: #dc2626;
}
