/* --- Chatbot Unified Style (v1.3, BVVT) ---
   Kết hợp ưu điểm: "Sản" (màu gradient, thân thiện) + "Nội trú" (hiện đại, ChatGPT-like)
   Author: BVVT DevOps | Last updated: 2025-10-29
*/

/* --- Nút mở chat (floating button) --- */
#chat-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 58px;
  height: 58px;
  background: linear-gradient(90deg, #3182ce, #2b6cb0);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s ease, background 0.3s;
  z-index: 9999;
}

#chat-button:hover {
  transform: scale(1.08);
  background: linear-gradient(90deg, #2b6cb0, #225da8);
}

/* --- Hộp chat chính --- */
#chatbox {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 320px;
  max-height: 420px;
  display: none;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  animation: fadeIn 0.25s ease-in-out;
}

/* --- Header chatbot --- */
#chat-header {
  background: linear-gradient(90deg, #3182ce, #2b6cb0);
  color: #fff;
  text-align: center;
  font-weight: 600;
  padding: 12px;
  font-size: 15px;
  position: relative;
}

/* --- Nút đóng --- */
#close-chat {
  position: absolute;
  right: 10px;
  top: 10px;
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.2s ease;
}
#close-chat:hover {
  transform: scale(1.2);
}

/* --- Khu vực tin nhắn --- */
#messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  font-size: 14px;
  background: #f7fafc;
  scroll-behavior: smooth;
  max-height: 300px;
}

#messages p {
  margin: 6px 0;
  line-height: 1.5;
  word-wrap: break-word;
  padding: 8px 12px;
  border-radius: 8px;
}

/* --- Tin nhắn người dùng và bot --- */
#messages p.user {
  background: #ebf8ff;
  align-self: flex-end;
}

#messages p.bot {
  background: #edf2f7;
  align-self: flex-start;
}

/* --- Ô nhập và nút gửi (kiểu ChatGPT) --- */
#chat-input {
  display: flex;
  align-items: flex-end;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  padding: 10px;
  gap: 8px;
}

/* Ô nhập (textarea) */
#chat-input textarea {
  flex: 1;
  min-height: 44px;
  max-height: 150px;
  resize: vertical;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
  line-height: 1.4;
  background: #f8fafc;
  transition: border-color 0.2s, background 0.2s;
}

#chat-input textarea:focus {
  border-color: #3182ce;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

/* --- Nút gửi tròn, kiểu ChatGPT --- */
#chat-input button {
  background: linear-gradient(90deg, #3182ce, #2b6cb0);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, transform 0.15s ease;
}

#chat-input button:hover {
  background: linear-gradient(90deg, #2b6cb0, #225da8);
  transform: scale(1.05);
}

/* --- Hiệu ứng mở hộp chat --- */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* --- Responsive --- */
@media (max-width: 600px) {
  #chatbox {
    right: 10px;
    bottom: 80px;
    width: 90%;
    max-height: 75%;
  }
  #chat-button {
    width: 52px;
    height: 52px;
    bottom: 15px;
    right: 15px;
  }
  #chat-input {
    padding: 8px;
    gap: 6px;
  }
  #chat-input textarea {
    font-size: 14px;
    padding: 8px 10px;
  }
  #chat-input button {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
}
