/* =========================================================================
   Crop Map — authentication screens
   -------------------------------------------------------------------------
   A self-contained visual language for the sign-in / register / OTP / reset
   pages, deliberately DISTINCT from the krishokcard card layout: a two-pane
   split with a full-bleed paddy-field hero on the left and a deep-green
   government panel on the right. All selectors are namespaced `cm-` so they
   never collide with the shared app-shell styles in custom.css.

   Swap static/img/auth-hero.svg for a real photograph (same filename, any
   raster format via the --cm-hero-image var below) to match the mock exactly.
   ========================================================================= */

:root {
  /* Auth screens inherit the ONE canonical Crop Map palette defined in
     custom.css (loaded first, globally). Keeping these as references — not
     fresh hex — means a future theme tweak in custom.css propagates to the
     login/register/OTP/reset screens automatically. Only the extra-dark panel
     anchor (--cm-green-950) is auth-specific, kept in the same paddy-green hue. */
  --cm-green-950: #10281b;                     /* deepest anchor for the panel gradient */
  --cm-green-900: var(--color-primary-dark);   /* #163a2b */
  --cm-green-800: var(--color-primary-dark);   /* #163a2b */
  --cm-green-700: var(--color-primary);        /* #1f4d3a */
  --cm-green-600: var(--color-primary-light);  /* #2f6b4f */
  --cm-gold: var(--color-accent);              /* #d4a017 rice-gold */
  --cm-gold-deep: var(--color-accent-dark);    /* #b8860b */
  --cm-ink: var(--color-text);                 /* #1c2321 */
  --cm-muted: var(--color-text-muted);         /* #5b6660 */
  --cm-line: var(--color-border);              /* #e1ddcd */
  --cm-danger: var(--color-danger);            /* #b3492d */
  --cm-radius: var(--radius-lg);               /* 18px */
  --cm-hero-image: url("../img/auth-hero.svg");
}

.cm-auth,
.cm-auth * {
  box-sizing: border-box;
}

.cm-auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  font-family: "Hind Siliguri", "Public Sans", "Noto Sans Bengali", system-ui, sans-serif;
  color: var(--cm-ink);
  background: var(--cm-green-950);
}

/* ---------- left: hero ---------- */
.cm-auth__hero {
  position: relative;
  overflow: hidden;
  background: var(--cm-hero-image) center / cover no-repeat, #cfe8c2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px 40px 48px;
}

.cm-auth__hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(22, 58, 43, 0.10) 0%, rgba(22, 58, 43, 0.05) 40%, rgba(16, 40, 27, 0.58) 100%);
  pointer-events: none;
}

.cm-lang {
  position: relative;
  z-index: 2;
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(22, 58, 43, 0.22);
  cursor: pointer;
  user-select: none;
}

.cm-lang span {
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  color: var(--cm-green-800);
  transition: background 0.15s ease, color 0.15s ease;
}

.cm-lang span.active {
  background: var(--cm-green-700);
  color: #fff;
}

.cm-hero__caption {
  position: relative;
  z-index: 2;
  max-width: 520px;
}

.cm-hero__title {
  margin: 0;
  color: #fff;
  font-size: clamp(22px, 2.6vw, 34px);
  line-height: 1.3;
  font-weight: 700;
  text-shadow: 0 2px 14px rgba(16, 40, 27, 0.5);
}

.cm-hero__badge {
  display: inline-block;
  margin-top: 18px;
  padding: 9px 18px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  background: rgba(47, 107, 79, 0.42);
  backdrop-filter: blur(2px);
}

/* ---------- right: panel ---------- */
.cm-auth__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px 40px 24px;
  color: #eafaef;
  background:
    radial-gradient(1200px 600px at 120% -10%, rgba(212, 160, 23, 0.20), transparent 55%),
    linear-gradient(160deg, var(--cm-green-700) 0%, var(--cm-green-900) 55%, var(--cm-green-950) 100%);
}

.cm-panel__home {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  color: #eafaef;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  transition: background 0.15s ease;
}

.cm-panel__home:hover {
  background: rgba(255, 255, 255, 0.12);
}

.cm-panel__body {
  flex: 1;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 0;
}

.cm-brand {
  text-align: center;
  margin-bottom: 22px;
}

.cm-brand__logo {
  width: 84px;
  height: 84px;
  margin: 0 auto 12px;
  display: block;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.35));
}

.cm-brand__name {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
}

.cm-brand__sub {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: rgba(234, 250, 239, 0.75);
}

/* ---------- form controls ---------- */
.cm-field {
  margin-bottom: 16px;
}

.cm-field__label {
  display: block;
  margin-bottom: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(234, 250, 239, 0.9);
}

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

.cm-input-wrap__icon {
  position: absolute;
  left: 14px;
  display: inline-flex;
  color: var(--cm-green-700);
  pointer-events: none;
}

.cm-auth .cm-input {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 44px;
  font-size: 15px;
  color: var(--cm-ink);
  background: #ffffff;
  border: 1.5px solid transparent;
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cm-auth .cm-input::placeholder {
  color: #9bb0a2;
}

.cm-auth .cm-input:focus {
  border-color: var(--cm-gold);
  box-shadow: 0 0 0 4px rgba(212, 160, 23, 0.28);
}

.cm-input--has-toggle {
  padding-right: 46px;
}

.cm-pw-toggle {
  position: absolute;
  right: 8px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #6b8574;
  cursor: pointer;
  border-radius: 8px;
}

.cm-pw-toggle:hover {
  background: #eef4ee;
}

.cm-pw-toggle .cm-eye-off {
  display: none;
}

.cm-pw-toggle.is-visible .cm-eye-on {
  display: none;
}

.cm-pw-toggle.is-visible .cm-eye-off {
  display: inline;
}

/* ---------- row: remember / forgot ---------- */
.cm-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 20px;
  font-size: 13.5px;
}

.cm-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(234, 250, 239, 0.9);
  cursor: pointer;
}

.cm-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--cm-gold);
}

.cm-link {
  color: var(--cm-gold);
  text-decoration: none;
  font-weight: 600;
}

.cm-link:hover {
  text-decoration: underline;
}

/* ---------- buttons ---------- */
.cm-btn {
  width: 100%;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.cm-btn:active {
  transform: translateY(1px);
}

.cm-btn--primary {
  color: #163a2b;
  background: linear-gradient(180deg, var(--cm-gold) 0%, var(--cm-gold-deep) 100%);
  box-shadow: 0 10px 24px rgba(184, 134, 11, 0.38);
}

.cm-btn--primary:hover {
  box-shadow: 0 12px 30px rgba(184, 134, 11, 0.48);
}

.cm-btn--ghost {
  margin-top: 12px;
  color: #eafaef;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.cm-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.16);
}

.cm-btn:disabled,
.cm-btn[aria-disabled="true"] {
  opacity: 0.7;
  cursor: not-allowed;
}

.cm-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 4px;
  color: rgba(234, 250, 239, 0.55);
  font-size: 12.5px;
}

.cm-divider::before,
.cm-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
}

/* ---------- footer / links ---------- */
.cm-panel__foot {
  margin-top: 22px;
  text-align: center;
  font-size: 13.5px;
  color: rgba(234, 250, 239, 0.85);
}

.cm-panel__foot p {
  margin: 6px 0;
}

.cm-credit {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: rgba(234, 250, 239, 0.55);
}

.cm-credit strong {
  color: rgba(234, 250, 239, 0.8);
}

/* ---------- alerts + field errors ---------- */
.cm-alert {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

.cm-alert--error {
  background: rgba(179, 73, 45, 0.20);
  border: 1px solid rgba(255, 180, 170, 0.5);
  color: #ffe2dd;
}

.cm-alert--ok {
  background: rgba(47, 107, 79, 0.30);
  border: 1px solid rgba(160, 230, 180, 0.5);
  color: #e6fff0;
}

.cm-field__error {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: #ffd7d0;
}

.cm-field__error ul {
  margin: 0;
  padding-left: 16px;
}

/* ---------- OTP boxes ---------- */
.cm-otp {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 8px 0 18px;
}

.cm-otp__box {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--cm-ink);
  background: #fff;
  border: 1.5px solid transparent;
  border-radius: 12px;
  outline: none;
}

.cm-otp__box:focus {
  border-color: var(--cm-gold);
  box-shadow: 0 0 0 4px rgba(212, 160, 23, 0.28);
}

.cm-resend-timer {
  font-size: 12.5px;
  color: rgba(234, 250, 239, 0.6);
  min-height: 16px;
}

/* ---------- waiting room ----------
   The hold-page for a verified account with no role/jurisdiction yet (see
   accounts/templates/accounts/waiting_room.html). Lives on the green panel,
   so every colour here is a translucent white over that green rather than a
   token from custom.css — the auth shell deliberately has its own palette. */
.cm-wait {
  text-align: left;
}

.cm-wait__hello {
  font-size: 16px;
  margin: 0 0 6px;
}

.cm-wait__lede {
  font-size: 13.5px;
  line-height: 1.75;
  color: rgba(234, 250, 239, 0.82);
  margin: 0 0 18px;
}

.cm-steps {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.cm-steps__item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1.5px solid rgba(234, 250, 239, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

/* The stage that is actually blocking gets the gold accent used elsewhere for
   "attention here"; finished stages stay quiet so the eye lands on the wait. */
.cm-steps__item--waiting {
  border-color: rgba(212, 160, 23, 0.55);
  background: rgba(212, 160, 23, 0.12);
}

.cm-steps__mark {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.16);
}

.cm-steps__item--done .cm-steps__mark {
  background: rgba(234, 250, 239, 0.92);
  color: var(--cm-ink);
}

.cm-steps__text {
  display: grid;
  gap: 3px;
  font-size: 13.5px;
  line-height: 1.5;
}

.cm-steps__detail {
  font-size: 12.5px;
  color: rgba(234, 250, 239, 0.7);
  word-break: break-word;
}

.cm-wait__note {
  font-size: 12.5px;
  line-height: 1.7;
  color: rgba(234, 250, 239, 0.62);
  margin: 16px 0 0;
}

/* ---------- forgot-password modal ---------- */
.cm-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 30, 18, 0.6);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.cm-modal.is-open {
  display: flex;
  opacity: 1;
}

.cm-modal__card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  color: var(--cm-ink);
  border-radius: var(--cm-radius);
  padding: 26px 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.cm-modal__title {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 700;
}

.cm-modal__text {
  margin: 0 0 18px;
  font-size: 13.5px;
  color: var(--cm-muted);
}

.cm-modal .cm-field__label {
  color: var(--cm-ink);
}

.cm-modal__close {
  float: right;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #9bb0a2;
  cursor: pointer;
}

.cm-modal__success {
  text-align: center;
  padding: 8px 0;
}

.cm-modal__success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: rgba(31, 77, 58, 0.15);
  color: var(--cm-green-700);
}

.cm-modal__success-icon.is-not-found {
  background: rgba(179, 73, 45, 0.14);
  color: var(--cm-danger);
}

.cm-modal .cm-input {
  border: 1.5px solid var(--cm-line);
}

.cm-modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.cm-btn--sm {
  height: 44px;
  font-size: 14.5px;
}

.cm-btn--muted {
  color: var(--cm-ink);
  background: #eef4ee;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .cm-auth {
    grid-template-columns: 1fr;
  }
  .cm-auth__hero {
    min-height: 240px;
    padding: 20px 24px 28px;
  }
  .cm-auth__panel {
    padding: 24px;
  }
}
