/* ── Chatbot Widget ─────────────────────────────────────────── */

#chatbot-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #1d2957;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: transform 0.2s, background 0.2s;
}
#chatbot-toggle:hover {
  background: #263580;
  transform: scale(1.08);
}
#chatbot-toggle svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}
#chatbot-toggle .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #e74c3c;
  color: #fff;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  font-size: 9px;
  display: none;
  align-items: center;
  justify-content: center;
}

/* ── Chat Window ────────────────────────────────────────────── */

#chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 360px;
  max-height: 520px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), opacity 0.25s;
}
#chatbot-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
#chatbot-header {
  background: #1d2957;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#chatbot-header .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #263580;
  display: flex;
  align-items: center;
  justify-content: center;
}
#chatbot-header .avatar svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}
#chatbot-header .info {
  flex: 1;
}
#chatbot-header .name {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}
#chatbot-header .status {
  font-size: 11px;
  opacity: 0.75;
  margin: 0;
}
#chatbot-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  opacity: 0.8;
}
#chatbot-close:hover { opacity: 1; }

/* Messages */
#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f5f6fa;
}
#chatbot-messages::-webkit-scrollbar { width: 4px; }
#chatbot-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}
.msg.bot {
  background: #fff;
  color: #222;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.msg.user {
  background: #1d2957;
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Typing indicator */
.typing-dots {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
}
.typing-dots span {
  width: 7px;
  height: 7px;
  background: #aaa;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-6px); }
}

/* Input */
#chatbot-input-area {
  display: flex;
  padding: 10px 12px;
  gap: 8px;
  border-top: 1px solid #eee;
  background: #fff;
  flex-shrink: 0;
}
#chatbot-input {
  flex: 1;
  border: 1.5px solid #dde0f0;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
  resize: none;
  font-family: inherit;
  transition: border 0.2s;
  direction: auto;
}
#chatbot-input:focus { border-color: #1d2957; }
#chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1d2957;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
  align-self: flex-end;
}
#chatbot-send:hover { background: #263580; }
#chatbot-send svg { width: 18px; height: 18px; fill: #fff; }
#chatbot-send:disabled { background: #aaa; cursor: not-allowed; }

/* Mobile */
@media (max-width: 480px) {
  #chatbot-window {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 90px;
  }
}
