/* /css/chat.css - FINAL FIX */

.fchat{
  width:100%;
  border-radius: 14px;
  border: 1px solid rgba(31,42,68,.75);
  background: rgba(2,6,23,.55);
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
  padding: 12px 12px;
  backdrop-filter: blur(6px);

  display:flex;
  flex-direction:column;
  height:100%;
  box-sizing:border-box;
}

.fchat .t{
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .6px;
  color: #e5e7eb;
  margin: 0 0 10px 0;
  display:flex;
  align-items:center;
  gap:8px;
  flex: 0 0 auto;
}

.fchat .chatbox{
  flex: 1 1 auto;
  min-height: 0;       /* ✅ quan trọng trong flex */
  overflow-y: auto;

  border-radius: 12px;
  border: 1px solid rgba(31,42,68,.60);
  background: rgba(2,6,23,.35);
  padding: 10px;

  box-sizing:border-box;
}

/* --- mỗi tin nhắn --- */
.chatmsg{
  padding: 10px 6px;
  margin: 0;
}

/* gạch ngang phân cách - nhìn RÕ */
.chatsep{
  border-top: 1px solid rgba(147,197,253,.18);
  margin: 10px 0;
}

/* Dùng GRID để đảm bảo: header + nội dung cùng hàng, wrap đúng */
.chatline{
  display:grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items:start;
}

/* Header dạng pill: 0898**[17:37] */
.chathead{
  display:inline-flex;
  align-items:center;

  font-size: 12px;
  font-weight: 900;
  color: #e5e7eb;

  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(147,197,253,.22);
  background: rgba(2,6,23,.55);

  line-height: 1;
  height: 22px;
  box-sizing:border-box;
  white-space:nowrap;
}

/* Nội dung: bắt đầu cùng hàng, dài thì xuống dòng nhưng chỉ ở cột nội dung */
.chattext{
  font-size: 13px;
  color:#e5e7eb;
  line-height: 1.35;

  white-space: pre-wrap;
  word-break: break-word;
  padding-top: 2px;
}

/* input row */
.fchat .chatrow{
  flex: 0 0 auto;
  display:flex;
  gap:8px;
  margin-top: 10px;
}

.fchat .chatinp{
  flex:1;
  box-sizing:border-box;
  background: rgba(2,6,23,.55);
  border:1px solid rgba(31,42,68,.75);
  border-radius: 10px;
  color:#e5e7eb;
  padding: 10px 10px;
  outline:none;
  min-width:0;
}

.fchat .chatbtn{
  flex: 0 0 auto;
  background: #2563eb;
  color:#fff;
  border:0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor:pointer;
}
.fchat .chatbtn:hover{ filter:brightness(1.06); }
.fchat .chatbtn:disabled{ opacity:.55; cursor:not-allowed; }

.fchat .sub{
  flex: 0 0 auto;
  margin-top: 8px;
  font-size: 12px;
  color: #cbd5e1;
  opacity: .95;
  border-top: 1px solid rgba(31,42,68,.55);
  padding-top: 8px;
}
/* ==============================
   CUSTOM SCROLLBAR – CHAT
   ============================== */

/* Firefox */
.fchat .chatbox{
  scrollbar-width: thin;
  scrollbar-color: rgba(147,197,253,.45) rgba(2,6,23,.35);
}

/* Chrome / Edge / Safari */
.fchat .chatbox::-webkit-scrollbar{
  width: 8px;              /* mảnh, gọn */
}

.fchat .chatbox::-webkit-scrollbar-track{
  background: rgba(2,6,23,.35);   /* nền tối */
  border-radius: 10px;
}

.fchat .chatbox::-webkit-scrollbar-thumb{
  background: linear-gradient(
    180deg,
    rgba(147,197,253,.55),
    rgba(59,130,246,.45)
  );
  border-radius: 10px;
  border: 2px solid rgba(2,6,23,.35); /* tạo cảm giác “nổi” */
}

.fchat .chatbox::-webkit-scrollbar-thumb:hover{
  background: linear-gradient(
    180deg,
    rgba(147,197,253,.75),
    rgba(59,130,246,.65)
  );
}
