/* ==============================
   CHATBOT WIDGET — AttorneyWebsiteDesign.us
   Groq-powered AI — Attorney Web Design Context Only
   ============================== */

/* Toggle Button */
#chatbot-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9990;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #c9963c, #a07830);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(201,150,60,0.45), 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.25s, box-shadow 0.25s;
  outline: none;
}
#chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(201,150,60,0.55), 0 4px 16px rgba(0,0,0,0.35);
}
#chatbot-toggle svg { stroke: #fff; fill: none; stroke-width: 2; transition: opacity 0.2s; }
#chatbot-toggle.open svg.icon-chat { opacity: 0; position: absolute; }
#chatbot-toggle.open svg.icon-close { opacity: 1; }
#chatbot-toggle svg.icon-close { opacity: 0; position: absolute; }

.chatbot-notif {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
  animation: chatPulse 2s infinite;
}
@keyframes chatPulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Chat Panel */
#chatbot-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  z-index: 9989;
  width: 380px;
  max-height: 560px;
  background: linear-gradient(180deg, #0d1e38 0%, #0a1628 100%);
  border: 1px solid rgba(201,150,60,0.25);
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.5),
    0 0 0 1px rgba(255,255,255,0.04),
    inset 0 1px 0 rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s;
}
#chatbot-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.chatbot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(201,150,60,0.12), rgba(10,22,40,0.8));
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.chatbot-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  background: linear-gradient(135deg, #c9963c, #a07830);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px rgba(201,150,60,0.2);
}
.chatbot-avatar svg { stroke: #fff; fill: none; stroke-width: 2; }
.chatbot-header-info { flex: 1; min-width: 0; }
.chatbot-name { font-weight: 700; color: #fff; font-size: 15px; }
.chatbot-role { font-size: 11px; color: rgba(255,255,255,0.45); margin-top: 1px; }
.chatbot-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}
.chatbot-status-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  animation: onlinePulse 2s infinite;
}
@keyframes onlinePulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}
.chatbot-status span { font-size: 10px; color: rgba(255,255,255,0.4); }
.chatbot-close {
  background: rgba(255,255,255,0.07);
  border: none;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  font-size: 18px;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}
.chatbot-close:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* Messages area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,150,60,0.2) transparent;
}
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: rgba(201,150,60,0.25); border-radius: 2px; }

/* Message rows */
.chatbot-msg {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  animation: msgSlideIn 0.25s ease;
}
@keyframes msgSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.chatbot-msg.user { flex-direction: row-reverse; }

.chatbot-bubble {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.65;
  word-break: break-word;
}
.chatbot-msg.bot .chatbot-bubble {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.88);
  border-bottom-left-radius: 4px;
}
.chatbot-msg.user .chatbot-bubble {
  background: linear-gradient(135deg, #c9963c, #a07830);
  color: #fff;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.chatbot-msg.bot .chatbot-bubble a {
  color: #c9963c;
  text-decoration: underline;
}

/* Bot avatar icon */
.chatbot-msg-icon {
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: linear-gradient(135deg, #c9963c, #7a5c20);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

/* Typing indicator */
.chatbot-typing {
  display: flex;
  gap: 4px;
  padding: 12px 15px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.chatbot-dot {
  width: 7px;
  height: 7px;
  background: rgba(201,150,60,0.7);
  border-radius: 50%;
  animation: typingDot 1.2s infinite;
}
.chatbot-dot:nth-child(2) { animation-delay: 0.2s; }
.chatbot-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%,60%,100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Quick action buttons */
.chatbot-quick {
  display: flex;
  gap: 6px;
  padding: 10px 16px 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.chatbot-quick-btn {
  font-size: 11px;
  font-weight: 600;
  color: rgba(201,150,60,0.9);
  background: rgba(201,150,60,0.08);
  border: 1px solid rgba(201,150,60,0.2);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}
.chatbot-quick-btn:hover {
  background: rgba(201,150,60,0.18);
  border-color: rgba(201,150,60,0.4);
  color: #c9963c;
}

/* Input area */
.chatbot-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 16px;
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}
#chatbot-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 11px 14px;
  color: #fff;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
#chatbot-input::placeholder { color: rgba(255,255,255,0.28); }
#chatbot-input:focus {
  border-color: rgba(201,150,60,0.5);
  background: rgba(255,255,255,0.09);
}
#chatbot-send {
  width: 42px;
  height: 42px;
  min-width: 42px;
  background: linear-gradient(135deg, #c9963c, #a07830);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
#chatbot-send:hover { transform: scale(1.06); box-shadow: 0 4px 14px rgba(201,150,60,0.4); }
#chatbot-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
#chatbot-send svg { stroke: #fff; fill: none; stroke-width: 2.5; }

/* Powered by */
.chatbot-footer {
  text-align: center;
  padding: 6px 0 10px;
  font-size: 10px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 480px) {
  #chatbot-panel {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 90px;
    max-height: 70vh;
  }
  #chatbot-toggle { bottom: 18px; right: 18px; }
}
