/* ─── Chatbot Widget ─────────────────────────────────────── */
#chatbot-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  font-family: 'Inter', system-ui, sans-serif;
}

/* Toggle button */
#chat-toggle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1E4FAF, #1A3F8F);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 20px rgba(30,79,175,.45);
  transition: transform .2s, box-shadow .2s;
  position: relative;
}
#chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(30,79,175,.55);
}

#chat-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: #C8102E;
  border-radius: 50%;
  font-size: .68rem;
  font-weight: 700;
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

/* Chat window */
#chat-window {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 360px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.96);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  max-height: 520px;
}
#chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
#chat-header {
  background: linear-gradient(135deg, #1E4FAF, #1A3F8F);
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}
#chat-header-info { display: flex; align-items: center; gap: .75rem; }

#chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 800;
  border: 2px solid rgba(255,255,255,.35);
}

#chat-name   { font-size: .92rem; font-weight: 700; }
#chat-status {
  font-size: .73rem;
  color: rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  gap: .3rem;
  margin-top: .1rem;
}
.status-dot {
  width: 7px;
  height: 7px;
  background: #4ADE80;
  border-radius: 50%;
  display: inline-block;
}

#chat-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  padding: .2rem;
  border-radius: 4px;
  transition: color .2s;
  display: flex;
}
#chat-close-btn:hover { color: #fff; }

/* Messages */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  background: #F7F8FC;
  min-height: 220px;
  max-height: 280px;
  scroll-behavior: smooth;
}
#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 4px; }

.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.bot  { justify-content: flex-start; }

.chat-bubble {
  max-width: 82%;
  padding: .65rem .9rem;
  border-radius: 12px;
  font-size: .84rem;
  line-height: 1.55;
}
.chat-msg.user .chat-bubble {
  background: #1E4FAF;
  color: #fff;
  border-bottom-right-radius: 3px;
}
.chat-msg.bot .chat-bubble {
  background: #fff;
  color: #1A1F36;
  border-bottom-left-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.chat-msg.bot .chat-bubble a {
  color: #1E4FAF;
  font-weight: 600;
  text-decoration: underline;
}

/* Typing indicator */
.typing {
  display: flex !important;
  align-items: center;
  gap: 4px;
  padding: .65rem .9rem !important;
}
.typing span {
  width: 7px;
  height: 7px;
  background: #9CA3AF;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-6px); }
}

/* Quick replies */
#chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: .6rem .9rem;
  background: #F7F8FC;
  border-top: 1px solid #E5E7EB;
}
.quick-reply-btn {
  padding: .35rem .75rem;
  border: 1.5px solid #1E4FAF;
  border-radius: 100px;
  background: #fff;
  color: #1E4FAF;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s;
  font-family: inherit;
}
.quick-reply-btn:hover { background: #1E4FAF; color: #fff; }

/* Input area */
#chat-input-area {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem 1rem;
  border-top: 1px solid #E5E7EB;
  background: #fff;
}
#chat-input {
  flex: 1;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  padding: .55rem .85rem;
  font-size: .85rem;
  font-family: inherit;
  color: #1A1F36;
  outline: none;
  transition: border-color .2s;
}
#chat-input:focus { border-color: #1E4FAF; }

#chat-send {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #1E4FAF;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s;
}
#chat-send:hover { background: #1A3F8F; }

/* Mobile */
@media (max-width: 480px) {
  #chatbot-widget { bottom: 1rem; right: 1rem; }
  #chat-window { width: calc(100vw - 2rem); right: 0; }
}
