/* ===================================================
   Demo page styling (delete this block on your real site)
=================================================== */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f4f2;
  color: #1a1a1a;
}

.demo-page {
  max-width: 640px;
  margin: 80px auto;
  padding: 0 24px;
}

/* ===================================================
   Chatbot widget — root container, fixed to viewport
=================================================== */
#chatbot-widget {
  position: fixed;
  bottom: 1px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------------------------------------------------
   Minimized icon
--------------------------------------------------- */
#chatbot-toggle {
  height: 52px;
  padding: 0 22px 0 20px;
  border-radius: 999px 0 0 999px;
  border: none;
  background: #e91e4d;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: filter 0.15s ease;
  margin-right: -24px; /* cancels #chatbot-widget's right offset so the bar sits flush against the screen edge */
}

#chatbot-toggle:hover {
  filter: brightness(1.08);
}

#chatbot-toggle i {
  font-size: 20px;
  line-height: 1;
}

#chatbot-toggle-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* When the chat is open, collapse the bar back into a round close button */
#chatbot-toggle.is-open {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
}

#chatbot-toggle.is-open #chatbot-toggle-label {
  display: none;
}

/* ---------------------------------------------------
   Chat window
--------------------------------------------------- */
#chatbot-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 340px;
  max-width: calc(100vw - 48px);
  height: 480px;
  max-height: calc(100vh - 140px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatbot-pop-in 0.18s ease-out;
}

/* Same ID specificity as the rule above, so this wins whenever
   the [hidden] attribute is present — otherwise #chatbot-window's
   own "display: flex" beats the browser's default [hidden] rule
   and the window never actually hides. */
#chatbot-window[hidden] {
  display: none;
}

@keyframes chatbot-pop-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header */
#chatbot-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid blue;
  background: blue;
  flex-shrink: 0;
}

.chatbot-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e6f1fb;
  color: #185fa5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-avatar i {
  font-size: 15px;
}

.chatbot-header-text {
  flex: 1;
  min-width: 0;
}

.chatbot-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.chatbot-subtitle {
  margin: 0;
  font-size: 12px;
  color: #ffffff;
}

/* Message list */
#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Footer */
#chatbot-footer {
  padding: 8px 16px;
  border-top: 1px solid #eeeeee;
  background: #fafafa;
  flex-shrink: 0;
}

#chatbot-footer p {
  margin: 0;
  font-size: 11px;
  color: #aaaaaa;
  text-align: center;
}

/* ---------------------------------------------------
   Chat bubbles
--------------------------------------------------- */
.msg {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  animation: msg-in 0.15s ease-out;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-bot {
  align-self: flex-start;
  background: #f1f1ef;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

.msg-user {
  align-self: flex-end;
  background: #e6f1fb;
  color: #0c447c;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.msg-typing {
  align-self: flex-start;
  background: #f1f1ef;
  border-bottom-left-radius: 4px;
  padding: 12px 14px;
  display: flex;
  gap: 4px;
}

.msg-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b4b2a9;
  animation: typing-bounce 1.1s infinite ease-in-out;
}

.msg-typing span:nth-child(2) { animation-delay: 0.15s; }
.msg-typing span:nth-child(3) { animation-delay: 0.3s; }

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

/* ---------------------------------------------------
   Option buttons (the clickable menu choices)
--------------------------------------------------- */
.msg-options {
  align-self: flex-start;
  width: 88%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 8px;
  cursor: pointer;
  color: #1a1a1a;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.option-btn:hover {
  background: #f7f7f5;
  border-color: #bbbbbb;
}

.option-btn:active {
  transform: scale(0.99);
}

.option-btn.back {
  color: #888888;
}

/* Link card (final answer with a URL) */
.msg-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 9px 11px;
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
  color: #185fa5;
}

.msg-link:hover {
  border-color: #185fa5;
}

/* Name input row */
.msg-input-row {
  align-self: stretch;
  display: flex;
  gap: 8px;
}

.msg-input-row input {
  flex: 1;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  border: 1px solid #dddddd;
  border-radius: 8px;
}

.msg-input-row input:focus {
  outline: none;
  border-color: #185fa5;
}

.msg-input-row button {
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: inherit;
  background: #1a1a1a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.msg-input-row button.skip-btn {
  background: none;
  color: #888888;
  border: 1px solid #dddddd;
}

/* Small screens: full-width widget */
@media (max-width: 420px) {
  #chatbot-widget {
    bottom: 16px;
    right: 16px;
  }
  #chatbot-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 120px);
  }
}