/* ============================================================
   community.css
   Styles for new community surfaces:
     - Post detail (P0-1)
     - Notification center (P0-2)
     - Profile page (P0-3)
     - Direct messages (P0-4)
     - Web push affordances (P1-1)
   Authoring rule: do NOT bloat style.css; everything new lands here.
   ============================================================ */

/* ---------- Toast utility (community feature scope) ---------- */
.communityToastHost {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.communityToast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 360px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(20, 22, 32, 0.92);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: communityToastIn 180ms ease-out;
}
.communityToast.isError { border-color: #d94c4c; background: rgba(75, 22, 22, 0.96); }
.communityToast.isSuccess { border-color: #4cd97a; }
@keyframes communityToastIn {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ---------- Shared chips/avatars ---------- */
.communityAvatarChip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
}
.communityAvatarChip:hover .communityAvatarChipName { text-decoration: underline; }
.communityAvatarChipAvatar {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #5b8cff 0%, #b85bff 100%);
  color: #fff; border-radius: 50%; font-weight: 600; font-size: 13px;
}
.communityAvatarChipName { font-weight: 600; }

/* ---------- Post detail (P0-1) ---------- */
.postDetailPage {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 0 64px;
}
.postDetailPageTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.postDetailEmpty,
.postDetailLoading {
  padding: 48px 18px;
  text-align: center;
  color: rgba(255, 255, 255, 0.62);
  font-size: 14px;
}
.postDetailCard {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.postDetailHero {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.postDetailTitle {
  font-size: 22px;
  line-height: 1.28;
  font-weight: 700;
  margin: 0;
}
.postDetailMeta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
}
.postDetailMeta .communitySideTag { margin-left: 4px; }
.postDetailImage {
  margin: 4px 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}
.postDetailImage img { width: 100%; display: block; }
.postDetailBody {
  font-size: 15px;
  line-height: 1.62;
  white-space: pre-wrap;
  color: rgba(255, 255, 255, 0.88);
}
.postDetailActionRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.postDetailActionRow .postDetailActionBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.postDetailActionRow .postDetailActionBtn:hover { background: rgba(255, 255, 255, 0.12); }
.postDetailActionRow .postDetailActionBtn.isActive {
  background: rgba(91, 140, 255, 0.18);
  border-color: rgba(91, 140, 255, 0.6);
}
.postDetailActionRow .postDetailActionBtn strong { font-weight: 600; }

.postDetailComments {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.postDetailCommentsHead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.postDetailCommentsHead h3 {
  font-size: 16px;
  margin: 0;
}
.postDetailCommentsHead span {
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
}
.postDetailComposer {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.postDetailComposer textarea {
  flex: 1;
  min-height: 64px;
  resize: vertical;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: inherit;
  font: inherit;
}
.postDetailCommentList {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.postDetailCommentItem {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.postDetailCommentItem.isHighlight {
  background: rgba(91, 140, 255, 0.08);
  border-radius: 8px;
  padding: 10px;
}
.postDetailCommentMeta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}
.postDetailCommentTime { color: rgba(255, 255, 255, 0.45); }
.postDetailCommentBody {
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.postDetailCommentsMore {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

/* ---------- Notification center (P0-2) ---------- */
.notificationBellBtn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: inherit;
  cursor: pointer;
  margin-right: 6px;
}
.notificationBellBtn:hover { background: rgba(255, 255, 255, 0.12); }
.notificationBellBtn svg { width: 18px; height: 18px; }
.notificationBellBadge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ff4d4d;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.notificationBellBadge[hidden] { display: none; }

.notificationPanel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 92vw;
  background: rgba(14, 16, 24, 0.98);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 8000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 220ms ease-out;
  box-shadow: -18px 0 36px rgba(0, 0, 0, 0.45);
}
.notificationPanel.isOpen { transform: translateX(0); }
.notificationPanelHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.notificationPanelHead h2 { margin: 0; font-size: 16px; }
.notificationPanelClose {
  background: none; border: 0; color: inherit; font-size: 18px; cursor: pointer;
}
.notificationPanelTabs {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
}
.notificationPanelTab {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.notificationPanelTab.isActive {
  background: rgba(91, 140, 255, 0.2);
  border-color: rgba(91, 140, 255, 0.6);
}
.notificationPanelList {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.notificationPanelEmpty {
  padding: 36px 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}
.notificationItem {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  padding: 10px 16px;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.notificationItem:hover { background: rgba(255, 255, 255, 0.04); }
.notificationItem.isUnread { background: rgba(91, 140, 255, 0.08); }
.notificationItemAvatar {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #5b8cff 0%, #b85bff 100%);
  color: #fff; border-radius: 50%; font-weight: 600; font-size: 13px;
}
.notificationItemText { font-size: 13px; line-height: 1.4; }
.notificationItemText strong { font-weight: 600; }
.notificationItemTime { color: rgba(255, 255, 255, 0.45); font-size: 12px; }
.notificationPanelFoot {
  padding: 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.notificationPanelScrim {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
  z-index: 7999;
}
.notificationPanelScrim.isOpen { opacity: 1; pointer-events: auto; }

/* ---------- Profile (P0-3) ---------- */
.profilePage {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 0 64px;
}
.profileLoading,
.profileEmpty {
  padding: 36px 18px;
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
}
.profileHero {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 18px;
  align-items: center;
}
.profileHeroAvatar {
  width: 88px; height: 88px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #5b8cff 0%, #b85bff 100%);
  color: #fff; border-radius: 50%; font-size: 30px; font-weight: 700;
}
.profileHeroMeta { display: flex; flex-direction: column; gap: 4px; }
.profileHeroName { font-size: 22px; font-weight: 700; margin: 0; }
.profileHeroId { color: rgba(255, 255, 255, 0.5); font-size: 13px; }
.profileHeroStats { display: flex; gap: 18px; margin-top: 8px; font-size: 13px; color: rgba(255, 255, 255, 0.75); }
.profileHeroStats strong { font-size: 14px; color: #fff; }
.profileHeroActions { display: flex; gap: 8px; align-items: center; }
.profileFollowBtn,
.profileMessageBtn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(91, 140, 255, 0.7);
  background: rgba(91, 140, 255, 0.16);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.profileFollowBtn.isFollowing {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.16);
}
.profileMessageBtn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}
.profileTabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.profileTab {
  padding: 10px 14px;
  background: none;
  border: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.profileTab.isActive {
  color: #fff;
  border-bottom-color: #5b8cff;
}
.profileTabPanel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- Direct messages (P0-4) ---------- */
.messagesPage {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  height: calc(100vh - 96px);
  min-height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
}
.messagesInbox {
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.02);
}
.messagesInboxHead {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-weight: 600;
}
.messagesInboxList { flex: 1; overflow-y: auto; }
.messagesInboxEmpty {
  padding: 36px 18px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}
.messagesInboxItem {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  padding: 10px 14px;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.messagesInboxItem.isActive,
.messagesInboxItem:hover { background: rgba(255, 255, 255, 0.04); }
.messagesInboxItemAvatar {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #5b8cff 0%, #b85bff 100%);
  color: #fff; border-radius: 50%; font-weight: 600; font-size: 13px;
}
.messagesInboxItemBody { min-width: 0; }
.messagesInboxItemName {
  font-weight: 600; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.messagesInboxItemLast {
  font-size: 12px; color: rgba(255, 255, 255, 0.55);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.messagesInboxItemMeta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.messagesInboxItemTime { font-size: 11px; color: rgba(255, 255, 255, 0.45); }
.messagesInboxItemBadge {
  background: #ff4d4d; color: #fff;
  font-size: 11px; min-width: 18px; height: 18px;
  border-radius: 9px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
}
.messagesThread {
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.18);
}
.messagesThreadEmpty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.45); font-size: 14px;
}
.messagesThreadHead {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.messagesThreadBody {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.messagesBubble {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}
.messagesBubble.isMine {
  align-self: flex-end;
  background: linear-gradient(135deg, #5b8cff 0%, #4574e8 100%);
  color: #fff;
}
.messagesBubble.isTheirs {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
}
.messagesBubbleMeta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}
.messagesComposer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.messagesComposer textarea {
  flex: 1;
  resize: none;
  height: 44px;
  padding: 10px 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: inherit;
  font: inherit;
}

/* ---------- Push subscribe prompt (P1-1) ---------- */
.communityPushPrompt {
  display: none;
}
.communityPushPrompt.isVisible { display: flex; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .profileHero { grid-template-columns: 1fr; text-align: center; }
  .profileHeroActions { justify-content: center; }
  .messagesPage { grid-template-columns: 1fr; height: auto; }
  .messagesInbox { max-height: 280px; }
  .notificationPanel { width: 100%; }
}
