/* ══════════════════════════════════════════════
   LOMO — CHAT PAGE STYLES
   ══════════════════════════════════════════════ */

#screenChat {
  align-items: flex-start;
  justify-content: flex-start;
  flex-direction: column;
  overflow: hidden;
  background: #f7f8fa;
}

.chatScreen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

/* ── Header ── */
.chatHeader {
  flex-shrink: 0;
  background: rgba(255,255,255,.97);
  border-bottom: 1px solid rgba(0,0,0,.07);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.chatHeaderInner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  width: 100%;
}

.chatHeaderBack {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  color: #555;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  padding: 6px 12px;
  border-radius: 999px;
  transition: all .18s;
  flex-shrink: 0;
}

.chatHeaderBack:hover {
  background: rgba(38,110,120,.07);
  color: #1a5c68;
}

.chatHeaderBrand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  user-select: none;
}

.chatHeaderWord {
  font-size: 15px;
  font-weight: 760;
  color: #0e0f0f;
  letter-spacing: -0.3px;
}

.chatAutoBadge {
  flex-shrink: 0;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  color: #1f6a75;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eef8fa;
  border: 1px solid rgba(42,122,138,.18);
}

/* ── Body ── */
.chatBody {
  flex: 1;
  overflow: hidden;
  padding: 14px 20px 16px;
  box-sizing: border-box;
}

/* ── Shell ── */
.chatShell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 12px;
  height: 100%;
}

.chatSidebar,
.chatThread {
  background: #fff;
  border: 1px solid rgba(0,0,0,.07);
  border-radius: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* ── Sidebar ── */
.chatSidebarHead {
  flex-shrink: 0;
  padding: 15px 16px 12px;
  border-bottom: 1px solid rgba(0,0,0,.05);
}

.chatSidebarTitleRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.chatSidebarTitle {
  font-size: 15px;
  font-weight: 720;
  color: #0e0f0f;
  letter-spacing: -0.2px;
}

.chatSidebarMeta {
  font-size: 11.5px;
  color: #a0a0a0;
  line-height: 1.4;
}

.chatRefreshIconBtn {
  background: none;
  border: none;
  cursor: pointer;
  color: #ccc;
  padding: 5px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .18s, background .18s;
  flex-shrink: 0;
}

.chatRefreshIconBtn:hover {
  color: #1a5c68;
  background: rgba(38,110,120,.08);
}

.chatConversationList {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.09) transparent;
}

.chatConversationList::-webkit-scrollbar { width: 4px; }
.chatConversationList::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.09);
  border-radius: 2px;
}

.chatConversationEmpty {
  padding: 28px 16px;
  text-align: center;
  color: #c0c0c0;
  font-size: 13px;
  line-height: 1.6;
}

.chatConnectionInbox {
  flex-shrink: 0;
  padding: 10px 10px 4px;
  border-bottom: 1px solid rgba(0,0,0,.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chatInboxSection {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chatInboxHeading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}

.chatInboxTitle {
  font-size: 11px;
  font-weight: 720;
  letter-spacing: .45px;
  text-transform: uppercase;
  color: #8a8a8a;
}

.chatInboxCount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(38,110,120,.08);
  color: #1a5c68;
  font-size: 10px;
  font-weight: 700;
}

.chatConnectionCard {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid rgba(0,0,0,.07);
  border-radius: 16px;
  background: #fafbfc;
}

.chatConnectionCard.incoming {
  background: linear-gradient(180deg, rgba(38,110,120,.06), rgba(38,110,120,.02));
  border-color: rgba(38,110,120,.12);
}

.chatConnectionCard.outgoing {
  background: rgba(0,0,0,.02);
}

.chatConnectionAvatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #26707a, #38b2ac);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}

.chatConnectionAvatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chatConnectionBody {
  min-width: 0;
  flex: 1;
}

.chatConnectionName {
  font-size: 13px;
  font-weight: 650;
  color: #0e0f0f;
  line-height: 1.4;
  margin-bottom: 2px;
}

.chatConnectionMeta {
  font-size: 11.5px;
  color: #7b8794;
  line-height: 1.45;
  margin-bottom: 8px;
}

.chatConnectionActions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chatConnectionBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  color: #0e0f0f;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .15s, border-color .18s, background .18s, color .18s;
}

.chatConnectionBtn:hover {
  transform: translateY(-1px);
  border-color: rgba(38,110,120,.22);
  color: #1a5c68;
}

.chatConnectionBtn.primary {
  background: #0e0f0f;
  border-color: #0e0f0f;
  color: #fff;
}

.chatConnectionBtn.primary:hover {
  background: #1a5c68;
  border-color: #1a5c68;
  color: #fff;
}

.chatConnectionBtn.danger {
  color: #b42318;
}

.chatConnectionBtn.danger:hover {
  border-color: rgba(180,35,24,.18);
  color: #8f1d15;
}

/* ── Conversation Items ── */
.chatConversationItem {
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  cursor: pointer;
  text-align: left;
  transition: background .15s;
  position: relative;
}

.chatConversationItem:hover {
  background: rgba(0,0,0,.04);
}

.chatConversationItem.active {
  background: rgba(38,110,120,.08);
}

.chatConversationItem.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  background: linear-gradient(180deg, #26707a, #38b2ac);
  border-radius: 0 3px 3px 0;
}

.chatConversationAvatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #26707a, #38b2ac);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}

.chatConversationAvatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chatConversationBody {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.chatConversationTop {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: space-between;
  margin-bottom: 2px;
}

.chatConversationName {
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
  color: #0e0f0f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chatConversationTime {
  flex-shrink: 0;
  font-size: 10.5px;
  color: #c0c0c0;
}

.chatConversationMeta {
  font-size: 11px;
  color: #bbb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.chatConversationPreview {
  font-size: 12px;
  color: #888;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.chatUnreadBadge {
  flex-shrink: 0;
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #26707a;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  margin-left: auto;
}

/* ── Thread ── */
.chatThread {
  position: relative;
}

.chatThreadHead {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(0,0,0,.05);
}

.chatThreadBack {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  padding: 6px;
  border-radius: 8px;
  transition: all .15s;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.chatThreadBack:hover {
  background: rgba(0,0,0,.06);
  color: #0e0f0f;
}

.chatThreadTitleWrap {
  min-width: 0;
  flex: 1;
}

.chatThreadTitle {
  font-size: 15px;
  font-weight: 700;
  color: #0e0f0f;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chatThreadMeta {
  font-size: 11px;
  color: #bbb;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chatThreadActions {
  flex-shrink: 0;
}

.chatProfileBtn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid rgba(38,110,120,.25);
  background: transparent;
  color: #1a5c68;
  font-family: inherit;
  transition: all .18s;
  white-space: nowrap;
}

.chatProfileBtn:hover {
  background: rgba(38,110,120,.08);
}

/* ── Empty State ── */
.chatEmptyState {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
}

.chatThreadPlaceholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  color: #bbb;
  font-size: 13px;
  line-height: 1.6;
  margin: 8px 0;
  border-radius: 14px;
  background: rgba(0,0,0,.02);
}

.chatEmptyIco {
  font-size: 42px;
  margin-bottom: 14px;
  opacity: .45;
}

.chatEmptyTitle {
  font-size: 15px;
  font-weight: 650;
  color: #888;
  margin-bottom: 8px;
}

.chatEmptyText {
  font-size: 13px;
  line-height: 1.6;
  color: #bbb;
  max-width: 260px;
}

/* ── Message List ── */
.chatMessageList {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.08) transparent;
}

.chatMessageList::-webkit-scrollbar { width: 4px; }
.chatMessageList::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.08);
  border-radius: 2px;
}

/* ── Bubbles ── */
.chatBubbleRow {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 1px;
}

.chatBubbleRow.mine {
  justify-content: flex-end;
}

.chatBubble {
  max-width: min(72%, 480px);
  padding: 10px 14px;
  background: #f0f2f5;
  border-radius: 18px 18px 18px 5px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}

.chatBubble.mine {
  background: #26707a;
  border-radius: 18px 18px 5px 18px;
  box-shadow: 0 2px 8px rgba(38,110,120,.22);
}

.chatBubbleText {
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: #1f2937;
}

.chatBubble.mine .chatBubbleText {
  color: #fff;
}

.chatBubbleText p {
  margin: 0;
}

.chatBubbleText p + p {
  margin-top: 8px;
}

.chatAttachmentBlock {
  margin-top: 0;
}

.chatBubbleText > p + .chatAttachmentBlock {
  margin-top: 8px;
}

.chatAttachment {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(0,0,0,.05);
  color: inherit;
  text-decoration: none;
  border: 1px solid rgba(0,0,0,.07);
  box-sizing: border-box;
  transition: background .15s;
}

.chatBubble.mine .chatAttachment {
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.16);
}

.chatAttachmentMuted {
  cursor: default;
  opacity: .92;
}

.chatAttachmentIcon {
  flex-shrink: 0;
  font-size: 18px;
  margin-top: 1px;
}

.chatAttachmentLabel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.chatAttachmentTitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}

.chatAttachmentHint {
  font-size: 11px;
  line-height: 1.35;
  opacity: .72;
}

.chatBubbleMeta {
  margin-top: 4px;
  font-size: 10px;
  color: rgba(0,0,0,.30);
  text-align: right;
}

.chatBubble.mine .chatBubbleMeta {
  color: rgba(255,255,255,.50);
}

/* ── New Messages Button ── */
.chatNewMessagesBtn {
  align-self: center;
  margin: 6px 0 2px;
  border: 1px solid rgba(38,110,120,.2);
  background: rgba(255,255,255,.95);
  color: #1a5c68;
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(38,110,120,.10);
  font-family: inherit;
  transition: all .18s;
  flex-shrink: 0;
}

.chatNewMessagesBtn:hover {
  background: rgba(38,110,120,.07);
}

/* ── Composer ── */
.chatComposer {
  flex-shrink: 0;
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(0,0,0,.05);
}

.chatComposerRow {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.chatComposerInput {
  flex: 1;
  resize: none;
  border: 1.5px solid rgba(0,0,0,.09);
  border-radius: 18px;
  padding: 10px 16px;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  box-sizing: border-box;
  background: #f7f8fa;
  color: #0e0f0f;
  outline: none;
  max-height: 120px;
  overflow-y: auto;
  transition: border .15s, box-shadow .15s, background .15s;
  scrollbar-width: none;
}

.chatComposerInput::-webkit-scrollbar { display: none; }

.chatComposerInput::placeholder {
  color: #c8c8c8;
}

.chatComposerInput:focus {
  border-color: rgba(38,110,120,.38);
  box-shadow: 0 0 0 3px rgba(38,110,120,.08);
  background: #fff;
}

.chatSendBtn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #26707a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  transition: background .18s, transform .15s, box-shadow .18s;
  box-shadow: 0 2px 8px rgba(38,110,120,.25);
}

.chatSendBtn:hover {
  background: #1a5c68;
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(38,110,120,.32);
}

.chatSendBtn:disabled {
  background: #d5d8db;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.chatComposerMeta {
  margin-top: 7px;
  font-size: 11px;
  color: #ccc;
  padding: 0 4px;
}

.chatLink {
  color: inherit;
  text-decoration: underline;
  word-break: break-all;
  opacity: .85;
}

.chatLink:hover { opacity: 1; }

/* ── Nav unread badge ── */
.chatNavUnreadBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 5px;
  border-radius: 999px;
  background: #26707a;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

[data-next="toChatHub"] {
  position: relative;
}

[data-next="toChatHub"].hasChatUnread {
  border-color: rgba(38,110,120,.32);
}

/* ── Pager ── */
#chatConversationPager:empty {
  display: none;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .chatBody {
    padding: 10px 12px;
  }

  .chatShell {
    grid-template-columns: 1fr;
  }

  .chatThread {
    display: none;
  }

  .chatShell.chatThreadVisible .chatSidebar {
    display: none;
  }

  .chatShell.chatThreadVisible .chatThread {
    display: flex;
  }

  .chatThreadBack {
    display: flex;
  }
}

@media (max-width: 640px) {
  .chatBody { padding: 8px; }
  .chatHeaderInner { padding: 0 14px; height: 52px; }
  .chatHeaderBack span { display: none; }
  .chatSidebarHead { padding: 13px 14px 10px; }
  .chatConnectionInbox { padding: 8px 8px 2px; }
  .chatConversationList { padding: 6px; }
  .chatThreadHead { padding: 12px 14px; }
  .chatMessageList { padding: 12px 14px 6px; }
  .chatComposer { padding: 8px 12px 12px; }
  .chatBubble { max-width: 88%; }
  .chatHeaderWord { font-size: 14px; }
  .chatConnectionCard { padding: 11px; }
}

/* ── CONVERSATION SEARCH ───────────────────────────────────────────────── */
.chatSearchWrap {
  padding: 8px 12px 4px;
  flex-shrink: 0;
}
.chatSearchInput {
  width: 100%;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: #222;
  background: #f8fafa;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s, background .15s;
}
.chatSearchInput:focus {
  border-color: #2a7a8a;
  background: #fff;
}
.chatSearchInput::placeholder { color: #aaa; }
/* hide browser clear button inconsistencies */
.chatSearchInput::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ── TYPING INDICATOR ──────────────────────────────────────────────────── */
.chatTypingIndicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 20px 2px;
  font-size: 12px;
  color: #888;
  min-height: 22px;
  flex-shrink: 0;
}
.chatTypingIndicator.hidden { display: none; }
.chatTypingText { font-style: italic; }

.chatTypingDots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.chatTypingDots span {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2a7a8a;
  animation: chatTypingBounce 1.2s infinite ease-in-out;
}
.chatTypingDots span:nth-child(2) { animation-delay: .2s; }
.chatTypingDots span:nth-child(3) { animation-delay: .4s; }

@keyframes chatTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30%            { transform: translateY(-4px); opacity: 1; }
}

/* ── DATE SEPARATORS ───────────────────────────────────────────────────── */
.chatDateSep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 8px;
  user-select: none;
}
.chatDateSep::before,
.chatDateSep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #ececec;
}
.chatDateSep span {
  font-size: 11px;
  color: #aaa;
  font-weight: 600;
  letter-spacing: .04em;
  white-space: nowrap;
}

/* ── READ RECEIPT TICKS ────────────────────────────────────────────────── */
.chatTick {
  display: inline-block;
  font-size: 11px;
  margin-left: 4px;
  color: rgba(255,255,255,.45);
  font-weight: 600;
  vertical-align: middle;
  letter-spacing: -1px;
}
.chatTick.read {
  color: #7ee8c8;
}

/* ── LOAD EARLIER BUTTON ───────────────────────────────────────────────── */
.chatLoadEarlierWrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 16px;
}
.chatLoadEarlierBtn {
  background: none;
  border: 1px solid #d8d8d8;
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 12px;
  color: #2a7a8a;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.chatLoadEarlierBtn:hover {
  background: #f0f8f9;
  border-color: #2a7a8a;
}

/* ── AUTO-GROW TEXTAREA ────────────────────────────────────────────────── */
.chatComposerInput {
  max-height: 120px;
  overflow-y: auto;
  resize: none;
}

@media (max-width: 640px) {
  .chatSearchWrap { padding: 6px 10px 2px; }
  .chatTypingIndicator { padding: 4px 16px 0; }
}
