/* ==========================================================================
   DELTA TRAVEL - AI CHATBOT WIDGET STYLES (chatbot.css)
   ========================================================================== */

/* 1. Nút bong bóng kích hoạt Chatbot nổi (Floating Chat Launcher) */
.chatbot-launcher {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1040;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: var(--transition);
}

.chatbot-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #05bfdb 0%, #0a4d68 100%);
  border: 2px solid #ffffff;
  color: #ffffff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(5, 191, 219, 0.45);
  transition: var(--transition);
  position: relative;
  outline: none;
}

.chatbot-btn:hover {
  transform: scale(1.08) rotate(5deg);
  box-shadow: 0 14px 30px rgba(5, 191, 219, 0.6);
  color: #ffffff;
}

.chatbot-pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #05bfdb;
  animation: chatbotPulse 2.4s infinite cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: none;
}

@keyframes chatbotPulse {
  0% {
    transform: scale(0.95);
    opacity: 0.9;
  }
  70% {
    transform: scale(1.5);
    opacity: 0;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

.chatbot-online-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #10b981;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

/* 2. Cửa sổ Chatbot chính (Chat Window Box) */
.chatbot-window {
  position: fixed;
  bottom: 88px;
  right: 1.5rem;
  width: min(520px, calc(100vw - 2rem));
  max-width: calc(100vw - 2rem);
  height: min(680px, calc(100vh - 108px));
  max-height: calc(100vh - 108px);
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 25px 50px rgba(10, 77, 104, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1060;
  border: 1px solid rgba(10, 77, 104, 0.12);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

.chatbot-window.hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.85) translateY(20px);
  pointer-events: none;
}

/* Header của Chatbot */
.chatbot-header {
  background: linear-gradient(135deg, #0a4d68 0%, #088395 100%);
  color: #ffffff;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chatbot-avatar-header {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: #ffffff;
  position: relative;
}

.chatbot-avatar-header .status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  background: #10b981;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.chatbot-title-box h6 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chatbot-title-box .badge-model {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.chatbot-title-box small {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chatbot-header-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}

.chatbot-header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

/* 3. Khung hiển thị Tin nhắn (Chat Body) */
.chatbot-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  background: #f8fafc;
  scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
  width: 5px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(10, 77, 104, 0.18);
  border-radius: 10px;
}

/* Bong bóng tin nhắn người dùng & Bot */
.chat-msg {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  max-width: 94%;
  min-width: 0;
  animation: chatMsgFadeIn 0.25s ease-out;
}

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

.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

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

.chat-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.chat-msg.bot .chat-msg-avatar {
  background: #000000;
  color: #ffffff;
  border: 1px solid #000000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.chat-msg.user .chat-msg-avatar {
  background: #000000;
  color: #ffffff;
  font-weight: 700;
  border: 1px solid #000000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.chat-msg-avatar-real {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #cbd5e1;
  display: block;
}

.chat-msg-bubble {
  padding: 0.85rem 1.05rem;
  font-size: 0.92rem;
  line-height: 1.6;
  border-radius: 14px;
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-msg.user .chat-msg-bubble {
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #0f172a;
  border-bottom-right-radius: 3px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
}

.chat-msg.bot .chat-msg-bubble {
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 3px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

.chat-msg-time {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 0.35rem;
  display: block;
}

.chat-msg.user .chat-msg-time {
  text-align: right;
  color: rgba(255, 255, 255, 0.75);
}

/* Định dạng nội dung tin nhắn bot */
.chat-msg-bubble p:last-child {
  margin-bottom: 0;
}

.chat-msg-bubble ul,
.chat-msg-bubble ol {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.chat-msg-bubble li {
  margin-bottom: 0.25rem;
}

.chat-msg-bubble strong {
  color: #000000;
}

.chat-msg.user .chat-msg-bubble strong {
  color: #000000;
  text-decoration: underline;
}

/* Thẻ highlight thông tin tour / voucher trong chat */
.ai-tag {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.8rem;
  font-family: monospace;
}

.ai-tag-voucher {
  background: rgba(255, 107, 53, 0.15);
  color: #d9480f;
  border: 1px dashed #d9480f;
}

.ai-tag-tour {
  background: rgba(10, 77, 104, 0.12);
  color: var(--primary-color);
}

.ai-tour-card-mini {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  margin-top: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  box-shadow: var(--shadow-sm);
}

.ai-tour-card-mini .tour-info {
  font-size: 0.82rem;
}

.ai-tour-card-mini .tour-title {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.15rem;
}

.ai-tour-card-mini .tour-price {
  font-weight: 800;
  color: var(--accent-color);
}

.ai-tour-card-mini .btn-action {
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
}

/* Khung cảnh báo khi chưa có API Key */
.ai-api-warning {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  color: #92400e;
  font-size: 0.85rem;
  line-height: 1.5;
}

.ai-api-warning strong {
  color: #b45309;
}

.ai-api-warning code {
  background: #fef3c7;
  color: #b45309;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.82rem;
}

/* Hiệu ứng 3 dấu chấm nhảy (Typing Indicator) */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.35rem 0.5rem;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--secondary-color);
  animation: typingBounce 1.3s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
  animation-delay: 0s;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1.1);
    opacity: 1;
  }
}

/* 4. Khung gợi ý câu hỏi nhanh (Quick Replies) */
.chatbot-quick-replies {
  padding: 0.5rem 1rem 0.4rem;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  flex-shrink: 0;
}

.chatbot-quick-replies::-webkit-scrollbar {
  display: none;
}

.quick-reply-btn {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.quick-reply-btn:hover {
  background: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

/* 5. Khung nhập liệu tin nhắn (Chat Footer) */
.chatbot-footer {
  padding: 0.75rem 1rem;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.chatbot-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-light);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.3rem 0.4rem 0.3rem 1rem;
  transition: var(--transition);
}

.chatbot-input-group:focus-within {
  border-color: var(--secondary-color);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(8, 131, 149, 0.15);
}

.chatbot-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  outline: none;
  color: var(--text-main);
  padding: 0.35rem 0;
}

.chatbot-input::placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.chatbot-send-btn {
  width: auto;
  min-width: 40px;
  height: 38px;
  padding: 0 0.85rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.chatbot-send-btn:hover {
  background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(8, 131, 149, 0.35);
}

.chatbot-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chatbot-footnote {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  margin-bottom: 0;
}

/* 7. Card gợi ý tour tương tác trong hội thoại AI */
.chat-suggested-tours {
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px dashed rgba(0, 0, 0, 0.12);
}

.chat-tour-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.65rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.chat-tour-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.large-ai-topic-btn {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.large-ai-topic-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateX(2px);
}

/* ==========================================================================
   8. AI CONCIERGE TOÀN MÀN HÌNH - ELEGANT 5-STAR HOSPITALITY CONCIERGE
   Thuần nền sáng trang nhã, không đè mất thanh điều hướng tab bar,
   tinh tế lịch sự chuẩn dịch vụ 5 sao, không lố AI hay khối đen cứng nhắc.
   ========================================================================== */
.ai-concierge-fullscreen-overlay {
  position: fixed;
  top: 108px;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: calc(100vh - 108px);
  z-index: 9999;
  background: #ffffff;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
  border-top: 1px solid #e2e8f0;
}

@media (max-width: 991px) {
  .ai-concierge-fullscreen-overlay {
    top: 72px;
    height: calc(100vh - 72px);
  }
}

.ai-fullscreen-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ai-fullscreen-logo-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.15);
}

.ai-fullscreen-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  line-height: 1.2;
}

.ai-fullscreen-tag {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.05em;
}

.ai-fullscreen-sub {
  font-size: 12px;
  color: #64748b;
  margin: 2px 0 0;
}

.btn-ai-paper-action {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-weight: 600;
  font-size: 12px;
  padding: 0.42rem 0.95rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ai-paper-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-ai-paper-close {
  background: #0f172a;
  border: 1px solid #0f172a;
  color: #ffffff;
  font-weight: 600;
  font-size: 12px;
  padding: 0.42rem 1.15rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ai-paper-close:hover {
  background: #1e293b;
  border-color: #1e293b;
  transform: translateY(-1px);
}

.ai-fullscreen-body {
  display: flex;
  flex: 1;
  min-height: 0;
  background: #ffffff;
}

.ai-fullscreen-sidebar {
  width: 320px;
  max-width: 32%;
  border-right: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  overflow-y: auto;
  gap: 1rem;
  flex-shrink: 0;
}

.ai-sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.ai-topics-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ai-topic-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.ai-topic-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  background: #ffffff;
}

.ai-topic-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 2px;
}

.ai-topic-desc {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

.ai-sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.ai-fullscreen-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #ffffff;
}

.ai-chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: #ffffff;
}

.ai-chat-input-bar {
  border-top: 1px solid #e2e8f0;
  padding: 1.1rem 2.5rem;
  background: #ffffff;
  flex-shrink: 0;
}

.ai-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.ai-paper-input {
  flex: 1;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 9999px;
  padding: 0.75rem 1.35rem;
  font-size: 14px;
  color: #0f172a;
  outline: none;
  transition: all 0.2s ease;
}

.ai-paper-input:focus {
  background: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.ai-paper-send-btn {
  background: #0f172a;
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  padding: 0.75rem 1.65rem;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-paper-send-btn:hover {
  background: #1e293b;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

@media (max-width: 991px) {
  .ai-fullscreen-sidebar {
    display: none;
  }
  .ai-fullscreen-header {
    padding: 0.75rem 1rem;
  }
  .ai-chat-messages-container {
    padding: 1rem;
  }
  .ai-chat-input-bar {
    padding: 0.75rem 1rem;
  }
}

/* Cửa sổ chat nhỏ trên điện thoại: cân đối 2 bên và không tràn màn hình */
@media (max-width: 575.98px) {
  .chatbot-window {
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: none;
    height: min(74vh, 560px);
    bottom: 84px;
  }
  .chatbot-launcher {
    right: 0.85rem;
    bottom: 1rem;
  }
  .chatbot-header {
    padding: 0.75rem 0.9rem;
  }
  .chatbot-title-box h6 {
    font-size: 0.9rem;
  }
  .chatbot-header .chatbot-header-btn {
    width: 32px;
    height: 32px;
  }
}
