/* ======== پایه ======== */
.vn-chat-widget {
  position: fixed;
  bottom: 16px;
  inset-inline-end: 16px;
  z-index: 9999;
  font-family: "IRANYekan", "Vazirmatn", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e5e7eb;
}

/* چیدمان چپ/راست */
.vn-chat-pos-left {
  inset-inline-end: auto;
  inset-inline-start: 16px;
}

/* دکمه لانچر */
.vn-chat-launcher {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #fff;
  border: none;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.7);
  cursor: pointer;
  font-size: 0.9rem;
}

.vn-chat-launcher-icon {
  font-size: 1.1rem;
}

.vn-chat-launcher-status {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  background: rgba(15, 23, 42, 0.7);
}

/* پنجره چت */
.vn-chat-window {
  position: absolute;
  bottom: 60px;
  inset-inline-end: 0;
  width: 320px;
  max-height: 520px;
  display: none;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.96);
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: 0 20px 55px rgba(15, 23, 42, 0.9);
  overflow: hidden;
  backdrop-filter: blur(18px);
}

/* هدر */
.vn-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: radial-gradient(circle at top, #1e293b, #020617 70%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
}

.vn-chat-header-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vn-chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(79, 70, 229, 0.8);
}

.vn-chat-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.vn-chat-subtitle {
  font-size: 0.75rem;
  color: #9ca3af;
}

.vn-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.vn-chat-indicator {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  background: rgba(22, 163, 74, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.8);
  color: #bbf7d0;
}

.vn-chat-close {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  font-size: 1.1rem;
}

/* نوار بالا */
.vn-chat-topbar {
  padding: 6px 10px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.8);
  font-size: 0.7rem;
  color: #9ca3af;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* پیام‌ها */
.vn-chat-messages {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  font-size: 0.85rem;
}

.vn-chat-messages::-webkit-scrollbar {
  width: 5px;
}
.vn-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(75, 85, 99, 0.8);
  border-radius: 999px;
}

/* حباب پیام */
.vn-msg {
  max-width: 90%;
  margin-bottom: 6px;
  padding: 8px 10px;
  border-radius: 14px;
  line-height: 1.4;
}

.vn-msg-operator {
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.6);
  align-self: flex-start;
}

.vn-msg-user {
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  align-self: flex-end;
}

.vn-msg-meta {
  display: block;
  margin-top: 2px;
  font-size: 0.7rem;
  opacity: 0.7;
}

/* نوار ابزار */
.vn-chat-toolbar {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid rgba(31, 41, 55, 0.9);
  border-bottom: 1px solid rgba(31, 41, 55, 0.9);
}

.vn-chat-btn {
  flex: 1;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.96);
  color: #e5e7eb;
  padding: 5px 8px;
  font-size: 0.75rem;
  cursor: pointer;
}

/* پیام‌های آماده */
.vn-chat-quick-replies,
.vn-chat-file-panel {
  position: absolute;
  inset-inline: 10px;
  bottom: 76px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.9);
  display: none;
  flex-direction: column;
}

.vn-chat-quick-header,
.vn-chat-file-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.9);
  font-size: 0.8rem;
}

.vn-chat-quick-header button,
.vn-chat-file-header button {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
}

.vn-chat-quick-list {
  list-style: none;
  margin: 0;
  padding: 6px 10px 8px;
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.78rem;
}
.vn-chat-quick-list li {
  padding: 6px 6px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
}
.vn-chat-quick-list li:hover {
  border-color: rgba(79, 70, 229, 0.7);
  background: rgba(79, 70, 229, 0.15);
}

/* فایل پنل */
.vn-chat-file-body {
  padding: 10px;
  font-size: 0.78rem;
  color: #9ca3af;
}
.vn-chat-file-body input {
  margin-top: 8px;
  width: 100%;
}

/* فوتر */
.vn-chat-footer {
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vn-chat-typing-indicator {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: #9ca3af;
}

.vn-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #9ca3af;
  animation: vn-bounce 1s infinite ease-in-out;
}
.vn-dot:nth-child(2) {
  animation-delay: 0.1s;
}
.vn-dot:nth-child(3) {
  animation-delay: 0.2s;
}

@keyframes vn-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-3px); opacity: 1; }
}

.vn-chat-form {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.vn-chat-input {
  flex: 1;
  resize: none;
  max-height: 80px;
  border-radius: 12px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  padding: 6px 8px;
  font-size: 0.82rem;
}

.vn-chat-send-btn {
  border-radius: 999px;
  padding: 6px 10px;
  border: none;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #fff;
  cursor: pointer;
  font-size: 0.78rem;
}

.vn-chat-note {
  font-size: 0.7rem;
  color: #6b7280;
}

/* پیش‌نمایش پیام */
.vn-chat-preview {
  position: absolute;
  bottom: 72px;
  inset-inline-end: 0;
  width: 260px;
  display: none;
  padding: 8px;
  background: rgba(15, 23, 42, 0.98);
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
}

.vn-chat-preview-body {
  font-size: 0.78rem;
}
.vn-chat-preview-title {
  font-weight: 600;
  margin-bottom: 4px;
}
.vn-chat-preview-text {
  color: #9ca3af;
}

.vn-chat-preview-close {
  position: absolute;
  top: 4px;
  inset-inline-start: 8px;
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
}

/* نمایش */
.vn-chat-window.is-open {
  display: flex;
}
.vn-chat-preview.is-visible {
  display: block;
}

/* موبایل */
@media (max-width: 640px) {
  .vn-chat-widget {
    inset-inline: 12px;
    bottom: 12px;
  }
  .vn-chat-window {
    width: 100vw;
    max-width: 100%;
    inset-inline: 0;
    bottom: 64px;
  }
  .vn-chat-preview {
    width: 90vw;
  }
}

/* لینک واتساپ و تلگرام در فوتر چت */
.vn-chat-external {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.vn-chat-external-btn {
  flex: 1;
  display: inline-block;
  text-align: center;
  padding: 5px 6px;
  border-radius: 999px;
  font-size: 0.75rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.vn-chat-wa {
  background: #16a34a;
  color: #fff;
}

.vn-chat-tg {
  background: #0ea5e9;
  color: #fff;
}
