/* فونت وزیرمتن به‌صورت محلی (سبک، فقط دو وزن) — چون panel.css در صفحات
   عادی سایت بارگذاری نمی‌شود، این ویجت به فونت خودش نیاز دارد. */
@font-face{font-family:'Vazirmatn';src:url('../fonts/Vazirmatn-Regular.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap;}
@font-face{font-family:'Vazirmatn';src:url('../fonts/Vazirmatn-Bold.woff2') format('woff2');font-weight:700;font-style:normal;font-display:swap;}

/* WPTA Live Chat Widget — front-end
   نکته: چون این ویجت داخل صفحات معمولی سایت (با هر قالبی) قرار می‌گیرد،
   برخلاف پنل مدیریت نمی‌توان بقیه عناصر صفحه را مخفی کرد؛ در عوض با
   ریست‌های !important از نشتی استایل قالب جلوگیری می‌شود و موقعیت آن
   به‌صورت پویا از روی عناصر ثابت/چسبان پایین صفحه (نوار موبایلی قالب،
   دکمه‌های شناور افزونه‌های دیگر) تنظیم می‌شود (ر.ک. wptaAdjustPosition
   در chat-widget.js که مقدار --wpta-cw-extra-bottom را می‌سازد). */

#wpta-cw-root, #wpta-cw-root *{
  box-sizing:border-box!important;
  direction:rtl!important;
  font-family:'Vazirmatn',Tahoma,sans-serif!important;
  -webkit-text-size-adjust:100%;
  text-transform:none!important;
  letter-spacing:normal!important;
  text-shadow:none!important;
  text-align:right;
}
#wpta-cw-root{
  position:fixed!important;
  z-index:2147483000;
  bottom:calc(20px + var(--wpta-cw-extra-bottom,0px));
  left:20px;
  line-height:1.6;
}
#wpta-cw-root a{text-decoration:none!important;}
#wpta-cw-root button{margin:0;outline:none;-webkit-tap-highlight-color:transparent;-webkit-appearance:none;appearance:none;}
#wpta-cw-root svg{flex-shrink:0;}

.wpta-cw-fab{
  width:58px;height:58px;min-width:58px;border-radius:50%!important;
  background:var(--wpta-cw-color,#54a9eb)!important;
  box-shadow:0 4px 18px rgba(0,0,0,.25)!important;
  border:none!important;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  color:#fff!important;position:relative;
  transition:transform .15s;
  padding:0!important;
}
.wpta-cw-fab:active{transform:scale(.93);}
.wpta-cw-fab-dot{
  position:absolute;top:2px;left:2px;
  width:14px;height:14px;border-radius:50%!important;
  background:#e05252!important;border:2px solid #fff!important;
  display:none;
}
.wpta-cw-fab-dot.show{display:block;}

.wpta-cw-panel{
  position:fixed!important;
  bottom:calc(20px + var(--wpta-cw-extra-bottom,0px));left:20px;
  width:340px;max-width:calc(100vw - 24px);
  height:480px;max-height:calc(100vh - 40px);
  background:#0e1621!important;color:#fff!important;
  border-radius:16px!important;
  box-shadow:0 8px 40px rgba(0,0,0,.35)!important;
  display:none;
  flex-direction:column;
  overflow:hidden;
  border:none!important;
}
.wpta-cw-panel.open{display:flex;}

.wpta-cw-head{
  background:var(--wpta-cw-color,#54a9eb)!important;
  padding:14px 16px;display:flex;align-items:center;gap:10px;
  flex-shrink:0;
}
.wpta-cw-head-av{
  width:34px;height:34px;border-radius:50%!important;
  background:rgba(255,255,255,.25)!important;
  display:flex;align-items:center;justify-content:center;font-size:16px;flex-shrink:0;
}
.wpta-cw-head-title{font-size:14px;font-weight:700;color:#fff!important;}
.wpta-cw-head-sub{font-size:11px;opacity:.85;margin-top:1px;color:#fff!important;}
.wpta-cw-close{
  margin-right:auto;background:none!important;border:none!important;color:#fff!important;
  cursor:pointer;opacity:.85;width:28px;height:28px;padding:0!important;
  display:flex;align-items:center;justify-content:center;
}

.wpta-cw-body{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:8px;background:#0e1621!important;-webkit-overflow-scrolling:touch;}
.wpta-cw-body::-webkit-scrollbar{width:3px;}
.wpta-cw-body::-webkit-scrollbar-thumb{background:#22303c;border-radius:2px;}

.wpta-cw-bubble{
  max-width:78%;padding:9px 12px;border-radius:14px!important;font-size:13px!important;line-height:1.7!important;
  word-break:break-word;white-space:pre-wrap;margin:0!important;
}
.wpta-cw-bubble-user{align-self:flex-end;background:var(--wpta-cw-color,#54a9eb)!important;color:#fff!important;border-bottom-left-radius:4px!important;}
.wpta-cw-bubble-admin{align-self:flex-start;background:#1e2c3d!important;color:#e6edf3!important;border-bottom-right-radius:4px!important;}
.wpta-cw-bubble-time{font-size:9px!important;opacity:.7;margin-top:4px;text-align:left;}

.wpta-cw-bubble-img{
  display:block;max-width:100%;max-height:220px;border-radius:10px!important;
  margin-bottom:4px;cursor:pointer;object-fit:cover;
}
.wpta-cw-bubble-file{
  display:flex;align-items:center;gap:8px;
  background:rgba(255,255,255,.12)!important;border-radius:10px!important;
  padding:8px 10px;margin-bottom:4px;color:inherit!important;font-size:12px!important;
}
.wpta-cw-bubble-file span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:180px;}

.wpta-cw-input-row{
  display:flex;align-items:flex-end;gap:6px;padding:10px;border-top:1px solid #1e2c3d;background:#0e1621!important;flex-shrink:0;
}
.wpta-cw-attach{
  width:34px;height:34px;min-width:34px;border-radius:50%!important;border:none!important;
  background:transparent!important;color:#7d8a96!important;cursor:pointer;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;padding:0!important;
}
.wpta-cw-attach:disabled{opacity:.5;cursor:default;}
.wpta-cw-input{
  flex:1;resize:none;border:1px solid #22303c!important;background:#141f2b!important;color:#fff!important;
  border-radius:10px!important;padding:9px 11px!important;font-size:13px!important;font-family:inherit!important;max-height:70px;
  box-shadow:none!important;
}
.wpta-cw-input:focus{outline:none!important;border-color:var(--wpta-cw-color,#54a9eb)!important;}
.wpta-cw-send{
  width:38px;height:38px;min-width:38px;border-radius:50%!important;border:none!important;flex-shrink:0;
  background:var(--wpta-cw-color,#54a9eb)!important;color:#fff!important;cursor:pointer;
  display:flex;align-items:center;justify-content:center;padding:0!important;
}
.wpta-cw-send:disabled{opacity:.5;cursor:default;}

/* فرم شروع گفتگو */
.wpta-cw-form{flex:1;padding:20px 18px;display:flex;flex-direction:column;gap:12px;overflow-y:auto;}
.wpta-cw-form-hint{font-size:12px!important;color:#7d8a96!important;line-height:1.8!important;margin-bottom:4px;}
.wpta-cw-field-label{font-size:12px!important;color:#9fb0bf!important;margin-bottom:5px;}
.wpta-cw-form-input{
  width:100%;border:1px solid #22303c!important;background:#141f2b!important;color:#fff!important;
  border-radius:10px!important;padding:10px 12px!important;font-size:13px!important;font-family:inherit!important;
  box-shadow:none!important;height:auto!important;
}
.wpta-cw-form-input:focus{outline:none!important;border-color:var(--wpta-cw-color,#54a9eb)!important;}
.wpta-cw-form-submit{
  margin-top:6px;border:none!important;border-radius:10px!important;padding:11px!important;
  background:var(--wpta-cw-color,#54a9eb)!important;color:#fff!important;font-size:13px!important;font-weight:700!important;
  cursor:pointer;font-family:inherit!important;width:100%;
}
.wpta-cw-form-err{color:#e05252!important;font-size:12px!important;display:none;}

/* آیکون سفارشی دکمه شناور (در صورت آپلود توسط ادمین) */
.wpta-cw-fab-img{width:100%;height:100%;object-fit:cover;border-radius:50%!important;}
.wpta-cw-head-av img{width:100%;height:100%;object-fit:cover;border-radius:50%!important;}

/* فاصله‌گذاری دستی (تنظیمات ادمین): اگر فعال باشد، محاسبهٔ خودکار برخورد
   با عناصر دیگر صفحه اعمال نمی‌شود و فقط همین مقادیر استفاده می‌شوند */
#wpta-cw-root.wpta-cw-manual{ bottom: var(--wpta-cw-manual-bottom,20px) !important; left: var(--wpta-cw-manual-side,20px) !important; right:auto !important; }
#wpta-cw-root.wpta-cw-manual.wpta-cw-side-right{ left:auto !important; right: var(--wpta-cw-manual-side,20px) !important; }
#wpta-cw-root.wpta-cw-manual .wpta-cw-panel{ bottom: var(--wpta-cw-manual-bottom,20px) !important; left: var(--wpta-cw-manual-side,20px) !important; right:auto !important; }
#wpta-cw-root.wpta-cw-manual.wpta-cw-side-right .wpta-cw-panel{ left:auto !important; right: var(--wpta-cw-manual-side,20px) !important; }
#wpta-cw-root.wpta-cw-manual .wpta-cw-fab-dot{ left:auto; right:2px; }
#wpta-cw-root.wpta-cw-manual.wpta-cw-side-right .wpta-cw-fab-dot{ right:auto; left:2px; }

/* نوار «کسی آنلاین نیست» */
.wpta-cw-offline-banner{
  background:rgba(240,167,50,.14)!important;color:#f0a732!important;
  font-size:11px!important;line-height:1.7!important;padding:9px 12px;
  display:flex;align-items:center;gap:6px;flex-shrink:0;
}

/* نشانگر «در حال تایپ...» */
.wpta-cw-typing-row{
  display:flex;align-items:center;gap:6px;padding:2px 14px 8px;
  font-size:11px!important;color:#7d8a96!important;flex-shrink:0;
}
.wpta-cw-typing-dots{display:inline-flex;gap:3px;}
.wpta-cw-typing-dots i{
  width:5px;height:5px;border-radius:50%!important;background:#7d8a96;display:inline-block;
  animation:wpta-cw-blink 1.2s infinite ease-in-out;
}
.wpta-cw-typing-dots i:nth-child(2){animation-delay:.2s;}
.wpta-cw-typing-dots i:nth-child(3){animation-delay:.4s;}
@keyframes wpta-cw-blink{0%,80%,100%{opacity:.25;}40%{opacity:1;}}

/* رسید دیده‌شد روی پیام‌های ارسالی کاربر */
.wpta-cw-seen{margin-right:6px;opacity:.75;}
.wpta-cw-seen.seen{opacity:1;color:#bfe3ff;}

/* موبایل: پنل به‌صورت تمام‌صفحه باز می‌شود تا با هیچ المان دیگری تداخل نداشته باشد */
@media (max-width:480px){
  #wpta-cw-root{bottom:calc(14px + var(--wpta-cw-extra-bottom,0px));left:14px;}
  .wpta-cw-panel{
    bottom:0;left:0;right:0;top:0;
    width:100%;max-width:100%;height:100%;max-height:100%;border-radius:0!important;
    padding-bottom:env(safe-area-inset-bottom);
  }
  .wpta-cw-fab{width:52px;height:52px;min-width:52px;}
}
