/* ===== VietSoftware Chatbot Widget ===== */
.vs-chatbot-toggle {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 24px rgba(99,102,241,0.5);
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  animation: chatbot-pulse 3s ease-in-out infinite;
}
.vs-chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 32px rgba(99,102,241,0.6);
}
.vs-chatbot-toggle svg { width: 28px; height: 28px; fill: #fff; transition: all 0.3s; }
.vs-chatbot-toggle.active svg.icon-chat { display: none; }
.vs-chatbot-toggle:not(.active) svg.icon-close { display: none; }

@keyframes chatbot-pulse {
  0%,100% { box-shadow: 0 6px 24px rgba(99,102,241,0.5); }
  50% { box-shadow: 0 6px 24px rgba(99,102,241,0.3), 0 0 0 12px rgba(99,102,241,0.1); }
}
.vs-chatbot-toggle.active { animation: none; }

/* Chat Window */
.vs-chatbot-window {
  position: fixed; bottom: 100px; right: 28px; z-index: 9998;
  width: 380px; max-height: 560px; border-radius: 20px;
  background: #0d0d24;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
  transform: scale(0.8) translateY(20px); opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
  transform-origin: bottom right;
}
.vs-chatbot-window.open {
  transform: scale(1) translateY(0); opacity: 1;
  pointer-events: auto;
}

/* Header */
.vs-chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(6,182,212,0.08));
  border-bottom: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px 20px 0 0;
}
.vs-chat-avatar {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.vs-chat-header-info h4 {
  font-size: 0.95rem; color: #f1f5f9; margin: 0; font-weight: 600;
}
.vs-chat-header-info p {
  font-size: 0.75rem; color: #22d3ee; margin: 0;
  display: flex; align-items: center; gap: 4px;
}
.vs-chat-header-info p::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: #22c55e; animation: blink-dot 2s infinite;
}
@keyframes blink-dot { 0%,100%{opacity:1}50%{opacity:0.4} }

/* Messages */
.vs-chat-messages {
  flex: 1; overflow-y: auto; padding: 20px 16px;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 300px; max-height: 360px;
  scroll-behavior: smooth;
}
.vs-chat-messages::-webkit-scrollbar { width: 4px; }
.vs-chat-messages::-webkit-scrollbar-track { background: transparent; }
.vs-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.vs-msg {
  max-width: 85%; padding: 12px 16px;
  font-size: 0.88rem; line-height: 1.55;
  animation: msg-in 0.3s ease;
  word-wrap: break-word;
}
@keyframes msg-in {
  from { opacity:0; transform: translateY(8px); }
  to { opacity:1; transform: translateY(0); }
}

.vs-msg.bot {
  align-self: flex-start;
  background: rgba(255,255,255,0.06);
  border-radius: 4px 16px 16px 16px;
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.05);
}
.vs-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border-radius: 16px 4px 16px 16px;
  color: #fff;
}

/* Typing indicator */
.vs-typing {
  display: flex; gap: 4px; padding: 12px 16px; align-self: flex-start;
}
.vs-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,0.3);
  animation: typing-bounce 1.4s ease-in-out infinite;
}
.vs-typing span:nth-child(2) { animation-delay: 0.2s; }
.vs-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%,60%,100% { transform: translateY(0); opacity:0.4; }
  30% { transform: translateY(-6px); opacity:1; }
}

/* Input */
.vs-chat-input {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.2);
  border-radius: 0 0 20px 20px;
}
.vs-chat-input input {
  flex: 1; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; padding: 10px 16px;
  color: #e2e8f0; font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  outline: none; transition: all 0.3s;
}
.vs-chat-input input::placeholder { color: rgba(255,255,255,0.3); }
.vs-chat-input input:focus { border-color: rgba(99,102,241,0.5); }

.vs-chat-send {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  border: none; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: all 0.3s; flex-shrink: 0;
}
.vs-chat-send:hover { transform: scale(1.08); }
.vs-chat-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.vs-chat-send svg { width: 18px; height: 18px; fill: #fff; }

/* Welcome */
.vs-chat-welcome {
  text-align: center; padding: 20px 12px; color: #94a3b8;
}
.vs-chat-welcome .welcome-icon {
  font-size: 2.5rem; margin-bottom: 8px; display: block;
}
.vs-chat-welcome h4 { color: #f1f5f9; margin-bottom: 6px; font-size: 1rem; }
.vs-chat-welcome p { font-size: 0.82rem; line-height: 1.5; }

.vs-quick-actions {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  padding: 0 16px 12px;
}
.vs-quick-btn {
  padding: 6px 14px; border-radius: 20px; font-size: 0.78rem;
  background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.2);
  color: #818cf8; cursor: pointer; transition: all 0.3s;
  font-family: 'Inter', sans-serif;
}
.vs-quick-btn:hover {
  background: rgba(99,102,241,0.2); border-color: rgba(99,102,241,0.4);
}

/* Responsive - Tablets */
@media (max-width: 768px) {
  .vs-chatbot-window {
    width: calc(100vw - 32px); right: 16px; bottom: 96px;
    max-height: calc(100vh - 130px);
    border-radius: 16px;
  }
  .vs-chatbot-toggle { bottom: 20px; right: 16px; width: 56px; height: 56px; }
  .vs-chatbot-toggle svg { width: 24px; height: 24px; }
  .vs-chat-header { padding: 14px 16px; }
  .vs-chat-messages { padding: 16px 12px; min-height: 250px; max-height: calc(100vh - 300px); }
  .vs-msg { max-width: 88%; font-size: 0.85rem; padding: 10px 14px; }
  .vs-chat-input { padding: 12px; }
  .vs-chat-input input { padding: 10px 14px; font-size: 0.85rem; }
  .vs-chat-send { width: 36px; height: 36px; }
  .vs-quick-btn { font-size: 0.75rem; padding: 5px 12px; }
}

/* Responsive - Small phones */
@media (max-width: 480px) {
  .vs-chatbot-window {
    width: calc(100vw - 16px); right: 8px; bottom: 84px;
    max-height: calc(100vh - 100px);
    border-radius: 14px;
  }
  .vs-chatbot-toggle { bottom: 16px; right: 12px; width: 52px; height: 52px; }
  .vs-chat-avatar { width: 34px; height: 34px; font-size: 1rem; }
  .vs-chat-header-info h4 { font-size: 0.88rem; }
  .vs-chat-messages { min-height: 200px; gap: 10px; }
  .vs-msg { max-width: 90%; padding: 10px 12px; font-size: 0.82rem; }
  .vs-chat-welcome .welcome-icon { font-size: 2rem; }
  .vs-chat-welcome h4 { font-size: 0.9rem; }
  .vs-chat-welcome p { font-size: 0.78rem; }
  .vs-quick-actions { gap: 4px; padding: 0 12px 10px; }
  .vs-quick-btn { font-size: 0.72rem; padding: 4px 10px; }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .vs-chatbot-window {
    bottom: 8px; max-height: calc(100vh - 16px);
    right: 70px;
  }
  .vs-chatbot-toggle { bottom: 8px; right: 8px; width: 48px; height: 48px; }
  .vs-chat-messages { min-height: 120px; max-height: 200px; }
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .vs-chatbot-toggle {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .vs-chat-input {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

