/* chatbot.css */
:root {
  --primary: #4a6fa5;
  --primary-dark: #3a5a8a;
  --bg: #ffffff;
  --text: #333333;
  --bubble-user: #4a6fa5;
  --bubble-assistant: #f1f3f5;
  --border: #ddd;
  --shadow: 0 10px 30px rgba(0,0,0,0.2);
}

body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

#chatbot-toggle {
  position: fixed; right: 20px; bottom: 20px; width: 60px; height: 60px;
  background: var(--primary); color: white; border: none; border-radius: 50%;
  cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.3); z-index: 10000;
  font-size: 24px; transition: transform 0.3s;
}
#chatbot-toggle:hover { transform: scale(1.1); }

#chatbot-popup {
  position: fixed; right: 20px; bottom: 90px; width: 380px; height: 520px;
  background: var(--bg); border-radius: 16px; box-shadow: var(--shadow);
  z-index: 9999; display: none; flex-direction: column; font-size: 14px;
}

#chatbot-header {
  padding: 12px 16px; background: var(--primary); color: white;
  border-radius: 16px 16px 0 0; display: flex; justify-content: space-between;
  align-items: center; font-weight: 600;
}

#lang-switch {
  background: none; border: none; color: white; font-size: 14px;
  cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
#lang-switch:hover { background: rgba(255,255,255,0.2); }

#chatbot-messages {
  flex: 1; padding: 16px; overflow-y: auto; line-height: 1.6;
  scroll-behavior: smooth;
}

.message {
  margin: 8px 0; padding: 10px 14px; border-radius: 18px;
  max-width: 82%; word-wrap: break-word; animation: fadeIn 0.3s;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.user { background: var(--bubble-user); color: white; margin-left: auto; }
.assistant { background: var(--bubble-assistant); color: var(--text); }

.typing {
  display: flex; align-items: center; gap: 6px; font-style: italic; color: #666;
}
.typing::after {
  content: ''; width: 6px; height: 6px; background: #666; border-radius: 50%;
  animation: blink 1.2s infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

#chatbot-input-area {
  display: flex; padding: 12px; border-top: 1px solid var(--border); gap: 8px;
}
#chatbot-input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 20px; font-size: 14px; outline: none;
}
#chatbot-input:focus { border-color: var(--primary); }

#chatbot-send, #chatbot-stop {
  padding: 0 16px; background: var(--primary); color: white;
  border: none; border-radius: 20px; cursor: pointer; font-size: 14px;
}
#chatbot-stop { background: #e74c3c; display: none; }

/* Markdown */
.markdown-body { font-size: 14px; }
.markdown-body :is(h1,h2,h3) { margin: 0.6em 0 0.3em; font-weight: 600; }
.markdown-body :is(ul,ol) { padding-left: 20px; margin: 0.5em 0; }
.markdown-body code { background: #e5e7eb; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.markdown-body pre { background: #2d2d2d; color: #f8f8f2; padding: 12px; border-radius: 8px; overflow-x: auto; margin: 0.5em 0; }
.markdown-body a { color: var(--primary); text-decoration: underline; }
.markdown-body table { border-collapse: collapse; width: 100%; margin: 0.5em 0; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 8px; text-align: left; }
.markdown-body th { background: #f5f5f5; }

@media (max-width: 480px) {
  #chatbot-popup { width: 92%; right: 4%; height: 70vh; }
}