/* ============================================================
 * 命主胶囊（共享组件 · 跨页复用）
 * ----------------------------------------------------------
 *  样式抽自 ask.css 的 .ask-profile-switch，前缀 .pp-
 *  让 wxti / report 等页能直接挂载使用
 * ============================================================ */

.pp-switch {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  font-family: inherit;
}

.pp-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 8px;
  background: rgba(0,0,0,0.03);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  max-width: 320px;
}
.pp-btn:hover {
  background: rgba(22, 97, 171, 0.06);
  border-color: rgba(22, 97, 171, 0.15);
}

.pp-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1661AB 0%, #0E4A82 100%);
  color: #fff;
  font-family: 'Noto Serif SC', serif;
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(22, 97, 171, 0.25);
}

.pp-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.25;
}
.pp-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #1A1A2E;
  letter-spacing: 0.5px;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pp-birth {
  font-size: 11.5px;
  color: #888;
  letter-spacing: 0.5px;
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.pp-caret {
  color: #888;
  flex-shrink: 0;
  transition: transform 0.18s;
}
.pp-switch.is-open .pp-caret { transform: rotate(180deg); }

/* 下拉菜单 */
.pp-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  transform: translateY(-6px);
  width: 320px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.06);
  padding: 8px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.18s;
  z-index: 50;
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pp-switch.is-open .pp-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.pp-menu-head {
  font-size: 11.5px;
  color: #888;
  letter-spacing: 2px;
  padding: 8px 12px 6px;
  font-weight: 600;
}
.pp-menu-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: 320px;
}
.pp-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
  text-decoration: none;
  color: inherit;
  background: transparent;
  border: none;
  font-family: inherit;
  text-align: left;
  width: 100%;
}
.pp-menu-item:hover { background: rgba(0,0,0,0.04); }
.pp-menu-item.is-current { background: rgba(22, 97, 171, 0.08); }
.pp-menu-item-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1661AB 0%, #0E4A82 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-family: 'Noto Serif SC', serif;
}
.pp-menu-item-body {
  flex: 1;
  min-width: 0;
}
.pp-menu-item-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #1A1A2E;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.pp-menu-item-meta {
  font-size: 11.5px;
  color: #888;
  font-family: 'Inter', 'Noto Sans SC', sans-serif;
  letter-spacing: 0.5px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  font-variant-numeric: tabular-nums;
}
.pp-menu-item-tag {
  flex-shrink: 0;
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(22, 97, 171, 0.08);
  color: #1661AB;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.pp-menu-item-edit {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #999;
  text-decoration: none;
  transition: all 0.12s;
  margin-left: 2px;
}
.pp-menu-item-edit:hover {
  background: rgba(22, 97, 171, 0.1);
  color: #1661AB;
}
.pp-menu-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  padding: 9px 12px;
  border-top: 1px dashed rgba(0,0,0,0.08);
  text-decoration: none;
  color: #1661AB;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: 10px;
  transition: background 0.12s;
}
.pp-menu-add:hover { background: rgba(22, 97, 171, 0.06); }

/* toast */
.pp-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translate(-50%, -16px);
  background: rgba(20, 20, 30, 0.92);
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.5px;
  padding: 9px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 9999;
  max-width: 80vw;
  text-align: center;
}
.pp-toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 深色模式 */
[data-theme="dark"] .pp-btn { background: rgba(255,255,255,0.06); }
[data-theme="dark"] .pp-btn:hover { background: rgba(125,183,229,0.10); border-color: rgba(125,183,229,0.20); }
[data-theme="dark"] .pp-name { color: #f5f5f5; }
[data-theme="dark"] .pp-birth { color: #aaa; }
[data-theme="dark"] .pp-menu { background: #1f1f1f; border-color: #333; }
[data-theme="dark"] .pp-menu-item:hover { background: rgba(255,255,255,0.05); }
[data-theme="dark"] .pp-menu-item.is-current { background: rgba(125,183,229,0.12); }
[data-theme="dark"] .pp-menu-item-name { color: #f5f5f5; }
[data-theme="dark"] .pp-menu-item-meta { color: #999; }
[data-theme="dark"] .pp-menu-item-edit { color: #80796D; }
[data-theme="dark"] .pp-menu-item-edit:hover { background: rgba(125,183,229,0.12); color: #7DB7E5; }
[data-theme="dark"] .pp-menu-add { color: #7DB7E5; border-top-color: rgba(255,255,255,0.08); }

/* 移动端：胶囊缩小 */
@media (max-width: 480px) {
  .pp-btn { padding: 5px 10px 5px 6px; gap: 7px; }
  .pp-avatar { width: 26px; height: 26px; font-size: 12px; }
  .pp-name { font-size: 12.5px; max-width: 110px; }
  .pp-birth { font-size: 10.5px; max-width: 130px; }
  .pp-menu { width: 280px; }
}
