body {
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0;
  padding: 0;
}
#chatbot-bubble {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #007bff;
  color: #fff;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 2em;
  box-shadow: 0 2px 8px #0002;
  z-index: 1000;
  transition: background 0.2s;
}

#chatbot-messages {
  display: flex;
  flex-direction: column;
}
#chatbot-messages div {
  display: inline-block;
  margin-bottom: 10px;
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 1em;
  word-break: break-word;
  box-shadow: 0 2px 8px #0001;
  min-width: 40px;
  max-width: 95%;
}
.bot-typing {
  display: inline-block;
  min-width: 30px;
  background: #fff;
  color: #222;
  align-self: flex-start;
  text-align: left;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  border-top-right-radius: 18px;
  border-top-left-radius: 18px;
  border-bottom-right-radius: 18px;
  margin-bottom: 10px;
  padding: 10px 16px;
  font-size: 1em;
  box-shadow: 0 2px 8px #0001;
}
.typing-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 1px;
  background: #007bff;
  border-radius: 50%;
  opacity: 0.5;
  animation: blink 1.2s infinite both;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.5; }
  40% { opacity: 1; }
}
#chatbot-messages .user {
  background: #d3e3fd;
  color: #007bff;
  align-self: flex-end;
  text-align: right;
  border-bottom-right-radius: 4px;
  border-top-right-radius: 18px;
  border-top-left-radius: 18px;
  border-bottom-left-radius: 18px;
}
#chatbot-messages .bot {
  background: #fff;
  color: #222;
  align-self: flex-start;
  text-align: left;
  border-bottom-left-radius: 4px;
  border-top-right-radius: 18px;
  border-top-left-radius: 18px;
  border-bottom-right-radius: 18px;
  transition: all 0.3s ease;
}
#chatbot-messages .bot.streaming {
  background: linear-gradient(90deg, #f8f9fa 0%, #fff 50%, #f8f9fa 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
#chatbot-messages .bot.streaming::after {
  content: '|';
  color: #007bff;
  animation: blink-cursor 1s infinite;
  margin-left: 2px;
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes blink-cursor {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.message-animate {
  animation: fadeInUp 0.3s ease-out;
}
#chatbot-messages .bot.error {
  background: #fff0f0;
  color: #d32f2f;
  border: 1px solid #d32f2f;
}
#chatbot-bubble:hover {
  background: #0056b3;
}
#chatbot-window {
  position: fixed;
  bottom: 110px;
  right: 40px;
  width: 370px;
  min-width: 300px;
  max-width: 90vw;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 32px #007bff33, 0 2px 8px #0002;
  border: none;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popupIn 0.3s cubic-bezier(.4,2,.6,1) both;
  resize: none;
}

#chatbot-window.fullscreen {
  position: fixed !important;
  top: 20px !important;
  left: 20px !important;
  right: 20px !important;
  bottom: 20px !important;
  width: calc(100vw - 40px) !important;
  height: calc(100vh - 40px) !important;
  max-width: none !important;
  border-radius: 12px;
  z-index: 10000;
  display: flex !important;
  flex-direction: column !important;
}

#chatbot-window.fullscreen #resize-handle {
  display: none;
}

#resize-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  cursor: nw-resize;
  z-index: 1002;
  border-top-left-radius: 18px;
}

#resize-handle::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 12px;
  height: 12px;
  background: linear-gradient(135deg, transparent 0%, transparent 40%, #007bff 40%, #007bff 60%, transparent 60%);
  border-top-left-radius: 14px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

#resize-handle:hover::before {
  opacity: 1;
}

@keyframes popupIn {
  0% { transform: scale(0.8) translateY(40px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

#chatbot-header {
  background: #007bff;
  color: #fff;
  padding: 18px 20px 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 1.2em;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  box-shadow: 0 2px 8px #007bff22;
  position: relative;
}

#fullscreen-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.1em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background-color 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#fullscreen-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

#fullscreen-btn:active {
  transform: scale(0.95);
}

#chatbot-messages {
  padding: 20px;
  height: 280px;
  min-height: 200px;
  overflow-y: auto;
  background: #f8f9fa;
  font-size: 1em;
  flex: 1;
}

#chatbot-window.fullscreen #chatbot-messages {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
}

#chatbot-input-row {
  display: flex;
  background: #fff;
  padding: 12px 16px;
}

#chatbot-window.fullscreen #chatbot-input-row {
  padding: 8px 16px;
}

#chatbot-input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 12px;
  font-size: 1em;
  outline: none;
  background: #fff;
  margin-right: 8px;
}

#send-btn {
  background: transparent;
  color: #007bff;
  border: none;
  border-radius: 50%;
  padding: 0 10px;
  font-size: 1.5em;
  cursor: pointer;
  box-shadow: none;
  transition: color 0.2s;
}
#send-btn:hover {
  color: #0056b3;
}