/* BuyBuyLemon AI Chat Widget */

.chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}
.chat-trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}
.chat-trigger .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border: 2px solid #0f172a;
  border-radius: 50%;
}

.chat-window {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 360px;
  height: 500px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: chatSlideIn 0.3s ease;
}
.chat-window.open { display: flex; }

@keyframes chatSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-header {
  padding: 1rem 1.2rem;
  background: linear-gradient(135deg, #1e3a5f, #0f172a);
  border-bottom: 1px solid #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.chat-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.chat-header .online {
  font-size: 0.7rem;
  color: #22c55e;
  font-weight: 400;
}
.chat-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
}
.chat-close:hover { color: #e2e8f0; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

.chat-msg {
  max-width: 85%;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  word-wrap: break-word;
}
.chat-msg.bot {
  align-self: flex-start;
  background: #334155;
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}
.chat-msg.user {
  align-self: flex-end;
  background: #3b82f6;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg .time {
  font-size: 0.65rem;
  color: #64748b;
  margin-top: 0.3rem;
  display: block;
}
.chat-msg.bot .time { color: #64748b; }
.chat-msg.user .time { color: rgba(255,255,255,0.6); }

.chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 0.3rem;
  padding: 0.7rem 1rem;
  background: #334155;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  align-items: center;
}
.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: typing 1.4s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.chat-input-area {
  padding: 0.8rem;
  border-top: 1px solid #334155;
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
}
.chat-input:focus { border-color: #60a5fa; }
.chat-input::placeholder { color: #475569; }
.chat-send {
  padding: 0.6rem 1rem;
  background: #60a5fa;
  color: #0f172a;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}
.chat-send:hover { background: #93c5fd; }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-welcome {
  text-align: center;
  padding: 1rem 1rem 0.5rem;
  color: #94a3b8;
  font-size: 0.8rem;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
}
.chat-welcome strong { color: #60a5fa; }
