/* ============================================
   YANKEYS DEMOLITION — CHATBOT WIDGET
   ============================================ */

/* === CHAT TOGGLE BUTTON === */
.chatbot-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #F48632;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(244, 134, 50, 0.4);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chatbot-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(244, 134, 50, 0.55);
}

.chatbot-toggle svg {
  width: 28px;
  height: 28px;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.chatbot-toggle .chat-icon-close {
  position: absolute;
  transform: rotate(90deg) scale(0);
  opacity: 0;
}

.chatbot-toggle.active .chat-icon-open {
  transform: rotate(-90deg) scale(0);
  opacity: 0;
}

.chatbot-toggle.active .chat-icon-close {
  transform: rotate(0) scale(1);
  opacity: 1;
}

/* Notification badge */
.chatbot-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #e53e3e;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: chatBadgePulse 2s ease-in-out infinite;
}

@keyframes chatBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.chatbot-toggle.active .chatbot-badge {
  display: none;
}

/* === CHAT WINDOW === */
.chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  visibility: hidden;
  transform-origin: bottom right;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.chatbot-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* === CHAT HEADER === */
.chatbot-header {
  background: linear-gradient(135deg, #F48632 0%, #e0751e 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* Close button in header */
.chatbot-close {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chatbot-close svg {
  width: 18px;
  height: 18px;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.chatbot-header-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
}

.chatbot-header-info p {
  font-size: 0.75rem;
  opacity: 0.85;
  margin: 2px 0 0;
}

.chatbot-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chatbot-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #68d391;
  border-radius: 50%;
  display: inline-block;
}

/* === CHAT MESSAGES === */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 260px;
  max-height: 320px;
  scroll-behavior: smooth;
  background: #f9fafb;
}

.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

/* Message bubbles */
.chat-message {
  display: flex;
  gap: 8px;
  animation: chatMsgIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes chatMsgIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-message.bot {
  align-self: flex-start;
}

.chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #F48632;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  font-weight: 700;
}

.chat-message.user .chat-msg-avatar {
  background: #1a1a1a;
}

.chat-bubble {
  max-width: 260px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-message.bot .chat-bubble {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 4px;
}

.chat-message.user .chat-bubble {
  background: #F48632;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-bubble a {
  color: #F48632;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

.chat-message.user .chat-bubble a {
  color: #fff;
}

/* Timestamp */
.chat-timestamp {
  font-size: 0.65rem;
  color: #9ca3af;
  margin-top: 4px;
  text-align: right;
  font-weight: 400;
}

.chat-message.user .chat-timestamp {
  color: rgba(255, 255, 255, 0.7);
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-items: center;
}

.chat-typing span {
  width: 7px;
  height: 7px;
  background: #9ca3af;
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* === QUICK REPLIES === */
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 8px;
  animation: chatMsgIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.chat-quick-btn {
  padding: 7px 14px;
  border: 1.5px solid #F48632;
  border-radius: 20px;
  background: transparent;
  color: #F48632;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.chat-quick-btn:hover {
  background: #F48632;
  color: #fff;
}

/* === CHAT INPUT === */
.chatbot-input {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  gap: 8px;
  flex-shrink: 0;
}

.chatbot-input input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.9rem;
  font-family: inherit;
  padding: 8px 0;
  background: transparent;
  color: #1a1a1a;
}

.chatbot-input input::placeholder {
  color: #9ca3af;
}

.chatbot-input button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #F48632;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.chatbot-input button:hover {
  background: #e0751e;
}

.chatbot-input button svg {
  width: 18px;
  height: 18px;
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 480px) {
  .chatbot-window {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    transform-origin: bottom center;
  }

  .chatbot-window.open {
    border-radius: 16px 16px 0 0;
  }

  .chatbot-messages {
    max-height: calc(100vh - 180px);
    max-height: calc(100dvh - 180px);
  }

  .chatbot-toggle {
    bottom: 16px;
    right: 16px;
  }
}

@media (max-width: 768px) and (min-width: 481px) {
  .chatbot-window {
    width: 340px;
    right: 16px;
    bottom: 88px;
  }
}

/* === NUDGE ANIMATION === */
@keyframes chatbotNudge {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.15) rotate(-5deg); }
  50% { transform: scale(1.1) rotate(3deg); }
  75% { transform: scale(1.12) rotate(-2deg); }
}

.chatbot-nudge {
  animation: chatbotNudge 0.6s ease-in-out 2;
}

@media (hover: none) {
  .chat-quick-btn:hover {
    background: transparent;
    color: #F48632;
  }

  .chat-quick-btn:active {
    background: #F48632;
    color: #fff;
  }
}
