.chat-bot-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #2196f3;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 20000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  padding: 0;
  overflow: hidden;
}

.chat-bot-button:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
}

.chat-bot-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  transition: all 0.3s ease;
}

.chat-container {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 400px;
  max-height: calc(100vh - 140px);
  height: 550px;
  background-color: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  z-index: 19999;
  display: flex;
  flex-direction: column;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  overflow: hidden;
  border: 1px solid rgba(0, 120, 255, 0.1);
}

.chat-container.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chat-header {
  display: flex;
  align-items: center;
  padding: 18px 20px;
  background: linear-gradient(135deg, #1976d2, #2196f3);
  color: white;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-header-img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  margin-right: 12px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.chat-header-title {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.chat-header .close-btn {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  transition: all 0.2s ease;
}

.chat-header .close-btn:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.chat-messages {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  background-color: #f8f9fb;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

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

.chat-messages::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  position: relative;
  animation: fadeIn 0.3s ease;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

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

.bot-message {
  background: linear-gradient(135deg, #f1f8ff 0%, #e8f4fd 100%);
  color: #2c3e50;
  align-self: flex-start;
  border-bottom-left-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-left: 3px solid #2196f3;
  line-height: 1.6;
  font-size: 14px;
}

/* Enhanced markdown styling for bot messages */
.bot-message h1, .bot-message h2 {
  color: #1976d2;
  font-weight: 600;
  margin: 12px 0 8px 0;
  padding-bottom: 4px;
  border-bottom: 2px solid #e3f2fd;
}

.bot-message h2 {
  font-size: 16px;
  margin: 10px 0 6px 0;
}

.bot-message h3 {
  color: #2196f3;
  font-weight: 600;
  font-size: 14px;
  margin: 8px 0 4px 0;
}

.bot-message ul, .bot-message ol {
  margin: 8px 0;
  padding-left: 20px;
}

.bot-message li {
  margin: 4px 0;
  line-height: 1.5;
}

.bot-message strong {
  color: #1565c0;
  font-weight: 600;
}

.bot-message em {
  color: #424242;
  font-style: italic;
}

.bot-message code {
  background: rgba(33, 150, 243, 0.1);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.bot-message blockquote {
  border-left: 3px solid #2196f3;
  margin: 8px 0;
  padding: 8px 12px;
  background: rgba(33, 150, 243, 0.05);
  font-style: italic;
}

.bot-message hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 12px 0;
}

/* Special styling for emojis and icons */
.bot-message .emoji {
  font-size: 16px;
  margin-right: 4px;
}

/* Enhanced spacing for structured content */
.bot-message > *:first-child {
  margin-top: 0;
}

.bot-message > *:last-child {
  margin-bottom: 0;
}

.bot-message a {
  color: #2196f3 !important;
  text-decoration: underline !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  transition: all 0.3s ease;
  border-radius: 3px;
  padding: 1px 3px;
  position: relative;
  z-index: 10;
  display: inline-block;
}

.bot-message a:hover {
  background-color: rgba(33, 150, 243, 0.15) !important;
  color: #1976d2 !important;
  text-decoration: underline !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(33, 150, 243, 0.4);
}

.bot-message a:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(33, 150, 243, 0.3);
}

.bot-message a:visited {
  color: #1976d2 !important;
}

.bot-message a:focus {
  outline: 2px solid #2196f3;
  outline-offset: 2px;
}

.user-message {
  align-self: flex-end;
  background-color: #2196f3;
  color: white;
  border-bottom-right-radius: 4px;
  margin-right: 5px;
  border-right: 3px solid #1565c0;
}

.chat-input-container {
  display: flex;
  padding: 16px;
  background-color: #fff;
  border-top: 1px solid #eaeef2;
  border-radius: 0 0 16px 16px;
}

.chat-input {
  flex: 1;
  padding: 12px 18px;
  border: 1px solid #e0e4e8;
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) inset;
  background-color: #f8f9fb;
  color: #333;
}

.chat-input:focus {
  border-color: #2196f3;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
  background-color: #fff;
}

.typing-indicator {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background-color: #e9f0f8;
  border-radius: 18px;
  align-self: flex-start;
  max-width: fit-content;
  margin-left: 5px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
  border-left: 3px solid #2196f3;
}

.typing-indicator span {
  height: 8px;
  width: 8px;
  float: left;
  margin: 0 2px;
  background-color: #2196f3;
  display: block;
  border-radius: 50%;
  opacity: 0.4;
}

.typing-indicator span:nth-of-type(1) {
  animation: typing 1s infinite;
}

/* Chat suggestion buttons */
.chat-suggestions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #eaeef2;
  background-color: #f8f9fb;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.chat-suggestions::-webkit-scrollbar {
  height: 6px;
}

.chat-suggestions::-webkit-scrollbar-thumb {
  background-color: #cfd8e3;
  border-radius: 999px;
}

.chat-suggestions::-webkit-scrollbar-track {
  background: transparent;
}

.suggestion-btn {
  flex: 0 0 auto;
  background: linear-gradient(135deg, #f6f9fc 0%, #eef2f7 100%);
  border: 1px solid #dce6f1;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  color: #445566;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-btn:hover {
  background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
  color: white;
  border-color: transparent;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

/* Product promotion styles */
.product-card {
  background-color: #f0f7ff;
  border-radius: 12px;
  border-left: 3px solid #2196f3;
  padding: 12px;
  margin: 8px 5px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-card-title {
  font-weight: 600;
  color: #0d47a1;
  font-size: 14px;
}

.product-card-desc {
  font-size: 12px;
  color: #444;
}

.product-card-actions {
  display: flex;
  gap: 8px;
}

.product-card-btn {
  background-color: #2196f3;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.product-card-btn:hover {
  background-color: #1976d2;
}

.contact-action {
  background-color: #4caf50;
}

.contact-action:hover {
  background-color: #388e3c;
}

.typing-indicator span:nth-of-type(2) {
  animation: typing 1s 0.33s infinite;
}

.typing-indicator span:nth-of-type(3) {
  animation: typing 1s 0.66s infinite;
}

@keyframes typing {
  0% {
    opacity: 0.4;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-5px);
  }
  100% {
    opacity: 0.4;
    transform: translateY(0);
  }
}

.welcome-message {
  background-color: rgba(33, 150, 243, 0.08);
  padding: 10px;
  border-radius: 12px;
  margin: 10px;
  border-left: 2px solid #2196f3;
  font-size: 14px;
  line-height: 1.3;
  position: relative;
  animation: fadeIn 0.5s ease-out;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.03);
  transition: all 0.3s ease;
  text-align: center;
  max-width: 80%;
  margin-left: auto;
  margin-right: auto;
}

.welcome-message:hover {
  background-color: rgba(33, 150, 243, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.welcome-message strong {
  display: block;
  margin-bottom: 3px;
  color: #1976d2;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.welcome-vi, .welcome-en {
  display: block;
  line-height: 1.4;
  color: #333;
  font-weight: 500;
}

.thinking-message {
  animation: thinking 1.5s infinite ease-in-out;
  font-style: italic;
  color: #666;
  align-self: flex-start;
  background-color: #e9f0f8;
  padding: 12px 16px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  max-width: 80%;
  margin-left: 5px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
  border-left: 3px solid #2196f3;
}

@keyframes thinking {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

.send-btn {
  background-color: #2196f3;
  color: white;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  margin-left: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(33, 150, 243, 0.4);
}

.send-btn:hover {
  background-color: #1976d2;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 10px rgba(33, 150, 243, 0.5);
}

.send-btn i {
  transition: transform 0.3s ease;
}

.send-btn:hover i {
  transform: translateX(2px);
}

/* Hiệu ứng khi bot đang gõ */
.bot-typing {
  position: relative;
  overflow: hidden;
}

.bot-message::before {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: #e9f0f8;
  bottom: -5px;
  left: -5px;
  transform: rotate(45deg);
}

.user-message::before {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: #2196f3;
  bottom: -5px;
  right: -5px;
  transform: rotate(45deg);
}

.chat-timestamp {
  font-size: 10px;
  color: #999;
  text-align: center;
  margin: 5px 0;
  opacity: 0.8;
}

/* Responsive design */
@media (max-width: 480px) {
  .chat-container {
    width: 95%;
    right: 2.5%;
    left: 2.5%;
    height: 75vh;
    bottom: 80px;
  }
}

@media (max-width: 768px) {
  .chat-container {
    width: 85%;
    right: 7.5%;
    left: 7.5%;
    height: 65vh;
  }

  .chat-bot-button {
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
  }

  .chat-input {
    padding: 10px 15px;
    font-size: 13px;
  }

  .send-btn {
    width: 38px;
    height: 38px;
  }

  .chat-header {
    padding: 14px 16px;
  }

  .chat-header-img {
    width: 32px;
    height: 32px;
  }

  .chat-header-title {
    font-size: 15px;
  }
}

/* Hiệu ứng nhấp nháy cho nút chatbot khi mới vào trang */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.7);
    transform: scale(1);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(33, 150, 243, 0);
    transform: scale(1.05);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(33, 150, 243, 0);
    transform: scale(1);
  }
}

.chat-bot-button.pulse {
  animation: pulse 2s infinite;
}

/* Style để thêm vào phần chỉ báo màu nhỏ ở bên trái avatar của bot */
.bot-status-indicator {
  position: absolute;
  width: 10px;
  height: 10px;
  background-color: #4CAF50;
  border-radius: 50%;
  bottom: 0;
  right: 0;
  border: 2px solid white;
}
/* (Removed duplicate .chat-suggestions/.suggestion-btn block to avoid conflicts.) */

