/* Auth gate + user menu — companion stylesheet to auth.js. */

/* Auth gate (shown by auth.js when no Firebase session). */
#auth-gate {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: grid;
  place-items: center;
  z-index: 9000;
  font-family: Inter, system-ui, sans-serif;
}
.auth-gate__panel {
  background: white;
  padding: 32px 28px;
  border-radius: 12px;
  text-align: center;
  max-width: 380px;
  width: calc(100% - 32px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}
.auth-gate__title { font-size: 1.6rem; margin: 0 0 4px; color: #2f6f4f; }
.auth-gate__sub   { color: #6b7280; margin: 0 0 18px; font-size: 0.95rem; }

/* Sign-in / Sign-up tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border-bottom: 1px solid #e5e7eb;
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 10px 4px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.auth-tab:hover { color: #111827; }
.auth-tab--active {
  color: #2f6f4f;
  border-bottom-color: #2f6f4f;
  font-weight: 600;
}

#auth-gate-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}
#auth-gate-email,
#auth-gate-password {
  padding: 11px 13px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}
#auth-gate-email:focus,
#auth-gate-password:focus {
  outline: 2px solid #2f6f4f;
  outline-offset: 1px;
  border-color: #2f6f4f;
}

/* Secondary links (Forgot password / Magic link) */
.auth-gate__links {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: #6b7280;
}
.auth-gate__link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: #2f6f4f;
  cursor: pointer;
  text-decoration: none;
}
.auth-gate__link:hover { text-decoration: underline; }
.auth-gate__dot { color: #d1d5db; }

.auth-gate__btn {
  background: #2f6f4f; color: white;
  border: 0; border-radius: 8px;
  padding: 12px 24px;
  font-size: 1rem; font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.auth-gate__btn:hover { background: #245438; }
.auth-gate__btn:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-gate__msg {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  text-align: left;
}
.auth-gate__msg--ok  { background: #ecfdf5; color: #065f46; }
.auth-gate__msg--err { background: #fef2f2; color: #991b1b; }

/* Hide the page until auth is ready, so users don't see a flash of the app
   before the gate opens. */
body.auth-pending > *:not(#auth-gate):not(script) { visibility: hidden; }

/* Header user menu (mounted into #user-menu-host by app.js / practice.js / dashboard.js). */
.user-menu {
  position: relative;
}
.user-menu__btn {
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  width: 34px; height: 34px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: #2f6f4f;
}
.user-menu__btn:hover { background: #f3f4f6; }
.user-menu__pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  padding: 6px 0;
  min-width: 220px;
  z-index: 100;
}
.user-menu__email {
  padding: 8px 14px 6px;
  font-size: 0.82rem;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu__pop button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.95rem;
  color: #111827;
  cursor: pointer;
}
.user-menu__pop button:hover {
  background: #f3f4f6;
}
.user-menu__pop hr {
  border: 0;
  border-top: 1px solid #e5e7eb;
  margin: 4px 0;
}
.user-menu__pop button.danger { color: #b91c1c; }
