#chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Bubble */
#chatbot-bubble {
  width: 60px;
  height: 60px;
  /* background: #28a745; */
  /* color: #fff; */
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 24px;
  box-shadow: 0 6px 18px rgba(0,0,0,.2);
  transition: transform .5s ease;
}
#chatbot-bubble:hover { transform: scale(1.05); }

/* Window */
#chatbot-window {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 330px;
  height: 480px;
  background: #fff;
  border: 1px solid #e9e9e9;
  /* border-radius: 12px; */
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
  display: none;              /* toggled via JS */
  flex-direction: column;
  /* overflow: hidden; */

  opacity: 0;
  transform: translateY(6px) scale(.98);
  transition: opacity .18s ease, transform .18s ease;
}
#chatbot-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Header */
#chatbot-header {
  background: #2f855a;
  color: #fff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}
#chatbot-header .cb-actions button {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  border-radius: 6px;
}
#chatbot-header .cb-actions button:hover {
  background: rgba(255,255,255,.18);
}

/* Quick chips */
#chatbot-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 6px;
  border-bottom: 1px solid #f0f0f0;
}
.cb-chip {
  background: #f5f5f5;
  border: 1px solid #e9e9e9;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background .15s ease;
}
.cb-chip:hover { background: #eee; }

/* Messages */

.cb-msg { margin: 8px 0; line-height: 1.45; font-size: 14px; }
.cb-msg strong { font-weight: 600; }
.cb-user { text-align: right; }
.cb-bot { text-align: left; }
.cb-msg a { color: #2f855a; text-decoration: none; }
.cb-msg a:hover { text-decoration: underline; }

/* Input */
#chatbot-input-area {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
}
#chatbot-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  outline: none;
  font-size: 14px;
}
#chatbot-input:focus { border-color: #2f855a; }
#chatbot-input-area button {
  background: #28a745;
  border: none;
  color: white;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
}
#chatbot-input-area button:hover { filter: brightness(.95); }


#chatbot-bubble img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}



/* Chat container remains the same */
#chatbot-messages {
  padding: 12px;
  flex: 1;
  overflow-y: auto;
  background: #e5ddd5; /* WhatsApp-like background */
}

/* Common message bubble style */
.cb-msg {
  display: flex;
  margin-bottom: 8px;
  max-width: 80%;
  align-items: flex-end;
}

/* Bot messages - left side */
.cb-bot {
  flex-direction: row;
  align-items: flex-start;
}
.cb-bot .cb-bubble {
  background: #fff;
  color: #000;
  border-radius: 8px;
  padding: 8px 12px;
  margin-left: 6px;
  box-shadow: 0 1px 1px rgba(0,0,0,.2);
}

/* Bot avatar */
.cb-bot .cb-avatar {
  align-self: flex-start;    /* belt-and-suspenders */
  margin-top: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #ccc;
  background-size: cover;
  background-position: center;
}

/* User messages - right side */
.cb-user {
  flex-direction: row-reverse;
  margin-left: auto;
}
.cb-user .cb-bubble {
  background: #dcf8c6;
  color: #000;
  border-radius: 8px;
  padding: 8px 12px;
  margin-right: 6px;
  box-shadow: 0 1px 1px rgba(0,0,0,.2);
}

/* Text inside bubbles */
.cb-bubble strong {
  display: block;
  font-weight: 600;
  margin-bottom: 3px;
}
.cb-bubble a {
  color: #2f855a;
  text-decoration: none;
}
.cb-bubble a:hover {
  text-decoration: underline;
}



/* Narrow screens */
@media (max-width: 420px) {
  #chatbot-window { width: calc(100vw - 24px); height: 70vh; right: 12px; }
}


/* Tooltip above bubble (raised + taller) */
#chatbot-tooltip {
  position: absolute;
  bottom: 70px;  /* lifted above bubble */
  right: 8px;
  background: rgba(34,62,143,1);
  color: white;
  font-weight: bold;
  padding: 12px 14px;
  min-height: 44px;
  line-height: 1.5;
  width: 200px;
  text-align: center;
  border-radius: 14px;
  /* border: 1px solid #ddd; */
  /* box-shadow: 0 2px 8px rgba(0,0,0,.2); */
  display: none;
  z-index: 10001;
}

#chatbot-tooltip::after {
  content: "";
  position: absolute;
  bottom: -10px;     /* moves pointer below tooltip box */
  right: 24px;       /* aligns arrow with chatbot bubble */
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid rgba(34,62,143,1); /* triangle pointing down */
  /* filter: drop-shadow(0 -1px 1px rgba(0,0,0,0.1)); subtle shadow */
}


/* Make bubbles positionable for tails */
.cb-bot .cb-bubble,
.cb-user .cb-bubble {
  position: relative;
}

/* LEFT tail for BOT bubble */
.cb-bot .cb-bubble::before {
  content: "";
  position: absolute;
  top: 10px;          /* adjust to align with your avatar/bubble */
  left: -6px;         /* how far the tail sticks out */
  width: 0;
  height: 0;
  border-style: solid;
  /* triangle pointing left: right-side colored */
  border-width: 6px 8px 6px 0;
  border-color: transparent #ffffff transparent transparent;  /* matches bot bubble bg (#fff) */
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.10));
}

/* RIGHT tail for USER bubble */
.cb-user .cb-bubble::before {
  content: "";
  position: absolute;
  top: 10px;          /* adjust to taste */
  right: -6px;        /* how far the tail sticks out */
  width: 0;
  height: 0;
  border-style: solid;
  /* triangle pointing right: left-side colored */
  border-width: 6px 0 6px 8px;
  border-color: transparent transparent transparent #dcf8c6; /* matches user bubble bg */
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.08));
}

/* Typing indicator (three dots) */
.typing .cb-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;             /* same as bot bubble */
  padding: 12px;
  border-radius: 8px;  /* same as .cb-bot .cb-bubble */
  box-shadow: 0 1px 1px rgba(0,0,0,.2);
}

.typing .dot {
  width: 6px;
  height: 6px;
  background-color: #999;
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}
.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0% { opacity: 0.2; }
  20% { opacity: 1; }
  100% { opacity: 0.2; }
}
