/* ========= Chat Widget Styles ========= */
#ai-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a6dff, #0d4dbd);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(26,109,255,0.4);
  z-index: 9999;
  transition: transform 0.2s;
}
#ai-chat-bubble:hover { transform: scale(1.1); }

#ai-chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 420px;
  height: 620px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}
#ai-chat-panel.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

#ai-chat-header {
  background: linear-gradient(135deg, #1a6dff, #0d4dbd);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#ai-chat-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
#ai-chat-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
}
.ai-msg {
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
}
.ai-msg.user { flex-direction: row-reverse; }
.ai-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.ai-msg.assistant .ai-msg-avatar {
  background: linear-gradient(135deg, #1a6dff, #0d4dbd);
  color: white;
}
.ai-msg.user .ai-msg-avatar {
  background: #e2e8f0;
  color: #475569;
}
.ai-msg-content {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
}
.ai-msg.assistant .ai-msg-content {
  background: white;
  color: #1e293b;
  border: 1px solid #e2e8f0;
}
.ai-msg.user .ai-msg-content {
  background: #1a6dff;
  color: white;
}
.ai-msg-tool {
  font-size: 12px;
  color: #64748b;
  font-style: italic;
  padding: 4px 0;
}

#ai-chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  background: white;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
#ai-chat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  resize: none;
  min-height: 20px;
  max-height: 100px;
  font-family: inherit;
}
#ai-chat-input:focus { border-color: #1a6dff; }
#ai-chat-send {
  background: #1a6dff;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
#ai-chat-send:disabled { background: #94a3b8; cursor: not-allowed; }

.ai-typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}
.ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: typing 1.4s infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}
