/*
 * Hộp thư mạng xã hội — CSS THUẦN, cố ý không dùng Tailwind.
 *
 * Lý do: public/build nằm trong .gitignore và chưa bao giờ được đóng gói lên
 * server, nên MỌI class Tailwind mới sẽ không có tác dụng trên production
 * (xem resources/css/app.css dòng 26 — grid-cols-7 phải hard-code vì đúng lý do này).
 * File này nạp thẳng từ public/css qua renderHook, giống public/js/push-notification.js.
 *
 * Đổi file này thì nhớ tăng ?v= trong AdminPanelProvider để trình duyệt nạp lại.
 */

.jf-inbox { --jf-line: #e5e7eb; --jf-muted: #6b7280; --jf-bg: #ffffff; --jf-soft: #f9fafb;
  --jf-me: #2296f3; --jf-me-text: #ffffff; --jf-them: #f1f5f9; --jf-them-text: #0f172a;
  --jf-danger: #dc2626; }
:is(.dark) .jf-inbox { --jf-line: #374151; --jf-muted: #9ca3af; --jf-bg: #111827; --jf-soft: #1f2937;
  --jf-them: #1f2937; --jf-them-text: #e5e7eb; }

/* ───── Danh sách hội thoại ───── */
.jf-inbox-list { display: flex; flex-direction: column; gap: 8px; }
.jf-inbox-search { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--jf-line);
  border-radius: 12px; background: var(--jf-bg); color: inherit; outline: none; font-size: 14px; }
.jf-conv { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--jf-line);
  border-radius: 16px; background: var(--jf-bg); text-decoration: none; color: inherit; }
.jf-conv:active { transform: scale(0.99); }
.jf-conv-avatar { width: 48px; height: 48px; border-radius: 999px; object-fit: cover; flex-shrink: 0;
  background: var(--jf-soft); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.jf-conv-main { min-width: 0; flex: 1; }
.jf-conv-top { display: flex; align-items: baseline; gap: 8px; }
.jf-conv-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jf-conv-time { margin-left: auto; flex-shrink: 0; font-size: 11px; color: var(--jf-muted); white-space: nowrap; }
.jf-conv-snippet { margin-top: 2px; font-size: 13px; color: var(--jf-muted);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.jf-chip { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 999px;
  background: var(--jf-soft); color: var(--jf-muted); white-space: nowrap; }
.jf-chip--unread { background: var(--jf-me); color: #fff; font-weight: 700; }
.jf-empty { padding: 32px 16px; text-align: center; color: var(--jf-muted); font-size: 14px;
  border: 1px dashed var(--jf-line); border-radius: 16px; }

/* ───── Khung chat ───── */
/* Trừ thanh trên + padding của Filament; trang khung chat không có tiêu đề. */
.jf-thread { display: flex; flex-direction: column; height: calc(100dvh - 8rem);
  min-height: 24rem; overflow: hidden; background: var(--jf-bg); }
.jf-thread-head { flex-shrink: 0; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--jf-line); background: var(--jf-bg); }
.jf-thread-back { font-size: 20px; line-height: 1; text-decoration: none; color: inherit;
  min-width: 36px; min-height: 36px; display: flex; align-items: center; }
.jf-thread-title { min-width: 0; flex: 1; }
.jf-thread-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jf-thread-sub { font-size: 11px; color: var(--jf-muted); }
.jf-thread-cta { flex-shrink: 0; background: var(--jf-me); color: #fff; text-decoration: none;
  font-weight: 700; font-size: 13px; padding: 9px 14px; border-radius: 10px; min-height: 40px;
  display: flex; align-items: center; }

.jf-thread-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--jf-soft); }

.jf-msg { max-width: 78%; padding: 8px 12px; border-radius: 16px; font-size: 14px;
  line-height: 1.45; word-break: break-word; }
/* pre-wrap CHỈ ở thẻ chữ — để ở thẻ cha thì khoảng trắng thụt dòng của blade
   lọt vào bong bóng, chữ bị đẩy thụt vào và bong bóng cao vống lên. */
.jf-msg-text { white-space: pre-wrap; }
.jf-msg--in { align-self: flex-start; background: var(--jf-them); color: var(--jf-them-text);
  border-bottom-left-radius: 4px; }
.jf-msg--out { align-self: flex-end; background: var(--jf-me); color: var(--jf-me-text);
  border-bottom-right-radius: 4px; }
.jf-msg--failed { background: var(--jf-danger); }
.jf-msg--system { align-self: center; max-width: 92%; background: transparent; color: var(--jf-muted);
  font-size: 12px; font-style: italic; text-align: center; padding: 2px 8px; }
.jf-msg img { display: block; max-width: 100%; border-radius: 10px; margin-top: 4px; }
.jf-msg-meta { margin-top: 3px; font-size: 10px; opacity: 0.75; }
.jf-msg-retry { margin-top: 4px; background: rgba(255,255,255,0.22); color: #fff; border: 0;
  border-radius: 8px; padding: 4px 10px; font-size: 11px; font-weight: 700; cursor: pointer; }

.jf-thread-foot { flex-shrink: 0; border-top: 1px solid var(--jf-line); background: var(--jf-bg);
  padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.jf-composer { display: flex; align-items: flex-end; gap: 8px; }
.jf-composer textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--jf-line);
  border-radius: 18px; padding: 10px 12px; font-size: 14px; line-height: 1.4; max-height: 120px;
  background: var(--jf-bg); color: inherit; outline: none; font-family: inherit; }
.jf-composer-btn { flex-shrink: 0; min-width: 56px; min-height: 44px; padding: 0 14px; border: 0;
  border-radius: 999px; background: var(--jf-me); color: #fff; font-size: 15px; font-weight: 700;
  cursor: pointer; white-space: nowrap; }
.jf-composer-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.jf-composer-icon { background: var(--jf-soft); color: var(--jf-muted); font-size: 19px; }
.jf-composer-closed { padding: 10px 12px; font-size: 13px; color: var(--jf-muted); text-align: center;
  background: var(--jf-soft); border-radius: 12px; }
.jf-preview { display: flex; align-items: center; gap: 8px; padding: 6px 2px 8px; font-size: 12px; color: var(--jf-muted); }
.jf-preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }

/* Máy tính: danh sách bên trái, khung chat bên phải — cùng một markup */
@media (min-width: 1024px) {
  .jf-thread { height: calc(100dvh - 9rem); border: 1px solid var(--jf-line); border-radius: 16px; }
  .jf-msg { max-width: 62%; }
}

/* ───── Kết nối kênh chat (dưới danh sách hội thoại) ───── */
.jf-ch { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--jf-line);
  display: flex; flex-direction: column; gap: 14px; }
.jf-ch-title { font-size: 16px; font-weight: 700; margin: 0; }
.jf-ch-sub { margin: 2px 0 0; font-size: 13px; color: var(--jf-muted); }
.jf-ch-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 900px) { .jf-ch-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.jf-ch-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--jf-line);
  border-radius: 16px; background: var(--jf-bg); min-width: 0; }
.jf-ch-card--soon { opacity: 0.7; }
.jf-ch-card-head { display: flex; align-items: center; gap: 10px; }
.jf-ch-card-title { font-weight: 700; font-size: 14px; }
.jf-ch-logo { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 17px; }
.jf-ch-logo--fb { background: #1877f2; }
.jf-ch-logo--ig { background: linear-gradient(45deg, #f09433, #dc2743 50%, #bc1888); }
.jf-ch-logo--zalo { background: #0068ff; }

.jf-ch-row { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between;
  padding: 10px; border-radius: 12px; background: var(--jf-soft); }
.jf-ch-row-main { min-width: 0; flex: 1; }
.jf-ch-row-name { font-weight: 600; font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.jf-ch-row-meta { font-size: 12px; color: var(--jf-muted); }
.jf-ch-row-err { font-size: 12px; color: var(--jf-danger); margin-top: 2px; }
.jf-ch-row-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.jf-ch-chip { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.jf-ch-chip--on { background: #dcfce7; color: #15803d; }
.jf-ch-chip--off { background: #fee2e2; color: #b91c1c; }
.jf-ch-connect { width: 100%; justify-content: center; margin-top: auto; }
.jf-ch-note { font-size: 12px; color: var(--jf-muted); margin: 0; line-height: 1.5; }

.jf-ch-pick { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 16px;
  border: 1px solid var(--jf-me); background: rgba(34, 150, 243, 0.06); }
.jf-ch-alert { padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.jf-ch-alert--danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.jf-ch-tech { border: 1px solid var(--jf-line); border-radius: 14px; padding: 10px 14px; background: var(--jf-bg); }
.jf-ch-tech summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--jf-muted); }
.jf-ch-tech[open] { display: flex; flex-direction: column; gap: 8px; }
.jf-ch-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.jf-ch-stats div { background: var(--jf-soft); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; }
.jf-ch-stats span { font-size: 11px; color: var(--jf-muted); }
.jf-ch-stats strong { font-size: 17px; }
.jf-ch-bad { color: var(--jf-danger); }
.jf-ch-label { font-size: 12px; color: var(--jf-muted); margin-top: 4px; }
.jf-ch-input { width: 100%; font-size: 13px; padding: 8px 10px; border: 1px solid var(--jf-line);
  border-radius: 10px; background: var(--jf-soft); color: inherit; }
