.mcpchat-container {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  position: fixed;
  z-index: 1000;
  font-size: 14px;
}

.position-bottom-right { bottom: 20px; right: 20px; }
.position-bottom-left  { bottom: 20px; left: 20px; }
.position-top-right    { top: 20px; right: 20px; }
.position-top-left     { top: 20px; left: 20px; }

.chat-toggle {
  padding: 12px 20px;
  background: #0078d4;
  color: #fff;
  border-radius: 30px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s ease;
}
.chat-toggle:hover {
  background: #005aab;
}

.chatbox {
  width: 380px;
  min-height: 400px;
  max-height: 90vh;
  max-width: 90vw;
  resize: both;
  overflow: auto;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
}

.chatbox-header {
  background: #002d72;
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
}

.chatbox-settings {
  background: #f5f7fa;
  padding: 10px 14px;
  border-bottom: 1px solid #ddd;
}
.chatbox-settings label {
  font-size: 13px;
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
}
.chatbox-settings input {
  width: 100%;
  padding: 6px 10px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
}

.chatbox-body {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  background: #fefefe;
}

.chat-msg {
  display: flex;
  align-items: flex-start;
  margin-bottom: 12px;
}
.chat-msg.user {
  justify-content: flex-end;
}
.chat-msg.ai {
  justify-content: flex-start;
}

.chat-msg .bubble {
  max-width: 80%;
  padding: 10px;
  background: #f0f4f8;
  border-radius: 8px;
  color: #333;

  /* 🔧 Important for overflow issues */
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  overflow-x: auto;
  box-sizing: border-box;
}
.chat-msg.user .bubble {
  background: #d3e3ff;
}
.chat-msg strong {
  font-size: 12px;
  display: block;
  margin-bottom: 3px;
  color: #888;
}

/* Markdown blocks fix */
.chat-msg .bubble pre,
.chat-msg .bubble code {
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  background: #eaeaea;
  padding: 6px;
  border-radius: 6px;
  font-size: 13px;
  display: block;
  box-sizing: border-box;
}

.chatbox-input {
  display: flex;
  border-top: 1px solid #eee;
  background: #fff;
}
.chatbox-input input {
  flex: 1;
  padding: 12px;
  border: none;
  outline: none;
  font-size: 14px;
}
.chatbox-input button {
  padding: 0 14px;
  background-color: #0078d4;
  color: white;
  border: none;
  border-left: 1px solid #ddd;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s ease;
}
.chatbox-input button:hover {
  background-color: #005aab;
}

.chat-msg.error {
  text-align: center;
  font-weight: bold;
  color: #d32f2f;
  background: #ffcdd2;
  padding: 8px 12px;
  border-radius: 6px;
  margin: 10px 0;
}

.bot-typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #f0f4f8;
  padding: 6px 12px;
  border-radius: 20px;
  animation: fadeIn 0.5s ease-in-out;
}
.bot-typing-bubble .dot {
  width: 6px;
  height: 6px;
  background-color: #888;
  border-radius: 50%;
  animation: bounce 1.3s infinite ease-in-out;
}
.bot-typing-bubble .dot:nth-child(2) {
  animation-delay: 0.2s;
}
.bot-typing-bubble .dot:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Avatar sizes */
.avatar {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  margin-right: 6px;
  object-fit: contain;
}
.chatbox-header .avatar {
  width: 20px;
  height: 20px;
  margin-right: 8px;
}

/* Clear button */
.clear-btn {
  margin-top: 6px;
  font-size: 12px;
  color: #c00;
  background: none;
  border: none;
  cursor: pointer;
}
.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.icon-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
}
