/* =====================================================================
   CHAT.CSS — Office Chat Panel: header, tabs, messages, input, typing
   ===================================================================== */

/* ── Chat Header ─────────────────────────────────────────────────────── */
.chat-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 46px;
  background: var(--bg2);
  border-bottom: 2px solid var(--purple);
  flex-shrink: 0;
  position: relative;
}
.chat-hdr::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--purple), var(--cyan), transparent);
  opacity: .6;
}
.chat-hdr-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--txt0);
  letter-spacing: .5px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Tabs ────────────────────────────────────────────────────────────── */
.ctabs {
  display: flex;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
  background: var(--bg1);
  overflow-x: auto;
  scrollbar-width: none;
}
.ctabs::-webkit-scrollbar { display: none; }

.ctab {
  flex: 1;
  min-width: 0;
  padding: 8px 4px;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--txt2);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}
.ctab:hover { color: var(--txt0); background: var(--bg2); }
.ctab.act {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  background: var(--bg2);
}

/* ── Messages Container ──────────────────────────────────────────────── */
.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}

/* ── Message Row ─────────────────────────────────────────────────────── */
.msg {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  animation: msgIn .2s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg.own { flex-direction: row-reverse; }

/* Avatar */
.mav {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Body */
.mbody {
  display: flex;
  flex-direction: column;
  max-width: calc(100% - 42px);
  min-width: 0;
}
.msg.own .mbody { align-items: flex-end; }

/* Sender name */
.msnd {
  font-size: 9px;
  font-weight: 700;
  color: var(--txt2);
  margin-bottom: 3px;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* Bubble */
.mbub {
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: 10px;
  padding: 7px 10px;
  position: relative;
}
.msg.own .mbub {
  background: rgba(124, 58, 237, .18);
  border-color: rgba(124, 58, 237, .4);
  border-radius: 10px 10px 4px 10px;
}
.msg:not(.own) .mbub {
  border-radius: 10px 10px 10px 4px;
}

/* Text */
.mtxt {
  font-size: 11px;
  color: var(--txt0);
  line-height: 1.55;
  word-break: break-word;
  font-family: 'Noto Sans Lao', 'Inter', sans-serif;
}

/* Timestamp */
.mtime {
  font-size: 8px;
  color: var(--txt3);
  margin-top: 4px;
  text-align: right;
}

/* ── Typing Indicator ────────────────────────────────────────────────── */
.typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 2px;
}
.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--txt2);
  animation: typingDot 1.2s infinite ease-in-out;
}
.typing span:nth-child(1) { animation-delay: 0s; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typingDot {
  0%, 80%, 100% { transform: scale(.7); opacity: .4; }
  40%           { transform: scale(1);  opacity: 1; }
}

/* ── Input Area ──────────────────────────────────────────────────────── */
.cinp-wrap {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--bdr);
  background: var(--bg2);
  flex-shrink: 0;
}

.cinp {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--bdr);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--txt0);
  font-size: 12px;
  font-family: 'Noto Sans Lao', 'Inter', sans-serif;
  outline: none;
  resize: none;
  line-height: 1.4;
  max-height: 90px;
  overflow-y: auto;
  transition: border-color .15s;
}
.cinp:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, .15);
}
.cinp::placeholder { color: var(--txt3); font-size: 11px; }

/* Send Button */
.sbtn {
  width: 34px;
  height: 34px;
  background: var(--purple);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
}
.sbtn:hover  { background: var(--purple2); }
.sbtn:active { transform: scale(.93); }

/* ── Empty state in chat msgs ────────────────────────────────────────── */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--txt3);
  font-size: 9px;
  font-family: 'Press Start 2P', monospace;
  text-align: center;
  padding: 20px;
  line-height: 2;
}
