/* Charlie Chatbot widget - first-party replacement for the old VectorShift iframe */

#chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: #007bff;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  z-index: 10000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

#chat-window {
  display: none;
  flex-direction: column;
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 380px;
  height: 600px;
  border: none;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  font-family: "Open Sans", sans-serif;
}

#chat-window.open {
  display: flex;
}

#chat-titlebar {
  height: 44px;
  flex: 0 0 auto;
  background: #007bff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 16px;
  font-weight: 600;
}

#chat-titlebar button {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

#chat-subheader {
  flex: 0 0 auto;
  background: #f4f7fb;
  color: #003366;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid #e2e8f0;
}

#chat-subheader .chat-controls {
  display: flex;
  gap: 6px;
}

#chat-subheader button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: #e2e8f0;
  color: #003366;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chat-subheader button:hover {
  background: #d3dce6;
}

#chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-msg {
  max-width: 82%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-msg.bot {
  align-self: flex-start;
}

.chat-msg.visitor {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-msg-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #667085;
}

.chat-msg.visitor .chat-msg-label {
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex: 0 0 auto;
}

.chat-avatar.bot {
  background: #e2e8f0;
}

.chat-avatar.visitor {
  background: #007bff;
  color: #fff;
  font-weight: 700;
}

.chat-bubble {
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg.bot .chat-bubble {
  background: #f0f2f5;
  color: #1d2939;
  border-top-left-radius: 4px;
}

.chat-msg.visitor .chat-bubble {
  background: #eaf3ff;
  color: #003366;
  border-top-right-radius: 4px;
}

.chat-msg.bot .chat-bubble a {
  color: #0056b3;
  font-weight: 600;
}

#chat-typing {
  display: none;
  align-self: flex-start;
  font-size: 13px;
  color: #667085;
  padding-left: 4px;
}

#chat-typing.visible {
  display: block;
}

#chat-input-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

#chat-input-pill {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d3dce6;
  border-radius: 999px;
  padding: 8px 14px;
  background: #f9fafb;
}

#chat-mic-icon {
  color: #98a2b3;
  font-size: 15px;
}

#chat-input {
  flex: 1 1 auto;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  font-family: inherit;
}

#chat-send {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #007bff;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chat-send:disabled,
#chat-input:disabled,
#chat-input-pill.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media screen and (max-width: 600px) {
  #chat-window {
    width: 94vw;
    height: 78vh;
    right: 3vw;
    bottom: 85px;
    border-radius: 10px;
  }

  #chat-toggle {
    bottom: 18px !important;
    right: 18px !important;
  }
}
