#kdv-widget-button {
  position: fixed;
  right: 25px;
  bottom: 25px;
  background: linear-gradient(180deg, rgb(227, 0, 67) 3.6%, rgb(255, 156, 101) 102.440002%) !important;
  color: white !important;
  border: none !important;
  padding: 14px 20px;
  border-radius: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
  box-shadow: none !important;
  z-index: 99999;
  transition: all 0.3s ease;
  width: auto;
  min-width: auto;
}

#kdv-widget-button:hover {
  background: linear-gradient(180deg, rgb(200, 0, 50) 3.6%, rgb(230, 140, 90) 102.440002%) !important;
  box-shadow: none !important;
  transform: translateY(-2px);
}

/* Button when chat is open - becomes circular */
#kdv-widget-button.open {
  border-radius: 50%;
  width: 56px;
  height: 56px;
  padding: 0;
  gap: 0;
  background: linear-gradient(180deg, rgb(227, 0, 67) 3.6%, rgb(255, 156, 101) 102.440002%) !important;
}

/* Hide text when button is open (circular) */
#kdv-widget-button.open .button-text {
  display: none;
}

/* Show only icon when open */
#kdv-widget-button.open img {
  margin: 0;
}

#kdv-widget-button svg,
#kdv-widget-button img {
  width: 20px;
  height: auto;
  display: block;
  flex-shrink: 0;
}

#kdv-widget-button svg {
  max-height: 20px;
}

#kdv-widget-panel {
  position: fixed;
  right: 25px;
  bottom: 85px;
  width: 420px;
  height: 600px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(0,0,0,.25);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
}

#kdv-widget-panel.open {
  display: flex;
}

.kdv-header {
  background: linear-gradient(180deg, rgb(227, 0, 67) 3.6%, rgb(255, 156, 101) 102.440002%) !important;
  color: white !important;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: none;
}

.kdv-header .title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white !important;
}

.kdv-header .title strong {
  color: white !important;
}

.kdv-header .title svg,
.kdv-header .title img {
  width: 24px;
  height: auto;
  display: block;
  flex-shrink: 0;
}

.kdv-header .title svg {
  max-height: 24px;
}

.kdv-header .close {
  background: transparent;
  border: none;
  color: white !important;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
  margin: 0;
}

.kdv-header .close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.kdv-header .close:active {
  background: rgba(255, 255, 255, 0.3);
}

.kdv-log {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  background: #f6f7f8;
  display: flex;
  flex-direction: column;
}

.u {
  align-self: flex-end;
  background: rgb(0, 102, 153);
  color: white;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 10px;
  width: fit-content;
  max-width: 65%;
  word-wrap: break-word;
  line-height: 1.5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Bot message container */
.bot-message {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.bot-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.bot-header .bot-avatar {
  width: 20px;
  height: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bot-header .bot-avatar svg,
.bot-header .bot-avatar img {
  width: 20px;
  height: auto;
  display: block;
}

.bot-header .bot-avatar svg {
  max-height: 20px;
}

.bot-header .bot-name {
  font-size: 13px;
  font-weight: 600;
  color: rgb(0, 102, 153);
}

/* Bot message bubble */
.b {
  margin-right: auto;
  background: white;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid #ddd;
  max-width: 75%;
  line-height: 1.5;
  color: rgb(0, 40, 70);
}

/* Lists in bot messages */
.b ul,
.b ol {
  margin: 8px 0;
  padding-left: 24px;
}

.b ul {
  list-style-type: disc;
}

.b ol {
  list-style-type: decimal;
}

.b li {
  margin: 4px 0;
  line-height: 1.6;
}

/* Address formatting */
.b address {
  font-style: normal;
  line-height: 1.8;
  margin: 8px 0;
  display: block;
  white-space: pre-line;
}

.bot-message.welcome .b {
  background: #eef5f6;
  border-color: rgb(0, 102, 153);
  border-width: 2px;
}

/* Links in bot messages */
.b a {
  color: rgb(0, 102, 153);
  text-decoration: underline;
  transition: color 0.2s ease;
}

.b a:hover {
  color: rgb(0, 80, 120);
  text-decoration: underline;
}

/* Sources section */
.b .sources {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  font-size: 12px;
}

.b .sources strong {
  display: block;
  margin-bottom: 6px;
  color: #333;
}

.b .sources ul {
  margin: 0;
  padding-left: 20px;
  list-style-type: disc;
}

.b .sources li {
  margin: 4px 0;
}

.b .sources a {
  color: rgb(0, 102, 153);
  text-decoration: none;
}

.b .sources a:hover {
  color: rgb(0, 80, 120);
  text-decoration: underline;
}

/* Typing indicator */
.typing-indicator {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.typing-dots {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 12px;
  margin-top: 6px;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgb(0, 102, 153);
  animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

.kdv-inputbar {
  display: flex;
  border-top: 1px solid #ddd;
  padding: 10px;
  gap: 10px;
}

.kdv-inputbar input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.kdv-inputbar button {
  background: linear-gradient(180deg, rgb(227, 0, 67) 3.6%, rgb(255, 156, 101) 102.440002%) !important;
  border: none;
  color: white !important;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.kdv-inputbar button:hover {
  background: linear-gradient(180deg, rgb(200, 0, 50) 3.6%, rgb(230, 140, 90) 102.440002%) !important;
}

.kdv-footer {
  text-align: center;
  font-size: 10px;
  padding: 6px;
  color: #888;
  background: #fafafa;
  border-top: 1px solid #eee;
}
