/* ---------------------------------------------------------------------------
 * Styles for the shared account layer (assets/auth.js).
 *
 * Loaded by BOTH the studio and the marketing/home page, because the sign-in
 * dialog is the same on both and the home page does not load the studio's
 * styles.css. Everything is scoped under .ov-auth-backdrop (the class auth.js
 * puts on its own dialogs) so these rules can never reach another modal.
 *
 * Base overlay/card rules are repeated here rather than relied upon: on the home
 * page there is nothing else to provide them.
 * --------------------------------------------------------------------------- */

.ov-auth-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;              /* above the studio's own modals (8000) */
  padding: 20px;
  /* Fade in/out: the backdrop stays in the flow (display:flex) and its
     visibility/opacity are toggled by .show, so both fade transitions can run
     (display:none can't be transitioned).

     `visibility` is deliberately NOT given a duration: it flips to `visible`
     the moment .show lands, and is merely DELAYED by the fade length on the way
     out (see .show below). With a plain `visibility .2s` transition the computed
     value is still `hidden` at progress 0, and auth.js focuses the first field in
     that very frame — focusing a hidden element is a silent no-op, so the dialog
     opened with focus left on the trigger and keyboard/screen-reader users were
     stranded behind the modal. The visual result is identical: the dialog is
     visible as soon as it starts fading in and stays visible until the fade-out
     finishes. */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s ease, visibility 0s linear .2s;
}
.ov-auth-backdrop.show {
  opacity: 1; visibility: visible; pointer-events: auto;
  /* No delay on the way in, so the dialog can take focus immediately. */
  transition: opacity .2s ease, visibility 0s linear 0s;
}

.ov-auth-backdrop .modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius:16px;
  padding: 44px 28px 28px;
  text-align: center;
  box-shadow:var(--e-3);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .22s ease, transform .22s ease;
  font-family: inherit;
  color: #18181b;
}
.ov-auth-backdrop.show .modal { opacity: 1; transform: translateY(0); }

.ov-auth-backdrop .modal-x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius:8px;
  border: none;
  background: none;
  cursor: pointer;
  color: #8a8a94;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ov-auth-backdrop .modal-x:hover { background: rgba(0, 0, 0, .05); }

.ov-auth-backdrop .login-title {
  font-size:20px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 10px;
}
.ov-auth-backdrop .login-body {
  font-size:14px;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0;
}
.ov-auth-backdrop .login-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}
/* The Google button leads; "Not now" sits beside it as a real option, because the
   prompt is dismissible and an account is genuinely not required. */
.ov-auth-backdrop .login-google {
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius:12px;
  border: 1px solid #e4e4e7;
  background: var(--surface);
  color: #18181b;
  font-size:15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.ov-auth-backdrop .login-google:hover:not(:disabled) { background: var(--surface-hover); }
.ov-auth-backdrop .login-google:disabled { cursor: default; opacity: .75; }
.ov-auth-backdrop .login-later {
  height: 40px;
  border: none;
  border-radius:8px;
  background: transparent;
  color: var(--text-2);
  font-size:14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.ov-auth-backdrop .login-later:hover { background: var(--surface-hover); }

/* Account dialog: the photo, then the name/email, then a plain sign-out. */
/* Sign-out reads as destructive, so its label is red rather than the muted gray
   of the "later"/cancel action it shares a style with. */
.ov-auth-backdrop .acct-signout { color: #e11d48; }
.ov-auth-backdrop .acct-signout:hover { background: var(--danger-soft); }
.ov-auth-backdrop .acct-av {
  width: 56px;
  height: 56px;
  border-radius:999px;
  object-fit: cover;
  margin: 0 auto 14px;
  display: block;
}
.ov-auth-backdrop .acct-av-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #18181b;
  color: #fff;
  font-size:20px;
  font-weight: 700;
}

/* Busy spinner for the sign-in button (styles.css has its own for the studio,
   but the home page does not load it). */
.ov-auth-backdrop .btn-spin {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, .18);
  border-top-color: #18181b;
  border-radius:999px;
  display: inline-block;
  animation: ov-auth-spin .7s linear infinite;
}
@keyframes ov-auth-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------------
 * Professional multi-provider sign-in dialog (assets/auth.js loginModal).
 * Scoped under .ov-auth-backdrop so nothing here can reach another modal.
 * --------------------------------------------------------------------------- */

/* One robust rule for every toggled element in this dialog. Several of them use
   display:flex/block via their class, which would otherwise beat the UA
   [hidden]{display:none} — the exact specificity trap that left a hidden item
   visible earlier. Scoped + !important here is deliberate and safe. */
.ov-auth-backdrop [hidden] { display: none !important; }

.ov-auth-backdrop .ovl-card {
  max-width: 400px;
  padding: 30px 28px 20px;
  text-align: left;
}
.ov-auth-backdrop .ovl-head { text-align: center; margin-bottom: 20px; }
.ov-auth-backdrop .ovl-head-img { display: block; height: 26px; width: auto; margin: 4px auto 0; }
.ov-auth-backdrop .ovl-title { font-size:20px; font-weight: 700; line-height: 1.3; }
.ov-auth-backdrop .ovl-sub {
  margin-top: 8px; font-size:13px; line-height: 1.5; color: var(--text-2);
}

/* Form wrapper + Sign in / Register tab group. The active tab drives the form
   below (fields, hint, submit label follow via a re-render). */
.ov-auth-backdrop .ovl-form-wrapper { display: block; }
.ov-auth-backdrop .ovl-tabs {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 16px;
  background: var(--canvas); border-radius:12px;
}
.ov-auth-backdrop .ovl-tab {
  flex: 1; height: 36px; border: none; border-radius:8px; cursor: pointer;
  background: none; color: var(--text-2); font-family: inherit; font-size:14px; font-weight: 600;
}
.ov-auth-backdrop .ovl-tab:hover { color: #18181b; }
.ov-auth-backdrop .ovl-tab.active {
  background: var(--surface); color: #18181b; box-shadow:var(--e-1);
}

/* Social buttons — neutral white with the brand glyph, stacked full-width. */
/* Gate badge — names the situation in two words so the dialog does not feel like
   it appeared out of nowhere. */
.ov-auth-backdrop .ovl-badge {
  display: inline-block; margin-bottom: 10px; padding: 4px 10px; border-radius:999px;
  background: var(--warn-tint); color: #d1453b; font-size:12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em;
}

/* Why sign in. Only claims that are true today (see auth.js). */
.ov-auth-backdrop .ovl-why {
  list-style: none; margin: 0 0 18px; padding: 14px 14px 12px;
  background: var(--canvas); border-radius:12px; text-align: left;
}
.ov-auth-backdrop .ovl-why li {
  display: flex; align-items: flex-start; gap: 9px;
  font-size:13px; line-height: 1.45; color: #3f3f46; padding: 4px 0;
}
.ov-auth-backdrop .ovl-why-ic { flex: none; margin-top: 2px; color: #16a34a; }

.ov-auth-backdrop .ovl-social { display: flex; flex-direction: column; gap: 10px; }
.ov-auth-backdrop .ovl-oauth {
  height: 46px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1px solid #e4e4e7; border-radius:12px; background: var(--surface); color: #18181b;
  font-size:15px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.ov-auth-backdrop .ovl-oauth:hover:not(:disabled) { background: var(--surface-hover); }
.ov-auth-backdrop .ovl-oauth:disabled { opacity: .7; cursor: default; }

.ov-auth-backdrop .ovl-or {
  display: flex; align-items: center; gap: 12px; margin: 16px 0; color: #a1a1aa; font-size:12px;
}
.ov-auth-backdrop .ovl-or::before,
.ov-auth-backdrop .ovl-or::after { content: ""; flex: 1; height: 1px; background: var(--canvas); }

.ov-auth-backdrop .ovl-form { display: flex; flex-direction: column; gap: 12px; }
.ov-auth-backdrop .ovl-field { display: flex; flex-direction: column; gap: 6px; }
.ov-auth-backdrop .ovl-field > label { font-size:12px; font-weight: 600; color: var(--text-2); }
.ov-auth-backdrop .ovl-field input {
  height: 44px; border: 1px solid #e4e4e7; border-radius:8px; padding: 0 12px;
  font-size:15px; font-family: inherit; color: #18181b; background: var(--surface); width: 100%;
  box-sizing: border-box; outline: none;
}
.ov-auth-backdrop .ovl-field input:focus {
  border-color: #fe655d; box-shadow: 0 0 0 3px rgba(254,101,93,.14);
}
.ov-auth-backdrop .ovl-pw-wrap { position: relative; display: block; }
.ov-auth-backdrop .ovl-pw-wrap input { padding-right: 44px; }
.ov-auth-backdrop .ovl-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer; color: #a1a1aa; border-radius:8px;
}
.ov-auth-backdrop .ovl-eye:hover { color: var(--text-2); background: var(--surface-hover); }
.ov-auth-backdrop .ovl-eye-on { color: #fe655d; }

.ov-auth-backdrop .ovl-row-end { display: flex; justify-content: flex-end; }
.ov-auth-backdrop .ovl-hint { font-size:12px; color: #8a8a94; }

.ov-auth-backdrop .ovl-primary {
  height: 46px; width: 100%; display: block; border: none; border-radius:12px;
  background: #18181b; color: #fff; font-size:15px; font-weight: 600; font-family: inherit;
  cursor: pointer; margin-top: 2px;
}
.ov-auth-backdrop .ovl-primary:hover:not(:disabled) { background: #2b2b30; }
.ov-auth-backdrop .ovl-primary:disabled { opacity: .75; cursor: default; }

.ov-auth-backdrop .ovl-link {
  border: none; background: none; padding: 0; cursor: pointer; font-family: inherit;
  font-size:13px; font-weight: 600; color: #fe655d;
}
.ov-auth-backdrop .ovl-link:hover { text-decoration: underline; }

.ov-auth-backdrop .ovl-switch { text-align: center; margin-top: 16px; font-size:13px; color: var(--text-2); }
.ov-auth-backdrop .ovl-alt { display: block; width: 100%; text-align: center; margin-top: 14px; }
.ov-auth-backdrop .ovl-back { display: inline-flex; margin-bottom: 4px; }

/* Per-input validation message shown under the field. */
.ov-auth-backdrop .ovl-field-err {
  font-size:12px; font-weight: 400; line-height: 1.4; color: #b91c1c; margin-top: 2px;
}
.ov-auth-backdrop .ovl-field-err.ovl-ok { color: #15803d; }
/* Invalid field: red border + focus ring on the input. */
.ov-auth-backdrop .ovl-field.invalid input { border-color: #ef4444; }
.ov-auth-backdrop .ovl-field.invalid input:focus {
  border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.16);
}

.ov-auth-backdrop .ovl-legal {
  margin-top: 16px; font-size:12px; line-height: 1.5; color: #a1a1aa; text-align: center;
}

/* ---------------------------------------------------------------------------
 * Overflow / mobile. This dialog is content-heavy (badge + reasons + social +
 * email + phone), so on short viewports — and especially on a phone once the
 * on-screen keyboard is up — it is taller than the screen. Flex-centering on its
 * own would clip the top and bottom with no way to scroll to them. Letting the
 * backdrop scroll and centering the card with auto margins keeps it centred when
 * it fits and reachable when it doesn't.
 * --------------------------------------------------------------------------- */
.ov-auth-backdrop { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ov-auth-backdrop .modal { margin: auto; }

@media (max-width: 480px) {
  .ov-auth-backdrop { padding: 12px; align-items: flex-start; }
  .ov-auth-backdrop .modal { max-width: 100%; border-radius:16px; }
  .ov-auth-backdrop .ovl-card { padding: 26px 18px 16px; }
  .ov-auth-backdrop .ovl-title { font-size:16px; }
  .ov-auth-backdrop .ovl-why { padding: 12px 12px 10px; margin-bottom: 14px; }
  .ov-auth-backdrop .ovl-why li { font-size:12px; }
  /* 16px stops iOS Safari from zooming the whole page when a field is focused. */
  .ov-auth-backdrop .ovl-field input { font-size:16px; }
}

/* ---------------------------------------------------------------------------
 * Home-page header control (see assets/homepage/home-auth.js). Hidden until the
 * server confirms sign-in is live, so a build with accounts off is unchanged.
 * --------------------------------------------------------------------------- */
.fp-auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: none;          /* never shrink: it sits next to the header's CTA */
  height: 38px;
  padding: 0 14px;
  border-radius:999px;
  border: 1px solid #e4e4e7;
  background: var(--surface);
  color: #18181b;
  font-size:14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.fp-auth-btn:hover { background: var(--surface-hover); }
.fp-auth-btn[hidden] { display: none; }
/* Signed in: collapse to just the avatar. */
.fp-auth-btn.fp-auth-signed-in {
  width: 38px;
  padding: 0;
  justify-content: center;
  overflow: hidden;
  border-color: transparent;
  background: none;
}
.fp-auth-av { width: 30px; height: 30px; border-radius:999px; object-fit: cover; display: block; }
.fp-auth-ic { flex: none; color: var(--text-2); }
.fp-auth-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #18181b;
  color: #fff;
  font-size:13px;
  font-weight: 700;
}
@media (max-width: 640px) {
  /* Keep the header from wrapping on small screens: the icon carries it. */
  .fp-auth-label { display: none; }
  .fp-auth-btn { width: 38px; padding: 0; justify-content: center; }
}

/* Account menu: one-tap path to the standalone history page. Sits above the
   sign-out button, styled as a quiet row rather than a second primary action. */
.acct-history{display:block;margin:14px 0 4px;padding:11px 14px;border:1px solid var(--ov-line,#ececee);
  border-radius:12px;font-size:14px;font-weight:700;color:inherit;text-decoration:none;
  text-align:center;background:var(--canvas);transition:border-color .15s,background .15s}
.acct-history:hover{border-color:#dcdce0;background:var(--canvas)}
.acct-history:focus-visible{outline:3px solid rgba(254,101,93,.35);outline-offset:1px}
