/* ============================================
   AI Chatbot Widget — Premium Portfolio Style
   ============================================ */

/* Chat Trigger Button */
.chatbot-trigger {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 998;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #080808;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 22px 14px 18px;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.chatbot-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(0,0,0,0.35);
  background: #1a1a1a;
}
.chatbot-trigger svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.chatbot-trigger .trigger-dot {
  width: 8px;
  height: 8px;
  background: #25D366;
  border-radius: 50%;
  animation: chatbot-dot-pulse 2s ease-out infinite;
}
@keyframes chatbot-dot-pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}
.chatbot-trigger.hidden { display: none; }

/* Chat Window */
.chatbot-window {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1001;
  width: 400px;
  height: 580px;
  max-height: calc(100vh - 56px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.8) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom right;
}
.chatbot-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.chatbot-header {
  background: #080808;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.chatbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFB646, #FF8C00);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Syne", sans-serif;
  font-weight: 800;
  font-size: 16px;
  color: #080808;
  flex-shrink: 0;
}
.chatbot-header-info {
  flex: 1;
  min-width: 0;
}
.chatbot-header-name {
  font-family: "Syne", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.chatbot-header-status {
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  display: flex;
  align-items: center;
  gap: 5px;
}
.chatbot-header-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #25D366;
  border-radius: 50%;
}
.chatbot-close {
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.chatbot-close:hover {
  background: rgba(255,255,255,0.15);
}
.chatbot-close svg {
  width: 18px;
  height: 18px;
  color: rgba(255,255,255,0.7);
}

/* Messages Area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8f8f8;
  scroll-behavior: smooth;
}
.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}
.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chatbot-messages::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

/* Message Bubbles */
.chatbot-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: chatbot-msg-in 0.3s ease;
}
@keyframes chatbot-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.chatbot-msg.bot {
  align-self: flex-start;
}
.chatbot-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chatbot-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  margin-top: 2px;
}
.chatbot-msg.bot .chatbot-msg-avatar {
  background: linear-gradient(135deg, #FFB646, #FF8C00);
  color: #080808;
  font-family: "Syne", sans-serif;
}
.chatbot-msg.user .chatbot-msg-avatar {
  background: #080808;
  color: #fff;
  font-family: "DM Sans", sans-serif;
}
.chatbot-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  color: #1a1a1a;
  word-break: break-word;
}
.chatbot-msg.bot .chatbot-msg-bubble {
  background: #fff;
  border: 1px solid #eee;
  border-top-left-radius: 4px;
}
.chatbot-msg.user .chatbot-msg-bubble {
  background: #080808;
  color: #fff;
  border-top-right-radius: 4px;
  border-color: transparent;
}

/* Markdown in bot messages */
.chatbot-msg.bot .chatbot-msg-bubble strong {
  font-weight: 700;
  color: #080808;
}
.chatbot-msg.bot .chatbot-msg-bubble a {
  color: #d4930d;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chatbot-msg.bot .chatbot-msg-bubble ul,
.chatbot-msg.bot .chatbot-msg-bubble ol {
  margin: 6px 0 2px;
  padding-left: 18px;
}
.chatbot-msg.bot .chatbot-msg-bubble li {
  margin-bottom: 3px;
}
.chatbot-msg.bot .chatbot-msg-bubble p {
  margin: 0 0 6px;
}
.chatbot-msg.bot .chatbot-msg-bubble p:last-child {
  margin-bottom: 0;
}

/* Typing Indicator */
.chatbot-typing {
  display: flex;
  gap: 8px;
  align-self: flex-start;
  max-width: 88%;
  animation: chatbot-msg-in 0.3s ease;
}
.chatbot-typing .chatbot-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFB646, #FF8C00);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #080808;
  font-family: "Syne", sans-serif;
  flex-shrink: 0;
  margin-top: 2px;
}
.chatbot-typing-dots {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 16px;
  border-top-left-radius: 4px;
  padding: 12px 16px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.chatbot-typing-dots span {
  width: 6px;
  height: 6px;
  background: #bbb;
  border-radius: 50%;
  animation: chatbot-dot-bounce 1.4s ease-in-out infinite;
}
.chatbot-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatbot-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); background: #bbb; }
  30% { transform: translateY(-4px); background: #FFB646; }
}

/* Suggested Chips */
.chatbot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  background: #f8f8f8;
}
.chatbot-chip {
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 20px;
  padding: 7px 14px;
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.chatbot-chip:hover {
  background: #080808;
  color: #fff;
  border-color: #080808;
}

/* Input Area */
.chatbot-input-area {
  padding: 12px 16px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: #fff;
  flex-shrink: 0;
}
.chatbot-input {
  flex: 1;
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  padding: 10px 14px;
  font-family: "DM Sans", sans-serif;
  font-size: 13.5px;
  resize: none;
  outline: none;
  max-height: 80px;
  min-height: 40px;
  line-height: 1.4;
  transition: border-color 0.2s;
  background: #fafafa;
}
.chatbot-input:focus {
  border-color: #FFB646;
  background: #fff;
}
.chatbot-input::placeholder {
  color: #aaa;
}
.chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #080808;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.chatbot-send:hover {
  background: #333;
  transform: scale(1.05);
}
.chatbot-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.chatbot-send svg {
  width: 18px;
  height: 18px;
  color: #fff;
}

/* Powered By */
.chatbot-footer {
  text-align: center;
  padding: 6px;
  font-family: "DM Sans", sans-serif;
  font-size: 10px;
  color: #bbb;
  background: #fff;
  flex-shrink: 0;
}
.chatbot-footer span {
  color: #FFB646;
  font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .chatbot-window {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
    transform: translateY(100%);
    opacity: 1;
  }
  .chatbot-window.open {
    transform: translateY(0);
  }
  .chatbot-trigger {
    bottom: 82px;
    right: 20px;
    padding: 12px 16px 12px 14px;
    font-size: 13px;
  }
  .chatbot-trigger .trigger-label {
    display: none;
  }
  .chatbot-trigger {
    border-radius: 50%;
    padding: 14px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .chatbot-window {
    width: calc(100% - 32px);
    right: 16px;
    bottom: 16px;
    height: 70vh;
  }
  .chatbot-trigger {
    bottom: 96px;
    right: 28px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .chatbot-window {
    transition: opacity 0.15s;
  }
  .chatbot-msg {
    animation: none;
  }
  .chatbot-typing-dots span {
    animation: none;
  }
  .chatbot-trigger .trigger-dot {
    animation: none;
  }
}

/* WhatsApp button adjustment when chatbot is open */
body.chatbot-open .whatsapp-float {
  transform: translateX(-80px);
}
