/* 
========================================================================
== TỆP: CSS/AICHATBOT.CSS
== CHỨC NĂNG: Nút tròn trợ lý AI góc trên bên phải & Khung Popup Chatbot hỗ trợ Tour VR 360
========================================================================
*/

/* ----------------------------------------------------------------------
   1. NÚT TRÒN NỔI AI CHATBOT (#aichat-btn)
   ---------------------------------------------------------------------- */
#aichat-btn {
  position: fixed;
  top: 20px;
  right: 80px; /* Kế bên nút dịch thuật (right: 20px) */
  width: 50px;
  height: 50px;
  border-radius: 50%;
  z-index: 99999;
  cursor: pointer;
  background-color: var(--default-menu-color, rgba(50, 75, 60, 0.65));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid var(--default-menu-border, #fbf8ec);
  box-shadow: 0 0 15px rgba(251, 248, 236, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
  user-select: none;
}

#aichat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(251, 248, 236, 0.7), inset 0 0 12px rgba(255, 255, 255, 0.4);
  background-color: rgba(60, 90, 70, 0.85);
}

#aichat-btn:active {
  transform: scale(0.95);
}

/* Hiệu ứng viền xoay phát sáng vàng xung quanh nút AI */
#aichat-btn::before {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  background: conic-gradient(
    from 180deg,
    transparent 60%,
    rgba(255, 241, 1, 0.4) 85%,
    #fbf8ec 100%
  );
  z-index: -1;
  animation: aichat-border-rotate 4s linear infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 2px;
}

@keyframes aichat-border-rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

#aichat-btn svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: #fbf8ec;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s ease;
}

#aichat-btn:hover svg {
  transform: scale(1.15) rotate(-10deg);
}

/* Chấm xanh hiển thị trạng thái AI đang online trên nút */
.aichat-online-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background-color: #2ed573;
  border: 2px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 8px #2ed573;
  animation: aichat-pulse 2s infinite;
}

@keyframes aichat-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(46, 213, 115, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(46, 213, 115, 0);
  }
}

/* ----------------------------------------------------------------------
   2. KHUNG POPUP CHATBOT AI (#aichat-popup)
   ---------------------------------------------------------------------- */
#aichat-popup {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 370px;
  height: 530px;
  max-height: calc(100vh - 100px);
  background: rgba(18, 28, 22, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--default-menu-border, #fbf8ec);
  border-radius: 16px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.65), 0 0 20px rgba(251, 248, 236, 0.2);
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px) scale(0.94);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#aichat-popup.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header Popup */
.aichat-header {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(251, 248, 236, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fbf8ec;
}

.aichat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.aichat-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(251, 248, 236, 0.15);
  border: 1px solid #fbf8ec;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aichat-avatar svg {
  width: 20px;
  height: 20px;
  stroke: #fbf8ec;
}

.aichat-title-container {
  display: flex;
  flex-direction: column;
}

.aichat-name {
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.3px;
  color: #fbf8ec;
}

.aichat-status {
  font-size: 11px;
  color: #2ed573;
  display: flex;
  align-items: center;
  gap: 4px;
}

.aichat-status-dot {
  width: 6px;
  height: 6px;
  background-color: #2ed573;
  border-radius: 50%;
}

.aichat-close-btn {
  cursor: pointer;
  font-size: 20px;
  color: rgba(251, 248, 236, 0.7);
  line-height: 1;
  transition: color 0.2s ease, transform 0.2s ease;
  padding: 4px;
}

.aichat-close-btn:hover {
  color: #ffffff;
  transform: scale(1.15);
}

/* Thân Khung Chat (Scrollable) */
.aichat-body {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.aichat-body::-webkit-scrollbar {
  width: 5px;
}

.aichat-body::-webkit-scrollbar-thumb {
  background: rgba(251, 248, 236, 0.3);
  border-radius: 4px;
}

/* Gợi ý câu hỏi nhanh (Suggestion Pills) */
.aichat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.aichat-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(251, 248, 236, 0.25);
  border-radius: 14px;
  padding: 6px 12px;
  font-size: 11.5px;
  color: #eeeeee;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.aichat-pill:hover {
  background: rgba(251, 248, 236, 0.2);
  border-color: #fbf8ec;
  color: #ffffff;
  transform: translateY(-1px);
}

/* Bubble Tin Nhắn */
.aichat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  font-size: 13px;
  line-height: 1.45;
  animation: aichat-msg-fadeIn 0.25s ease-out;
}

@keyframes aichat-msg-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.aichat-msg.bot {
  align-self: flex-start;
}

.aichat-msg.user {
  align-self: flex-end;
}

.aichat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  word-wrap: break-word;
}

.aichat-msg.bot .aichat-bubble {
  background: rgba(255, 255, 255, 0.1);
  color: #fbf8ec;
  border: 1px solid rgba(251, 248, 236, 0.2);
  border-top-left-radius: 4px;
}

.aichat-msg.user .aichat-bubble {
  background: rgba(50, 90, 70, 0.85);
  color: #ffffff;
  border: 1px solid var(--default-menu-border, #fbf8ec);
  border-top-right-radius: 4px;
}

.aichat-time {
  font-size: 10px;
  color: rgba(251, 248, 236, 0.5);
  margin-top: 3px;
}

.aichat-msg.bot .aichat-time {
  align-self: flex-start;
}

.aichat-msg.user .aichat-time {
  align-self: flex-end;
}

/* Các nút hành động đính kèm trong tin nhắn bot */
.aichat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.aichat-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(251, 248, 236, 0.15);
  border: 1px solid rgba(251, 248, 236, 0.4);
  color: #fbf8ec;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.aichat-action-btn:hover {
  background: var(--default-menu-color, #324b3c);
  border-color: #ffffff;
  color: #ffffff;
}

.aichat-teleport-btn {
  background: rgba(251, 248, 236, 0.18);
  border: 1px solid var(--default-menu-border, #fbf8ec);
  color: #fbf8ec;
  box-shadow: 0 0 6px rgba(251, 248, 236, 0.2);
}

.aichat-teleport-btn:hover {
  background: #fbf8ec;
  color: #121c16;
  border-color: #ffffff;
  box-shadow: 0 0 12px rgba(251, 248, 236, 0.6);
  transform: translateY(-1px);
}


/* Hiệu ứng gõ phím AI (Typing indicator) */
.aichat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  width: fit-content;
  margin-bottom: 5px;
}

.aichat-typing-dot {
  width: 6px;
  height: 6px;
  background-color: rgba(251, 248, 236, 0.7);
  border-radius: 50%;
  animation: aichat-bounce 1.4s infinite ease-in-out both;
}

.aichat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.aichat-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes aichat-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* Khung Nhập Liệu (Input Footer) */
.aichat-footer {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid rgba(251, 248, 236, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.aichat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(251, 248, 236, 0.25);
  border-radius: 20px;
  padding: 8px 14px;
  color: #ffffff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.aichat-input::placeholder {
  color: rgba(251, 248, 236, 0.5);
}

.aichat-input:focus {
  border-color: #fbf8ec;
  background: rgba(255, 255, 255, 0.12);
}

.aichat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--default-menu-color, rgba(50, 75, 60, 0.8));
  border: 1px solid var(--default-menu-border, #fbf8ec);
  color: #fbf8ec;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.aichat-send-btn:hover {
  transform: scale(1.08);
  background: rgba(60, 95, 75, 0.95);
}

.aichat-send-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-left: 2px;
}

/* ----------------------------------------------------------------------
   3. RESPONSIVE CHO MÀN HÌNH NHỎ (MOBILE & TABLET)
   ---------------------------------------------------------------------- */
@media screen and (max-width: 768px) {
  #aichat-btn {
    top: 15px;
    right: 68px; /* Kế bên nút dịch (right: 15px, width 44px) */
    width: 44px;
    height: 44px;
  }

  #aichat-btn svg {
    width: 22px;
    height: 22px;
  }

  #aichat-popup {
    top: 68px;
    right: 15px;
    width: calc(100vw - 30px);
    max-width: 360px;
    height: 480px;
  }
}
