/* ============================================
   Four C Agricultural Limited
   AI Trade Assistant Widget
   ============================================ */

.fc-ai-widget {
  position: fixed;
  bottom: 24px;
  left: 24px; /* Placed on the left as requested */
  z-index: 9999;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Floating Button */
.fc-ai-button {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #1a5632, #0f3d22);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(26, 86, 50, 0.3);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border: 2px solid rgba(197, 165, 90, 0.4);
}

.fc-ai-button:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 25px rgba(26, 86, 50, 0.4);
  border-color: #c9a227;
}

.fc-ai-button svg {
  width: 28px;
  height: 28px;
}

/* Chat Window */
.fc-ai-chat-window {
  position: absolute;
  bottom: 80px;
  left: 0;
  width: 350px;
  height: 500px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom left;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border: 1px solid #e8e6e1;
}

.fc-ai-widget.active .fc-ai-chat-window {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.fc-ai-header {
  background: #1a5632;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
}

.fc-ai-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fc-ai-avatar {
  width: 36px;
  height: 36px;
  background: #c9a227;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  color: #1a1816;
}

.fc-ai-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
}

.fc-ai-status {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  gap: 4px;
}

.fc-ai-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #2ecc71;
  border-radius: 50%;
  display: inline-block;
}

.fc-ai-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  padding: 4px;
}

.fc-ai-close:hover {
  opacity: 1;
}

/* Chat Body */
.fc-ai-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: #faf9f6;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fc-ai-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: fcFadeIn 0.3s ease forwards;
}

.fc-ai-msg.bot {
  background: #ffffff;
  color: #2d2b28;
  border: 1px solid #e8e6e1;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.fc-ai-msg.user {
  background: #1a5632;
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

@keyframes fcFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Quick Replies */
.fc-ai-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.fc-ai-quick-reply {
  background: #f0efe9;
  border: 1px solid #e8e6e1;
  color: #1a5632;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.fc-ai-quick-reply:hover {
  background: #e8f5ee;
  border-color: #2d7a4a;
}

/* Input Area */
.fc-ai-footer {
  padding: 16px;
  background: #ffffff;
  border-top: 1px solid #e8e6e1;
  display: flex;
  gap: 8px;
}

.fc-ai-input {
  flex: 1;
  border: 1px solid #e8e6e1;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.fc-ai-input:focus {
  border-color: #c9a227;
}

.fc-ai-send {
  width: 40px;
  height: 40px;
  background: #1a5632;
  border: none;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.fc-ai-send:hover {
  background: #0f3d22;
}

.fc-ai-send svg {
  width: 18px;
  height: 18px;
  margin-left: 2px;
}

/* Typing Indicator */
.fc-ai-typing {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #e8e6e1;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: fit-content;
}

.fc-ai-typing.active {
  display: flex;
}

.fc-ai-typing span {
  width: 6px;
  height: 6px;
  background: #9a9890;
  border-radius: 50%;
  animation: fcTyping 1.4s infinite ease-in-out both;
}

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

@keyframes fcTyping {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

@media (max-width: 480px) {
  .fc-ai-chat-window {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    z-index: 10000;
  }
  
  .fc-ai-widget.active .fc-ai-button {
    display: none;
  }
}
