/* ===================== KARP CHATBOT WIDGET ===================== */
:root {
  --kbot-grad: linear-gradient(135deg, #5B4FE9 0%, #8A5CF6 55%, #B368F0 100%);
  --kbot-bg: #ffffff;
  --kbot-bg-soft: #f6f5ff;
  --kbot-border: #e7e4fb;
  --kbot-text: #1f1d2b;
  --kbot-text-soft: #6b6880;
  --kbot-bot-bubble: #f1effc;
  --kbot-user-bubble: linear-gradient(135deg, #5B4FE9 0%, #8A5CF6 100%);
  --kbot-shadow: 0 18px 45px -12px rgba(91, 79, 233, 0.35);
}

/* Floating toggle button — stacked above the WhatsApp button */
#kbotToggle {
  position: fixed;
  right: 24px;
  bottom: 80px;
  /* sits above #whatsappBtn (usually bottom:24px) */
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--kbot-grad);
  color: #fff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--kbot-shadow);
  z-index: 999;
  transition: transform .25s ease, box-shadow .25s ease;
}

#kbotToggle:hover {
  transform: translateY(-3px) scale(1.05);
}

#kbotToggle .kbot-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
}

/* Chat panel */
#kbotPanel {
  position: fixed;
  right: 24px;
  bottom: 146px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(94vh - 200px);
  background: var(--kbot-bg);
  border-radius: 20px;
  box-shadow: var(--kbot-shadow);
  border: 1px solid var(--kbot-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 999;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

#kbotPanel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.kbot-header {
  background: var(--kbot-grad);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.kbot-header .kbot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.kbot-header .kbot-title {
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.2;
  font-family: 'Poppins', sans-serif;
}

.kbot-header .kbot-sub {
  font-size: .75rem;
  opacity: .85;
  display: flex;
  align-items: center;
  gap: 5px;
}

.kbot-header .kbot-sub::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}

.kbot-close {
  margin-left: auto;
  background: rgba(255, 255, 255, .18);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kbot-close:hover {
  background: rgba(255, 255, 255, .3);
}

.kbot-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--kbot-bg-soft);
}

.kbot-body::-webkit-scrollbar {
  width: 5px;
}

.kbot-body::-webkit-scrollbar-thumb {
  background: var(--kbot-border);
  border-radius: 10px;
}

.kbot-msg {
  max-width: 84%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: .87rem;
  line-height: 1.45;
  animation: kbotIn .18s ease;
}

@keyframes kbotIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kbot-msg.bot {
  background: var(--kbot-bot-bubble);
  color: var(--kbot-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.kbot-msg.user {
  background: var(--kbot-user-bubble);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.kbot-msg a {
  color: inherit;
  text-decoration: underline;
}

.kbot-typing {
  align-self: flex-start;
  background: var(--kbot-bot-bubble);
  padding: 12px 14px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 4px;
}

.kbot-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--kbot-text-soft);
  animation: kbotBounce 1.1s infinite ease-in-out;
}

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

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

@keyframes kbotBounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: .5;
  }

  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.kbot-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  background: var(--kbot-bg-soft);
}

.kbot-chip {
  border: 1px solid var(--kbot-border);
  background: #fff;
  color: #5B4FE9;
  font-size: .76rem;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}

.kbot-chip:hover {
  background: #5B4FE9;
  color: #fff;
}

.kbot-inputbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--kbot-border);
  background: var(--kbot-bg);
}

.kbot-inputbar input {
  flex: 1;
  border: 1px solid var(--kbot-border);
  background: var(--kbot-bg-soft);
  border-radius: 999px;
  padding: 10px 15px;
  font-size: .87rem;
  outline: none;
  color: var(--kbot-text);
  font-family: 'Inter', sans-serif;
}

.kbot-inputbar input:focus {
  border-color: #8A5CF6;
}

.kbot-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--kbot-grad);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
}

.kbot-send:hover {
  filter: brightness(1.05);
}

@media (max-width: 480px) {
  #kbotPanel {
    right: 16px;
    left: 16px;
    width: auto;
    bottom: 158px;
  }

  #kbotToggle {
    right: 16px;
    bottom: 90px;
  }
}