/* Messaging. Builds on the prototype's .message-layout, .conversation, .chat and .bubble styles in web/urbanx.css. */

.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; display: inline-grid;
  place-items: center; background: var(--brand); color: var(--brand-ink); font-size: 10px; font-weight: 800;
}
.mobile-nav a { position: relative; }
.mobile-nav .nav-badge { position: absolute; top: -4px; right: 6px; margin: 0; min-width: 16px; height: 16px; font-size: 9px; }

.message-layout { min-height: 620px; }
.message-layout .chat { height: 620px; }
.conversation { align-items: center; color: inherit; text-decoration: none; }
.conversation.has-unread strong { font-weight: 800; }
.conversation.has-unread small { color: var(--ink); }
.conversation-meta { display: grid; justify-items: end; gap: 5px; font-size: 9px; color: var(--muted); white-space: nowrap; }
.unread-dot {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink); font-size: 10px; font-weight: 800;
}
.chat-group-icon { background: var(--surface-2); color: var(--ink); font-size: 17px; }

.chat-head-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.chat-head-actions form { margin: 0; }
.chat-back { display: none; font-size: 18px; color: var(--ink); text-decoration: none; padding: 0 4px; }
.chat-body { overflow-y: auto; }
.chat-empty { margin: auto; color: var(--muted); font-size: 11px; }
.bubble-sender { display: block; font-size: 9px; font-weight: 800; color: var(--muted); margin-bottom: 3px; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble-meta { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 5px; }
.bubble-meta time { margin: 0; }
.report-form { margin: 0; }
.report-link { border: 0; background: none; padding: 0; font: inherit; font-size: 8px; color: inherit; opacity: .6; text-decoration: underline; cursor: pointer; }
.chat-compose { align-items: flex-end; }
.chat-compose textarea {
  flex: 1; min-width: 0; min-height: 42px; max-height: 140px; resize: none; border: 1px solid var(--line); border-radius: 11px;
  background: var(--bg); padding: 11px; color: var(--ink); font: inherit; font-size: 12px; outline: 0;
}
.chat-compose textarea:focus-visible { border-color: var(--brand); }
.chat-blocked { padding: 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); text-align: center; }
.chat-placeholder { flex: 1; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 40px; text-align: center; font-size: 11px; color: var(--muted); }
.chat-placeholder strong { color: var(--ink); font-size: 13px; }

@media (max-width: 560px) {
  .message-layout.has-active .conversation-list { display: none; }
  .message-layout:not(.has-active) .chat { display: none; }
  /* An open chat takes the screen between the top bar and the bottom navigation. */
  .content:has(.message-layout.has-active) > .page-heading { display: none; }
  .message-layout .chat { height: calc(100dvh - 175px); min-height: 360px; }
  .conversation-list { max-height: none; }
  .chat-back { display: inline-block; }
}

/* display: grid above would otherwise override the hidden attribute (no unread → no badge). */
.nav-badge[hidden], .unread-dot[hidden], [data-report][hidden], [data-sender][hidden] { display: none; }
