/* CDKL floating chat widget */
#cdkl-chat-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#cdkl-chat-root.rtl {
  right: auto;
  left: 20px;
}

.cdkl-chat-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0056b3;
  color: #fff;
  border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, background .15s;
}
.cdkl-chat-btn:hover { background: #004494; transform: scale(1.05); }
.cdkl-chat-btn svg { width: 26px; height: 26px; }

.cdkl-chat-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 100px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transition: opacity .2s, transform .2s;
}
#cdkl-chat-root.rtl .cdkl-chat-panel { right: auto; left: 0; }
.cdkl-chat-panel.open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }

.cdkl-chat-header {
  background: #0056b3;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cdkl-chat-header strong { font-size: 15px; }
.cdkl-chat-header small { display: block; opacity: .8; font-size: 11px; font-weight: 400; }
.cdkl-chat-close {
  background: none; border: none; color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}

.cdkl-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f4f6f8;
}
.cdkl-chat-msg {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}
.cdkl-chat-msg.user { align-items: flex-end; }
.cdkl-chat-msg.bot { align-items: flex-start; }

.cdkl-chat-bubble {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.cdkl-chat-msg.user .cdkl-chat-bubble {
  background: #0056b3;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.cdkl-chat-msg.bot .cdkl-chat-bubble {
  background: #fff;
  color: #222;
  border: 1px solid #e1e4e8;
  border-bottom-left-radius: 4px;
}

.cdkl-chat-sources {
  margin-top: 6px;
  font-size: 11px;
  color: #555;
  max-width: 86%;
}
.cdkl-chat-sources summary { cursor: pointer; outline: none; }
.cdkl-chat-sources ul { margin: 6px 0 0; padding-left: 16px; }
.cdkl-chat-sources li { margin-bottom: 4px; }

.cdkl-chat-input-area {
  display: flex;
  padding: 12px;
  border-top: 1px solid #e1e4e8;
  background: #fff;
  gap: 8px;
}
.cdkl-chat-input {
  flex: 1;
  border: 1px solid #d0d7de;
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 14px;
  resize: none;
  outline: none;
  min-height: 20px;
  max-height: 100px;
  font-family: inherit;
}
.cdkl-chat-input:focus { border-color: #0056b3; }
.cdkl-chat-send {
  background: #0056b3; color: #fff; border: none; border-radius: 50%;
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.cdkl-chat-send:hover { background: #004494; }
.cdkl-chat-send:disabled { background: #9fb6d3; cursor: not-allowed; }
.cdkl-chat-send svg { width: 18px; height: 18px; }

.cdkl-chat-typing {
  display: inline-flex; gap: 4px; padding: 8px 12px;
  background: #fff; border: 1px solid #e1e4e8; border-radius: 14px;
}
.cdkl-chat-typing span {
  width: 6px; height: 6px; background: #999; border-radius: 50%;
  animation: cdkl-bounce 1.2s infinite ease-in-out;
}
.cdkl-chat-typing span:nth-child(2) { animation-delay: .2s; }
.cdkl-chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes cdkl-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
}

@media (max-width: 420px) {
  .cdkl-chat-panel { width: calc(100vw - 32px); height: calc(100vh - 100px); }
  #cdkl-chat-root { right: 12px; bottom: 12px; }
  #cdkl-chat-root.rtl { left: 12px; }
}
