#crm-chat-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #007bff;
  color: white;
  font-size: 24px;
  padding: 12px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 9999;
  transition: all 0.2s ease;
}
#crm-chat-button:hover {
  transform: scale(1.05);
  background: #0056b3;
}

#crm-chat-box {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 320px;
  min-height: 380px;
  max-height: 500px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  transition: all 0.3s ease;
}

#crm-chat-box.open {
  display: flex;
}
.msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #666;
}

.msg-time {
  font-size: 11px;
  color: #999;
  margin-left: 8px;
}

.msg-text {
  font-size: 14px;
  color: #222;
  margin-top: 2px;
  word-wrap: break-word;
}

.chat-header {
  background: #007bff;
  color: white;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between; /* left & right alignment */
  align-items: center;
  font-weight: bold;
  flex-shrink: 0;
}

#chat-close {
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  margin-left: 10px;
  transition: 0.2s;
}

#chat-close:hover {
  color: #ffcccc;
}


.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  background: #f5f5f5;
  min-height: 250px;
  max-height: 380px;
}

.msg {
  margin: 5px 0;
  display: flex;
  flex-direction: column;
}

.msg.user {
  align-items: flex-end;
}

.msg.bot {
  align-items: flex-start;
}

.bubble {
  background: #e9ecef;
  padding: 8px 12px;
  border-radius: 10px;
  max-width: 75%;
  word-wrap: break-word;
}

.msg.user .bubble {
  background: #007bff;
  color: white;
}

.time {
  font-size: 10px;
  color: gray;
  margin-top: 2px;
}

.chat-input {
  display: flex;
  align-items: center;
  border-top: 1px solid #ddd;
  padding: 8px;
  background: #fff;
  flex-shrink: 0;
}

.chat-input input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  outline: none;
  font-size: 14px;
}

.chat-input button {
  margin-left: 8px;
  width: 40px;
  height: 36px;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}

.chat-input button:hover {
  background: #0056b3;
  transform: scale(1.1);
}
#prechat-form {
  padding: 15px;
  text-align: center;
}

#prechat-form input {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
}

#start-chat {
  background: #007bff;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 6px;
  cursor: pointer;
}

#start-chat:hover {
  background: #0056b3;
}
.msg.user {
  text-align: right;
}
.msg.user .bubble {
  background: #0084ff;
  color: #fff;
  display: inline-block;
  border-radius: 15px 15px 0 15px;
  padding: 8px 12px;
}

.msg.bot {
  text-align: left;
}
.msg.bot .bubble {
  background: #e5e5ea;
  color: #000;
  display: inline-block;
  border-radius: 15px 15px 15px 0;
  padding: 8px 12px;
}
.bubble.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
}

.bubble.typing span {
  width: 6px;
  height: 6px;
  background: #ccc;
  border-radius: 50%;
  display: inline-block;
  animation: blink 1.4s infinite both;
}

.bubble.typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.bubble.typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}
.msg.bot.typing .bubble {
  background: #f0f0f0;
  color: #666;
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  display: inline-block;
  animation: blink 1.4s infinite both;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}
.chat-buttons, .chat-objectives {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px;
}

.auto-reply-btn {
  background-color: #6469b0;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer;
}

.auto-reply-btn:hover {
  background-color: #5050a0;
}

.objective-btn {
  background-color: #00a86b;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer;
}

.objective-btn:hover {
  background-color: #008854;
}



