/* =====================================================================
 *  social.css — Diễn Đàn (mạng xã hội) + Chat + nút chuyển màn hình
 *  ---------------------------------------------------------------------
 *  BẢN 2026-12-06 (Alya): đổi Diễn Đàn sang giao diện XANH–TRẮNG kiểu
 *  Facebook (nền #f0f2f5, thẻ trắng, xanh #1877f2), responsive:
 *    - < 1000px : 1 cột (điện thoại / tablet dọc)
 *    - ≥ 1000px : 2 cột — bảng tin + cột phải "Lối tắt" (PC)
 *  Phạm vi: mọi rule giao diện Diễn Đàn đều scope trong #forumRoot để
 *  KHÔNG phá theme tối amber/tím của tờ phiếu và ngăn kéo.
 *  Chat (trong ngăn kéo) vẫn tối, nhưng bong bóng "của tôi" đổi sang
 *  xanh Messenger #0084ff.
 * ===================================================================== */

/* =====================================================================
 *  1. Hai nút chuyển màn hình (cạnh nút Hồi hướng)
 * ===================================================================== */
.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid #3f3f46;
  background: #131317;
  color: #e4e4e7;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.mode-pill:hover { background: #1e1e24; border-color: #52525b; }
.mode-pill:active { transform: scale(0.95); }
.mode-pill .ic { color: #a1a1aa; }
.mode-pill.is-mode-active {
  background: #0a0a0d;
  border-color: #71717a;
  color: #fafafa;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
.mode-pill.is-mode-active .ic { color: #a78bfa; }
.mode-pill-text { max-width: 74px; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 420px) {
  .mode-pill { font-size: 11px; padding: 6px 11px; }
  .mode-pill-text { max-width: 120px; }
}

/* Ẩn các nút thuộc tờ phiếu khi đang ở Diễn Đàn */
html[data-app-mode="forum"] .house-only { display: none !important; }

/* Nền sáng cho cả màn hình Diễn Đàn */
html[data-app-mode="forum"] body { background: #0f0d15; }
html[data-app-mode="forum"] #screenDienDan {
  background: #f0f2f5;
  border-radius: 14px;
  padding: 0;
  min-height: 76vh;
}

/* =====================================================================
 *  2. BIẾN MÀU + KHUNG CHUNG của Diễn Đàn (scope #forumRoot)
 * ===================================================================== */
#forumRoot {
  --fb-blue: #1877f2;
  --fb-blue-dark: #166fe5;
  --fb-bg: #f0f2f5;
  --fb-card: #ffffff;
  --fb-line: #e4e6eb;
  --fb-text: #050505;
  --fb-muted: #65676b;
  --fb-hover: #f2f3f5;
  --fb-danger: #e41e3f;

  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Roboto, Arial, sans-serif;
  color: var(--fb-text);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Bố cục lưới: 1 cột mặc định, 2 cột khi màn rộng */
#forumRoot .social-wrap {
  display: grid;
  grid-template-areas: "header" "tabs" "body";
  gap: 10px;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 10px 10px 26px;
}

/* ---------- Thanh tiêu đề xanh (top bar) ---------- */
#forumRoot .social-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #1877f2 0%, #0b5ed7 100%);
  box-shadow: 0 2px 10px rgba(24, 119, 242, 0.28);
}

#forumRoot .social-header-title {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  letter-spacing: 0.2px;
}

#forumRoot .social-header-sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 2px;
}

/* Nút tài khoản nằm trong thanh xanh → viên trắng */
#forumRoot .social-header .social-chip,
#forumRoot .social-header .social-chip--ghost {
  flex: 0 0 auto;
  max-width: 46vw;
  padding: 7px 14px;
  border: none;
  border-radius: 999px;
  background: #ffffff;
  color: var(--fb-blue);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* ---------- Tab con: gạch chân xanh kiểu Facebook ---------- */
#forumRoot .social-tabs {
  grid-area: tabs;
  display: flex;
  gap: 2px;
  padding: 0;
  background: var(--fb-card);
  border: 1px solid var(--fb-line);
  border-radius: 12px;
  overflow: hidden;
}

#forumRoot .social-tab {
  flex: 1 1 0;
  padding: 12px 6px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--fb-muted);
  font-size: 13px;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#forumRoot .social-tab:hover { background: var(--fb-hover); }

#forumRoot .social-tab.is-active {
  background: transparent;
  color: var(--fb-blue);
  border-bottom-color: var(--fb-blue);
}

/* ---------- Vùng nội dung ---------- */
#forumRoot #forumBody {
  grid-area: body;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

/* ---------- Cột phải trên PC ---------- */
#forumRoot .social-rail {
  grid-area: rail;
  display: none;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

#forumRoot .social-rail-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--fb-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

#forumRoot .social-rail-link {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--fb-text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

#forumRoot .social-rail-link:hover { background: var(--fb-hover); }
#forumRoot .social-rail-link.is-active { background: rgba(24, 119, 242, 0.1); color: var(--fb-blue); }

#forumRoot .social-rail-text {
  font-size: 12.5px;
  color: var(--fb-muted);
  line-height: 1.55;
}

/* =====================================================================
 *  3. Thẻ / nút / chip dùng chung
 * ===================================================================== */
#forumRoot .social-card {
  background: var(--fb-card);
  border: 1px solid var(--fb-line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

#forumRoot .social-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: none;
  border-radius: 999px;
  background: var(--fb-hover);
  color: var(--fb-text);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

#forumRoot .social-chip:hover { background: #e4e6eb; }

#forumRoot .social-chip--ghost {
  background: var(--fb-hover);
  color: var(--fb-muted);
  border: 1px solid var(--fb-line);
}

/* Nút "Đăng" và các nút hành động chính → xanh Facebook */
#forumRoot .social-chip[data-act="post"],
#forumRoot .social-chip[data-act="signin"] {
  background: var(--fb-blue);
  color: #fff;
}
#forumRoot .social-chip[data-act="post"]:hover,
#forumRoot .social-chip[data-act="signin"]:hover { background: var(--fb-blue-dark); }

/* =====================================================================
 *  4. Ô soạn bài (composer)
 * ===================================================================== */
#forumRoot .social-composer textarea {
  width: 100%;
  min-height: 62px;
  resize: vertical;
  border: none;
  border-radius: 20px;
  background: var(--fb-hover);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--fb-text);
  outline: none;
  transition: background 0.15s ease;
}

#forumRoot .social-composer textarea::placeholder { color: var(--fb-muted); }
#forumRoot .social-composer textarea:focus { background: #eaecef; }

#forumRoot .social-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

/* =====================================================================
 *  5. Bài đăng
 * ===================================================================== */
#forumRoot .social-post {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--fb-card);
  border: 1px solid var(--fb-line);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

#forumRoot .social-post-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

#forumRoot .social-post-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--fb-text);
  line-height: 1.25;
}

#forumRoot .social-post-meta {
  font-size: 11.5px;
  color: var(--fb-muted);
  margin-top: 1px;
}

#forumRoot .social-post-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--fb-text);
  white-space: pre-wrap;
  word-break: break-word;
}

#forumRoot .social-post-media {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--fb-line);
  background: var(--fb-hover);
}

#forumRoot .social-post-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  border-top: 1px solid var(--fb-line);
  padding-top: 6px;
  margin-top: 2px;
}

#forumRoot .social-action-btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--fb-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

#forumRoot .social-action-btn:hover { background: var(--fb-hover); }
#forumRoot .social-action-btn.is-liked { color: var(--fb-blue); }

/* =====================================================================
 *  6. Bình luận
 * ===================================================================== */
#forumRoot .social-comment {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

#forumRoot .social-comment-bubble {
  flex: 1 1 auto;
  background: var(--fb-hover);
  border-radius: 18px;
  padding: 9px 13px;
  font-size: 13px;
  color: var(--fb-text);
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
}

/* =====================================================================
 *  7. Người / bạn bè / nhóm
 * ===================================================================== */
#forumRoot .social-person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--fb-card);
  border: 1px solid var(--fb-line);
}

#forumRoot .social-person-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--fb-text);
  line-height: 1.25;
}

#forumRoot .social-person-sub {
  font-size: 11.5px;
  color: var(--fb-muted);
  margin-top: 1px;
}

#forumRoot .social-group-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: var(--fb-card);
  border: 1px solid var(--fb-line);
}

/* =====================================================================
 *  8. Trạng thái rỗng / lỗi / đang tải
 * ===================================================================== */
#forumRoot .social-empty {
  text-align: center;
  padding: 26px 16px;
  border-radius: 12px;
  border: 1px dashed #ccd0d5;
  background: var(--fb-card);
  color: var(--fb-muted);
  font-size: 13px;
  line-height: 1.6;
}

#forumRoot .social-error {
  text-align: center;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #f5c2c7;
  background: #fff5f6;
  color: #c0392b;
  font-size: 13px;
  line-height: 1.55;
}

#forumRoot .social-error .social-chip {
  background: var(--fb-blue);
  color: #fff;
}

#forumRoot .social-skeleton {
  height: 78px;
  border-radius: 12px;
  background: linear-gradient(90deg, #e9ebee 25%, #f5f6f7 37%, #e9ebee 63%);
  background-size: 400% 100%;
  animation: social-shimmer 1.4s ease infinite;
}

@keyframes social-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* =====================================================================
 *  9. RESPONSIVE — máy nhỏ gọn hơn, PC rộng rãi hơn
 * ===================================================================== */
@media (max-width: 380px) {
  #forumRoot { font-size: 13px; }
  #forumRoot .social-wrap { padding: 8px 8px 22px; gap: 8px; }
  #forumRoot .social-header { padding: 10px 12px; }
  #forumRoot .social-header-title { font-size: 15.5px; }
  #forumRoot .social-post-text { font-size: 13.5px; }
  #forumRoot .social-tab { font-size: 12px; padding: 10px 4px; }
}

@media (min-width: 768px) {
  #forumRoot { font-size: 14.5px; }
  #forumRoot .social-wrap { padding: 14px 16px 32px; gap: 12px; }
  #forumRoot .social-header { padding: 14px 18px; border-radius: 14px; }
  #forumRoot .social-header-title { font-size: 19px; }
  #forumRoot .social-post-text { font-size: 14.5px; }
  #forumRoot .social-tab { font-size: 14px; padding: 13px 8px; }
  #forumRoot .social-card { padding: 14px; }
}

/* PC: 2 cột — bảng tin + cột phải dính khi cuộn */
@media (min-width: 1000px) {
  #forumRoot .social-wrap {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas:
      "header rail"
      "tabs   rail"
      "body   rail";
    align-items: start;
  }
  #forumRoot .social-rail {
    display: flex;
    position: sticky;
    top: 8px;
  }
  #forumRoot .social-post-media { max-height: 520px; }
}

/* =====================================================================
 *  10. CHAT (Messenger) — trong ngăn kéo, nền tối
 * ===================================================================== */
.chat-list { display: flex; flex-direction: column; gap: 6px; }

.chat-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(168, 85, 247, 0.14);
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: background 0.15s ease;
}

.chat-list-item:hover { background: rgba(255, 255, 255, 0.06); }

.chat-list-item.is-unread {
  background: rgba(0, 132, 255, 0.12);
  border-color: rgba(0, 132, 255, 0.4);
}

.chat-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #0084ff;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding: 4px 2px;
}

.chat-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.07);
  color: #f5f3ff;
  align-self: flex-start;
  border-bottom-left-radius: 5px;
}

.chat-bubble.is-me {
  align-self: flex-end;
  background: linear-gradient(135deg, #0084ff, #0068d6);
  color: #fff;
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 5px;
}

.chat-bubble-time {
  font-size: 9.5px;
  color: rgba(196, 181, 253, 0.55);
  margin-top: 3px;
  text-align: right;
}

.chat-sender {
  font-size: 10px;
  font-weight: 700;
  color: rgba(125, 190, 255, 0.9);
  margin-bottom: 2px;
}

.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 4px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-input-bar textarea {
  flex: 1 1 auto;
  min-height: 38px;
  max-height: 96px;
  resize: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(168, 85, 247, 0.25);
  padding: 9px 12px;
  font-size: 13px;
  color: #f5f3ff;
  outline: none;
}

.chat-input-bar textarea:focus { border-color: rgba(0, 132, 255, 0.6); }

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0084ff, #0068d6);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}

.chat-send-btn:active { transform: scale(0.94); }

.chat-thread-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* =========================================================================
   DIỄN ĐÀN — THANH TRÊN GỌN (giống Facebook) + thẻ tài khoản nhỏ bên phải
   (Alya, 06/12/2026)
   ========================================================================= */
#forumRoot .social-header {
  padding: 6px 10px;
  border-radius: 10px;
  gap: 8px;
  box-shadow: 0 1px 4px rgba(24, 119, 242, 0.22);
}
#forumRoot .social-header-title { font-size: 14px; line-height: 1.1; }
#forumRoot .social-header-sub { font-size: 9.5px; margin-top: 0; opacity: .8; }

/* Thẻ tài khoản nhỏ: avatar 24px + tên 11px, nằm sát bên phải */
#forumRoot .social-me {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 44vw;
  padding: 2px 9px 2px 2px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}
#forumRoot .social-me:hover { background: rgba(255, 255, 255, 0.26); }
#forumRoot .social-me .social-me-name {
  max-width: 26vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#forumRoot .social-me img,
#forumRoot .social-me > span:first-child { flex: 0 0 auto; }

/* 4 tab: thu chữ lại cho vừa một hàng trên điện thoại */
#forumRoot .social-tab {
  font-size: 11.5px;
  padding: 9px 4px;
  white-space: nowrap;
}
#forumRoot .social-tab .ic { width: 14px; height: 14px; }

@media (min-width: 768px) {
  #forumRoot .social-header { padding: 9px 14px; border-radius: 12px; }
  #forumRoot .social-header-title { font-size: 16px; }
  #forumRoot .social-header-sub { font-size: 10.5px; }
  #forumRoot .social-tab { font-size: 13.5px; padding: 11px 8px; }
  #forumRoot .social-tab .ic { width: 16px; height: 16px; }
}
/* =========================================================================
   AVATAR CÓ KHUNG (Diễn Đàn) — dùng lại .user-avatar + .avatar-frame của
   trang cá nhân, chỉ thu nhỏ khung; thông số tỷ lệ/x/y giữ nguyên.
   ========================================================================= */
.social-av {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  vertical-align: middle;
}
.social-av > .user-avatar { border-radius: 50%; }
.social-av .social-av-txt {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed 0%, #f59e0b 100%);
  line-height: 1;
}
/* Khung vẽ đè lên ảnh nhưng không chặn click */
.social-av .avatar-frame { pointer-events: none; }
/* Khung nhỏ thì bóng/độ dày khung cũng phải nhẹ bớt cho khỏi "bệt" */
.social-av.has-frame { overflow: visible; }

/* Thẻ tài khoản trong header Diễn Đàn: avatar 24px + khung */
#forumRoot .social-me { padding-left: 2px; }
#forumRoot .social-me .social-av { margin-right: 1px; }
/* =========================================================================
   FORM trong Diễn Đàn — màu cố định "chữ đậm trên nền sáng" để ĐỌC ĐƯỢC ở
   mọi theme (trước đây dùng amber-300/purple-50 nên theme Sáng bị mất chữ).
   ========================================================================= */
#forumRoot .social-form-title {
  font-size: 12.5px;
  font-weight: 800;
  color: #92400e;
  letter-spacing: .01em;
}
#forumRoot .social-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 12px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #111827;
  font-size: 12.5px;
  line-height: 1.4;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}
#forumRoot .social-input::placeholder { color: #9ca3af; }
#forumRoot .social-input:focus { border-color: #1877f2; background: #fff; }
#forumRoot .social-input--area { resize: vertical; min-height: 56px; }
#forumRoot .social-select {
  padding: 8px 10px;
  border-radius: 12px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #111827;
  font-size: 12px;
  font-weight: 600;
  outline: none;
}
#forumRoot .social-form-hint { font-size: 11px; color: #6b7280; }
#forumRoot .social-empty { color: #4b5563; }
/* =========================================================================
   CHAT — GIAO DIỆN MESSENGER (Alya, 06/12/2026)
   Toàn bộ dùng biến theme (--t-*) nên đổi Sang/Tối/Vũ trụ… vẫn đọc được.
   ========================================================================= */
#screenChat { margin: 0 auto; }
#screenChat #panelChat {
  background: var(--t-panel, #15121d);
  color: var(--t-text, #f5f3ff);
  border-color: var(--t-border, rgba(255, 255, 255, .1));
  min-height: 72vh;
}

/* ---------- thanh đầu ---------- */
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 6px; }
.chat-head__title { font-size: 19px; font-weight: 800; letter-spacing: -.01em; color: var(--t-text, #f5f3ff); line-height: 1.15; }
.chat-head__sub { font-size: 11px; color: var(--t-muted, #8b8b93); margin-top: 2px; }
.chat-head__actions { display: flex; gap: 6px; }

.chat-icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--t-soft, rgba(255, 255, 255, .08));
  color: var(--t-text, #f5f3ff);
  border: 0; cursor: pointer; flex: 0 0 auto;
  transition: background .15s ease, transform .1s ease;
}
.chat-icon-btn:hover { background: var(--t-soft-2, rgba(255, 255, 255, .14)); }
.chat-icon-btn:active { transform: scale(.94); }
.chat-icon-btn .ic { width: 17px; height: 17px; }

/* ---------- ô tìm kiếm ---------- */
.chat-search {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 12px 8px; padding: 9px 13px;
  border-radius: 999px;
  background: var(--t-soft, rgba(255, 255, 255, .08));
  color: var(--t-muted, #8b8b93);
}
.chat-search .ic { width: 15px; height: 15px; flex: 0 0 auto; }
.chat-search input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  color: var(--t-text, #f5f3ff); font-size: 13px;
}
.chat-search input::placeholder { color: var(--t-muted-dim, #7d7d87); }

.chat-section-title {
  padding: 8px 14px 4px; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--t-muted, #8b8b93);
}

/* ---------- dòng hội thoại ---------- */
.chat-list { display: flex; flex-direction: column; }
.chat-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 0; background: transparent;
  text-align: left; cursor: pointer; border-radius: 12px;
  transition: background .15s ease;
}
.chat-row:hover { background: var(--t-soft, rgba(255, 255, 255, .06)); }
.chat-row__av { position: relative; display: inline-flex; flex: 0 0 auto; }
.chat-row__group {
  position: absolute; right: -3px; bottom: -3px;
  width: 17px; height: 17px; border-radius: 50%;
  background: #1877f2; color: #fff;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--t-panel, #15121d);
}
.chat-row__group .ic { width: 9px; height: 9px; }
.chat-row__main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.chat-row__name {
  font-size: 14px; font-weight: 700; color: var(--t-text, #f5f3ff);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-row.is-unread .chat-row__name { font-weight: 800; }
.chat-row__last {
  font-size: 12.5px; color: var(--t-muted, #8b8b93);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-row.is-unread .chat-row__last { color: var(--t-text, #f5f3ff); font-weight: 600; }
.chat-row__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: 0 0 auto; }
.chat-row__time { font-size: 10.5px; color: var(--t-muted, #8b8b93); }
.chat-row__dot { width: 10px; height: 10px; border-radius: 50%; background: #0084ff; box-shadow: 0 0 0 2px var(--t-panel, #15121d); }

.chat-hint { padding: 12px 14px; font-size: 12.5px; line-height: 1.55; color: var(--t-muted, #8b8b93); }

/* ---------- trạng thái rỗng ---------- */
.chat-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 46px 22px; }
.chat-empty__icon {
  width: 68px; height: 68px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--t-soft, rgba(255, 255, 255, .08));
  color: var(--t-text, #f5f3ff); margin-bottom: 4px;
}
.chat-empty__icon .ic { width: 30px; height: 30px; }
.chat-empty__title { font-size: 16.5px; font-weight: 800; color: var(--t-text, #f5f3ff); }
.chat-empty__sub { font-size: 12.5px; color: var(--t-muted, #8b8b93); max-width: 270px; line-height: 1.5; }
.chat-btn-primary {
  margin-top: 10px; padding: 10px 20px; border-radius: 999px; border: 0;
  background: #0084ff; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
}
.chat-btn-primary:active { transform: scale(.96); }

/* ---------- khung trò chuyện ---------- */
.chat-thread-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid var(--t-border, rgba(255, 255, 255, .1));
}
.chat-thread-who { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.chat-thread-meta { display: flex; flex-direction: column; min-width: 0; }
.chat-thread-name { font-size: 14px; font-weight: 800; color: var(--t-text, #f5f3ff); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-thread-sub { font-size: 10.5px; color: var(--t-muted, #8b8b93); }
.chat-thread-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.chat-messages { display: flex; flex-direction: column; gap: 6px; padding: 12px; overflow-y: auto; }
.chat-bubble {
  max-width: 78%; padding: 9px 13px; border-radius: 18px;
  font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
  background: var(--t-surface, #26232f); color: var(--t-text, #f5f3ff);
  align-self: flex-start; border-bottom-left-radius: 6px;
}
.chat-bubble.is-me {
  align-self: flex-end; background: linear-gradient(135deg, #0084ff, #0068d6); color: #fff;
  border-bottom-left-radius: 18px; border-bottom-right-radius: 6px;
}
.chat-bubble img { border-radius: 12px; max-height: 240px; object-fit: cover; display: block; margin-bottom: 4px; }
.chat-bubble-time { font-size: 9.5px; opacity: .65; margin-top: 3px; text-align: right; }
.chat-sender { font-size: 10px; font-weight: 800; color: #7db8ff; margin-bottom: 2px; }

.chat-composer {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 8px 10px 12px; border-top: 1px solid var(--t-border, rgba(255, 255, 255, .1));
}
.chat-composer textarea {
  flex: 1 1 auto; min-height: 38px; max-height: 120px; resize: none;
  border-radius: 20px; background: var(--t-soft, rgba(255, 255, 255, .08));
  color: var(--t-text, #f5f3ff); border: 0; padding: 10px 14px; font-size: 13.5px; outline: none;
}
.chat-composer textarea::placeholder { color: var(--t-muted, #8b8b93); }
.chat-send-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; flex: 0 0 auto;
  background: #0084ff; color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.chat-send-btn .ic { width: 18px; height: 18px; }
.chat-send-btn:active { transform: scale(.94); }

/* ---------- khung gọi ---------- */
.chat-call { position: fixed; inset: 0; z-index: 260; display: flex; align-items: center; justify-content: center; background: rgba(6, 8, 14, .86); backdrop-filter: blur(8px); padding: 20px; }
.chat-call__card {
  width: 100%; max-width: 320px; text-align: center;
  padding: 28px 22px 22px; border-radius: 24px;
  background: var(--t-card-1, #17141f);
  border: 1px solid var(--t-border, rgba(255, 255, 255, .12));
  color: var(--t-text, #f5f3ff);
}
.chat-call__ring {
  width: 96px; height: 96px; margin: 0 auto 12px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 0 rgba(0, 132, 255, .55); animation: chatCallPulse 1.6s ease-out infinite;
}
@keyframes chatCallPulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 132, 255, .5); }
  100% { box-shadow: 0 0 0 26px rgba(0, 132, 255, 0); }
}
.chat-call__name { font-size: 17px; font-weight: 800; }
.chat-call__state { font-size: 12.5px; color: var(--t-muted, #8b8b93); margin-top: 4px; }
.chat-call__note { font-size: 10.5px; color: var(--t-muted-dim, #7d7d87); margin-top: 10px; }
.chat-call__actions { display: flex; justify-content: center; gap: 22px; margin-top: 18px; }
.chat-call__btn {
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--t-soft-2, rgba(255, 255, 255, .14)); color: var(--t-text, #fff);
  display: flex; align-items: center; justify-content: center;
}
.chat-call__btn .ic { width: 22px; height: 22px; }
.chat-call__btn.is-off { background: #3f3f46; color: #a1a1aa; }
.chat-call__btn--end { background: #e11d48; color: #fff; transform: rotate(135deg); }