/*
 * Nivaas authentication surfaces
 * --------------------------------
 * Page-specific styles only. Shared brand tokens and Bootstrap primitives come
 * from styles.css; these selectors stay namespaced under .auth-* for reuse.
 */

:root {
  --auth-accent: #b8442d;
  --auth-accent-dark: #913522;
  --auth-field-bg: #fffefa;
  --auth-success: #256b4f;
  --auth-warning: #9c611c;
  --auth-info-bg: #edf4f0;
  --auth-panel-width: 31rem;
}

.auth-page {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  color: var(--nv-ink);
  background: var(--nv-paper);
}

.auth-page .btn-brand {
  --bs-btn-bg: var(--auth-accent);
  --bs-btn-border-color: var(--auth-accent);
  --bs-btn-hover-bg: var(--auth-accent-dark);
  --bs-btn-hover-border-color: var(--auth-accent-dark);
  --bs-btn-active-bg: #78301f;
  --bs-btn-active-border-color: #78301f;
}

.auth-page code {
  padding: 0.08rem 0.28rem;
  border-radius: 0.35rem;
  color: var(--nv-forest-dark);
  background: var(--nv-sage);
  font-size: 0.83em;
}

.auth-header {
  position: relative;
  z-index: 20;
  border-bottom: 1px solid rgba(24, 35, 31, 0.09);
  background: rgba(255, 253, 249, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.auth-header__inner {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-inline: clamp(1rem, 3vw, 2.5rem);
}

.auth-header__action {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--nv-muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.auth-header__action .btn {
  min-height: 44px;
  padding-inline: 1.05rem;
  font-size: 0.84rem;
}

.auth-header .auth-brand {
  min-height: 44px;
}

.auth-main,
.auth-layout {
  min-height: calc(100dvh - 75px);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(25rem, 0.9fr) minmax(32rem, 1.1fr);
}

.auth-story {
  position: sticky;
  top: 0;
  min-height: calc(100dvh - 75px);
  align-self: start;
  isolation: isolate;
  overflow: hidden;
  color: var(--nv-white);
  background: var(--nv-forest-dark);
}

.auth-story__media,
.auth-story__media img,
.auth-story__scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.auth-story__media {
  z-index: -3;
  display: block;
}

.auth-story__media img {
  object-fit: cover;
  object-position: 52% center;
  transform: scale(1.015);
}

.auth-story--register .auth-story__media img {
  object-position: 58% center;
}

.auth-story__scrim {
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(10, 29, 24, 0.14), rgba(10, 29, 24, 0.72)),
    linear-gradient(90deg, rgba(10, 29, 24, 0.63), rgba(10, 29, 24, 0.08));
}

.auth-story::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
  content: "";
}

.auth-story__content {
  position: absolute;
  right: clamp(2rem, 5vw, 5rem);
  bottom: clamp(2.5rem, 7vh, 5.5rem);
  left: clamp(2rem, 5vw, 5rem);
  max-width: 38rem;
}

.auth-story__eyebrow {
  margin-bottom: 1.2rem;
  color: var(--nv-white);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.auth-story h1 {
  max-width: 10ch;
  margin: 0;
  font-family: var(--nv-font-display);
  font-size: clamp(3rem, 5vw, 5.3rem);
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.auth-story p {
  max-width: 37rem;
  margin: 1.4rem 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: clamp(0.96rem, 1.3vw, 1.08rem);
  line-height: 1.7;
}

.auth-story__proof {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.7rem;
}

.auth-story__proof span {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 0.48rem;
  padding: 0.55rem 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(15, 38, 32, 0.34);
  font-size: 0.76rem;
  font-weight: 700;
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.auth-story__steps {
  max-width: 35rem;
  display: grid;
  gap: 0.72rem;
  margin: 1.8rem 0 0;
  padding: 0;
  list-style: none;
}

.auth-story__steps li {
  display: grid;
  grid-template-columns: 2.3rem 1fr;
  align-items: start;
  gap: 0.75rem;
}

.auth-story__steps li > span {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  background: rgba(15, 38, 32, 0.3);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.auth-story__steps strong,
.auth-story__steps small {
  display: block;
}

.auth-story__steps strong {
  font-size: 0.88rem;
}

.auth-story__steps small {
  margin-top: 0.1rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.74rem;
}

.auth-content {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 5vw, 5.25rem);
  background:
    radial-gradient(
      circle at 100% 0%,
      rgba(220, 231, 223, 0.6),
      transparent 32rem
    ),
    var(--nv-paper);
}

.auth-page--register .auth-content {
  align-items: flex-start;
}

.auth-panel {
  width: min(100%, var(--auth-panel-width));
}

.auth-panel--register {
  --auth-panel-width: 33rem;
}

.auth-panel__heading {
  margin-bottom: 1.65rem;
}

.auth-back-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 0.45rem;
  margin: -0.55rem 0 1rem;
  color: var(--nv-muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.auth-back-link:hover {
  color: var(--nv-forest);
}

.auth-kicker {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--nv-forest);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.auth-panel__heading h2,
.auth-modal .modal-title,
.auth-reset-success h2 {
  margin: 0;
  color: var(--nv-ink);
  font-family: var(--nv-font-display);
  font-size: clamp(2.35rem, 4.2vw, 3.35rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.auth-panel__heading p {
  max-width: 34rem;
  margin: 0.8rem 0 0;
  color: var(--nv-muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

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

.auth-social-button {
  display: grid;
  grid-template-columns: 1.25rem 1fr 1.25rem;
  align-items: center;
  gap: 0.55rem;
  min-height: 52px;
  padding-inline: 0.9rem;
  border: 1px solid var(--nv-border-strong);
  border-radius: 14px;
  color: var(--nv-ink);
  background: var(--nv-white);
  font-size: 0.78rem;
  font-weight: 700;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.auth-social-button:hover {
  border-color: var(--nv-forest);
  color: var(--nv-forest);
  background: #f8fbf8;
  transform: translateY(-1px);
}

.auth-social-button:disabled {
  color: var(--nv-muted);
  background: var(--nv-sand);
  transform: none;
}

.auth-provider-mark,
.auth-social-button > .bi {
  justify-self: center;
  font-size: 1.05rem;
}

.auth-provider-mark--google {
  color: #3159b8;
  font-family: Arial, sans-serif;
  font-weight: 800;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 1.4rem 0;
  color: var(--nv-muted);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.auth-form {
  display: grid;
  gap: 1rem;
}

.auth-field {
  min-width: 0;
}

.auth-field > label,
.auth-field > div > label {
  margin-bottom: 0.42rem;
  color: var(--nv-ink);
  font-size: 0.77rem;
  font-weight: 800;
}

.auth-control {
  position: relative;
}

.auth-control > .bi:first-child {
  position: absolute;
  top: 50%;
  left: 1rem;
  z-index: 3;
  color: #748079;
  font-size: 1rem;
  transform: translateY(-50%);
  transition: color 150ms ease;
  pointer-events: none;
}

.auth-control--with-icon .form-control,
.auth-control--with-icon .form-select {
  padding-left: 2.85rem;
}

.auth-control--password .form-control {
  padding-right: 3.4rem;
}

.auth-page .form-control,
.auth-page .form-select {
  min-height: 56px;
  border: 1px solid var(--nv-border-strong);
  border-radius: 14px;
  color: var(--nv-ink);
  background-color: var(--auth-field-bg);
  font-size: 0.9rem;
  font-weight: 500;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

.auth-page .form-control::placeholder {
  color: #858d89;
  opacity: 1;
}

.auth-page .form-control:hover,
.auth-page .form-select:hover {
  border-color: #aeb5af;
}

.auth-page .form-control:focus,
.auth-page .form-select:focus {
  border-color: var(--nv-forest);
  background-color: var(--nv-white);
  box-shadow: 0 0 0 4px rgba(29, 79, 70, 0.12);
}

.auth-control:focus-within > .bi:first-child {
  color: var(--nv-forest);
}

.auth-page .form-control.is-invalid,
.auth-page .form-select.is-invalid {
  border-color: var(--nv-danger);
  background-image: none;
  box-shadow: 0 0 0 3px rgba(166, 56, 45, 0.08);
}

.auth-field.has-error > .invalid-feedback,
.auth-field:has(.form-control.is-invalid) > .invalid-feedback {
  display: block;
}

.auth-page .invalid-feedback {
  margin-top: 0.4rem;
  color: var(--nv-danger);
  font-size: 0.72rem;
  font-weight: 600;
}

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 0.4rem;
  z-index: 4;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--nv-muted);
  background: transparent;
  transform: translateY(-50%);
}

.auth-password-toggle:hover {
  color: var(--nv-forest);
  background: var(--nv-sand);
}

.auth-inline-action {
  min-height: 44px;
  margin: -0.25rem 0 0.18rem;
  padding: 0.35rem 0;
  border: 0;
  color: var(--nv-forest);
  background: transparent;
  font-size: 0.74rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.auth-inline-action:hover {
  color: var(--auth-accent-dark);
}

.auth-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-block: 0.05rem;
}

.auth-page .form-check {
  min-height: 24px;
  margin: 0;
  padding-left: 1.8rem;
}

.auth-page .form-check-input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.16rem;
  margin-left: -1.8rem;
  border-color: var(--nv-border-strong);
  border-radius: 0.32rem;
}

.auth-page .form-check-input:focus {
  border-color: var(--nv-forest);
  box-shadow: 0 0 0 3px rgba(29, 79, 70, 0.12);
}

.auth-page .form-check-label {
  color: var(--nv-ink-soft);
  font-size: 0.76rem;
  line-height: 1.55;
}

.auth-security-note {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--nv-muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.auth-security-note .bi {
  color: var(--nv-forest);
}

.auth-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 54px;
  margin-top: 0.2rem;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(145, 53, 34, 0.16);
}

.auth-submit__loading {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.auth-integration-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.05rem auto 0;
  color: var(--nv-muted);
  font-size: 0.66rem;
  line-height: 1.55;
}

.auth-integration-note .bi {
  flex: 0 0 auto;
  margin-top: 0.05rem;
  color: var(--nv-forest);
}

.auth-feedback {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  align-items: start;
  gap: 0.65rem;
  margin: 0;
  padding: 0.82rem 0.9rem;
  border-radius: 12px;
  font-size: 0.75rem;
  line-height: 1.5;
}

.auth-feedback > .bi {
  padding-top: 0.05rem;
  font-size: 1rem;
}

.auth-feedback strong,
.auth-feedback span {
  display: block;
}

.auth-feedback strong {
  margin-bottom: 0.08rem;
  font-size: 0.78rem;
}

.auth-feedback__action {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 0.38rem;
  margin-top: 0.35rem;
  color: currentColor;
  font-size: 0.72rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.auth-feedback__action:hover {
  color: var(--nv-ink);
}

.auth-feedback.alert-success {
  border-color: rgba(37, 107, 79, 0.2);
  color: #1d5b43;
  background: #e8f3ed;
}

.auth-feedback.alert-danger {
  border-color: rgba(166, 56, 45, 0.2);
  color: #843025;
  background: #f9ebe8;
}

.auth-feedback.alert-info {
  border-color: rgba(29, 79, 70, 0.16);
  color: var(--nv-forest-dark);
  background: var(--auth-info-bg);
}

.auth-panel__footer {
  margin: 1.4rem 0 0;
  color: var(--nv-muted);
  font-size: 0.78rem;
  text-align: center;
}

.auth-panel__footer a,
.auth-consent a {
  color: var(--nv-forest);
  font-weight: 800;
}

.auth-consent {
  padding: 0.78rem 0.9rem 0.78rem 2.75rem !important;
  border: 1px solid var(--nv-border);
  border-radius: 12px;
  background: rgba(246, 241, 232, 0.52);
}

.auth-consent .form-check-input {
  margin-left: -1.85rem;
}

.auth-consent:has(.form-check-input.is-invalid) {
  border-color: var(--nv-danger);
  background: #fff7f5;
}

.auth-password-meter {
  margin-top: 0.58rem;
}

.auth-password-meter__track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--nv-sand-deep);
}

.auth-password-meter__track span {
  display: block;
  width: var(--password-strength, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--password-strength-color, var(--nv-border-strong));
  transition:
    width 180ms ease,
    background-color 180ms ease;
}

.auth-password-meter__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.35rem;
  color: var(--nv-muted);
  font-size: 0.64rem;
}

.auth-password-meter__meta strong {
  color: var(--nv-ink-soft);
}

.auth-password-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  margin: 0.55rem 0 0;
  padding: 0;
  color: var(--nv-muted);
  font-size: 0.65rem;
  list-style: none;
}

.auth-password-rules li {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.auth-password-rules li.is-met {
  color: var(--auth-success);
  font-weight: 700;
}

.auth-modal .modal-dialog {
  max-width: 31rem;
  padding: 0.75rem;
}

.auth-modal .modal-content {
  overflow: hidden;
  border: 1px solid var(--nv-border);
  border-radius: 22px;
  background:
    radial-gradient(
      circle at 100% 0%,
      rgba(220, 231, 223, 0.75),
      transparent 17rem
    ),
    var(--nv-paper);
  box-shadow: var(--nv-shadow-md);
}

.auth-modal .modal-header {
  align-items: flex-start;
  padding: 1.35rem 1.4rem 0;
}

.auth-modal .modal-body {
  padding: 1rem clamp(1.4rem, 5vw, 2.2rem) 2.1rem;
}

.auth-modal .modal-title,
.auth-reset-success h2 {
  font-size: clamp(2rem, 7vw, 2.65rem);
}

.auth-modal__icon,
.auth-success-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  color: var(--nv-forest);
  background: var(--nv-sage);
  font-size: 1.15rem;
}

.auth-modal__copy,
.auth-reset-success p {
  margin: 0.8rem 0 1.4rem;
  color: var(--nv-muted);
  font-size: 0.82rem;
  line-height: 1.65;
}

.auth-reset-success {
  outline: 0;
  text-align: center;
}

.auth-reset-success .auth-success-mark {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.1rem;
  color: var(--auth-success);
  font-size: 1.45rem;
}

.auth-reset-success .auth-kicker {
  text-align: center;
}

@media (max-width: 1199.98px) {
  .auth-layout {
    grid-template-columns: minmax(22rem, 0.76fr) minmax(30rem, 1.24fr);
  }

  .auth-story__content {
    right: 2.25rem;
    bottom: 3rem;
    left: 2.25rem;
  }

  .auth-story h1 {
    font-size: clamp(2.8rem, 5vw, 4.2rem);
  }

  .auth-story__proof {
    display: grid;
    justify-items: start;
  }

  .auth-content {
    padding-inline: clamp(2rem, 4vw, 3.5rem);
  }
}

@media (max-width: 991.98px) {
  .auth-main,
  .auth-layout {
    min-height: calc(100dvh - 69px);
  }

  .auth-header__inner {
    min-height: 68px;
  }

  .auth-story {
    display: none;
  }

  .auth-layout {
    display: block;
  }

  .auth-content {
    min-height: calc(100dvh - 69px);
    align-items: flex-start;
    padding: clamp(2.25rem, 7vw, 5rem) clamp(1.25rem, 7vw, 5rem);
    background:
      radial-gradient(
        circle at 100% 0%,
        rgba(220, 231, 223, 0.84),
        transparent 28rem
      ),
      linear-gradient(145deg, var(--nv-paper), var(--nv-sand));
  }

  .auth-panel {
    width: min(100%, 35rem);
    padding: clamp(1.5rem, 5vw, 2.5rem);
    border: 1px solid rgba(24, 35, 31, 0.1);
    border-radius: 24px;
    background: rgba(255, 253, 249, 0.9);
    box-shadow: 0 18px 55px rgba(24, 35, 31, 0.09);
  }
}

@media (max-width: 575.98px) {
  .auth-header__inner {
    padding-inline: 0.9rem;
  }

  .auth-header .brand-mark {
    gap: 0.42rem;
    font-size: 1.4rem;
  }

  .auth-header .brand-mark__symbol {
    width: 29px;
    height: 29px;
  }

  .auth-header__action {
    gap: 0.5rem;
  }

  .auth-header__action .btn {
    min-height: 44px;
    padding-inline: 0.85rem;
    font-size: 0.74rem;
  }

  .auth-content {
    min-height: calc(100dvh - 69px);
    padding: 1.65rem 1rem 2.5rem;
  }

  .auth-panel {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .auth-back-link {
    margin-bottom: 0.75rem;
  }

  .auth-panel__heading {
    margin-bottom: 1.35rem;
  }

  .auth-panel__heading h2 {
    font-size: clamp(2.35rem, 12vw, 2.9rem);
  }

  .auth-social-grid {
    grid-template-columns: 1fr;
  }

  .auth-social-button {
    min-height: 50px;
    font-size: 0.8rem;
  }

  .auth-divider {
    margin-block: 1.2rem;
  }

  .auth-form-row {
    align-items: flex-start;
  }

  .auth-security-note {
    max-width: 8rem;
    justify-content: flex-end;
    text-align: right;
  }

  .auth-password-rules {
    gap: 0.35rem 0.7rem;
  }

  .auth-modal .modal-dialog {
    align-items: flex-end;
    min-height: calc(100% - 1rem);
    margin: 0.5rem;
    padding: 0;
  }

  .auth-modal .modal-content {
    border-radius: 22px;
  }
}

@media (max-width: 374.98px) {
  .auth-content {
    padding-inline: 0.85rem;
  }

  .auth-page .form-control,
  .auth-page .form-select {
    font-size: 0.84rem;
  }

  .auth-form-row {
    display: grid;
  }

  .auth-security-note {
    max-width: none;
    justify-content: flex-start;
    padding-left: 1.8rem;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-story__media img,
  .auth-social-button,
  .auth-password-meter__track span {
    transition: none;
    transform: none;
  }
}

@media (forced-colors: active) {
  .auth-story__scrim {
    background: transparent;
  }

  .auth-feedback,
  .auth-consent,
  .auth-panel {
    border: 1px solid CanvasText;
  }
}
