/* ==========================================================================
   auth.css - shared styles for Django auth templates
     /login/  /register/  /password_reset/  /password_reset_confirm/  /2fa/
   Built on the v4 brand system. Imported alongside site.css + site-v4.css.
   ========================================================================== */

/* Full-viewport split layout: brand panel (left) + form panel (right) */
.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 5fr 7fr;
  background: var(--soft);
  color: var(--ink);
}
@media (max-width: 899px) {
  .auth-layout { grid-template-columns: 1fr; }
}

/* ---------- BRAND PANEL ---------- */
.auth-brand {
  position: relative;
  background:
    radial-gradient(700px 360px at 80% 10%, rgba(255,196,46,.18), transparent 60%),
    radial-gradient(700px 360px at 10% 100%, rgba(237,40,126,.30), transparent 60%),
    linear-gradient(180deg, #A30444 0%, #7C0334 100%);
  color: #fff;
  padding: 3rem 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  isolation: isolate;
}
.auth-brand::before {
  /* faint grain */
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 4px 4px;
  opacity: .5;
  z-index: -1;
}

.auth-brand-head {
  display: flex; align-items: center; gap: 1rem;
  color: #fff;
  text-decoration: none;
}
.auth-brand-head:hover,
.auth-brand-head:focus,
.auth-brand-head:active,
.auth-brand-head:visited { color: #fff; text-decoration: none; }
.auth-brand-head img {
  height: 56px; width: auto;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.25));
}
.auth-brand-head .name {
  display: flex; flex-direction: column; line-height: 1.1;
}
.auth-brand-head .name-1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
}
.auth-brand-head .name-2 { font-size: .78rem; color: rgba(255,255,255,.78); }

.auth-brand-body { max-width: 32ch; }
.auth-brand-eyebrow {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--sun-yellow);
  margin-bottom: 1rem;
}
.auth-brand-tag {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 900;
  font-size: clamp(2.2rem, 4.5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -.02em;
  margin: 0;
  text-wrap: balance;
}
.auth-brand-tag span { display: block; }
/* 3-colour rotation: white -> sun-yellow -> pink-tint -> repeats. */
.auth-brand-tag .word-1,
.auth-brand-tag .word-4,
.auth-brand-tag .word-7 { color: #fff; }
.auth-brand-tag .word-2,
.auth-brand-tag .word-5,
.auth-brand-tag .word-8 { color: var(--sun-yellow); }
.auth-brand-tag .word-3,
.auth-brand-tag .word-6,
.auth-brand-tag .word-9 { color: #ffd9e3; }
.auth-brand-blurb {
  margin-top: 1.25rem;
  font-size: .98rem;
  line-height: 1.55;
  color: rgba(255,255,255,.85);
  max-width: 32ch;
}

.auth-brand-foot {
  font-size: .82rem;
  color: rgba(255,255,255,.75);
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.auth-brand-foot a { color: #fff; text-decoration: none; border-bottom: 1px dotted rgba(255,255,255,.4); }
.auth-brand-foot a:hover { border-bottom-color: var(--sun-yellow); }

/* On narrow screens, condense the brand panel into a slim header */
@media (max-width: 899px) {
  .auth-brand {
    padding: 1.5rem 1.5rem 1.75rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }
  .auth-brand-body, .auth-brand-foot { display: none; }
}

/* ---------- FORM PANEL ---------- */
.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 460px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  padding: 2.25rem 2.25rem 2rem;
  box-shadow: 0 22px 44px -32px rgba(20, 48, 95, .25);
}
@media (max-width: 575px) {
  .auth-main { padding: 1.5rem .85rem; }
  .auth-card { padding: 1.75rem 1.5rem; border-radius: 1rem; }
}

.auth-heading {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.65rem, 2.5vw, 2rem);
  line-height: 1.15;
  letter-spacing: -.01em;
  color: var(--crest-navy);
  margin: 0 0 .5rem;
  text-wrap: balance;
}
.auth-lede {
  font-size: .95rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

/* ---------- FORM CONTROLS ---------- */
.field-group { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .35rem; }
.field-group > label,
.field-group .form-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.field-group .label-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .8rem;
}
.field-group .label-row a {
  color: var(--reach-rose);
  text-decoration: none;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.field-group .label-row a:hover { text-decoration: underline; }

.form-control,
.field-group input[type="text"],
.field-group input[type="email"],
.field-group input[type="password"],
.field-group input[type="tel"],
.field-group select {
  width: 100%;
  padding: .7rem .85rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: .7rem;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.form-control:hover,
.field-group input:hover,
.field-group select:hover { border-color: #cfd5e6; }
.form-control:focus,
.field-group input:focus,
.field-group select:focus {
  outline: 0;
  border-color: var(--reach-rose);
  box-shadow: 0 0 0 4px rgba(163, 4, 68, .12);
  background: #fff;
}

.field-help { font-size: .8rem; color: var(--muted); margin: .2rem 0 0; }
.field-error {
  font-size: .82rem;
  color: var(--reach-rose);
  margin: .25rem 0 0;
  display: flex;
  align-items: flex-start;
  gap: .35rem;
}
.field-error i { margin-top: .15rem; }
.field-group.is-invalid .form-control,
.field-group.is-invalid input { border-color: var(--reach-rose); }

/* Password input with reveal toggle */
.field-pass { position: relative; }
.field-pass input { padding-right: 3rem; }
.pass-toggle {
  position: absolute;
  right: .5rem; top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  border: 0; background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pass-toggle:hover { color: var(--reach-rose); background: var(--soft); }

/* Checkbox row */
.field-check {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .9rem;
  color: var(--ink-2);
  margin-bottom: 1.25rem;
}
.field-check input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--reach-rose);
  cursor: pointer;
}
.field-check label { margin: 0; cursor: pointer; }

/* Role radio chip group (register) */
.role-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}
.role-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem .5rem;
  border: 1.5px solid var(--line);
  border-radius: .7rem;
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.role-chip input { position: absolute; opacity: 0; pointer-events: none; }
.role-chip:hover { border-color: #cfd5e6; }
.role-chip input:checked + i,
.role-chip input:checked ~ * { color: var(--reach-rose); }
.role-chip:has(input:checked) {
  background: var(--rose-100);
  border-color: var(--reach-rose);
  color: var(--reach-rose);
}

/* ---------- SUBMIT BUTTON ---------- */
.btn-auth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  width: 100%;
  padding: .85rem 1.2rem;
  background: var(--reach-rose);
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 12px 22px -12px rgba(163, 4, 68, .55);
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn-auth:hover {
  background: var(--reach-rose-700);
  transform: translateY(-1px);
  box-shadow: 0 16px 30px -14px rgba(163, 4, 68, .6);
}
.btn-auth:active { transform: translateY(0); }
.btn-auth:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
  background: transparent;
  color: var(--crest-navy);
  border: 1.5px solid var(--line);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--soft); color: var(--reach-rose); box-shadow: none; }

/* ---------- FOOTER LINKS BELOW FORM ---------- */
.auth-footer {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: .9rem;
  color: var(--muted);
}
.auth-footer a {
  color: var(--reach-rose);
  font-weight: 600;
  text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }

/* ---------- MESSAGES (Django messages framework) ---------- */
.alert {
  padding: .8rem 1rem;
  border-radius: .7rem;
  font-size: .9rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  border: 1px solid transparent;
}
.alert i { margin-top: .15rem; flex-shrink: 0; }
.alert-success { background: #e6f6ec; border-color: #b8e3c8; color: #1f8550; }
.alert-error,
.alert-danger  { background: #fde8ee; border-color: #f7c3d3; color: #a30444; }
.alert-info    { background: #e9eef9; border-color: #c3d2eb; color: #1E4A8C; }
.alert-warning { background: #fff4cf; border-color: #ffe19a; color: #8a6500; }

/* ---------- OTP / 2FA ---------- */
.otp-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .5rem;
  margin: .5rem 0 1.25rem;
}
.otp-box {
  width: 100%;
  aspect-ratio: 4 / 5;
  text-align: center;
  font-family: "Fraunces", Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--crest-navy);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: .7rem;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  -moz-appearance: textfield;
}
.otp-box::-webkit-outer-spin-button,
.otp-box::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.otp-box:focus {
  outline: 0;
  border-color: var(--reach-rose);
  box-shadow: 0 0 0 4px rgba(163, 4, 68, .12);
}
.otp-box.is-filled { background: var(--rose-100); border-color: var(--reach-rose); }

.otp-meta {
  font-size: .85rem;
  color: var(--muted);
  margin: 1rem 0 .25rem;
  display: flex; justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}
.otp-meta a {
  color: var(--reach-rose);
  font-weight: 600;
  text-decoration: none;
}
.otp-meta a:hover { text-decoration: underline; }

/* ---------- PASSWORD STRENGTH METER ---------- */
.pwd-strength {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .3rem;
  margin: .5rem 0 .35rem;
}
.pwd-strength span {
  height: 4px;
  border-radius: 4px;
  background: var(--line);
  transition: background .2s ease;
}
.pwd-strength.s1 span:nth-child(-n+1) { background: #ED5151; }
.pwd-strength.s2 span:nth-child(-n+2) { background: var(--sun-yellow-700); }
.pwd-strength.s3 span:nth-child(-n+3) { background: #2EA866; }
.pwd-strength.s4 span                 { background: #1f8550; }
.pwd-strength-label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- ICONIC HEADERS (success / mail-sent screens) ---------- */
.auth-icon-bubble {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin: 0 0 1rem;
}
.auth-icon-bubble.is-rose    { background: var(--rose-100); color: var(--reach-rose); }
.auth-icon-bubble.is-yellow  { background: var(--sun-yellow-100); color: var(--sun-yellow-700); }
.auth-icon-bubble.is-green   { background: #e6f6ec; color: #1f8550; }

.auth-center { text-align: center; }
.auth-center .auth-icon-bubble { margin-left: auto; margin-right: auto; display: flex; }

/* 2FA verify - centered, spaced 6-digit input. */
.otp-verify-input {
  text-align: center;
  letter-spacing: 0.5em;
  font-size: 1.5rem;
}

/* Terms-acceptance row on register form */
.auth-terms-row { margin-top: .25rem; }
.auth-terms-label {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  font-size: .9rem;
  color: var(--ink-2);
  cursor: pointer;
  line-height: 1.45;
}
.auth-terms-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: .15rem;
  accent-color: var(--reach-rose);
  cursor: pointer;
}
.auth-terms-label a {
  color: var(--reach-rose);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.auth-terms-label a:hover { color: var(--reach-rose-700); }
.auth-terms-row.is-invalid .auth-terms-label { color: var(--reach-rose); }
