/* 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, dashboard.js, profile.js. */
.user-menu {
  position: relative;
}
.user-menu__btn {
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  width: 36px; height: 36px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: #2f6f4f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.user-menu__btn:hover, .user-menu__btn:focus-visible {
  background: #f3f4f6;
  outline: none;
}

.user-menu__pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.05);
  padding: 0;
  min-width: 220px;
  max-width: 280px;
  z-index: 100;
  overflow: hidden;
  font-family: Inter, system-ui, -apple-system, sans-serif;
}

/* Non-clickable header block (name + email). */
.user-menu__name {
  padding: 12px 14px 2px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu__email {
  padding: 0 14px 12px;
  font-size: 0.78rem;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Clickable items: both <a> links and <button>s look the same. */
.user-menu__pop a,
.user-menu__pop button {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  background: none;
  border: 0;
  padding: 10px 14px;
  font: inherit;
  font-family: inherit;
  font-size: 0.92rem;
  color: #111827;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
}
.user-menu__pop a:hover,
.user-menu__pop button:hover {
  background: #f3f4f6;
}

.user-menu__pop hr {
  border: 0;
  border-top: 1px solid #e5e7eb;
  margin: 0;
}

.user-menu__pop button.danger { color: #b91c1c; }
