/* FAQ mini widget */

.faq-mini-widget {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9999;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Nút tròn mở/đóng */
.faqmw-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 24px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  background: #2563eb; /* xanh primary */
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.faqmw-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.28);
  background: #1d4ed8;
}

/* Panel */
.faqmw-panel {
  position: absolute;
  bottom: 60px;
  right: 0;
  width: 340px;
  max-height: 540px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(15,23,42,0.45);
  display: none; /* ẩn mặc định */
  flex-direction: column;
  overflow: hidden;
}

.faq-mini-widget.is-open .faqmw-panel {
  display: flex;
}

/* Header */
.faqmw-header {
  padding: 10px 12px;
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}

.faqmw-title {
  font-size: 15px;
  font-weight: 600;
}

.faqmw-subtitle {
  font-size: 11px;
  opacity: 0.9;
}

.faqmw-close {
  position: absolute;
  top: 4px;
  right: 6px;
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 18px;
  cursor: pointer;
}

/* Body */
.faqmw-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.faqmw-messages {
  flex: 1;
  min-height: 160px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Bubbles */
.faqmw-msg {
  margin-bottom: 6px;
  display: flex;
}

.faqmw-msg-user {
  justify-content: flex-end;
}

.faqmw-msg-bot {
  justify-content: flex-start;
}

.faqmw-msg-inner {
  max-width: 80%;
  padding: 6px 8px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.35;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.faqmw-msg-user .faqmw-msg-inner {
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.faqmw-msg-bot .faqmw-msg-inner {
  background: #e5e7eb;
  color: #111827;
  border-bottom-left-radius: 4px;
}

.faqmw-msg-bot .faqmw-msg-inner a {
  color: #1d4ed8;
  text-decoration: underline;
}

/* Typing indicator */
.faqmw-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #9ca3af;
  margin-right: 3px;
  animation: faqmw-bounce 1s infinite alternate;
}

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

@keyframes faqmw-bounce {
  from { transform: translateY(0); opacity: 0.6; }
  to { transform: translateY(-3px); opacity: 1; }
}

/* Suggestions */
.faqmw-suggestions {
  border-radius: 10px;
  background: #f3f4f6;
  padding: 6px 8px;
}

.faqmw-sug-title {
  font-size: 11px;
  color: #4b5563;
  margin-bottom: 4px;
}

.faqmw-sug-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.faqmw-suggestion {
  border: none;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  background: #e5e7eb;
  color: #111827;
  cursor: pointer;
  white-space: nowrap;
}

.faqmw-suggestion:hover {
  background: #d1d5db;
}

/* Footer */
.faqmw-footer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 10px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.faqmw-input {
  flex: 1;
  resize: none;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  padding: 5px 8px;
  font-size: 13px;
  max-height: 60px;
  outline: none;
}

.faqmw-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37,99,235,0.25);
}

.faqmw-send {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #2563eb;
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.faqmw-send:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Escalate */
.faqmw-escalate {
  display: none; /* chỉ hiện khi bot không tìm thấy */
  padding: 6px 10px 10px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.faqmw-escalate-text {
  font-size: 11px;
  color: #4b5563;
  margin-bottom: 4px;
}

.faqmw-escalate-btn {
  width: 100%;
  border-radius: 999px;
  border: 1px solid #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.faqmw-escalate-btn:hover {
  background: #dbeafe;
}

/* Mobile: để widget không quá to */
@media (max-width: 480px) {
  .faqmw-panel {
    width: calc(100vw - 20px);
    right: -4px;
  }
}
