/* Accounts (app/src/account.ts): the header's sign-in button and the
   account dialog. The dialog is built like the confirm dialog
   (confirmDialog.css) but sits below it in z-order, so an alert can still
   appear on top of it. */

#accountButton {
  gap: 8px;
}
/* The button classes set display: flex, which would beat the browser's own
   [hidden] rule; without this the header button shows on a site with no
   Google client, and the settings panel's "clear everything" ignores the
   sign-in state (signed out only). */
#accountButton[hidden],
#resetEverythingButton[hidden] {
  display: none;
}
#accountButton p {
  margin: 0;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#accountAvatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
/* The icon shown without a picture: the same circle as the picture would
   be, so the button keeps its width either way and a ring around it
   (presence.css) is the size of the other avatars'. */
#accountButton .smallIcon {
  box-sizing: border-box;
  width: 28px;
  height: 28px;
  padding: 4px;
  border-radius: 50%;
}

#accountDialogOverlay {
  position: fixed;
  inset: 0;
  z-index: 190;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
}
#accountDialogOverlay:not([hidden]) {
  display: flex;
}

#accountDialogPanel {
  position: relative;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--bg);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0px 4px 16px 2px #0001;
}
#accountDialogPanel h3 {
  margin: 0 0 8px 0;
  /* Room for the close button in the corner. */
  padding-right: 32px;
}
/* Only the panel's own paragraphs (the sign-in text, the privacy note):
   not the label inside a button, nor the project list's lines. */
#accountDialogPanel > div > p {
  color: var(--textFaint);
  margin: 0 0 16px 0;
}
#accountDialogEmail {
  color: var(--textFaint);
}

/* Google draws its button here; the box keeps its height while the script
   loads so the dialog doesn't jump. */
#googleSignInButton {
  min-height: 44px;
  margin: 8px 0 16px 0;
  display: flex;
  justify-content: center;
}

.accountError {
  color: var(--redDark);
}
/* Scoped under the panel so it outranks the panel's paragraph rule above. */
#accountDialogPanel .accountPrivacyNote {
  font-size: 0.8rem;
  margin-bottom: 0;
}
.accountPrivacyNote a {
  color: inherit;
}

.accountIdentity {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
#accountDialogAvatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
}
.accountIdentity p {
  margin: 0;
  overflow-wrap: anywhere;
}
#accountDialogName {
  color: var(--text);
}

/* --- The project list (projects.ts), on the signed-in side --- */

/* Wider than the sign-in side: names, counts and three actions per row.
   Keyed on being signed in (the sign-in side hidden), not on the list
   view, so switching to the manage view and back doesn't resize the
   dialog. */
#accountDialogPanel:has(#accountSignedOut[hidden]) {
  width: 540px;
}
.accountIdentity {
  margin-bottom: 16px;
}
.projectsHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 8px 0;
}
.projectsHeader h4 {
  margin: 0;
}
#projectsPanel .projectsNote {
  color: var(--text);
  background: var(--bgHover);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
#projectsPanel .projectsPdfDownloads {
  margin: 12px 0;
}
#projectsList {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.projectRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.projectRow.currentProject {
  border-color: var(--accent);
}
.projectOpen {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--text);
}
.projectOpen:hover .projectName {
  color: var(--accent);
}
.projectName {
  display: block;
  font-family: "Lato Bold";
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.projectMeta {
  display: block;
  font-size: 0.75rem;
  color: var(--textFaint);
  margin-top: 2px;
}
/* Under the name: "Open now" and/or "Published". */
.projectBadges {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.projectPublishedBadge {
  font-size: 0.7rem;
  color: var(--greenDark);
  border: 1px solid var(--greenSemi);
  border-radius: 999px;
  padding: 1px 7px;
}
.projectCurrentBadge {
  font-family: "Lato Bold";
  font-size: 0.7rem;
  color: var(--accent);
}
.projectRenameInput {
  width: 100%;
  font-family: "Lato Bold";
  font-size: 0.9rem;
}
.projectActions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.projectActions button {
  background: none;
  padding: 6px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--textFaint);
  cursor: pointer;
}
.projectActions button:hover {
  color: var(--accent);
}
/* "Your projects" / "Shared with you" over the two groups of rows. */
#projectsList .projectsGroupTitle {
  margin: 8px 0 2px 0;
  font-size: 0.75rem;
  color: var(--textFaint);
}
#projectsList .projectsGroupTitle:first-child {
  margin-top: 0;
}
.projectSharedBadge {
  font-size: 0.7rem;
  color: var(--textMuted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
}

/* --- The members view (projects.ts, openMembersView) --- */

.membersProjectName {
  font-family: "Lato Bold";
  margin: 0 0 8px 0;
}
/* Both are flex boxes, which a bare [hidden] does not hide. */
.membersLinkRow[hidden],
#membersCreateLinkButton[hidden] {
  display: none;
}
.membersLinkRow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.membersLinkRow input {
  flex: 1 1 240px;
  min-width: 0;
  font-size: 0.8rem;
}
#membersList {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}
.memberRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.memberWho {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.memberName {
  font-family: "Lato Bold";
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.memberEmail {
  font-size: 0.75rem;
  color: var(--textFaint);
}
.memberRemove {
  background: none;
  padding: 6px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--textFaint);
  cursor: pointer;
}
.memberRemove:hover {
  color: var(--accent);
}
#accountMembers .membersEmpty {
  margin: 0 0 8px 0;
}

/* "Sign out" with the quieter "Manage account" beside it. */
.accountActions {
  display: flex;
  align-items: center;
  gap: 8px;
}
#accountManageButton {
  color: var(--textFaint);
}

/* --- The manage view (showAccountDialogView) --- */

/* A text button above the title, lined up with it: its arrow sits where
   the title's left edge is. */
.accountBackButton {
  display: inline-flex;
  gap: 6px;
  min-height: 32px;
  padding: 4px 0;
  margin-bottom: 12px;
  color: var(--textFaint);
}
.accountBackButton svg {
  width: 16px;
  height: 16px;
}
#accountManage h4 {
  margin: 24px 0 4px 0;
}
/* The dialog's one destructive action: plain until pointed at. The confirm
   dialog does the real asking. */
#accountDeleteButton:hover {
  border-color: var(--redDark);
  color: var(--redDark);
}

/* Phones: the picture or icon alone, like the header's other buttons. */
@media (max-width: 700px) {
  #accountButtonText {
    display: none;
  }
}
