/*
 * cheery-usermenu.css — Google-style multi-account avatar menu.
 * Namespaced under #user-menu and .um-* — safe to drop on any page.
 *
 * Brand: green #19af75, danger red #d24a43.
 * Do NOT add overflow-y to .um-dropdown — it forces overflow-x:auto and clips content.
 */

/* ── Mount point ──────────────────────────────────────────────────────── */
#user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* ── Avatar button ────────────────────────────────────────────────────── */
.um-avatar {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #19af75;
  background: #19af75;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
}
.um-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.um-avatar svg {
  width: 22px;
  height: 22px;
  display: block;
}
.um-avatar:hover,
.um-avatar:focus-visible {
  background: #15985f;
  border-color: #15985f;
  box-shadow: 0 0 0 3px rgba(25, 175, 117, 0.25);
  outline: none;
}

/* ── Dropdown panel ───────────────────────────────────────────────────── */
.um-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 260px;
  /* Width follows content; max-width prevents viewport overflow.
     No overflow-y — adding it (per CSS spec) also sets overflow-x:auto
     which clips wide content to min-width. */
  width: max-content;
  max-width: calc(100vw - 24px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  text-align: left;
  z-index: 200;
  padding: 6px 0;
  box-sizing: border-box;
}
#user-menu.open .um-dropdown {
  display: block;
}

/* ── Divider ──────────────────────────────────────────────────────────── */
.um-divider {
  border: none;
  border-top: 1px solid #eef1ef;
  margin: 4px 0;
}

/* ── Block 1: current account (centered) ─────────────────────────────── */
.um-block-current {
  padding: 20px 16px 16px;
  text-align: center;
}
.um-avatar-large {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #19af75;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 auto 10px;
}
.um-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.um-avatar-large svg {
  width: 30px;
  height: 30px;
  display: block;
}
.um-block-current .um-name {
  font-size: 0.98rem;
  font-weight: 600;
  color: #1d2b24;
  margin-bottom: 2px;
}
.um-block-current .um-email {
  font-size: 0.82rem;
  color: #6b7c74;
  word-break: break-all;
}
/* Actions row: 管理账号 | 退出登录 side by side */
.um-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
  box-sizing: border-box;
}

.um-btn-manage {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border: 1px solid #c8d5ce;
  border-radius: 20px;
  font-size: 0.85rem;
  color: #1d2b24;
  text-decoration: none;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  box-sizing: border-box;
  white-space: nowrap;
  flex: 1;
}
.um-btn-manage:hover {
  background: #f1f4f2;
  border-color: #a8b8b0;
  text-decoration: none;
  color: #1d2b24;
}

.um-btn-signout-current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border: 1px solid #e9c5c3;
  border-radius: 20px;
  font-size: 0.85rem;
  color: #d24a43;
  text-decoration: none;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  box-sizing: border-box;
  white-space: nowrap;
  flex: 1;
}
.um-btn-signout-current:hover {
  background: #fdf2f1;
  border-color: #d24a43;
  color: #b53b35;
  text-decoration: none;
}

/* ── Shared item style ────────────────────────────────────────────────── */
.um-item {
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 16px;
  border: 0;
  border-radius: 0;
  background: none;
  color: #1d2b24;
  font-size: 0.93rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  gap: 8px;
  text-align: left;
}
.um-item:hover,
.um-item:focus-visible {
  background: #f1f4f2;
  color: #1d2b24;
  text-decoration: none;
  outline: none;
}

/* ── Block 2: switch accounts (collapsible) ───────────────────────────── */
.um-block-switch {
  /* no extra padding; rows use .um-item spacing */
}

.um-switch-toggle {
  justify-content: space-between;
  font-weight: 500;
}

/* Chevron icon rotates when expanded */
.um-chevron {
  display: block;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.um-block-switch.expanded .um-chevron {
  transform: rotate(180deg);
}

/* Collapsible content — hidden by default */
.um-switch-content {
  display: none;
  padding-bottom: 4px;
}
.um-block-switch.expanded .um-switch-content {
  display: block;
}

/* Section label inside collapsed content */
.um-switch-section-label {
  padding: 6px 16px 2px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #8a9e96;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Per-account row: flex, switch link fills, 登出 on right */
.um-account-row {
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 0 16px;
  gap: 8px;
}
.um-account-label {
  flex: 1;
  display: block;
  padding: 8px 0;
  color: #1d2b24;
  font-size: 0.93rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.um-account-label:hover {
  color: #19af75;
  text-decoration: none;
}
.um-account-signout {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: #6b7c74;
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.um-account-signout:hover {
  background: #f1f4f2;
  color: #d24a43;
  text-decoration: none;
}

/* "+ 登录其他账号" */
.um-add-account {
  color: #19af75;
  font-weight: 500;
}
.um-add-account:hover {
  color: #15985f;
}
.um-plus {
  color: #19af75;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
}

/* ── Block 3: footer (centered) ───────────────────────────────────────── */
.um-block-footer {
  padding: 4px 0;
}

/* All footer items are center-aligned per spec */
.um-block-footer .um-item {
  justify-content: center;
}

.um-admin {
  color: #1d2b24;
}

.um-signout-all {
  color: #d24a43;
  font-weight: 500;
}
.um-signout-all:hover {
  background: #fdf2f1;
  color: #b53b35;
}
