/* Chat about ads: thread (ChatThreadView), conversation list (ConversationListView), docked panel
   (ChatPanelHost), top-bar badge (MessagesBadge), the form control (RecordChatControl) and the
   page blocks (PageChatBlock / PageConversationsBlock). */

/* ── Thread ───────────────────────────────────────────────────────────── */
.chat { display: flex; flex-direction: column; min-height: 0; background: var(--rz-base-background-color, #fff); border: 1px solid var(--rz-border-color, #e0e0e0); border-radius: 10px; overflow: hidden; color: var(--rz-text-color, #212121); }
.chat__head { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--rz-border-color, #e0e0e0); }
.chat__avatar { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--rz-primary, #1976d2); color: #fff; font-weight: 600; font-size: 0.85rem; }
.chat__who { flex: 1 1 auto; min-width: 0; }
.chat__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat__sub { font-size: 0.8rem; color: var(--rz-text-secondary-color, #5f6368); }
.chat__open { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; min-height: 44px; padding: 0 6px; text-decoration: none; }
.chat__open .rzi { font-size: 16px; }
.chat__iconbtn { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.chat__iconbtn:hover, .chat__iconbtn:focus-visible { background: var(--rz-base-200, #eeeeee); }

.chat__record { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--rz-border-color, #e0e0e0); text-decoration: none; color: inherit; background: var(--rz-base-50, #fafafa); }
.chat__record:hover .chat__rectitle { text-decoration: underline; }
.chat__photos { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, 52px); gap: 3px; height: 40px; }
.chat__photos img, .chat__ph, .chat__more { width: 52px; height: 40px; border-radius: 5px; object-fit: cover; display: block; }
.chat__ph { background: var(--rz-base-300, #d6d6d6); }
.chat__more { display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 0.8rem; font-weight: 600; }
.chat__recinfo { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat__rectitle { font-weight: 600; font-size: 0.95rem; color: var(--rz-primary-dark, #1565c0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat__facts { font-size: 0.82rem; color: var(--rz-text-secondary-color, #5f6368); }
.chat__facts--design { font-family: monospace; }

.chat__body { flex: 1 1 auto; min-height: 120px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--rz-base-50, #fafafa); }
.chat__day { align-self: center; font-size: 0.75rem; color: var(--rz-text-secondary-color, #5f6368); padding: 4px 0; }
.chat__msg { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; max-width: 78%; align-self: flex-start; }
.chat__msg--mine { align-self: flex-end; align-items: flex-end; }
.chat__bubble { padding: 9px 13px; border-radius: 14px; border-bottom-left-radius: 4px; background: var(--rz-base-background-color, #fff); border: 1px solid var(--rz-border-color, #e0e0e0); font-size: 0.95rem; line-height: 1.4; white-space: pre-line; overflow-wrap: anywhere; }
.chat__msg--mine .chat__bubble { background: var(--rz-primary, #1976d2); border-color: var(--rz-primary, #1976d2); color: #fff; border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.chat__meta { display: flex; gap: 4px; font-size: 0.72rem; color: var(--rz-text-secondary-color, #5f6368); }
.chat__note { margin: auto; color: var(--rz-text-secondary-color, #5f6368); font-size: 0.9rem; }
.chat__empty { margin: auto; max-width: 320px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--rz-text-secondary-color, #5f6368); font-size: 0.9rem; }
.chat__empty .rzi { font-size: 36px; color: var(--rz-primary, #1976d2); }
.chat__empty strong { color: var(--rz-text-color, #212121); font-size: 1rem; }
.chat__empty .pg-btn { margin-top: 6px; }
.chat__empty--start { margin-top: auto; margin-bottom: 0; }
.chat__error { align-self: stretch; padding: 8px 12px; border-radius: 8px; background: #fdecea; color: #8a1c13; font-size: 0.85rem; }

.chat__compose { flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--rz-border-color, #e0e0e0); background: var(--rz-base-background-color, #fff); }
.chat__quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.chat__chip { flex: 0 0 auto; font: inherit; font-size: 0.85rem; min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--rz-primary-lighter, #90caf9); background: var(--rz-base-background-color, #fff); color: var(--rz-primary-darker, #0d47a1); cursor: pointer; white-space: nowrap; }
.chat__chip:hover, .chat__chip:focus-visible { background: var(--rz-primary-lighter, #e3f2fd); }
.chat__inputrow { display: flex; gap: 8px; align-items: flex-end; }
.chat__input { flex: 1 1 auto; font: inherit; font-size: 0.95rem; min-height: 44px; max-height: 140px; padding: 11px 14px; border: 1px solid var(--rz-input-border-color, #9e9e9e); border-radius: 22px; resize: none; box-sizing: border-box; field-sizing: content; background: var(--rz-input-background-color, #fff); color: inherit; }
.chat__input:focus { outline: 2px solid var(--rz-primary, #1976d2); outline-offset: 0; border-color: transparent; }
.chat__send { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--rz-primary, #1976d2); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.chat__send:disabled { opacity: 0.45; cursor: default; }
.chat__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chat--compact .chat__head { padding: 6px 6px 6px 12px; }
.chat--compact .chat__photos { grid-template-columns: repeat(4, 44px); height: 34px; }
.chat--compact .chat__photos img, .chat--compact .chat__ph, .chat--compact .chat__more { width: 44px; height: 34px; }

/* ── Conversation list ────────────────────────────────────────────────── */
.chatlist { display: flex; flex-direction: column; min-height: 0; background: var(--rz-base-background-color, #fff); border: 1px solid var(--rz-border-color, #e0e0e0); border-radius: 10px; overflow: hidden; }
.chatlist__tabs { flex: 0 0 auto; display: flex; border-bottom: 1px solid var(--rz-border-color, #e0e0e0); overflow-x: auto; scrollbar-width: none; }
.chatlist__tab { flex: 1 0 auto; white-space: nowrap; font: inherit; font-size: 0.85rem; min-height: 44px; padding: 0 10px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--rz-text-secondary-color, #5f6368); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.chatlist__tab--on { color: var(--rz-primary-darker, #0d47a1); border-bottom-color: var(--rz-primary, #1976d2); font-weight: 600; }
.chatlist__count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rz-primary, #1976d2); color: #fff; font-size: 0.72rem; display: inline-flex; align-items: center; justify-content: center; }
.chatlist__search { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; margin: 10px 12px; padding: 0 10px; border: 1px solid var(--rz-input-border-color, #bdbdbd); border-radius: 8px; }
.chatlist__search input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 0.9rem; height: 40px; border: 0; outline: 0; background: transparent; color: inherit; }
.chatlist__search .rzi { color: var(--rz-text-secondary-color, #5f6368); font-size: 20px; }
.chatlist__items { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.chatlist__note { padding: 24px 16px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; color: var(--rz-text-secondary-color, #5f6368); font-size: 0.9rem; }
.chatlist__item { font: inherit; width: 100%; border: 0; border-bottom: 1px solid var(--rz-base-200, #eeeeee); background: transparent; color: inherit; text-align: left; padding: 12px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.chatlist__item:hover { background: var(--rz-base-100, #f5f5f5); }
.chatlist__item--on, .chatlist__item--on:hover { background: var(--rz-primary-lighter, #e3f2fd); }
.chatlist__photo { flex: 0 0 56px; width: 56px; height: 44px; border-radius: 6px; object-fit: cover; }
.chatlist__photo--none { display: flex; align-items: center; justify-content: center; background: var(--rz-base-300, #d6d6d6); color: var(--rz-text-color, #212121); font-weight: 600; font-size: 0.85rem; }
.chatlist__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chatlist__line { display: flex; align-items: baseline; gap: 8px; }
.chatlist__name { flex: 1 1 auto; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatlist__item--unread .chatlist__name, .chatlist__item--unread .chatlist__last { font-weight: 700; color: var(--rz-text-color, #212121); }
.chatlist__time { flex: 0 0 auto; font-size: 0.75rem; color: var(--rz-text-secondary-color, #5f6368); }
.chatlist__title { font-size: 0.8rem; color: var(--rz-primary-dark, #1565c0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatlist__side { display: inline-block; margin-right: 4px; padding: 0 5px; border-radius: 3px; background: var(--rz-base-200, #eeeeee); color: var(--rz-text-secondary-color, #455a64); font-size: 0.7rem; }
.chatlist__last { font-size: 0.85rem; color: var(--rz-text-secondary-color, #455a64); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatlist__badge { flex: 0 0 auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--rz-primary, #1976d2); color: #fff; font-size: 0.75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* ── Docked panel ─────────────────────────────────────────────────────── */
.chatpanel { position: fixed; right: 24px; bottom: 0; z-index: 1050; width: 400px; height: min(600px, calc(100vh - 80px)); display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28); border-radius: 12px 12px 0 0; }
.chatpanel .chat { flex: 1 1 auto; border-radius: 12px 12px 0 0; border: 0; }
.chatpanel .chat__head { background: var(--rz-primary, #1976d2); color: #fff; border-bottom: 0; }
.chatpanel .chat__head .chat__avatar { background: #fff; color: var(--rz-primary, #1976d2); }
.chatpanel .chat__head .chat__sub { color: rgba(255, 255, 255, 0.85); }
.chatpanel .chat__head .chat__open { color: #fff; }
.chatpanel .chat__head .chat__iconbtn:hover, .chatpanel .chat__head .chat__iconbtn:focus-visible { background: rgba(255, 255, 255, 0.16); }
@media (max-width: 600px) {
    .chatpanel { inset: 0; width: auto; height: auto; border-radius: 0; }
    .chatpanel .chat { border-radius: 0; }
    .chatpanel .chat__open { display: none; }
}

/* ── Top-bar badge ────────────────────────────────────────────────────── */
.msgbadge { position: relative; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: inherit; text-decoration: none; }
.msgbadge:hover, .msgbadge:focus-visible { background: rgba(255, 255, 255, 0.16); color: inherit; }
.msgbadge .rzi { font-size: 24px; }
.msgbadge__count { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #fff; color: var(--rz-primary-darker, #0d47a1); font-size: 0.7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--rz-primary, #1976d2); }

/* ── Form control ─────────────────────────────────────────────────────── */
.recchat { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.recchat__title { font-weight: 600; font-size: 1rem; }
.recchat__split { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }
.recchat__list { flex: 1 1 260px; min-width: 0; display: flex; }
.recchat__list .chatlist { flex: 1 1 auto; }
.recchat__thread { flex: 999 1 380px; min-width: 0; display: flex; }
.recchat__thread .chat, .recchat__thread .recchat__note { flex: 1 1 auto; }
.recchat__note { padding: 16px; border: 1px dashed var(--rz-border-color, #e0e0e0); border-radius: 10px; color: var(--rz-text-secondary-color, #5f6368); font-size: 0.9rem; }

/* ── Page blocks ──────────────────────────────────────────────────────── */
.pg-chat__pick { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 320px; border: 1px dashed var(--rz-border-color, #e0e0e0); border-radius: 10px; color: var(--rz-text-secondary-color, #5f6368); }
.pg-chat__pick .rzi { font-size: 40px; color: var(--rz-primary, #1976d2); }
.pg-chat__pick strong { color: var(--rz-text-color, #212121); }
/* Wide and medium pages show list and chat side by side: no back arrow */
.pg-chat .chat-back { display: none; }
/* Narrow pages: the list, or the open conversation with a back arrow */
@container pgpage (max-width: 575.98px) {
    .pg-chatlist--open { display: none; }
    .pg-chat--empty { display: none; }
    .pg-chat .chat-back { display: inline-flex; }
}

/* ── Report a conversation (participants) and review it (admins) ─────── */
.chat__report-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 22px; background: transparent; color: inherit; font: inherit; font-size: 0.85rem; cursor: pointer; }
.chat__report-btn .rzi { font-size: 20px; }
.chat__report-btn:hover, .chat__report-btn:focus-visible, .chat__report-btn--on { background: var(--rz-base-200, #eeeeee); }
.chatpanel .chat__report-btn:hover, .chatpanel .chat__report-btn:focus-visible, .chatpanel .chat__report-btn--on { background: rgba(255, 255, 255, 0.16); }
.chat--compact .chat__report-word { display: none; }
.chat__report { flex: 0 0 auto; max-height: 70%; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--rz-border-color, #e0e0e0); background: var(--rz-base-background-color, #fff); }
.chat__report-title { font-weight: 600; }
.chat__reasons { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.chat__reason { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid var(--rz-border-color, #e0e0e0); border-radius: 8px; cursor: pointer; }
.chat__reason input { margin-top: 3px; width: 18px; height: 18px; flex: 0 0 auto; }
.chat__reason span { display: flex; flex-direction: column; gap: 2px; }
.chat__reason small { color: var(--rz-text-secondary-color, #5f6368); font-size: 0.78rem; line-height: 1.3; }
.chat__reason--on { border-color: #b3261e; background: #fdf3f2; }
.chat__report-label { font-size: 0.8rem; color: var(--rz-text-secondary-color, #5f6368); }
.chat__report-text { font: inherit; font-size: 0.9rem; padding: 8px 10px; border: 1px solid var(--rz-input-border-color, #9e9e9e); border-radius: 8px; resize: vertical; box-sizing: border-box; width: 100%; background: var(--rz-input-background-color, #fff); color: inherit; }
.chat__tip { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: #5d4300; background: #fff4d6; padding: 6px 10px; border-radius: 6px; }
.chat__tip .rzi { font-size: 18px; }
.chat__report-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.pg-btn--danger { background: #b3261e; color: #fff; }
.pg-btn--danger:disabled { opacity: 0.5; }
.chat__notice { flex: 0 0 auto; display: flex; align-items: flex-start; gap: 8px; padding: 8px 16px; font-size: 0.82rem; color: #5c1a14; background: #fdecea; border-bottom: 1px solid #f5c6c2; }
.chat__notice .rzi { font-size: 18px; color: #b3261e; }
.chat__review { flex: 0 0 auto; max-height: 45%; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 16px; background: #fff8e1; border-bottom: 1px solid #f0d58a; font-size: 0.85rem; }
.chat__review-title { display: flex; align-items: center; gap: 6px; font-weight: 600; color: #5d4300; }
.chat__review-title .rzi { font-size: 18px; }
.chat__review-item { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.7); }
.chat__review-item--open { box-shadow: inset 3px 0 0 #b3261e; }
.chat__review-item span { color: var(--rz-text-secondary-color, #5f6368); font-size: 0.78rem; }
.chat__review-item q { font-style: italic; }
.chat__review-none { color: var(--rz-text-secondary-color, #5f6368); }
