/* Sign-in, registration and password reset pages. Colours come from theme.css tokens. */

html:has(.auth-body) { height: auto; min-height: 100%; background: var(--bg-gradient) fixed; }

.auth-body {
  margin: 0;
  height: auto;
  overflow-x: hidden;
  min-height: 100vh;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
}

[data-theme="dark"] .logo-light,
[data-theme="light"] .logo-dark,
:root:not([data-theme]) .logo-light { display: none; }

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

@media (min-width: 960px) {
  .auth-shell { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
}

/* --- Brand panel ---------------------------------------------------------------- */

.auth-aside {
  display: none;
  position: relative;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem 3rem;
  color: #e6fffa;
  background: linear-gradient(160deg, #0b1220 0%, #0f2a2a 55%, #0f766e 120%);
  isolation: isolate;
}

@media (min-width: 960px) {
  .auth-aside { display: flex; position: sticky; top: 0; height: 100vh; }
}

.auth-glow {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: auth-float 14s ease-in-out infinite alternate;
}

.auth-glow-1 { width: 360px; height: 360px; top: -90px; right: -110px; background: #14b8a6; }
.auth-glow-2 { width: 300px; height: 300px; bottom: -80px; left: -90px; background: #0e7490; animation-delay: -7s; }

@keyframes auth-float {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-30px, 40px) scale(1.12); }
}

.auth-aside-logo img { display: block; height: 34px; width: auto; }

.auth-aside-copy { max-width: 30rem; }

.auth-eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5eead4;
}

.auth-aside h2 {
  margin: 0 0 1.75rem;
  font-size: clamp(1.75rem, 2.6vw, 2.4rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }

.auth-points li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #ccfbf1;
  opacity: 0;
  animation: auth-rise 0.6s ease forwards;
}

.auth-points li:nth-child(2) { animation-delay: 0.1s; }
.auth-points li:nth-child(3) { animation-delay: 0.2s; }
.auth-points li:nth-child(4) { animation-delay: 0.3s; }

.auth-tick {
  flex: none;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.05rem;
  border-radius: 50%;
  background: rgba(20, 184, 166, 0.2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235eead4' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 0.8rem no-repeat;
  border: 1px solid rgba(94, 234, 212, 0.35);
}

.auth-aside-foot { margin: 0; font-size: 0.8rem; color: rgba(204, 251, 241, 0.6); }

@keyframes auth-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --- Form side ------------------------------------------------------------------ */

.auth-main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }

.auth-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
}

.auth-top-logo { margin-right: auto; display: inline-flex; }
.auth-top-logo img { display: block; height: 28px; width: auto; }

@media (min-width: 960px) {
  .auth-top-logo { visibility: hidden; }
}

.auth-home-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
}

.auth-home-link:hover { color: var(--text-primary); background: var(--nav-hover-bg); }

.auth-theme {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.auth-theme:hover { transform: rotate(25deg); }
.auth-theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.auth-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 1rem 2.5rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  animation: auth-rise 0.45s ease both;
}

.auth-card-wide { max-width: 640px; }

@media (max-width: 480px) {
  .auth-card { padding: 1.5rem 1.25rem; border-radius: 14px; }
}

.auth-title {
  margin: 0 0 0.35rem;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.auth-subtitle {
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.auth-subtitle strong { color: var(--text-primary); }

.auth-after { margin-top: 1.25rem; font-size: 0.875rem; }
.auth-after a { color: var(--text-muted); text-decoration: none; }
.auth-after a:hover { color: var(--accent); }

/* Inputs with a leading icon */
.auth-input { position: relative; }

.auth-input-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  z-index: 1;
}

.auth-input .form-control { padding-left: 2.5rem; }

.auth-form .form-control {
  min-height: 2.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-form .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  outline: none;
}

.auth-form .has-error .form-control,
.auth-form .form-control[aria-invalid="true"] {
  border-color: var(--danger);
}

.auth-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.auth-label-row label { margin-bottom: 0.35rem; }

.auth-small-link { font-size: 0.8rem; font-weight: 500; color: var(--accent); text-decoration: none; }
.auth-small-link:hover { text-decoration: underline; }

.auth-req { color: var(--danger); }
.auth-optional { font-size: 0.72rem; font-weight: 400; color: var(--text-muted); }

.auth-caps { margin-top: 0.35rem; font-size: 0.78rem; color: var(--warning); }

.auth-submit {
  width: 100%;
  min-height: 2.75rem;
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
}

.auth-submit[aria-busy="true"] { cursor: progress; opacity: 0.85; }

.auth-submit[aria-busy="true"]::before {
  content: "";
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: auth-spin 0.7s linear infinite;
}

@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-alt { width: 100%; min-height: 2.6rem; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.auth-divider::before,
.auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--surface-border); }

.auth-note { margin: 1rem 0 0; font-size: 0.8rem; line-height: 1.5; text-align: center; color: var(--text-muted); }

/* Icon badge at the top of a card */
.auth-badge {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1rem;
  border-radius: 14px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.auth-badge svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.auth-badge-success { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); border-color: color-mix(in srgb, var(--success) 40%, transparent); border-radius: 50%; }

.auth-check { stroke-dasharray: 30; stroke-dashoffset: 30; animation: auth-draw 0.6s 0.25s ease forwards; }

@keyframes auth-draw { to { stroke-dashoffset: 0; } }

/* Step indicator for password reset */
.auth-steps {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.auth-steps li { flex: 1; display: flex; align-items: center; gap: 0.4rem; padding-top: 0.55rem; border-top: 3px solid var(--surface-border); }
.auth-steps span { display: grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 50%; font-size: 0.68rem; font-weight: 700; background: var(--surface-border); color: var(--text-primary); }
.auth-steps .is-current { color: var(--text-primary); font-weight: 600; border-top-color: var(--accent); }
.auth-steps .is-current span { background: var(--accent); color: var(--btn-primary-text); }
.auth-steps .is-done { border-top-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.auth-steps .is-done span { background: color-mix(in srgb, var(--accent) 30%, transparent); }

@media (max-width: 400px) {
  .auth-steps li { font-size: 0; gap: 0; }
  .auth-steps span { font-size: 0.68rem; }
}

/* One-time code */
.auth-otp {
  text-align: center;
  font-size: 1.5rem !important;
  font-weight: 600;
  letter-spacing: 0.45em;
  font-variant-numeric: tabular-nums;
  padding-left: 0.45em !important;
}

.auth-otp::placeholder { color: var(--text-muted); opacity: 0.45; }

.auth-resend { margin-top: 1rem; display: flex; justify-content: center; align-items: center; gap: 0.35rem; flex-wrap: wrap; font-size: 0.85rem; }

.auth-link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
}

.auth-link-btn:hover:not(:disabled) { text-decoration: underline; }
.auth-link-btn:disabled { color: var(--text-muted); cursor: default; font-weight: 500; }

/* Password strength */
.auth-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.3rem; margin-top: 0.5rem; }
.auth-meter span { height: 4px; border-radius: 4px; background: var(--surface-border); transition: background 0.2s ease; }
.auth-meter[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.auth-meter[data-score="2"] span:nth-child(-n+2) { background: var(--warning); }
.auth-meter[data-score="3"] span:nth-child(-n+3) { background: #a3e635; }
.auth-meter[data-score="4"] span { background: var(--success); }
.text-success-soft { color: var(--success); }

/* Registration sections */
.auth-section { margin: 0 0 1.25rem; padding: 0; border: 0; min-width: 0; }

/* Floated so the section divider line doesn't run through the legend. */
.auth-section legend {
  float: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.9rem;
  padding: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.auth-section-no {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.auth-section legend + * { clear: both; }
.auth-section + .auth-section { padding-top: 1.25rem; border-top: 1px solid var(--surface-border); }

.auth-grid { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 1rem; }

@media (min-width: 560px) {
  .auth-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-span-2 { grid-column: span 2; }
}

.auth-grid .form-group { margin-bottom: 0.9rem; }
.auth-form textarea.form-control { resize: vertical; min-height: 4rem; }

/* What happens next (after registering) */
.auth-next { list-style: none; counter-reset: next; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.9rem; }

.auth-next li {
  counter-increment: next;
  position: relative;
  padding-left: 2.4rem;
  display: grid;
  gap: 0.15rem;
  font-size: 0.875rem;
}

.auth-next li::before {
  content: counter(next);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.auth-next span { color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  .auth-glow, .auth-points li, .auth-card, .auth-check { animation: none !important; opacity: 1 !important; stroke-dashoffset: 0 !important; }
}
