/* ==========================================================================
   Friendse — Auth screens (fp-auth.css)
   Login · Register · Forgot access code · Help request
   Mobile-first, app-like, brand-consistent.
   ========================================================================== */

.fp-auth {
  position: relative;
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: calc(24px + var(--fp-safe-t, 0px)) 16px calc(28px + var(--fp-safe-b, 0px));
  background: var(--c-bg, #fff);
  overflow: hidden;
}

/* Soft brand aura — gives the page identity without heavy images. */
.fp-auth::before,
.fp-auth::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  filter: blur(70px); opacity: .55; z-index: 0;
}
.fp-auth::before { width: 60vmax; height: 60vmax; top: -28vmax; right: -22vmax; background: color-mix(in srgb, var(--fp-brand, #4F46E5) 34%, transparent); }
.fp-auth::after  { width: 46vmax; height: 46vmax; bottom: -24vmax; left: -18vmax; background: color-mix(in srgb, var(--fp-brand-3, #06B6D4) 26%, transparent); }
html.dark .fp-auth::before { opacity: .38; }
html.dark .fp-auth::after  { opacity: .30; }

.fp-auth__wrap { position: relative; z-index: 1; width: 100%; max-width: 440px; }

/* ---- Brand block ---- */
.fp-auth__brand { text-align: center; margin-bottom: 20px; }
.fp-auth__brand .friende-logo-box {
  display: flex; justify-content: center; align-items: center;
  margin-inline: auto;
  /* FIX: the box used to stretch to its max-width (logo height x 8) while the
     logo itself is much narrower. The "beta" label is pinned to the box's right
     edge (fp-logo-beta.css), so it floated far away from the logo. Hugging the
     logo puts "beta" right under the end of the logo, exactly like the main
     site header. The box stays centred via margin-inline:auto. */
  width: fit-content;
  max-width: min(100%, calc(var(--friende-logo-h, 36px) * 8));
}
/* Only the logo variant matching the active colour mode is shown. The old
   `.fp-auth__brand img` rule out-ranked the global
   `[data-site-logo="dark"] { display: none }` rule, so BOTH the light and
   dark logo images rendered side by side on the auth screens and pushed the
   brand off centre. These scoped rules restore one centred logo. */
.fp-auth__brand img { margin-inline: auto; }
.fp-auth__brand img[data-site-logo="light"] { display: block; }
.fp-auth__brand img[data-site-logo="dark"]  { display: none; }
html.dark .fp-auth__brand img[data-site-logo="light"],
[data-theme="dark-glass"] .fp-auth__brand img[data-site-logo="light"],
[data-theme="neon-cyber"] .fp-auth__brand img[data-site-logo="light"] { display: none; }
html.dark .fp-auth__brand img[data-site-logo="dark"],
[data-theme="dark-glass"] .fp-auth__brand img[data-site-logo="dark"],
[data-theme="neon-cyber"] .fp-auth__brand img[data-site-logo="dark"] { display: block; }
.fp-auth__tag {
  margin-top: 10px; font-size: 13.5px; font-weight: 600;
  color: var(--c-text-muted, #6b7280);
}

/* ---- Card ---- */
.fp-auth__card {
  background: color-mix(in srgb, var(--c-surface, #fff) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid color-mix(in srgb, var(--c-border, #e5e7eb) 90%, transparent);
  border-radius: 24px;
  box-shadow: var(--fp-shadow-lg, 0 22px 60px rgba(16,24,40,.14));
  padding: 26px 22px;
  animation: fpAuthIn .5s cubic-bezier(.22,.61,.36,1) both;
}
@keyframes fpAuthIn { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }

.fp-auth__title { margin: 0; font-size: 24px; font-weight: 850; line-height: 1.2; color: var(--c-text, #111); }
.fp-auth__sub   { margin: 8px 0 0; font-size: 14px; line-height: 1.55; color: var(--c-text-muted, #6b7280); }
.fp-auth__head  { margin-bottom: 20px; }

/* ---- Fields (reuse UI kit, with auth flourishes) ---- */
.fp-auth__field { margin-bottom: 15px; }
.fp-auth__row { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 520px) { .fp-auth__row { grid-template-columns: 1fr 1fr; gap: 0 14px; } }

.fp-auth__code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .22em; text-transform: uppercase; }

/* Show/hide password toggle */
.fp-auth__inputwrap { position: relative; }
.fp-auth__inputwrap .fp-input { padding-right: 50px; }
html[dir="rtl"] .fp-auth__inputwrap .fp-input { padding-right: 15px; padding-left: 50px; }
.fp-auth__eye {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: none; cursor: pointer; border-radius: 50%;
  color: var(--c-text-muted, #6b7280);
}
html[dir="rtl"] .fp-auth__eye { right: auto; left: 8px; }
.fp-auth__eye:hover { background: color-mix(in srgb, var(--c-text, #111) 6%, transparent); }
.fp-auth__eye svg { width: 19px; height: 19px; }

.fp-auth__check {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 600; color: var(--c-text-muted, #6b7280);
  margin: 4px 0 18px; cursor: pointer; user-select: none;
}
.fp-auth__check input { width: 18px; height: 18px; accent-color: var(--fp-brand, #4F46E5); }

.fp-auth__terms {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 2px 0 18px;
  padding: 0 2px;
  box-sizing: border-box;
  overflow: hidden;
  color: var(--c-text-muted, #6b7280);
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
}
.fp-auth__terms input[type="checkbox"] {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--fp-brand, #4F46E5);
}
.fp-auth__terms span { min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.fp-auth__terms a { color: var(--fp-brand, #4F46E5); font-weight: 700; text-decoration: underline; }
.fp-auth__terms a:hover { text-decoration: none; }

/* ---- Actions ---- */
.fp-auth__submit {
  width: 100%; min-height: 50px; border: 0; border-radius: 14px; cursor: pointer;
  font-size: 15.5px; font-weight: 800; color: #fff;
  background: var(--fp-gradient, linear-gradient(135deg,#4F46E5,#7C3AED));
  box-shadow: 0 10px 26px color-mix(in srgb, var(--fp-brand, #4F46E5) 32%, transparent);
  transition: filter .16s ease, transform .16s ease;
}
.fp-auth__submit:hover { filter: brightness(1.07); }
.fp-auth__submit:active { transform: translateY(1px); }

.fp-auth__links {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; font-size: 14px; flex-wrap: wrap;
}
.fp-auth__link { color: var(--fp-brand, #4F46E5); font-weight: 750; text-decoration: none; }
.fp-auth__link:hover { text-decoration: underline; }

.fp-auth__sep { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--c-text-muted, #6b7280); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.fp-auth__sep::before, .fp-auth__sep::after { content: ""; flex: 1; height: 1px; background: var(--c-border, #e5e7eb); }

.fp-auth__alt {
  display: block; width: 100%; text-align: center;
  min-height: 48px; line-height: 46px; border-radius: 14px;
  font-size: 15px; font-weight: 800; text-decoration: none;
  color: var(--fp-brand, #4F46E5);
  background: color-mix(in srgb, var(--fp-brand, #4F46E5) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--fp-brand, #4F46E5) 22%, transparent);
  transition: background .16s ease;
}
.fp-auth__alt:hover { background: color-mix(in srgb, var(--fp-brand, #4F46E5) 16%, transparent); }

.fp-auth__foot {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--c-border, #e5e7eb);
  text-align: center; font-size: 13px; color: var(--c-text-muted, #6b7280); line-height: 1.6;
}

/* Trust strip under the card */
.fp-auth__badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.fp-auth__badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
  color: var(--c-text-muted, #6b7280);
  background: color-mix(in srgb, var(--c-text, #111) 5%, transparent);
}

/* ---- Phone tuning ---- */
@media (max-width: 520px) {
  .fp-auth { padding: calc(18px + var(--fp-safe-t, 0px)) 14px calc(22px + var(--fp-safe-b, 0px)); align-items: flex-start; }
  .fp-auth__wrap { margin-top: 8px; }
  .fp-auth__card { padding: 22px 17px; border-radius: 20px; }
  .fp-auth__title { font-size: 22px; }
}
@media (max-width: 360px) {
  .fp-auth__card { padding: 18px 14px; }
  .fp-auth__links { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* Auth screens never show the app bottom nav padding. */
body:has(.fp-auth) { padding-bottom: 0 !important; }
