/* ==========================================================================
   Cyber Yeti Chat Widget (Cloudflare LM Studio Bridge)
   ========================================================================== */

#ml-ai-chat-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  background: #7C3AED !important;
  color: #FFFFFF !important;
  border: 2px solid #F59E0B !important;
  border-radius: 50px !important;
  padding: 12px 22px !important;
  font-family: inherit !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  text-decoration: none !important;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35) !important;
  transition: transform 0.2s ease, background 0.2s ease !important;
  cursor: pointer !important;
}

#ml-ai-chat-btn:hover {
  background: #6D28D9 !important;
  transform: translateY(-2px) !important;
}

#ml-ai-chat-btn i {
  color: #FBBF24 !important;
  font-size: 1rem !important;
}

/* Chat Popup Window */
#ml-ai-chat-window {
  display: none;
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 110px);
  background: #0B0F19;
  border: 1px solid rgba(124, 58, 237, 0.4);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 25px rgba(124, 58, 237, 0.25);
  flex-direction: column;
  overflow: hidden;
  z-index: 100000;
  font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

#ml-ai-chat-window.active {
  display: flex !important;
}

.ml-chat-header {
  background: linear-gradient(135deg, #1E1B4B 0%, #0F172A 100%);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(124, 58, 237, 0.3);
}

.ml-chat-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ml-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #F59E0B;
  object-fit: cover;
  background: #1E1B4B;
}

.ml-chat-title {
  display: flex;
  flex-direction: column;
}

.ml-chat-title strong {
  color: #FFFFFF;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.ml-chat-title span {
  color: #10B981;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
}

.ml-chat-title span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10B981;
}

.ml-chat-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #94A3B8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ml-chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.ml-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #0B0F19;
}

.ml-chat-bubble {
  max-width: 88%;
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.55;
  word-break: break-word;
}

.ml-bubble-bot {
  align-self: flex-start;
  background: #1E293B;
  color: #F1F5F9;
  border-left: 3px solid #7C3AED;
  border-radius: 4px 12px 12px 12px;
}

.ml-bubble-bot strong {
  color: #FBBF24;
}

.ml-bubble-user {
  align-self: flex-end;
  background: #7C3AED;
  color: #FFFFFF;
  border-radius: 12px 12px 4px 12px;
  font-weight: 600;
}

/* Typing Dots Animation */
.ml-bubble-typing {
  align-self: flex-start;
  background: #1E293B;
  padding: 10px 14px;
}

.ml-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ml-typing-dots span {
  width: 7px;
  height: 7px;
  background: #94A3B8;
  border-radius: 50%;
  display: inline-block;
  animation: mlTypingBounce 1.4s infinite ease-in-out both;
}

.ml-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.ml-typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes mlTypingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; background: #7C3AED; }
}

.ml-chat-input-bar {
  padding: 12px 14px;
  background: #111827;
  border-top: 1px solid rgba(124, 58, 237, 0.2);
  display: flex;
  gap: 8px;
  align-items: center;
}

.ml-chat-input-bar input {
  flex: 1;
  background: #0B0F19;
  border: 1px solid #374151;
  color: #FFFFFF;
  border-radius: 25px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}

.ml-chat-input-bar input:focus {
  border-color: #F59E0B;
}

.ml-chat-send-btn {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  border-radius: 50% !important;
  background: #F59E0B !important;
  color: #0F172A !important;
  border: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.4) !important;
  transition: background 0.2s ease, transform 0.1s ease !important;
}

.ml-chat-send-btn:hover {
  background: #D97706 !important;
  transform: scale(1.06) !important;
}

@media (max-width: 640px) {
  #ml-ai-chat-window {
    right: 12px;
    left: 12px;
    bottom: 74px;
    width: auto;
    max-width: none;
    height: 480px;
  }
}
