/* Nhắn tin trên cổng học tập (C7, đợt 27/10) — chung .edu-chat-*, web .edw-chat-*, app .edm-chat-* */

/* ---------- danh sách hội thoại ---------- */
.edu-chat-search { position: relative; margin: 0 0 10px; }
.edu-chat-search edu-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.edu-chat-search .edu-input { padding-left: 36px; width: 100%; }
.edu-chat-threads { display: flex; flex-direction: column; }
.edu-chat-thread { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; background: transparent; text-align: left; border-radius: var(--r-sm); cursor: pointer; color: inherit; font: inherit; }
.edu-chat-thread:hover { background: var(--surface-2); }
.edu-chat-thread.is-active { background: var(--primary-soft); }
.edu-chat-thread-main { flex: 1; min-width: 0; }
.edu-chat-thread-top { display: flex; align-items: baseline; gap: 8px; }
.edu-chat-thread-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.edu-chat-thread-time { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.edu-chat-thread-sub, .edu-chat-thread-last { color: var(--text-3); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.edu-chat-thread.is-unread .edu-chat-thread-title, .edu-chat-thread.is-unread .edu-chat-thread-last { color: var(--text-1); font-weight: 700; }
.edu-chat-thread-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.edu-chat-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.edu-chat-muted { color: var(--text-3); }
.edu-chat-ava { width: 44px; height: 44px; flex: 0 0 44px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.edu-chat-ava.is-group { background: var(--primary-soft); color: var(--primary); }

/* ---------- web: 2 cột ---------- */
.edw-chat { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; height: calc(100vh - 190px); min-height: 460px; }
.edw-chat-side { display: flex; flex-direction: column; padding: 12px; overflow: hidden; }
.edw-chat-side .edu-chat-threads { overflow-y: auto; flex: 1; margin: 0 -4px; }
.edw-chat-main { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.edw-chat-back { display: none; }
.edu-chat-placeholder { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-3); gap: 8px; }
.edu-chat-room { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.edu-chat-roomhead { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.edu-chat-roomtitle { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.edu-chat-roomtitle b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edu-chat-roomtitle small { color: var(--text-3); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edu-chat-roomtools { display: flex; gap: 6px; }
.edu-chat-scrollbox { flex: 1; overflow-y: auto; padding: 12px 16px; background: var(--surface-2); }
@media (max-width: 900px) {
  .edw-chat { grid-template-columns: minmax(0, 1fr); height: auto; }
  .edw-chat.has-room .edw-chat-side { display: none; }
  .edw-chat:not(.has-room) .edw-chat-main { display: none; }
  .edw-chat.has-room .edw-chat-main { height: calc(100vh - 170px); }
  .edw-chat-back { display: inline-flex; }
  .edu-chat-hide-sm { display: none; }
}

/* ---------- tin nhắn ---------- */
.edu-chat-msgs { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; }
.edu-chat-older { text-align: center; margin: 4px 0 8px; }
.edu-chat-hello { text-align: center; color: var(--text-3); padding: 32px 0; }
.edu-chat-day { text-align: center; margin: 12px 0 6px; }
.edu-chat-day span { display: inline-block; padding: 2px 10px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); font-size: var(--fs-xs); }
.edu-chat-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 78%; }
.edu-chat-msg.is-head { margin-top: 8px; }
.edu-chat-msg.is-mine { align-self: flex-end; align-items: flex-end; }
.edu-chat-who { font-size: var(--fs-xs); color: var(--text-3); margin: 0 0 2px 10px; }
.edu-chat-role { color: var(--primary); font-weight: 600; }
.edu-chat-bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 8px 12px; box-shadow: var(--sh-1); max-width: 100%; }
.edu-chat-msg.is-mine .edu-chat-bubble { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.edu-chat-msg.is-sending .edu-chat-bubble { opacity: .7; }
.edu-chat-msg.is-failed .edu-chat-bubble { background: var(--danger-soft); border-color: var(--danger); color: var(--text-1); }
.edu-chat-bubble.is-recalled { background: transparent !important; border-style: dashed; color: var(--text-3) !important; box-shadow: none; }
.edu-chat-text { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; line-height: 1.45; }
.edu-chat-meta { font-size: 11px; opacity: .75; margin-top: 2px; text-align: right; }
.edu-chat-recall { margin-left: 6px; cursor: pointer; text-decoration: underline; color: inherit; opacity: 0; transition: opacity .15s; }
.edu-chat-msg:hover .edu-chat-recall, .edu-mobile .edu-chat-recall { opacity: 1; }
.edu-chat-fail { font-size: var(--fs-xs); color: var(--danger); margin-top: 2px; }
.edu-chat-fail a { cursor: pointer; text-decoration: underline; }
.edu-chat-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.edu-chat-img { display: block; cursor: zoom-in; }
.edu-chat-img img { display: block; max-width: 220px; max-height: 220px; border-radius: 10px; object-fit: cover; }
.edu-chat-file { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: rgba(0, 0, 0, .06); color: inherit; text-decoration: none; max-width: 240px; }
.edu-chat-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edu-chat-msg.is-mine .edu-chat-file { background: rgba(255, 255, 255, .18); }

/* ---------- ô soạn ---------- */
.edu-chat-composer { border-top: 1px solid var(--border); background: var(--surface); padding: 8px 10px; }
.edu-chat-cantpost { color: var(--text-3); font-size: var(--fs-sm); text-align: center; padding: 6px; }
.edu-chat-pending { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.edu-chat-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 4px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-xs); max-width: 200px; }
.edu-chat-chip img { width: 28px; height: 28px; object-fit: cover; border-radius: 6px; }
.edu-chat-chip em { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edu-chat-chip button { border: 0; background: transparent; color: var(--text-3); cursor: pointer; padding: 2px; display: inline-flex; }
.edu-chat-chip.is-busy { color: var(--text-3); padding: 6px 10px; }
.edu-chat-inputrow { display: flex; align-items: flex-end; gap: 6px; }
.edu-chat-tool { position: relative; width: 38px; height: 38px; flex: 0 0 38px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--text-2); border-radius: 50%; cursor: pointer; overflow: hidden; }
.edu-chat-tool:hover { background: var(--surface-2); color: var(--primary); }
.edu-chat-tool.is-disabled { opacity: .5; pointer-events: none; }
.edu-chat-tool input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
textarea.edu-input.edu-chat-input { flex: 1; min-width: 0; width: auto; height: 40px; min-height: 40px; max-height: 140px; resize: none; padding: 9px 14px; border-radius: 20px; line-height: 1.35; }
textarea.edu-input.edu-chat-input:focus { height: 72px; }
.edu-chat-send { width: 38px; height: 38px; flex: 0 0 38px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: var(--primary); color: var(--on-primary); cursor: pointer; }
.edu-chat-send[disabled] { background: var(--surface-3); color: var(--text-3); cursor: default; }

/* ---------- danh bạ (sheet) ---------- */
.edu-chat-contacts .edu-row { gap: 10px; }
.edu-chat-cgroup { margin-bottom: 12px; }

/* ---------- app ---------- */
.edm-chat-list .edu-chat-threads { padding: 4px; }
.edm-chat-fab { position: absolute; right: 18px; bottom: calc(18px + var(--sab, 0px)); z-index: 5; }
.edm-chat-sub { text-align: center; color: var(--text-3); font-size: var(--fs-xs); margin: -4px 0 6px; }
.edm-chat-view .edm-chat-content { background: var(--surface-2); }
.edm-chat-view .has-footer { bottom: 62px; }
.edm-chat-view .bar-footer.edm-chat-footer { height: auto; min-height: 62px; padding: 0; border-top: 0; background: var(--surface); }
.edm-chat-footer-in { width: 100%; }
.edm-chat-footer .edu-chat-composer { padding-bottom: calc(8px + var(--sab, 0px)); }
/* nút cài đặt hội thoại nằm trên thanh tiêu đề Ionic (ion-nav-buttons — ngoài .edm-chat-view) → chỉ còn biểu tượng */
.edu-mobile .edu-chat-roomtools .edu-btn { padding: 4px 8px; min-height: 32px; border: 0; background: transparent; }
.edu-mobile .edu-chat-hide-sm, .edu-mobile .edu-chat-roomtools .edu-chat-hide-sm { display: none !important; }
.edu-mobile .edu-chat-msg { max-width: 86%; }

/* ---------- nhóm tự tạo: chọn thành viên / thông tin nhóm ---------- */
.edu-chat-pick { display: flex; flex-direction: column; gap: 10px; min-height: 100%; }
.edu-chat-pick-tabs { width: 100%; }
.edu-chat-pick-tabs .edu-seg-item { flex: 1; }
.edu-chat-pick-classes { display: flex; flex-wrap: wrap; gap: 6px; }
.edu-chat-pick-class { display: inline-flex; align-items: center; gap: 2px; }
.edu-chat-pick-classes .edu-chip { cursor: pointer; border: 0; }
.edu-chat-pick-all { border: 0; background: transparent; color: var(--primary); font-size: var(--fs-xs); font-weight: 600; cursor: pointer; padding: 2px 4px; }
.edu-chat-pick-list .edu-row { gap: 10px; }
.edu-chat-pick-list .edu-row.is-on { background: var(--primary-soft); }
.edu-chat-pick-empty { color: var(--text-3); text-align: center; padding: 18px 8px; font-size: var(--fs-sm); }
.edu-chat-pick-foot { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 8px 0 calc(4px + var(--sab, 0px)); margin-top: auto; }
.edu-chat-pick-sel { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.edu-chat-pick-sel .edu-chat-chip { white-space: nowrap; flex-shrink: 0; }
.edu-chat-pick-actions { display: flex; justify-content: flex-end; gap: 8px; }
.edu-chat-ginfo-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.edu-chat-ginfo-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.edu-chat-ginfo-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edu-chat-ginfo-name small { color: var(--text-3); font-size: var(--fs-xs); }
.edu-chat-ginfo-title { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.edu-chat-ginfo .edu-row { gap: 10px; }
.edu-chat-me { color: var(--text-3); font-weight: 400; }
.edu-chat-ginfo-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-top: 16px; }
.edm-chat-navbtn { display: inline-flex !important; align-items: center; gap: 4px; font-size: 13px !important; color: var(--primary) !important; }
