/* Cogentix AI Chatbot v2 */

:root {
  --cx-chat-green: #358127;
  --cx-chat-green-dark: #28651d;
  --cx-chat-purple: #120c49;
  --cx-chat-text: #1c1c1c;
  --cx-chat-muted: #6d7280;
  --cx-chat-border: #e6e8ec;
  --cx-chat-bg: #f7f9fb;
  --cx-chat-white: #fff;
}

.cx-chatbot-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cx-chat-green), var(--cx-chat-purple));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99999;
  box-shadow: 0 12px 30px rgba(18, 12, 73, .25);
  transition: transform .2s ease, box-shadow .2s ease;
}

.cx-chatbot-launcher:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 16px 36px rgba(18, 12, 73, .32);
}

.cx-chatbot-launcher svg {
  width: 29px;
  height: 29px;
  fill: currentColor;
}

.cx-chatbot-launcher .cx-chat-close-icon { display: none; }
.cx-chatbot-launcher.is-open .cx-chat-open-icon { display: none; }
.cx-chatbot-launcher.is-open .cx-chat-close-icon { display: block; }

.cx-chatbot {
  position: fixed;
  right: 24px;
  bottom: 98px;
  width: min(410px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 125px));
  min-height: 470px;
  background: var(--cx-chat-white);
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 20px;
  overflow: hidden;
  z-index: 99998;
  display: flex;
  flex-direction: column;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}

.cx-chatbot.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.cx-chatbot-header {
  padding: 17px 18px;
  background: linear-gradient(135deg, var(--cx-chat-green), var(--cx-chat-purple));
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cx-chatbot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: rgba(255,255,255,.16);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.cx-chatbot-avatar svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.cx-chatbot-title {
  min-width: 0;
  flex: 1;
}

.cx-chatbot-title strong {
  display: block;
  font-size: 15px;
  line-height: 1.2;
}

.cx-chatbot-title span {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  opacity: .9;
}

.cx-chatbot-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7dff75;
}

.cx-chatbot-close {
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 22px;
}

.cx-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 15px;
  background: var(--cx-chat-bg);
  scroll-behavior: smooth;
}

.cx-chatbot-message {
  display: flex;
  margin-bottom: 12px;
}

.cx-chatbot-message.user {
  justify-content: flex-end;
}

.cx-chatbot-bubble {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 15px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--cx-chat-text);
  background: #fff;
  border: 1px solid var(--cx-chat-border);
  overflow-wrap: anywhere;
}

.cx-chatbot-message.user .cx-chatbot-bubble {
  color: #fff;
  background: var(--cx-chat-green);
  border-color: var(--cx-chat-green);
  border-bottom-right-radius: 5px;
}

.cx-chatbot-message.bot .cx-chatbot-bubble {
  border-bottom-left-radius: 5px;
}

.cx-chatbot-time {
  display: block;
  margin-top: 5px;
  font-size: 9px;
  opacity: .55;
}

.cx-chatbot-suggestions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
}

.cx-chatbot-suggestion {
  border: 1px solid #cfd9d0;
  background: #fff;
  color: var(--cx-chat-green-dark);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 11px;
  cursor: pointer;
}

.cx-chatbot-suggestion:hover {
  background: #eef7ec;
  border-color: var(--cx-chat-green);
}

.cx-chatbot-sources {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.cx-chatbot-source {
  display: block;
  text-decoration: none;
  color: var(--cx-chat-green-dark);
  background: #f3f8f2;
  border: 1px solid #d9e8d7;
  border-radius: 9px;
  padding: 7px 9px;
  font-size: 10px;
  line-height: 1.3;
}

.cx-chatbot-source:hover {
  border-color: var(--cx-chat-green);
}

.cx-chatbot-source small {
  display: block;
  color: var(--cx-chat-muted);
  margin-top: 2px;
}

.cx-chatbot-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--cx-chat-border);
  border-radius: 15px;
  border-bottom-left-radius: 5px;
}

.cx-chatbot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8b929b;
  animation: cxTyping 1.1s infinite ease-in-out;
}

.cx-chatbot-typing span:nth-child(2) { animation-delay: .15s; }
.cx-chatbot-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes cxTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.cx-chatbot-composer {
  padding: 10px;
  background: #fff;
  border-top: 1px solid var(--cx-chat-border);
}

.cx-chatbot-form {
  display: flex;
  gap: 7px;
  align-items: flex-end;
}

.cx-chatbot-input {
  flex: 1;
  width: 100%;
  min-height: 42px;
  max-height: 110px;
  resize: none;
  border: 1px solid #dfe3e8;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: var(--cx-chat-text);
}

.cx-chatbot-input:focus {
  border-color: var(--cx-chat-green);
  box-shadow: 0 0 0 3px rgba(53,129,39,.10);
}

.cx-chatbot-send {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--cx-chat-green);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cx-chatbot-send:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.cx-chatbot-send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.cx-chatbot-note {
  margin: 6px 3px 0;
  font-size: 9px;
  color: var(--cx-chat-muted);
  text-align: center;
}

@media (max-width: 575px) {
  .cx-chatbot-launcher {
    width: 56px;
    height: 56px;
    right: 16px;
    bottom: 16px;
  }

  .cx-chatbot {
    right: 10px;
    bottom: 82px;
    width: calc(100vw - 20px);
    height: min(620px, calc(100vh - 100px));
    min-height: 430px;
    border-radius: 17px;
  }
}
