/* Root: fixed container */
.ai-chat-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99990;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  width: 360px;
  pointer-events: none;
}

/* Chat bubble — properly positioned just above the bottom edge */
.ai-chat-bubble {
  position: absolute;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 18px 46px rgba(12, 12, 12, 0.14);
  background: #0b76ff;
  pointer-events: auto;
  bottom: 0;        /* use bottom instead of top */
  right: 12px;      /* aligns neatly with window edge */
  z-index: 99991;
  transition: transform .18s ease, right .12s ease;
}

/* When open, place bubble visually behind window */
.ai-chat-bubble.ai-bubble-behind {
  z-index: 99988;
  transform: translateY(-6px) scale(.98);
}

/* Chat window */
.ai-chat-window {
  display: none;
  pointer-events: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.15);
  overflow: hidden;
  width: 360px;
  max-width: calc(100vw - 24px);
  height: 520px;
  flex-direction: column;
  z-index: 99992;
  position: absolute;
  bottom: 80px; /* sits nicely above the bubble */
  right: 0;
}
.ai-chat-window[aria-hidden="false"] {
  display: flex;
}

/* Header */
.ai-chat-header {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid #f1f1f1;
}
.ai-chat-header strong {
  font-size: 20px;
  color: #213547;
}

/* Body & messages */
.ai-chat-body {
  padding: 18px;
  flex: 1;
  overflow: auto;
  background: #fbfbfb;
}
.ai-chat-message {
  margin-bottom: 16px;
  clear: both;
}
.ai-chat-message .msg {
  display: inline-block;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 75%;
  line-height: 1.4;
}
.ai-chat-message.bot .msg {
  background: #fff;
  border: 1px solid #eee;
  color: #111;
  float: left;
}
.ai-chat-message.user {
  text-align: right;
}
.ai-chat-message.user .msg {
  background: #0b76ff;
  color: #fff;
  float: right;
}

/* Footer / inputs */
.ai-chat-footer {
  padding: 12px;
  border-top: 1px solid #eee;
  background: #fff;
}
.ai-lead-container form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-lead-container input,
#ai-input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e6e6e6;
  font-size: 15px;
}
#ai-input {
  padding: 12px 14px;
}
#ai-send {
  padding: 10px 14px;
  border-radius: 10px;
  background: #0b76ff;
  color: #fff;
  border: none;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 480px) {
  .ai-chat-widget {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
  }
  .ai-chat-bubble {
    right: 18px;
    bottom: 0;
  }
  .ai-chat-window {
    width: 100%;
    height: 70vh;
    border-radius: 12px;
    bottom: 80px;
  }
}
