/* ---------- Floating toggle ---------- */
#chat-toggle {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: #4946ec;
  border-radius: 100px;
  padding: 6px 12px 6px 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  z-index: 10000;
  user-select: none;
  transition:transform .15s ease, box-shadow .15s ease;
}
/* ---------- Mobile view: show only the avatar ---------- */
@media (max-width: 575px) {
  #chat-toggle {
    padding: 2px;            
    border-radius: 50%;    
    gap: 0;                 
  }
   #chat-toggle .toggle-avatar {
    width: 50px;           
    height: 50px;
  }
  #chat-toggle .toggle-name {
    display: none;           
  }
}
#chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.18),
    0 12px 24px rgba(0, 0, 0, 0.12);
}
.toggle-avatar-wrapper { position: relative; }
.toggle-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
}
.online-dot{
  position: absolute;
  bottom: 0; right: 0;
  width: 9.5px; height: 9.5px;
  background:#00cc59;
  border:2px solid #fff;
  border-radius:50%;
}
.toggle-name{
  font-weight:600;
  color:#fff;
  font-family:'Segoe UI',sans-serif;
  font-size:14px;
}

.chatbot{
  position: fixed;
  bottom:100px;
  right:16px;
  width:320px;
  height: 400px;  
  background:#f3e8ff;
  border-radius:12px;
  box-shadow:0 0 15px rgba(0,0,0,.15);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  font-family:'Segoe UI',sans-serif;
  z-index: 9999;
}

/* Header */
.chat-header{
  background:#4946ec;
  color:#fff;
  padding:10px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.header-left{
  display:flex;
  align-items:center;
  gap:10px;
}
.header-avatar{
  width:38px;height:38px;
  border-radius:50%;
  object-fit:cover;
}
.header-name{font-weight:600;font-size:15px;line-height:1;}
.header-role{font-size:12px;opacity:.8;margin-top:2px;}

.header-actions button{
  background:none;
  border:none;
  color:#fff;
  font-size:18px;
  font-family:'Segoe UI',sans-serif;
  cursor:pointer;
  padding:4px 6px;
}
.header-actions button:hover{opacity:.8}

/* Body */
.chat-body {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #ffffff;  /* white body */
}

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

/* bot bubble */
.bot-msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  
  /* light gray background for contrast on white */
  background-color: #f0f0f0;
  color: #333333;
  
  /* subtle shadow for “lift” */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* user bubble */
.user-msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  
  /* brand‐accent blue */
  background-color: #4946ec;
  color: #ffffff;
  
  /* same subtle shadow */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* Input */
.chat-input{display:flex;border-top:1px solid #ccc;}
.chat-input input{
  flex:1;border:none;padding:10px;font-size:14px;outline:none;
}
.chat-input button{
  background:#4946ec;color:#fff;border:none;
  padding:0 16px;font-size:18px;cursor:pointer;
}
.chat-input button:hover{background:#6462ee}

#sendBtn:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

.typing-bubble {
  display: inline-flex;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 12px;  
  background: #f0f0f0;        
}

.typing-bubble .dot {
  width: 6px;               
  height: 6px;
  border-radius: 50%;
  background: #333333;     
  animation: typing-bounce 1s infinite ease-in-out both;
}

.typing-bubble .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-bubble .dot:nth-child(3) { animation-delay: 0.4s; }

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