body {
  font-family: 'Segoe UI', 'Roboto', sans-serif;
  background: #eef1f5;
  margin: 0;
  padding: 0;
}

.chat-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  transition: all 0.3s ease;
}

.chat-bubble-toggle {
  background: linear-gradient(to right, #1e3c72, #2a5298);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(86, 93, 144, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s infinite ease-in-out;
  z-index: 1001; /* Ensure it's above welcome message */
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.chat-bubble-toggle:hover {
  background: linear-gradient(135deg, #e60000, #ff6600);
  box-shadow: 0 6px 15px rgba(255, 77, 77, 0.7);
}

.chat-box {
  display: none;
  flex-direction: column;
  width: 320px;
  height: 400px;
  background: #ffffff;
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border: 1px solid #e0e0e0;
  transition: all 0.3s ease;
}

.chat-header {
  background: linear-gradient(to right, #1e3c72, #2a5298);
  color: white;
  padding: 12px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 16px;
  position: relative;
}

.close-chat {
  background: none;
  border: none;
  color: #ffcccc;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  line-height: 20px;
  text-align: center;
}

.close-chat:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #ff6666;
}

.chat-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: #f8f9fa;
  scrollbar-width: thin;
  scrollbar-color: #ff4d4d #e0e0e0;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background-color: #ff4d4d;
  border-radius: 3px;
}

.chat-bubble {
  max-width: 70%;
  padding: 10px 12px;
  margin: 8px 0;
  border-radius: 12px;
  line-height: 1.4;
  position: relative;
  clear: both;
  font-size: 13px;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-bubble.user {
  background: #ffebee;
  color: #c0392b;
  float: right;
  border-bottom-right-radius: 4px;
}

.chat-bubble.bot {
  background: #fff3e6;
  color: #d35400;
  float: left;
  border-bottom-left-radius: 4px;
}

.bot-avatar::before,
.user-avatar::before {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
  background-size: cover;
  background-position: center;
}

.bot-avatar::before {
  background-image: url('https://cdn-icons-png.flaticon.com/512/4712/4712103.png');
}

.user-avatar::before {
  background-image: url('https://cdn-icons-png.flaticon.com/512/847/847969.png');
}

.chat-input {
  display: flex;
  border-top: 1px solid #e0e0e0;
  padding: 10px;
  background: #fff;
}

#userMessage {
  flex: 1;
  border: none;
  width: auto;
  padding: 12px 15px;
  font-size: 14px;
  outline: none;
  border-radius: 20px;
  background: #f8f9fa;
  margin-right: 10px;
  transition: background 0.2s, box-shadow 0.2s;
}

#userMessage:focus {
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 77, 77, 0.4);
}

#sendButton {
  background: #ff4d4d;
  border: none;
  color: white;
  padding: 12px 15px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
}

#sendButton:hover {
  background: #e60000;
}

.typing-indicator {
  display: none;
  color: #666;
  font-style: italic;
  margin: 8px 12px;
  font-size: 12px;
}

.typing-indicator .dots {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #666;
  border-radius: 50%;
  margin: 0 2px;
  animation: bounce 1.2s infinite;
}

.typing-indicator .dots:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator .dots:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Welcome Message Styling */
.welcome-message {
  position: fixed;
  bottom: 80px; /* Adjusted to be just above the toggle */
  right: 70px; /* Positioned to the right of the toggle */
  background: linear-gradient(to right, #1e3c72, #2a5298);
  color: white;
  padding: 10px 15px;
  border-radius: 20px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(111, 119, 160, 0.5);
  z-index: 1000;
  animation: pulse 2s infinite ease-in-out;
  cursor: pointer;
  display: block; /* Always visible */
}

@keyframes wave {
  0% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-5px) rotate(2deg); }
  50% { transform: translateY(0) rotate(0deg); }
  75% { transform: translateY(-5px) rotate(-2deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

.welcome-message:hover {
  background: #e60000;
}