
/* ویجت چت آنلاین zqz — سمت راست، واکنش‌گرا */
.zqz-chat-root{position:fixed;z-index:99990;font-family:inherit}
.zqz-chat-root *{box-sizing:border-box}

.zqz-chat-fab{
  position:fixed;bottom:22px;right:22px;left:auto;
  width:60px;height:60px;border-radius:50%;border:0;cursor:pointer;
  background:linear-gradient(135deg,#4f46e5,#7c3aed);color:#fff;
  box-shadow:0 12px 32px rgba(79,70,229,.42);
  display:flex;align-items:center;justify-content:center;
  transition:transform .18s ease,box-shadow .18s ease;
}
.zqz-chat-fab:hover{transform:scale(1.06);box-shadow:0 16px 36px rgba(79,70,229,.5)}
.zqz-chat-fab svg{width:26px;height:26px}
.zqz-chat-fab .zqz-chat-dot{
  position:absolute;top:8px;left:8px;width:12px;height:12px;border-radius:50%;
  background:#22c55e;border:2px solid #fff;display:none;
}
.zqz-chat-fab.has-unread .zqz-chat-dot{display:block}

/* اشاره خودکار به چت */
.zqz-chat-nudge{
  position:fixed;bottom:92px;right:22px;left:auto;
  max-width:min(280px,calc(100vw - 90px));
  background:#fff;color:#0f172a;
  border:1px solid rgba(79,70,229,.2);
  border-radius:16px;padding:12px 14px 12px 12px;
  box-shadow:0 16px 40px rgba(15,23,42,.16);
  font-size:13px;line-height:1.7;font-weight:600;
  display:none;z-index:99991;direction:rtl;cursor:pointer;
  animation:zqzNudgeIn .45s ease;
}
.zqz-chat-nudge.is-on{display:block}
.zqz-chat-nudge b{color:#4f46e5;font-weight:800}
.zqz-chat-nudge-x{
  position:absolute;top:6px;left:8px;border:0;background:transparent;
  color:#94a3b8;cursor:pointer;font-size:16px;line-height:1;padding:2px 6px;
}
@keyframes zqzNudgeIn{
  from{opacity:0;transform:translateY(10px) scale(.96)}
  to{opacity:1;transform:translateY(0) scale(1)}
}
.zqz-chat-fab.zqz-pulse{
  animation:zqzFabPulse 1.2s ease 3;
}
@keyframes zqzFabPulse{
  0%,100%{box-shadow:0 12px 32px rgba(79,70,229,.42)}
  50%{box-shadow:0 12px 32px rgba(79,70,229,.42),0 0 0 12px rgba(79,70,229,.18)}
}

.zqz-chat-panel{
  position:fixed;bottom:92px;right:22px;left:auto;
  width:min(370px,calc(100vw - 24px));
  height:min(540px,calc(100vh - 110px));
  background:var(--card,#fff);
  color:var(--text,#0f172a);
  border:1px solid var(--border,#e2e8f0);
  border-radius:18px;
  box-shadow:0 22px 55px rgba(15,23,42,.18);
  display:none;flex-direction:column;overflow:hidden;
  direction:rtl;
}
.zqz-chat-root.is-open .zqz-chat-panel{display:flex}
.zqz-chat-root.is-open .zqz-chat-nudge{display:none !important}

.zqz-chat-head{
  padding:14px 16px;display:flex;align-items:center;justify-content:space-between;gap:8px;
  background:linear-gradient(135deg,#4f46e5,#7c3aed);color:#fff;
}
.zqz-chat-head strong{font-size:14px;font-weight:800}
.zqz-chat-head .zqz-chat-status{display:block;font-size:11.5px;opacity:.95;font-weight:600;margin-top:3px}
.zqz-chat-head .zqz-chat-status.online::before,
.zqz-chat-head .zqz-chat-status.offline::before{
  content:'';display:inline-block;width:8px;height:8px;border-radius:50%;margin-left:6px;vertical-align:middle;
}
.zqz-chat-head .zqz-chat-status.online::before{background:#4ade80}
.zqz-chat-head .zqz-chat-status.offline::before{background:#fbbf24}
.zqz-chat-close{
  border:0;background:rgba(255,255,255,.18);color:#fff;width:32px;height:32px;
  border-radius:10px;cursor:pointer;font-size:18px;line-height:1;
}
.zqz-chat-body{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:8px;background:var(--bg,#f8fafc)}
.zqz-chat-msg{
  max-width:88%;padding:9px 12px;border-radius:14px;font-size:13.5px;line-height:1.65;
  white-space:pre-wrap;word-break:break-word;
}
.zqz-chat-msg.visitor{align-self:flex-end;background:linear-gradient(135deg,#4f46e5,#7c3aed);color:#fff;border-bottom-left-radius:4px}
.zqz-chat-msg.admin{align-self:flex-start;background:var(--card,#fff);border:1px solid var(--border,#e2e8f0);border-bottom-right-radius:4px}
.zqz-chat-msg time{display:block;font-size:10px;opacity:.7;margin-top:4px}

.zqz-chat-foot{padding:10px;border-top:1px solid var(--border,#e2e8f0);background:var(--card,#fff)}
.zqz-chat-fields{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:8px}
@media(max-width:400px){.zqz-chat-fields{grid-template-columns:1fr}}
.zqz-chat-fields input{
  width:100%;padding:8px 10px;border-radius:10px;border:1px solid var(--border,#e2e8f0);
  font-family:inherit;font-size:12.5px;background:var(--bg,#f8fafc);color:inherit;
}
.zqz-chat-offline-note{
  font-size:11.5px;color:#b45309;background:#fffbeb;border:1px solid #fde68a;
  border-radius:10px;padding:8px 10px;margin-bottom:8px;line-height:1.6;display:none;
}
.zqz-chat-offline-note.is-on{display:block}
.zqz-chat-row{display:flex;gap:8px;align-items:flex-end}
.zqz-chat-input{
  flex:1;min-height:42px;max-height:100px;resize:none;padding:10px 12px;border-radius:12px;
  border:1px solid var(--border,#e2e8f0);font-family:inherit;font-size:13.5px;
  background:var(--bg,#f8fafc);color:inherit;
}
.zqz-chat-tools{display:flex;gap:6px;align-items:center}
.zqz-chat-emoji-btn,.zqz-chat-send{
  border:0;cursor:pointer;border-radius:12px;height:42px;font-family:inherit;
}
.zqz-chat-emoji-btn{
  width:42px;background:var(--bg,#f1f5f9);color:#0f172a;font-size:18px;
  border:1px solid var(--border,#e2e8f0);
}
.zqz-chat-send{
  padding:0 14px;background:linear-gradient(135deg,#4f46e5,#7c3aed);color:#fff;font-weight:800;font-size:13px;
}
.zqz-chat-emoji-panel{
  display:none;flex-wrap:wrap;gap:4px;padding:8px;margin-bottom:8px;
  background:var(--bg,#f8fafc);border:1px solid var(--border,#e2e8f0);border-radius:12px;
  max-height:120px;overflow-y:auto;
}
.zqz-chat-emoji-panel.is-on{display:flex}
.zqz-chat-emoji-panel button{
  border:0;background:transparent;font-size:20px;cursor:pointer;width:34px;height:34px;
  border-radius:8px;line-height:1;
}
.zqz-chat-emoji-panel button:hover{background:rgba(79,70,229,.1)}
.zqz-chat-hint{font-size:11px;color:var(--text-muted,#64748b);margin:6px 2px 0;text-align:center}

@media(max-width:480px){
  .zqz-chat-fab{bottom:16px;right:16px;width:56px;height:56px}
  .zqz-chat-nudge{right:16px;bottom:82px}
  .zqz-chat-panel{right:10px;left:10px;width:auto;bottom:78px;height:min(72vh,580px)}
}

.zqz-chat-meta{display:flex;align-items:center;justify-content:flex-end;gap:6px;margin-top:4px}
.zqz-chat-msg.admin .zqz-chat-meta{justify-content:flex-start}
.zqz-chat-meta time{font-size:10px;opacity:.75}
.zqz-ticks{display:inline-flex;align-items:center;opacity:.75;color:inherit}
.zqz-ticks.seen{opacity:1;color:#a5b4fc}
.zqz-chat-msg.visitor .zqz-ticks.seen{color:#c7d2fe}
.zqz-chat-emoji-btn{display:inline-flex;align-items:center;justify-content:center}
.zqz-chat-emoji-btn svg{display:block}
