/**
 * HEALTH.N.E.S.S. premium auth surfaces — portal + administrator login.
 * Intentionally separate from the operational workspace.css light UI.
 */

.auth-page {
  --auth-bg: #0c0f0e;
  --auth-panel: rgba(26, 28, 27, 0.92);
  --auth-ink: #f5f0e6;
  --auth-muted: rgba(208, 197, 175, 0.82);
  --auth-line: rgba(153, 144, 124, 0.34);
  --auth-gold: #f2ca50;
  --auth-gold-soft: rgba(242, 202, 80, 0.14);
  --auth-danger: #f0b4b0;
  --auth-ok: #b7e3c7;
  --auth-font-display: "Montserrat", sans-serif;
  --auth-font-body: "Manrope", "Inter", sans-serif;
  min-height: 100dvh;
  min-height: 100svh;
  min-height: 100vh;
  margin: 0;
  color: var(--auth-ink);
  background: var(--auth-bg);
  font-family: var(--auth-font-body);
}

.auth-page *,
.auth-page *::before,
.auth-page *::after {
  box-sizing: border-box;
}

.auth-shell {
  min-height: 100dvh;
  min-height: 100svh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(22rem, 0.95fr);
}

.auth-visual {
  position: relative;
  overflow: hidden;
  min-height: 0;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--auth-line);
}

.auth-visual__media {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(8, 9, 8, 0.72) 8%, rgba(8, 9, 8, 0.38) 48%, rgba(8, 9, 8, 0.78) 100%),
    radial-gradient(1100px 700px at 18% 18%, rgba(242, 202, 80, 0.16), transparent 58%),
    url("/assets/hero/hero-loop-poster.jpg") center / cover no-repeat;
  transform: scale(1.03);
}

.auth-visual__media--admin {
  background:
    linear-gradient(125deg, rgba(8, 9, 8, 0.82) 10%, rgba(8, 9, 8, 0.48) 52%, rgba(8, 9, 8, 0.86) 100%),
    radial-gradient(900px 560px at 70% 20%, rgba(242, 202, 80, 0.12), transparent 60%),
    url("/assets/social/default-og.jpg") center / cover no-repeat;
}

.auth-visual__content {
  position: relative;
  z-index: 1;
  max-width: 30rem;
}

.auth-logo {
  display: inline-flex;
  text-decoration: none;
}

.auth-logo img {
  width: min(220px, 56vw);
  height: auto;
  display: block;
}

.auth-kicker {
  margin: 3.5rem 0 0.85rem;
  font-family: var(--auth-font-display);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--auth-gold);
}

.auth-title {
  margin: 0;
  font-family: var(--auth-font-display);
  font-size: clamp(2rem, 4vw, 3.15rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: #fffaf0;
  max-width: 11ch;
}

.auth-lede {
  margin: 1.1rem 0 0;
  max-width: 34rem;
  color: var(--auth-muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

.auth-visual__meta {
  position: relative;
  z-index: 1;
  font-family: var(--auth-font-display);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(245, 240, 230, 0.58);
}

.auth-panel-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  background:
    radial-gradient(720px 420px at 80% 0%, rgba(242, 202, 80, 0.08), transparent 55%),
    linear-gradient(180deg, #121413 0%, #0c0f0e 100%);
}

.auth-panel {
  width: min(100%, 27rem);
}

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  color: var(--auth-muted);
  text-decoration: none;
  font-family: var(--auth-font-display);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-back:hover,
.auth-back:focus-visible {
  color: var(--auth-gold);
  outline: none;
}

.auth-panel__eyebrow {
  margin: 0 0 0.55rem;
  font-family: var(--auth-font-display);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--auth-gold);
}

.auth-panel__heading {
  margin: 0;
  font-family: var(--auth-font-display);
  font-size: clamp(1.55rem, 2.4vw, 1.9rem);
  letter-spacing: -0.015em;
}

.auth-panel__support {
  margin: 0.7rem 0 0;
  color: var(--auth-muted);
  line-height: 1.55;
  font-size: 0.96rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  align-items: stretch;
  margin: 1.45rem 0 1.2rem;
  padding: 0.2rem;
  border: 1px solid rgba(153, 144, 124, 0.38);
  border-radius: 0.45rem;
  background:
    linear-gradient(180deg, rgba(22, 24, 23, 0.72), rgba(10, 12, 11, 0.78));
  box-shadow: inset 0 1px 0 rgba(255, 250, 240, 0.04);
}

.auth-tabs--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.auth-tabs button {
  position: relative;
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(245, 240, 230, 0.82);
  min-height: 2.5rem;
  min-width: 0;
  width: 100%;
  border-radius: 0.32rem;
  font-family: var(--auth-font-display);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  line-height: 1.15;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  padding: 0.45rem 0.35rem;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.auth-tabs button:not(:first-child)::before {
  content: "";
  position: absolute;
  top: 22%;
  bottom: 22%;
  left: 0;
  width: 1px;
  background: rgba(153, 144, 124, 0.34);
  pointer-events: none;
  transition: opacity 160ms ease;
}

.auth-tabs button:hover:not([aria-selected="true"]) {
  color: #fffaf0;
  background: rgba(255, 250, 240, 0.045);
}

.auth-tabs button[aria-selected="true"] {
  color: var(--auth-gold);
  background:
    linear-gradient(180deg, rgba(242, 202, 80, 0.16), rgba(242, 202, 80, 0.08));
  border-color: rgba(242, 202, 80, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(242, 202, 80, 0.22),
    0 0 0 1px rgba(242, 202, 80, 0.06),
    0 0 18px rgba(242, 202, 80, 0.08);
}

.auth-tabs button[aria-selected="true"]::before,
.auth-tabs button[aria-selected="true"] + button::before {
  opacity: 0;
}

.auth-tabs button:focus-visible {
  outline: 2px solid rgba(242, 202, 80, 0.7);
  outline-offset: 2px;
  z-index: 1;
}

.auth-panel__heading--compact {
  font-size: 1.25rem;
  margin-top: 0.25rem;
}

.auth-optional {
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: rgba(208, 197, 175, 0.62);
  font-size: 0.82em;
}

.auth-alert {
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.35rem;
  border: 1px solid rgba(242, 202, 80, 0.28);
  background: rgba(242, 202, 80, 0.08);
  color: #f4e3ad;
  font-size: 0.92rem;
  line-height: 1.45;
}

.auth-alert[hidden] {
  display: none !important;
}

.auth-alert.is-ok {
  border-color: rgba(183, 227, 199, 0.35);
  background: rgba(43, 90, 62, 0.28);
  color: var(--auth-ok);
}

.auth-alert.is-err {
  border-color: rgba(240, 180, 176, 0.35);
  background: rgba(104, 40, 40, 0.28);
  color: var(--auth-danger);
}

.auth-form {
  display: grid;
  gap: 0.95rem;
}

.auth-form label {
  display: grid;
  gap: 0.4rem;
  font-family: var(--auth-font-display);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--auth-muted);
}

.auth-form input {
  width: 100%;
  min-height: 48px;
  border-radius: 0.3rem;
  border: 1px solid var(--auth-line);
  background: rgba(8, 9, 8, 0.72);
  color: var(--auth-ink);
  padding: 0.75rem 0.85rem;
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
}

.auth-form input:focus-visible {
  outline: 2px solid rgba(242, 202, 80, 0.7);
  outline-offset: 2px;
  border-color: rgba(242, 202, 80, 0.55);
}

.auth-btn {
  appearance: none;
  min-height: 48px;
  border-radius: 0.3rem;
  border: 1px solid transparent;
  font-family: var(--auth-font-display);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.85rem 1rem;
}

.auth-btn:focus-visible {
  outline: 2px solid rgba(242, 202, 80, 0.7);
  outline-offset: 3px;
}

.auth-btn--primary {
  background: var(--auth-gold);
  color: #3c2f00;
  border-color: var(--auth-gold);
}

.auth-btn--primary:hover {
  filter: brightness(1.04);
}

.auth-btn--secondary {
  background: transparent;
  color: var(--auth-ink);
  border-color: var(--auth-line);
}

.auth-btn--secondary:hover,
.auth-btn--secondary:focus-visible {
  color: var(--auth-gold);
  border-color: rgba(242, 202, 80, 0.55);
}

.auth-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-actions {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.25rem;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-top: 0.15rem;
}

.auth-mode-legend {
  margin: -0.35rem 0 1.1rem;
  color: rgba(208, 197, 175, 0.78);
  font-size: 0.78rem;
  line-height: 1.45;
}

.auth-mode-legend strong {
  color: rgba(245, 240, 230, 0.92);
  font-weight: 600;
}

.auth-links button,
.auth-text-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--auth-muted);
  font-family: var(--auth-font-display);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.auth-links button:hover,
.auth-links button:focus-visible,
.auth-text-link:hover,
.auth-text-link:focus-visible {
  color: var(--auth-gold);
  outline: none;
}

.auth-note {
  margin: 1.15rem 0 0;
  color: rgba(208, 197, 175, 0.72);
  font-size: 0.88rem;
  line-height: 1.55;
}

.auth-admin-mark {
  display: inline-flex;
  margin: 0 0 0.85rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid rgba(242, 202, 80, 0.35);
  border-radius: 999px;
  color: var(--auth-gold);
  font-family: var(--auth-font-display);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .auth-shell {
    grid-template-columns: 1fr;
    min-height: 100dvh;
    min-height: 100svh;
  }

  .auth-visual {
    min-height: auto;
    padding: clamp(1.35rem, 5vw, 1.75rem) var(--space-gutter-mobile, 1.25rem) 1.5rem;
    border-right: 0;
    border-bottom: 1px solid var(--auth-line);
  }

  .auth-visual__content {
    max-width: none;
  }

  .auth-logo img {
    width: min(200px, 52vw);
  }

  .auth-kicker {
    margin-top: 1.35rem;
    font-size: 0.68rem;
  }

  .auth-title {
    max-width: none;
    font-size: clamp(1.85rem, 7.8vw, 2.45rem);
    line-height: 1.1;
  }

  .auth-lede {
    max-width: 38rem;
    font-size: 0.98rem;
    line-height: 1.62;
  }

  .auth-visual__meta {
    margin-top: 1.15rem;
    letter-spacing: 0.12em;
  }

  .auth-panel-wrap {
    align-items: flex-start;
    justify-content: flex-start;
    padding: clamp(1.35rem, 5vw, 1.75rem) var(--space-gutter-mobile, 1.25rem)
      calc(2rem + env(safe-area-inset-bottom, 0px));
  }

  .auth-panel {
    width: min(100%, 28rem);
    margin-inline: auto;
  }

  .auth-panel__heading {
    font-size: clamp(1.45rem, 5.5vw, 1.75rem);
  }

  .auth-panel__support {
    font-size: 0.94rem;
    max-width: 34rem;
  }
}

@media (max-width: 520px) {
  .auth-tabs {
    margin: 1.2rem 0 1rem;
    padding: 0.15rem;
  }

  .auth-tabs--three {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .auth-tabs--three button {
    min-height: 2.85rem;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    padding: 0.65rem 0.75rem;
    justify-content: flex-start;
    white-space: normal;
    text-overflow: clip;
    overflow: visible;
    text-align: left;
  }

  .auth-tabs--three button:not(:first-child)::before {
    display: none;
  }

  .auth-form input,
  .auth-btn {
    min-height: 48px;
    font-size: 1rem;
  }

  .auth-links {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 390px) {
  .auth-tabs--three button {
    font-size: 0.78rem;
  }
}
