/* ==========================================================================
   SHOPVN - 24/7 AI CHATBOT WIDGET STYLES (NHÂN VIÊN - SHOPVN 24/7)
   Theme: Royal Blue (#1e3c72 - #2a5298) & Vibrant Orange (#f0601e)
   ========================================================================== */

/* 1. NÚT NỔI LAUNCHER */
#shopvn-chatbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #f0601e 100%);
  color: #ffffff;
  border: 3px solid #ffffff;
  box-shadow: 0 6px 24px rgba(30, 60, 114, 0.45);
  cursor: pointer;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  outline: none;
}

#shopvn-chatbot-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 30px rgba(240, 96, 30, 0.55);
}

#shopvn-chatbot-launcher .launcher-icon {
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: shopvnBounce 3s infinite;
}

@keyframes shopvnBounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
  60% { transform: translateY(-3px); }
}

/* Vòng sóng pulse tỏa sáng thu hút khách */
#shopvn-chatbot-launcher::before {
  content: "";
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  border: 2px solid #f0601e;
  opacity: 0.8;
  animation: shopvnPulse 2.2s infinite;
}

@keyframes shopvnPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.18); opacity: 0.3; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* Huy hiệu thông báo đỏ */
.shopvn-chatbot-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ea4335;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* Tooltip chào đón bay nhẹ */
.shopvn-chatbot-tooltip {
  position: absolute;
  right: 74px;
  background: #ffffff;
  color: #1e293b;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  animation: shopvnFloat 3s ease-in-out infinite;
}

.shopvn-chatbot-tooltip::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 6px solid #ffffff;
}

@keyframes shopvnFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* 2. CỬA SỔ CHATBOX CHÍNH */
#shopvn-chatbot-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 570px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
  border: 1px solid #e2e8f0;
}

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

/* HEADER CỬA SỔ CHAT */
.shopvn-chat-header {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 70%, #f0601e 100%);
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.shopvn-chat-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shopvn-chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  color: #1e3c72;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  border: 2px solid #f0601e;
  position: relative;
  flex-shrink: 0;
}

.shopvn-chat-avatar .online-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.shopvn-chat-info h6 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.shopvn-chat-status {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}

.shopvn-chat-status .status-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px #22c55e;
}

.shopvn-chat-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shopvn-chat-btn-action {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.shopvn-chat-btn-action:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  transform: scale(1.08);
}

/* BODY CHAT */
.shopvn-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
.shopvn-chat-body::-webkit-scrollbar {
  width: 5px;
}
.shopvn-chat-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* TIN NHẮN CHAT */
.shopvn-msg-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 88%;
  animation: shopvnMsgIn 0.25s ease-out;
}

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

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

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

.shopvn-msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1e3c72;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.shopvn-msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.shopvn-msg-bot .shopvn-msg-bubble {
  background: #ffffff;
  color: #1e293b;
  border-top-left-radius: 4px;
  border: 1px solid #e2e8f0;
}

.shopvn-msg-user .shopvn-msg-bubble {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: #ffffff;
  border-top-right-radius: 4px;
}

.shopvn-msg-time {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  display: block;
  text-align: right;
}

.shopvn-msg-user .shopvn-msg-time {
  color: rgba(255, 255, 255, 0.75);
}

/* Card sản phẩm trong tin nhắn bot */
.shopvn-chat-product-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 10px;
  margin-top: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.shopvn-chat-product-card:hover {
  border-color: #f0601e;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(240, 96, 30, 0.15);
}

.shopvn-chat-product-img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8fafc;
  padding: 3px;
  border: 1px solid #f1f5f9;
  flex-shrink: 0;
}

.shopvn-chat-product-info {
  flex: 1;
  min-width: 0;
}

.shopvn-chat-product-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 3px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shopvn-chat-product-price {
  font-size: 13px;
  font-weight: 700;
  color: #dc2626;
  margin: 0;
}

.shopvn-chat-product-old-price {
  font-size: 11px;
  color: #94a3b8;
  text-decoration: line-through;
  margin-left: 5px;
}

.shopvn-chat-product-btn {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 8px;
  background: #1e3c72;
  color: #ffffff;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

.shopvn-chat-product-btn:hover {
  background: #f0601e;
  color: #ffffff;
}

/* HỘP GỢI Ý NHANH (QUICK REPLIES) */
.shopvn-chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.shopvn-quick-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  padding: 5px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

/* TYPING INDICATOR */
.shopvn-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: #ffffff;
  border-radius: 16px;
  border-top-left-radius: 4px;
  border: 1px solid #e2e8f0;
  width: fit-content;
}

.shopvn-typing-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: shopvnDotPulse 1.4s infinite ease-in-out;
}

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

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

/* FOOTER NHẬP LIỆU */
.shopvn-chat-footer {
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.shopvn-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shopvn-chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13.5px;
  outline: none;
  transition: all 0.2s ease;
  background: #f8fafc;
}

.shopvn-chat-input:focus {
  border-color: #1e3c72;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.12);
}

.shopvn-chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3c72 0%, #f0601e 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.shopvn-chat-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 2px 10px rgba(240, 96, 30, 0.4);
}

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

.shopvn-chat-bottom-note {
  font-size: 10.5px;
  color: #64748b;
  text-align: center;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* RESPONSIVE TRÊN ĐIỆN THOẠI DI ĐỘNG */
@media (max-width: 576px) {
  #shopvn-chatbot-launcher {
    bottom: 16px;
    right: 16px;
    width: 54px;
    height: 54px;
  }
  #shopvn-chatbot-launcher .launcher-icon {
    font-size: 22px;
  }
  .shopvn-chatbot-tooltip {
    display: none;
  }
  #shopvn-chatbot-window {
    right: 8px;
    bottom: 80px;
    width: calc(100vw - 16px);
    height: calc(100vh - 100px);
    max-height: 560px;
    border-radius: 16px;
  }
}
