/* ============================================================
   StudyVaults — auth UI (nav button, dropdown, modal)
   Loaded on every page; only used when accounts are configured.
   ============================================================ */

/* ---- Nav sign-in button / avatar ---- */
.auth-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 999px;
  font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  background: transparent; color: var(--ink); border: 1px solid var(--line);
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
  white-space: nowrap; flex-shrink: 0;
}
.auth-btn:hover { background: var(--surface-2); transform: translateY(-1px); }
.auth-btn.is-in { padding: 0; width: 40px; border-color: transparent; }
.auth-btn__avatar {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .95rem;
}
[data-theme="dark"] .auth-btn__avatar { color: #14131a; }

/* ---- Account dropdown ---- */
.auth-menu {
  position: fixed; z-index: 60; min-width: 210px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 8px; overflow: hidden;
}
.auth-menu__email {
  font-size: .82rem; color: var(--muted); padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line); margin: 0 0 6px; word-break: break-all;
}
.auth-menu__item {
  display: block; width: 100%; text-align: left; padding: 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink);
  font: inherit; font-size: .92rem; font-weight: 500; cursor: pointer; text-decoration: none;
}
.auth-menu__item:hover { background: var(--surface-2); color: var(--accent-ink); }
.auth-menu__item:disabled { opacity: .6; cursor: default; }

/* ---- Modal ---- */
.auth-modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 20px;
  background: color-mix(in srgb, #0b0b0f 55%, transparent);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: authFade .2s var(--ease);
}
@keyframes authFade { from { opacity: 0; } to { opacity: 1; } }
.auth-modal__card {
  position: relative; width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; padding: 32px 28px; box-shadow: var(--shadow-lg);
}
.auth-modal__close {
  position: absolute; top: 14px; right: 16px;
  width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: transparent; color: var(--muted); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.auth-modal__close:hover { background: var(--surface-2); color: var(--ink); }
.auth-modal__title { font-family: var(--font-display); font-weight: 400; font-size: 1.55rem; }
.auth-modal__sub { color: var(--muted); font-size: .92rem; margin: 6px 0 20px; }

.auth-tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; margin-bottom: 20px; }
.auth-tabs button {
  flex: 1; padding: 9px; border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 600; font-size: .9rem; color: var(--muted); background: transparent;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.auth-tabs button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.auth-form label[hidden] { display: none !important; }
/* newsletter opt-in: checkbox beside its consent text (GDPR) */
.auth-form label.auth-check { grid-template-columns: auto 1fr; align-items: start; gap: 9px; font-weight: 500; line-height: 1.45; }
.auth-form label.auth-check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); }
.auth-form label.auth-check a { color: var(--accent-ink); text-decoration: underline; }
.auth-form input {
  font: inherit; font-size: 1rem; color: var(--ink);
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.auth-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.auth-submit { margin-top: 4px; justify-content: center; }

.auth-forgot { margin: -8px 0 0; text-align: right; }
.auth-link {
  background: none; border: 0; padding: 0; font: inherit; font-size: .85rem;
  color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}

.auth-msg { margin: 0; font-size: .86rem; color: #c0392b; }
.auth-msg.is-ok { color: var(--success-ink); }
[data-theme="dark"] .auth-msg { color: #ff8a80; }

.auth-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: .8rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-google { width: 100%; justify-content: center; }

/* ---- Sign-in gate (locked notes) ---- */
body.is-locked .topic-layout,
body.is-locked .selftest,
body.is-locked .topic-nav,
body.is-locked .topic-share,
body.is-locked .revise,
body.is-locked .topic-back { display: none !important; }
.authgate { max-width: 560px; margin: 28px auto clamp(48px, 8vw, 90px); }
.authgate__card {
  text-align: center; padding: clamp(40px, 7vw, 64px) 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
  box-shadow: var(--shadow-lg);
}
.authgate__icon {
  display: grid; place-items: center; width: 56px; height: 56px;
  margin: 0 auto 18px; border-radius: 16px;
  background: var(--accent-tint); color: var(--accent-ink);
}
.authgate h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.6rem, 4vw, 2.1rem); }
.authgate p { margin: 12px auto 0; max-width: 380px; color: var(--muted); }
.authgate__actions { display: flex; gap: 12px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
