/* BlueMountain Live Chat */
.tm-chat-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 520px;
  overflow: hidden;
}

.tm-chat-head {
  background: var(--navy);
  color: #fff;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.tm-chat-head .ic {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--sage);
  flex-shrink: 0;
}

.tm-chat-head h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

.tm-chat-head p {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.65);
}

.tm-chat-status {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: rgba(79, 99, 82, 0.35);
  color: #d4e4d6;
}

.tm-chat-start {
  padding: 24px 22px;
  flex: 1;
  overflow-y: auto;
}

.tm-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  background: var(--bg-section);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
  max-height: 380px;
}

.tm-chat-bubble {
  max-width: 82%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  word-break: break-word;
}

.tm-chat-bubble.customer {
  align-self: flex-end;
  background: var(--navy);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.tm-chat-bubble.admin {
  align-self: flex-start;
  background: #fff;
  color: var(--text-dark);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.tm-chat-bubble .meta {
  display: block;
  margin-top: 6px;
  font-size: 0.68rem;
  opacity: 0.72;
}

.tm-chat-compose {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  background: #fff;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.tm-chat-compose textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--font-main);
  font-size: 0.88rem;
  resize: none;
  min-height: 46px;
  max-height: 120px;
  outline: none;
}

.tm-chat-compose textarea:focus {
  border-color: var(--sage);
}

.tm-chat-send {
  background: var(--sage);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 12px 20px;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.tm-chat-send:hover { background: var(--sage-dark); }
.tm-chat-send:disabled { opacity: 0.55; cursor: not-allowed; }

.tm-chat-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 40px 16px;
}

.tm-chat-error {
  margin: 0 16px 12px;
  padding: 10px 14px;
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
  border-radius: var(--radius);
  font-size: 0.82rem;
}

/* Admin chat modal — use fixed colors (admin panel has no --sage vars) */
.admin-chat-thread {
  max-height: 340px;
  overflow-y: auto;
  padding: 16px;
  background: #f4f6f8;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-chat-compose {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.admin-chat-compose textarea {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 72px;
}

/* Admin inbox: customer left (white), support reply right (green) */
.admin-chat-thread .tm-chat-bubble {
  max-width: 78%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  word-break: break-word;
}

.admin-chat-thread .tm-chat-bubble.customer {
  align-self: flex-start;
  background: #ffffff !important;
  color: #0A1622 !important;
  border: 1px solid #e2e8f0 !important;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 14px;
}

.admin-chat-thread .tm-chat-bubble.admin {
  align-self: flex-end;
  background: #4F6352 !important;
  color: #ffffff !important;
  border: none !important;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 14px;
  box-shadow: 0 2px 8px rgba(79, 99, 82, 0.25);
}

.admin-chat-thread .tm-chat-bubble.customer .meta {
  color: #64748b !important;
  opacity: 1 !important;
}

.admin-chat-thread .tm-chat-bubble.admin .meta {
  color: rgba(255, 255, 255, 0.85) !important;
  opacity: 1 !important;
}

.admin-chat-thread .tm-chat-bubble.admin span:first-child,
.admin-chat-thread .tm-chat-bubble.customer span:first-child {
  color: inherit !important;
}

@media (max-width: 576px) {
  .tm-chat-wrap { min-height: 460px; }
  .tm-chat-messages { max-height: 300px; }
  .tm-chat-compose { flex-direction: column; align-items: stretch; }
  .tm-chat-send { width: 100%; }
}
