/* ==========================================================================
   CSS CHO WIDGET TRỢ LÝ KỸ THUẬT AI - ÂU VI TÍNH (auvitinh.vn)
   ========================================================================== */

/* Nút bấm nổi AI (Floating Action Button) */
.avt-chat-fab {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.4), 0 8px 10px -6px rgba(37, 99, 235, 0.2);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  z-index: 45;
}

.avt-chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 28px -4px rgba(37, 99, 235, 0.5);
}

.avt-chat-fab:active {
  transform: scale(0.95);
}

/* Badge nhấp nháy trên nút FAB */
.avt-chat-badge {
  position: absolute;
  top: -8px;
  right: -6px;
  background-color: #ef4444;
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 9999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  animation: avtPulse 2s infinite;
  pointer-events: none;
}

@keyframes avtPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.08);
    opacity: 0.9;
  }
}

/* Lớp phủ mờ (Backdrop overlay) trên di động */
.avt-chat-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.avt-chat-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Cửa sổ Chat Modal */
.avt-chat-window {
  position: fixed;
  z-index: 95;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.3), 0 0 0 1px rgba(226, 232, 240, 0.8);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Desktop: Cửa sổ nổi góc dưới phải */
@media (min-width: 641px) {
  .avt-chat-window {
    right: 20px;
    bottom: 85px;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 110px);
    border-radius: 20px;
    transform: translateY(20px) scale(0.96);
  }

  .avt-chat-window.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }
}

/* Mobile: Trượt lên dạng Bottom Sheet */
@media (max-width: 640px) {
  .avt-chat-window {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 82vh;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }

  .avt-chat-window.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }
}

/* Header khung chat */
.avt-chat-header {
  background: linear-gradient(135deg, #1e40af 0%, #3730a3 100%);
  color: #ffffff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

/* Khu vực hiển thị tin nhắn */
.avt-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Bubble tin nhắn Bot */
.avt-msg-bot {
  align-self: flex-start;
  max-width: 90%;
  background-color: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-radius: 16px 16px 16px 4px;
  padding: 10px 13px;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  word-break: break-word;
}

/* Bubble tin nhắn Khách */
.avt-msg-user {
  align-self: flex-end;
  max-width: 85%;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  padding: 9px 13px;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
  word-break: break-word;
}

/* Khối Welcome Screen với 4 nút danh mục */
.avt-welcome-box {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.05);
}

.avt-cat-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #1e293b;
  font-size: 11.5px;
  font-weight: 600;
  text-align: left;
  transition: all 0.2s ease;
  cursor: pointer;
}

.avt-cat-btn:hover {
  background-color: #e0e7ff;
  border-color: #c7d2fe;
  color: #3730a3;
  transform: translateX(2px);
}

.avt-cat-btn:active {
  transform: scale(0.98);
}

/* Nút hành động tương tác cuối hướng dẫn [Đã làm được] / [Chưa được] */
.avt-action-group {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #cbd5e1;
}

.avt-action-btn {
  flex: 1;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.avt-action-btn-success {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.avt-action-btn-success:hover {
  background-color: #d1fae5;
}

.avt-action-btn-support {
  background-color: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.avt-action-btn-support:hover {
  background-color: #dbeafe;
}

/* Thẻ UltraViewer Card nổi bật */
.avt-ultraviewer-card {
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border: 1.5px solid #bfdbfe;
  border-radius: 14px;
  padding: 12px;
  margin-top: 6px;
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.08);
}

/* Hiệu ứng gõ phím đang tải (Typing indicator) */
.avt-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  width: fit-content;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.avt-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background-color: #94a3b8;
  animation: avtTyping 1.4s infinite ease-in-out both;
}

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

@keyframes avtTyping {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; background-color: #2563eb; }
}

/* Footer & ô nhập chat */
.avt-chat-footer {
  padding: 10px 12px;
  background-color: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.avt-chat-input {
  flex: 1;
  padding: 8px 12px;
  font-size: 12.5px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
  outline: none;
  transition: all 0.2s ease;
}

.avt-chat-input:focus {
  border-color: #2563eb;
  background-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.avt-chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background-color: #2563eb;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.avt-chat-send-btn:hover {
  background-color: #1d4ed8;
  transform: scale(1.05);
}

.avt-chat-send-btn:disabled {
  background-color: #94a3b8;
  cursor: not-allowed;
  transform: none;
}
