@import url("chc-tokens.css");

:root {
  --line-dark: rgba(32, 48, 63, 0.12);
  --line: rgba(255, 255, 255, 0.14);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --shadow: 0 28px 60px rgba(4, 18, 36, 0.35);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--night);
  -webkit-font-smoothing: antialiased;
}

body.chc-auth-body {
  min-height: 100vh;
  overflow-x: hidden;
}

/* Full-bleed night sky stage */
.chc-auth-stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  align-items: center;
  gap: clamp(28px, 4vw, 56px);
  padding: clamp(28px, 5vw, 64px) clamp(20px, 5vw, 72px);
  background:
    radial-gradient(900px 520px at 12% 18%, rgba(26, 122, 76, 0.22), transparent 58%),
    radial-gradient(700px 420px at 78% 88%, rgba(201, 162, 74, 0.14), transparent 55%),
    linear-gradient(145deg, #07182a 0%, #0d2440 42%, #123a5c 100%);
  color: #e8eef4;
}

.chc-auth-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.11;
  background: repeating-conic-gradient(from 45deg, #f0d79c 0 1deg, transparent 1deg 14deg);
  mask-image: radial-gradient(circle at 80% -10%, #000, transparent 58%);
}

.chc-auth-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.7) 0 0.7px, transparent 1.1px);
  background-size: 64px 64px;
  opacity: 0.22;
  mask-image: linear-gradient(#000, transparent 78%);
  animation: chc-drift 48s linear infinite;
}

@keyframes chc-drift {
  from { background-position: 0 0; }
  to { background-position: 64px 48px; }
}

@keyframes chc-rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes chc-moon {
  from { opacity: 0; transform: scale(0.85) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.chc-auth-copy,
.chc-auth-panel {
  position: relative;
  z-index: 2;
}

.chc-auth-copy {
  max-width: 560px;
  animation: chc-rise 0.7s ease both;
}

.chc-auth-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #a9bbc9;
  text-decoration: none;
  transition: color 0.2s, transform 0.2s;
}

.chc-auth-back:hover {
  color: var(--gold-soft);
  transform: translateX(-2px);
}

.chc-auth-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.chc-auth-logo-plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 8px 10px;
  border-radius: 14px;
  background: #fffdf8;
  border: 1px solid rgba(184, 135, 47, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.chc-auth-brand-row img,
.chc-auth-logo-plate img {
  height: 52px;
  width: auto;
  max-width: 150px;
  object-fit: contain;
  filter: none;
  display: block;
}

.chc-auth-brand-row strong {
  display: block;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  color: #f5efe2;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.chc-auth-brand-row small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9fb2c2;
}

.chc-auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin-bottom: 12px;
}

.chc-auth-kicker::before {
  content: "";
  width: 28px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

.chc-auth-copy h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 4.6vw, 52px);
  line-height: 1.08;
  margin: 0 0 14px;
  color: #f7f1e4;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.chc-auth-copy h1 em {
  font-style: italic;
  color: var(--gold-soft);
}

.chc-auth-lede {
  margin: 0 0 26px;
  max-width: 46ch;
  font-size: 15.5px;
  line-height: 1.65;
  color: #b7c6d3;
}

.chc-auth-points {
  display: grid;
  gap: 12px;
  max-width: 460px;
}

.chc-auth-point {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px);
}

.chc-auth-point i {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 18px;
  background: linear-gradient(145deg, rgba(240, 215, 156, 0.18), rgba(26, 122, 76, 0.2));
  border: 1px solid rgba(240, 215, 156, 0.25);
}

.chc-auth-point b {
  display: block;
  font-size: 13px;
  color: var(--gold-soft);
  margin-bottom: 2px;
}

.chc-auth-point span {
  font-size: 12.5px;
  color: #c4d2de;
  line-height: 1.45;
}

.chc-auth-moon {
  position: absolute;
  right: 8%;
  top: 12%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 30%, #f7efd5, #d8c07a 42%, #8a6d2a 100%);
  box-shadow:
    inset -18px -10px 0 0 rgba(7, 24, 42, 0.55),
    0 0 60px rgba(240, 215, 156, 0.25);
  opacity: 0.55;
  z-index: 1;
  animation: chc-moon 1.1s ease both 0.15s;
  pointer-events: none;
}

@media (max-width: 1100px) {
  .chc-auth-moon { width: 88px; height: 88px; right: 4%; top: 8%; opacity: 0.4; }
}

/* Form panel */
.chc-auth-panel {
  width: min(480px, 100%);
  justify-self: end;
  animation: chc-rise 0.75s ease both 0.12s;
}

.chc-auth-card {
  background: linear-gradient(180deg, #fffef9 0%, #f8f4eb 100%);
  border: 1px solid rgba(240, 215, 156, 0.35);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  color: var(--ink);
}

.chc-auth-tabs {
  display: flex;
  background: linear-gradient(140deg, #0d2440, #16406e);
}

.chc-auth-tabs a {
  flex: 1;
  text-align: center;
  color: #9fb2c2;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 18px 12px;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.chc-auth-tabs a:hover { color: #f2ede0; }

.chc-auth-tabs a.on {
  color: #f5e5bb;
  border-bottom-color: #e6c987;
  background: rgba(255, 255, 255, 0.06);
}

.chc-auth-pad {
  padding: 32px 32px 34px;
  display: grid;
  gap: 20px;
}

.chc-auth-pad > form {
  display: grid;
  gap: 18px;
  margin: 0;
}

.chc-auth-hello {
  text-align: center;
  margin-bottom: 4px;
  padding-bottom: 4px;
}

.chc-auth-hello h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  color: var(--navy);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.chc-auth-hello p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
}

.chc-auth-field {
  display: grid;
  gap: 9px;
}

.chc-auth-field > label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.chc-auth-input,
.chc-auth-field .form-control,
.chc-auth-field select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line-dark);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  padding: 12px 16px;
  font-size: 14.5px;
  font-family: var(--sans);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chc-auth-input:focus,
.chc-auth-field .form-control:focus,
.chc-auth-field select:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(26, 122, 76, 0.16);
  outline: none;
}

.chc-auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chc-auth-role {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 2px;
}

.chc-auth-role button {
  border: 1.5px solid var(--line-dark);
  border-radius: 14px;
  background: #fff;
  padding: 16px 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.2s;
  font-family: var(--sans);
}

.chc-auth-role button:hover {
  border-color: rgba(26, 122, 76, 0.45);
  transform: translateY(-1px);
}

.chc-auth-role button.on {
  border-color: var(--acc);
  background: var(--acc-soft);
  box-shadow: 0 8px 18px rgba(26, 122, 76, 0.14);
}

.chc-auth-role b {
  display: block;
  font-size: 13px;
  color: var(--navy);
  margin-bottom: 5px;
}

.chc-auth-role span {
  font-size: 11px;
  color: var(--ink-2);
  line-height: 1.4;
}

.chc-auth-btn {
  width: 100%;
  min-height: 52px;
  margin-top: 4px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--sans);
  cursor: pointer;
  letter-spacing: 0.01em;
  box-shadow: 0 14px 30px rgba(26, 122, 76, 0.32);
  transition: transform 0.2s, filter 0.2s, box-shadow 0.2s;
}

.chc-auth-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(26, 122, 76, 0.38);
}

.chc-auth-btn:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

.chc-auth-btn.chc-btn-loading {
  pointer-events: none;
  opacity: 0.78;
}

.chc-btn-loading-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

.chc-btn-spinner.spinner-border,
.spinner-border {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  vertical-align: -0.125em;
  border: 0.15em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: chc-spinner-border 0.75s linear infinite;
}

.spinner-border-sm {
  width: 0.95rem;
  height: 0.95rem;
  border-width: 0.15em;
}

@keyframes chc-spinner-border {
  to { transform: rotate(360deg); }
}

.chc-auth-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-3);
}

.chc-auth-links a {
  color: var(--acc-2);
  font-weight: 700;
  text-decoration: none;
}

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

.chc-auth-check {
  display: flex;
  gap: 12px;
  align-items: start;
  margin-top: 2px;
  padding: 4px 0;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.5;
}

.chc-auth-check input {
  margin-top: 3px;
  accent-color: var(--acc);
}

.chc-auth-alert {
  display: none;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 13px;
}

.chc-auth-alert.is-visible { display: block; }

.chc-auth-alert.is-error {
  background: #fdeceb;
  color: #8a3735;
  border: 1px solid #f0c4c2;
}

.chc-auth-alert.is-success {
  background: var(--acc-soft);
  color: var(--acc-2);
  border: 1px solid rgba(26, 122, 76, 0.28);
}

.chc-auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.chc-password-field { position: relative; }

.chc-password-field .chc-auth-input,
.chc-password-field .form-control {
  padding-right: 52px;
}

.chc-password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--sans);
}

.chc-password-toggle:hover { color: var(--navy); }

.text-danger {
  font-size: 12px;
  color: #cf5a5f;
  line-height: 1.35;
}

.text-danger:empty,
.field-validation-valid {
  display: none !important;
}

.form-floating { display: none; }

@media (max-width: 920px) {
  .chc-auth-stage {
    grid-template-columns: 1fr;
    padding: 28px 18px 40px;
    gap: 28px;
  }

  .chc-auth-panel {
    justify-self: stretch;
    width: 100%;
    max-width: 460px;
    margin-inline: auto;
  }

  .chc-auth-copy {
    max-width: none;
    text-align: left;
  }

  .chc-auth-moon { display: none; }

  .chc-auth-points { max-width: none; }
}

@media (max-width: 520px) {
  .chc-auth-grid,
  .chc-auth-role { grid-template-columns: 1fr; }

  .chc-auth-pad {
    padding: 26px 20px 28px;
    gap: 18px;
  }

  .chc-auth-pad > form { gap: 16px; }

  .chc-auth-copy h1 { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .chc-auth-stage::after,
  .chc-auth-copy,
  .chc-auth-panel,
  .chc-auth-moon {
    animation: none !important;
  }
}
