/* ── Lex Chatbot Widget ──────────────────────────────────────────────────── */
/* Namespaced with lex- prefix to avoid conflicts with site CSS */

#lex-launcher {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--aqua, #00778B);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,119,139,0.45);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 9999;
}
#lex-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0,119,139,0.55);
}
.lex-icon-close { display: none; }

#lex-chat {
  position: fixed;
  bottom: 96px; right: 24px;
  width: 380px;
  max-height: 580px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 9998;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom right;
  transition: transform 0.22s ease, opacity 0.22s ease;
  font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
}
#lex-chat.lex-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.lex-chat-header {
  background: linear-gradient(135deg, #00778B 0%, #009aad 100%);
  padding: 18px 20px 16px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.lex-chat-avatar {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.lex-chat-header-info { flex: 1; }
.lex-chat-name  { font-size: 14px; font-weight: 800; color: #fff; letter-spacing: -0.01em; }
.lex-chat-status {
  font-size: 11px; color: rgba(255,255,255,0.75);
  display: flex; align-items: center; gap: 5px; margin-top: 2px;
}
.lex-status-dot { width: 7px; height: 7px; background: #4ade80; border-radius: 50%; }
.lex-chat-close {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,0.7); padding: 4px;
  border-radius: 6px; transition: color 0.15s;
}
.lex-chat-close:hover { color: #fff; }

/* Messages */
.lex-messages {
  flex: 1; overflow-y: auto;
  padding: 16px; display: flex;
  flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}
.lex-messages::-webkit-scrollbar { width: 4px; }
.lex-messages::-webkit-scrollbar-thumb { background: #E5E7EB; border-radius: 4px; }

.lex-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.lex-msg-bot  { justify-content: flex-start; }
.lex-msg-user { justify-content: flex-end; }

.lex-msg-avatar {
  width: 28px; height: 28px;
  background: #e6f4f6;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.lex-msg-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px; line-height: 1.55;
  word-break: break-word;
}
.lex-msg-bot  .lex-msg-bubble {
  background: #F9FAFB; border: 1px solid #E5E7EB;
  color: #111827; border-bottom-left-radius: 4px;
}
.lex-msg-user .lex-msg-bubble {
  background: #00778B; color: #fff;
  border-bottom-right-radius: 4px;
}
.lex-msg-bot  .lex-msg-bubble a { color: #d49a0a; }
.lex-msg-user .lex-msg-bubble a { color: #fff; }
.lex-msg-time {
  font-size: 10px; color: #6B7280;
  margin-top: 3px; padding: 0 4px;
}

/* Typing indicator */
.lex-typing {
  display: flex; align-items: center; gap: 4px;
  padding: 12px 14px;
  background: #F9FAFB; border: 1px solid #E5E7EB;
  border-radius: 16px; border-bottom-left-radius: 4px;
}
.lex-typing span {
  width: 7px; height: 7px;
  background: #6B7280; border-radius: 50%;
  animation: lex-bounce 1.2s infinite;
}
.lex-typing span:nth-child(2) { animation-delay: 0.15s; }
.lex-typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes lex-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-5px); }
}

/* Quick replies */
.lex-quick-replies {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 16px 12px;
}
.lex-qr-btn {
  background: #fff;
  border: 1.5px solid #00778B;
  color: #00778B;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px; font-weight: 700;
  padding: 6px 12px; border-radius: 100px;
  cursor: pointer; white-space: nowrap;
  transition: all 0.15s;
}
.lex-qr-btn:hover { background: #00778B; color: #fff; }

/* Input area */
.lex-input-area {
  padding: 12px 16px;
  border-top: 1px solid #E5E7EB;
  display: flex; align-items: flex-end; gap: 8px;
  flex-shrink: 0; background: #fff;
}
.lex-input {
  flex: 1;
  border: 1.5px solid #E5E7EB;
  border-radius: 12px;
  padding: 10px 14px;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px; color: #111827;
  outline: none; resize: none;
  max-height: 100px; line-height: 1.4;
  transition: border-color 0.15s;
}
.lex-input:focus { border-color: #00778B; }
.lex-input::placeholder { color: #9ca3af; }

.lex-send {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: #00778B; border: none;
  cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  color: #fff;
}
.lex-send:hover    { background: #005a6b; }
.lex-send:disabled { background: #E5E7EB; cursor: not-allowed; }

/* Footer */
.lex-chat-footer {
  text-align: center;
  font-size: 10px; color: #6B7280;
  padding: 6px 16px 10px;
  border-top: 1px solid #E5E7EB;
  background: #fff;
}
.lex-chat-footer a { color: #00778B; }

/* Mobile */
@media (max-width: 440px) {
  #lex-chat  { width: calc(100vw - 16px); right: 8px; bottom: 88px; }
  #lex-launcher { bottom: 16px; right: 16px; }
}
