:root {
  --chat-primary: #2D5A27;
  --chat-accent: #A0DD43;
  --chat-bg: #1a1a2e;
  --chat-surface: #242438;
  --chat-text: #ffffff;
  --chat-text-muted: #a0a0b0;
  --chat-user-bg: linear-gradient(135deg, #2D5A27, #3a7a30);
  --chat-bot-bg: #2a2a40;
  --chat-input-bg: #1e1e32;
  --chat-border: rgba(160, 221, 67, 0.15);
}

/* Floating Button */
.chat-toggle-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary), #3a7a30);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(45, 90, 39, 0.4);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chat-toggle-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(45, 90, 39, 0.6);
}

.chat-toggle-btn svg {
  width: 30px;
  height: 30px;
  fill: #fff;
}

.chat-toggle-btn .chat-close-icon {
  display: none;
}

.chat-toggle-btn.active .chat-open-icon {
  display: none;
}

.chat-toggle-btn.active .chat-close-icon {
  display: block;
}

/* Notification Badge */
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #e74c3c;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  font-weight: 700;
  animation: pulse 2s infinite;
}

.chat-badge.show {
  display: flex;
}

/* Chat Container */
.chat-container {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: var(--chat-bg);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--chat-border);
}

.chat-container.open {
  display: flex;
  animation: fadeIn 0.3s ease;
}

/* Header */
.chat-header {
  background: linear-gradient(135deg, var(--chat-primary), #1a3d15);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.chat-avatar img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.chat-header-info h4 {
  margin: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: "Poppins", sans-serif;
}

.chat-header-info .chat-status {
  font-size: 12px;
  color: var(--chat-accent);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-status-dot {
  width: 7px;
  height: 7px;
  background: var(--chat-accent);
  border-radius: 50%;
  display: inline-block;
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(160, 221, 67, 0.3);
  border-radius: 4px;
}

/* Message Bubbles */
.chat-message {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  font-family: "Poppins", sans-serif;
  animation: messageIn 0.3s ease;
}

.chat-message.user {
  align-self: flex-end;
  background: var(--chat-user-bg);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message.bot {
  align-self: flex-start;
  background: var(--chat-bot-bg);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
}

.chat-message a {
  color: var(--chat-accent);
  text-decoration: underline;
}

.chat-message strong {
  color: var(--chat-accent);
}

.chat-message ul, .chat-message ol {
  margin: 6px 0;
  padding-left: 18px;
}

.chat-message li {
  margin: 3px 0;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--chat-bot-bg);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  animation: messageIn 0.3s ease;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--chat-text-muted);
  border-radius: 50%;
  animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* Quick Buttons */
.chat-quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px;
  flex-shrink: 0;
}

.chat-quick-btn {
  background: transparent;
  border: 1px solid var(--chat-border);
  color: var(--chat-accent);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  font-family: "Poppins", sans-serif;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chat-quick-btn:hover {
  background: rgba(160, 221, 67, 0.1);
  border-color: var(--chat-accent);
}

/* Input Area */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  background: var(--chat-input-bg);
  border-top: 1px solid var(--chat-border);
  flex-shrink: 0;
}

.chat-input-area textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--chat-text);
  font-size: 14px;
  font-family: "Poppins", sans-serif;
  resize: none;
  outline: none;
  max-height: 80px;
  line-height: 1.4;
  padding: 4px 0;
}

.chat-input-area textarea::placeholder {
  color: var(--chat-text-muted);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary), #3a7a30);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.chat-send-btn:hover {
  transform: scale(1.08);
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Animations */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

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

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

/* Responsive */
@media (max-width: 480px) {
  .chat-container {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .chat-toggle-btn {
    bottom: 16px;
    right: 16px;
  }
}
