/* ============================================================
   CHATBOT WIDGET — Klarity IT
   ============================================================ */

.chatbot-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-primary, #00C9A7);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,201,167,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chatbot-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0,201,167,0.45);
}
.chatbot-fab svg { width: 28px; height: 28px; fill: currentColor; }
.chatbot-fab .fab-close { display: none; }
.chatbot-fab.open .fab-chat { display: none; }
.chatbot-fab.open .fab-close { display: block; }

/* Notification dot */
.chatbot-fab::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: #FF6B6B;
  border-radius: 50%;
  border: 2px solid var(--color-bg, #0A0A0A);
  animation: chatbot-pulse 2s ease-in-out infinite;
}
.chatbot-fab.open::after { display: none; }

@keyframes chatbot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* Chat window */
.chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-height: 540px;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.08);
  font-family: 'Inter', 'Helvetica Neue', sans-serif;
}
.chatbot-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
  background: linear-gradient(135deg, #0d0d0d 0%, #141414 100%);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chatbot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary, #00C9A7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #0A0A0A;
  flex-shrink: 0;
}
.chatbot-header-info { flex: 1; }
.chatbot-header-name {
  font-size: 15px;
  font-weight: 600;
  color: #EBEBEB;
  line-height: 1.2;
}
.chatbot-header-status {
  font-size: 12px;
  color: #00C9A7;
  display: flex;
  align-items: center;
  gap: 5px;
}
.chatbot-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #00C9A7;
  border-radius: 50%;
  display: inline-block;
}

/* Messages area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #0A0A0A;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 280px;
  max-height: 340px;
}
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }

/* Message bubbles */
.chatbot-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  animation: chatbot-fadeIn 0.3s ease;
  word-wrap: break-word;
}
@keyframes chatbot-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chatbot-msg.bot {
  background: #171717;
  color: #EBEBEB;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255,255,255,0.05);
}
.chatbot-msg.user {
  background: var(--color-primary, #00C9A7);
  color: #0A0A0A;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.chatbot-msg a {
  color: #00C9A7;
  text-decoration: underline;
}
.chatbot-msg.user a {
  color: #0A0A0A;
}

/* Quick reply buttons */
.chatbot-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  animation: chatbot-fadeIn 0.3s ease;
}
.chatbot-opt-btn {
  background: rgba(0,201,167,0.08);
  border: 1px solid rgba(0,201,167,0.25);
  color: #00C9A7;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}
.chatbot-opt-btn:hover {
  background: rgba(0,201,167,0.18);
  border-color: #00C9A7;
}

/* Typing indicator */
.chatbot-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}
.chatbot-typing span {
  width: 7px;
  height: 7px;
  background: #555;
  border-radius: 50%;
  animation: chatbot-bounce 1.2s infinite ease-in-out;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatbot-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Input area */
.chatbot-input-area {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  gap: 8px;
  background: #111111;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.chatbot-input {
  flex: 1;
  border: 1px solid rgba(255,255,255,0.1);
  background: #1A1A1A;
  color: #EBEBEB;
  padding: 10px 14px;
  border-radius: 24px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease;
  font-family: inherit;
}
.chatbot-input::placeholder { color: #555552; }
.chatbot-input:focus { border-color: rgba(0,201,167,0.4); }

.chatbot-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-primary, #00C9A7);
  border: none;
  color: #0A0A0A;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}
.chatbot-send:hover { opacity: 0.85; }
.chatbot-send svg { width: 18px; height: 18px; }

/* Lead capture form inside chat */
.chatbot-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  animation: chatbot-fadeIn 0.3s ease;
}
.chatbot-form input {
  border: 1px solid rgba(255,255,255,0.1);
  background: #1A1A1A;
  color: #EBEBEB;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.chatbot-form input::placeholder, .chatbot-form textarea::placeholder { color: #555552; }
.chatbot-form input:focus, .chatbot-form textarea:focus { border-color: rgba(0,201,167,0.4); }
.chatbot-form button {
  background: var(--color-primary, #00C9A7);
  color: #0A0A0A;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
  font-family: inherit;
}
.chatbot-form button:hover { opacity: 0.85; }

/* Powered by */
.chatbot-powered {
  text-align: center;
  padding: 6px;
  font-size: 10px;
  color: #444;
  background: #0d0d0d;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .chatbot-window {
    right: 8px;
    left: 8px;
    bottom: 88px;
    width: auto;
    max-height: 70vh;
  }
  .chatbot-messages { min-height: 200px; max-height: 50vh; }
  .chatbot-fab { bottom: 16px; right: 16px; width: 54px; height: 54px; }
}
