/* ===========================
   FLOATING BUTTONS
=========================== */
.tc-chat-fab-wrap {
  position: fixed;
  right: 5px;
  bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 4000;
}
.tc-chat-fab {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  border: none;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
  background: rgb(17,21,26);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.tc-chat-fab:hover {
  background: #183b53;
}

/* ===========================
   CONTACTS PANEL
=========================== */
.tc-contacts {
  position: fixed;
  right: 50px;
  bottom: 0px;
  width: 280px;
  height: 360px;
  background: rgb(8,12,16);
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 8px 8px 0px 0px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 4100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.25s ease;
  color: #222;
}

.tc-contacts-header {
  background: rgb(18,21,27);
  color: #eee;
  font-weight: bold;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tc-contacts-header .tc-btn-close {
  background: transparent;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
}

.tc-contacts-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgb(8,12,16) rgb(22, 30, 37);
  padding: 6px;
}


.tc-contacts-loading {
  font-size: 12px;
  color: #555;
  text-align: center;
  margin-top: 8px;
}

.tc-contact-item {
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  background: rgb(23,27,34);
  transition: background 0.15s ease;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.tc-contact-item:hover {
  background: #0002079c;
}
.tc-contact-name {
  color: #eee;
  font-size: 14px;
  min-width: 0;
  line-height: 1.25;
}
.tc-contact-name small {
  display: block;
  color: #98a6b3;
  font-size: 11px;
  margin-top: 2px;
}

.tc-contact-copy {
  min-width: 0;
}

.tc-contact-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #31566b, #1c3748);
  color: #ecf5fa;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tc-contact-avatar > img {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 50%;
  object-fit: cover;
}

/* ===========================
   CHAT WINDOW
=========================== */
.tc-chat-win {
  position: fixed;
  width: 300px;
  height: 420px;
  border: 1px solid rgb(0, 0, 0);
  background: #222;
  border-radius: 8px 8px 0px 0px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 4200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease;
  animation: fadeInUp 0.25s ease;
}

.tc-chat-header {
  flex-shrink: 0;
  min-height: 50px;
  background: /*#e9edf7*/rgb(18,21,27);
  color: #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  box-sizing: border-box;
  font-weight: bold;
}

.tc-chat-peer {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tc-chat-header-avatar {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  font-size: 10px;
}

.tc-chat-title-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  color: #f1f1f1;
  line-height: 1.15;
}

.tc-chat-title-copy strong {
  max-width: 175px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-chat-title-copy small {
  margin-top: 2px;
  color: #9cabb6;
  font-size: 10px;
  font-weight: 500;
}
.tc-chat-actions button {
  margin-left: 6px;
  background: transparent;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  font-weight: bold;
}

.tc-chat-actions button:hover {
  background: #555;
}

.tc-chat-body {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgb(8,12,16) rgb(22, 30, 37);
  background: /*#fafafa*/rgb(8,12,16);
  box-sizing: border-box;
  border-bottom: 1px solid transparent;
}

/* ===========================
   INPUT AREA
=========================== */
.tc-chat-input {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 6px;
  border-top: 1px solid rgb(35,37,44);
  background: /*#f8f8f8*/rgb(17,20,26);
  gap: 6px;
}

.tc-chat-input input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid /*#ccc*/rgb(35,37,45);
  border-radius: 6px;
  outline: none;
  font-size: 12px;
  height: 32px;
  box-sizing: border-box;
  background: rgb(10,14,18);
  color: #eee;
}

.tc-chat-input button {
  margin-left: 6px;
  padding: 8px 14px;
  border: none;
  background: /*#1e6f43*/rgb(28,51,54);
  color: #eee;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 12px;
  transition: background 0.2s ease;
}

.tc-chat-input button:hover {
  background: #218a50;
}

/* ===========================
   MESSAGE BUBBLES + TIMESTAMP
=========================== */
.tc-chat-bubble {
  display: flex;               /* ✅ corrige empilhamento */
  flex-direction: column;      /* ✅ texto e hora na vertical */
  align-items: flex-start;     /* alinhamento padrão à esquerda */
  position: relative;
  max-width: 80%;
  padding: 6px 8px;
  margin: 3px 0;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  word-wrap: break-word;
  word-break: break-word;
}

.tc-chat-message-row {
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.tc-chat-message-row.mine {
  justify-content: flex-end;
}

.tc-chat-message-row.theirs {
  justify-content: flex-start;
}

.tc-chat-message-avatar {
  width: 26px;
  height: 26px;
  flex-basis: 26px;
  margin-bottom: 3px;
  font-size: 8px;
}

/* Mensagens do próprio usuário */
.tc-chat-bubble.mine {
  background: /*#2e7d32*/rgb(27,51,53);
  color: #fff;
  margin-left: auto;           /* cola à direita */
  align-items: flex-end;       /* texto e hora à direita */
}

/* Mensagens recebidas */
.tc-chat-bubble.theirs {
  background: /*#e0e0e0*/rgb(22,27,31);
  color: #fff;
  margin-right: auto;          /* cola à esquerda */
}

/* Texto da mensagem */
.tc-chat-bubble .msg-text {
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Horário da mensagem */
.tc-chat-bubble .msg-time {
  font-size: 10px;
  opacity: 0.8;
  margin-top: 3px;
  align-self: flex-end;        /* ✅ mantém hora no canto inferior direito da bolha */
}

/* Cores específicas do horário */
.tc-chat-bubble.mine .msg-time {
  color: rgba(255, 255, 255, 0.8);
}

.tc-chat-bubble.theirs .msg-time {
  color: rgba(255,255,255,0.8);
}


/* ===========================
   DATE SEPARATORS
=========================== */
.tc-chat-date {
  text-align: center;
  margin: 10px auto;
  font-size: 10px;
  font-weight: bold;
  color: #c4c4c4;
  background: #353535;
  display: inline-block;
  padding: 4px 10px;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  animation: fadeIn 0.25s ease;
}

/* ===========================
   MINIMIZED BAR
=========================== */
.tc-chat-minibar {
  position: fixed;
  bottom: 0;
  background: rgb(18,21,27);
  color: #fff;
  height: 36px;
  line-height: 36px;
  padding: 0 8px;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.25);
  z-index: 4300;
  width: 220px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: fadeInUp 0.25s ease;
  font-size: 13px;
}

.tc-chat-minibar-peer {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.tc-chat-minibar-peer > span:last-child {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-chat-minibar-avatar {
  width: 26px;
  height: 26px;
  flex-basis: 26px;
  font-size: 8px;
}

.tc-chat-minibar:hover {
  cursor: pointer;
}

.tc-chat-minibar .tc-restore {
  background: transparent;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
}

/* ===========================
   MINIMIZED WINDOW STATE
=========================== */
.tc-chat-win.minimized {
  height: 36px !important;
  overflow: hidden;
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
  transition: height 0.25s ease, transform 0.3s ease, opacity 0.3s ease;
}

.tc-chat-win.minimized .tc-chat-header {
  border-bottom: none;
}

.tc-chat-win.minimized .tc-chat-body,
.tc-chat-win.minimized .tc-chat-input {
  display: none;
}
.tc-chat-date {
  margin: 12px auto 8px auto;
}


/* ===========================
   ANIMATIONS
=========================== */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}


.tc-contact-lastmsg {
  font-size: 12px;
  color: #9aa5af;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3px;
  gap: 6px;
}

.tc-contact-lastmsg span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-conversation-item .tc-contact-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tc-conversation-user {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-conversation-item .tc-conversation-department {
  display: inline-block;
  flex: 0 1 auto;
  max-width: 45%;
  margin: 0;
  overflow: hidden;
  color: #8393a0;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-chat-badge {
  position: absolute;
  top: 32px;
  right: -9px;
  background: #e63946;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 3px rgba(0,0,0,0.3);
}

.tc-contact-item.unread {
  background: #192a3b !important;
  border-color: #0074d9 !important;
  color: #000;
}

.chat-unread-mini {
  background: #e63946;
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  padding: 0 5px;
  margin-left: 6px;
}

