/* Direktnachrichten zwischen Freunden: Gesprächsliste im Kontakte-Hub und
   Unterhaltungsdialog. Nutzt die Farben aus camera.css/theme.css. */

/* ---- Gesprächsliste (Hub) ---- */
#messages-card .card-heading { justify-content: flex-start; }
.dm-conversations { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; }
.dm-conversation { border-bottom: 1px solid var(--line); }
.dm-conversation:last-child { border-bottom: 0; }
.dm-conversation-open { width: 100%; min-height: 64px; display: flex; align-items: center; gap: 13px; padding: 12px 2px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.dm-conversation-open:hover .social-row-name { color: #fff; }
.dm-conversation-open:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; border-radius: var(--radius-md); }
.dm-conversation-open .account-avatar { width: 42px; height: 42px; flex-shrink: 0; font-size: 16px; background: #2d2d2d; color: #cec9c5; }
.dm-conversation-body { flex: 1; min-width: 0; }
.dm-conversation-preview { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dm-conversation.unread .dm-conversation-preview { color: var(--text); font-weight: 600; }
.dm-conversation-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.dm-unread { background: var(--accent); color: #fff; }

/* ---- Dialog ---- */
.dm-dialog { width: min(560px, calc(100vw - 24px)); max-width: calc(100vw - 24px); height: min(720px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow); overflow: hidden; }
.dm-dialog::backdrop { background: rgba(11, 11, 11, .72); }
.dm-card { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.dm-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.dm-head .account-avatar { width: 40px; height: 40px; flex-shrink: 0; font-size: 16px; background: #2d2d2d; color: #cec9c5; }
.dm-head-body { flex: 1; min-width: 0; }
.dm-head h2 { margin: 0; font-size: 16px; font-weight: 640; overflow-wrap: anywhere; }
.dm-head .social-row-username { margin-top: 2px; }
.dm-close { width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: var(--radius-md); background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; }
.dm-close:hover { color: #fff; background: #ffffff10; }

.dm-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; overscroll-behavior: contain; }
.dm-older { display: block; margin: 0 auto 10px; }
.dm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dm-message { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.dm-message.mine { align-self: flex-end; align-items: flex-end; }
.dm-bubble { margin: 0; padding: 9px 13px; border-radius: 16px 16px 16px 4px; background: var(--surface-2); color: var(--text); font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.dm-message.mine .dm-bubble { border-radius: 16px 16px 4px 16px; background: var(--accent); color: #fff; }
.dm-time { margin-top: 3px; color: var(--muted); font-size: 11px; }
.dm-scroll .list-state { padding: 40px 8px; }

.dm-composer { border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.dm-composer textarea { width: 100%; min-height: 48px; max-height: 160px; resize: vertical; box-sizing: border-box; font: inherit; font-size: 14px; line-height: 1.45; color: var(--text); background: #121a26; border: 1px solid var(--line); border-radius: var(--radius-md); padding: 11px 13px; }
.dm-composer textarea:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 1px; }
.dm-composer-foot { display: flex; align-items: center; gap: 10px; }
.dm-counter { margin-inline-end: auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.dm-counter.near-limit { color: #ffcf8a; }
.dm-composer .social-btn { min-height: 44px; }
.dm-composer .inline-message:empty { display: none; }
.dm-readonly { margin: 0; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

/* Aus "ist jetzt online": Einladung hervorheben, aber nie automatisch senden. */
#p-call-invite.attention { box-shadow: 0 0 0 3px var(--accent-soft); }

@media (max-width: 620px) {
  .dm-dialog { width: 100%; max-width: 100%; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
  .dm-composer-foot { justify-content: flex-end; }
  .dm-message { max-width: 88%; }
}
