/* WP-Sell Chat Manager 0.3.7 — Nexo integrated widget */
.wscm-widget-root{
  --wscm-primary:var(--nx-primary,#6A4DF4);
  --wscm-primary-rgb:var(--nx-primary-rgb,106,77,244);
  --wscm-surface:var(--nx-surface,#fff);
  --wscm-surface-2:var(--nx-surface-2,#F8F9FE);
  --wscm-surface-3:var(--nx-surface-3,#EEF0FA);
  --wscm-border:var(--nx-border,#E4E7F2);
  --wscm-border-strong:var(--nx-border-strong,#CFD4E6);
  --wscm-text:var(--nx-text,#0F1126);
  --wscm-text-2:var(--nx-text-2,#3A3F5E);
  --wscm-muted:var(--nx-muted,#646A8C);
  --wscm-success:var(--nx-success,#12B76A);
  --wscm-danger:var(--nx-danger,#F04438);
  --wscm-grad:var(--nx-grad,linear-gradient(120deg,#6A4DF4 0%,#9B5CFF 48%,#FF5CA8 100%));
  --wscm-shadow:var(--nx-shadow-3,0 30px 70px -20px rgba(15,17,38,.3));
  --wscm-shadow-soft:var(--nx-shadow-2,0 6px 16px -4px rgba(15,17,38,.08),0 20px 40px -16px rgba(15,17,38,.14));
  --wscm-ring:var(--nx-ring,0 0 0 4px rgba(106,77,244,.18));
  --wscm-r:var(--nx-r,16px);
  --wscm-r-lg:var(--nx-r-lg,22px);
  --wscm-r-xl:var(--nx-r-xl,28px);
  --wscm-ease:var(--nx-ease,cubic-bezier(.2,.8,.2,1));
  --wscm-spring:var(--nx-spring,cubic-bezier(.34,1.56,.64,1));
  position:fixed;
  z-index:214700;
  left:18px;
  bottom:18px;
  font-family:var(--nx-font,"Vazirmatn FD","Vazirmatn",Tahoma,system-ui,-apple-system,"Segoe UI",sans-serif);
  font-size:14px;
  line-height:1.8;
  color:var(--wscm-text);
  direction:rtl;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
.wscm-widget-root *,
.wscm-widget-root *::before,
.wscm-widget-root *::after{box-sizing:border-box}
.wscm-widget-root button,
.wscm-widget-root input,
.wscm-widget-root textarea{font:inherit}
.wscm-widget-root svg{display:block;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.wscm-widget-root [hidden]{display:none!important}
.wscm-sr{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}

/* Launcher */
.wscm-launcher{
  min-height:52px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  padding:0 16px 0 14px;
  border:1px solid rgba(255,255,255,.2);
  border-radius:999px;
  background:var(--wscm-grad);
  background-size:160% 100%;
  background-position:100% 0;
  color:#fff;
  font-weight:800;
  font-size:13px;
  box-shadow:0 16px 38px -12px rgba(var(--wscm-primary-rgb),.68);
  cursor:pointer;
  transition:transform .18s var(--wscm-ease),box-shadow .26s var(--wscm-ease),background-position .5s var(--wscm-ease);
  -webkit-tap-highlight-color:transparent;
}
.wscm-launcher:hover{transform:translateY(-2px);background-position:0 0;box-shadow:0 20px 46px -13px rgba(var(--wscm-primary-rgb),.78)}
.wscm-launcher:active{transform:translateY(0) scale(.97)}
.wscm-launcher:focus-visible{outline:0;box-shadow:0 16px 38px -12px rgba(var(--wscm-primary-rgb),.68),0 0 0 4px rgba(var(--wscm-primary-rgb),.22)}
.wscm-launcher-dot{
  width:9px;height:9px;border-radius:50%;
  background:#39D98A;
  box-shadow:0 0 0 4px rgba(57,217,138,.16);
  animation:wscm-presence-pulse 2.4s ease-in-out infinite;
}
.wscm-launcher-icon{width:18px;height:18px;opacity:.95}
@keyframes wscm-presence-pulse{0%,100%{box-shadow:0 0 0 4px rgba(57,217,138,.14)}50%{box-shadow:0 0 0 7px rgba(57,217,138,0)}}

/* Panel */
.wscm-panel{
  position:absolute;
  left:0;
  bottom:66px;
  width:min(398px,calc(100vw - 36px));
  height:min(640px,calc(100dvh - 104px));
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  overflow:hidden;
  border:1px solid color-mix(in srgb,var(--wscm-border) 82%,transparent);
  border-radius:var(--wscm-r-xl);
  background:var(--wscm-surface);
  box-shadow:var(--wscm-shadow);
  opacity:0;
  transform:translateY(12px) scale(.985);
  transform-origin:bottom left;
  pointer-events:none;
  transition:opacity .2s ease,transform .28s var(--wscm-spring),box-shadow .28s var(--wscm-ease);
  contain:layout paint;
}
.wscm-panel.is-visible{opacity:1;transform:none;pointer-events:auto}

/* Header */
.wscm-header{
  min-height:86px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:15px 16px;
  color:#fff;
  background:
    radial-gradient(circle at 10% 0%,rgba(255,255,255,.2),transparent 32%),
    var(--wscm-grad);
  border-bottom:1px solid rgba(255,255,255,.14);
}
.wscm-header-brand{min-width:0;display:flex;align-items:center;gap:11px}
.wscm-header-mark{
  width:42px;height:42px;flex:0 0 42px;
  display:grid;place-items:center;
  border:1px solid rgba(255,255,255,.22);
  border-radius:14px;
  background:rgba(255,255,255,.13);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.18);
  backdrop-filter:blur(8px);
}
.wscm-header-mark svg{width:22px;height:22px}
.wscm-header-copy{min-width:0}
.wscm-header-copy strong{
  display:block;
  margin:0;
  color:#fff;
  font-size:16px;
  font-weight:900;
  line-height:1.55;
  letter-spacing:-.015em;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.wscm-header-copy small{
  display:flex;
  align-items:center;
  gap:6px;
  margin-top:2px;
  color:rgba(255,255,255,.82);
  font-size:11px;
  font-weight:600;
  line-height:1.6;
}
.wscm-presence{width:7px;height:7px;border-radius:50%;background:#45E59A;box-shadow:0 0 0 3px rgba(69,229,154,.15)}
.wscm-close{
  width:42px;height:42px;flex:0 0 42px;
  display:grid;place-items:center;
  padding:0;
  border:1px solid rgba(255,255,255,.23);
  border-radius:14px;
  background:rgba(255,255,255,.1);
  color:#fff;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.12);
  cursor:pointer;
  transition:background .18s ease,transform .18s var(--wscm-ease),border-color .18s ease;
  -webkit-tap-highlight-color:transparent;
}
.wscm-close svg{width:20px;height:20px}
.wscm-close:hover{background:rgba(255,255,255,.2);border-color:rgba(255,255,255,.34);transform:rotate(3deg)}
.wscm-close:active{transform:scale(.92)}
.wscm-close:focus-visible{outline:2px solid rgba(255,255,255,.95);outline-offset:2px}

.wscm-body{min-height:0;background:var(--wscm-surface)}

/* Start screen */
.wscm-start{
  height:100%;
  min-height:0;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:14px;
  padding:26px 24px 28px;
  background:
    radial-gradient(circle at 12% 0%,rgba(var(--wscm-primary-rgb),.075),transparent 36%),
    linear-gradient(180deg,var(--wscm-surface) 0%,var(--wscm-surface-2) 100%);
}
.wscm-start-heading{
  display:flex;
  align-items:flex-start;
  gap:12px;
  margin-bottom:4px;
  padding:15px;
  border:1px solid var(--wscm-border);
  border-radius:18px;
  background:color-mix(in srgb,var(--wscm-surface) 92%,transparent);
  box-shadow:var(--wscm-shadow-soft);
}
.wscm-start-icon{
  width:40px;height:40px;flex:0 0 40px;
  display:grid;place-items:center;
  border-radius:13px;
  color:var(--wscm-primary);
  background:rgba(var(--wscm-primary-rgb),.11);
}
.wscm-start-icon svg{width:21px;height:21px}
.wscm-start-heading strong{
  display:block;
  margin:0 0 3px;
  font-size:14px;
  font-weight:900;
  line-height:1.6;
  color:var(--wscm-text);
}
.wscm-start-heading p{
  margin:0;
  color:var(--wscm-muted);
  font-size:12px;
  font-weight:500;
  line-height:1.9;
}
.wscm-field{display:block}
.wscm-field-label{
  display:block;
  margin:0 3px 6px;
  color:var(--wscm-text-2);
  font-size:11px;
  font-weight:800;
}
.wscm-start input,
.wscm-compose textarea{
  width:100%;
  border:1px solid var(--wscm-border);
  outline:0;
  color:var(--wscm-text);
  background:var(--wscm-surface);
  box-shadow:0 1px 0 rgba(15,17,38,.015);
  transition:border-color .18s ease,box-shadow .18s ease,background .18s ease,transform .18s ease;
}
.wscm-start input{
  height:50px;
  padding:0 14px;
  border-radius:14px;
  font-size:14px;
  font-weight:600;
}
.wscm-start input::placeholder,
.wscm-compose textarea::placeholder{color:color-mix(in srgb,var(--wscm-muted) 72%,transparent);font-weight:500}
.wscm-start input:hover,
.wscm-compose textarea:hover{border-color:var(--wscm-border-strong)}
.wscm-start input:focus,
.wscm-compose textarea:focus{border-color:rgba(var(--wscm-primary-rgb),.62);box-shadow:var(--wscm-ring)}
.wscm-phone-wrap{position:relative;display:block}
.wscm-phone-wrap input{padding-left:92px!important;text-align:left;font-variant-numeric:tabular-nums}
.wscm-phone-wrap input.is-detected{background:color-mix(in srgb,var(--wscm-success) 4%,var(--wscm-surface));border-color:color-mix(in srgb,var(--wscm-success) 35%,var(--wscm-border))}
.wscm-phone-detected{
  position:absolute;
  left:10px;
  top:50%;
  transform:translateY(-50%);
  display:inline-flex;
  align-items:center;
  min-height:25px;
  padding:3px 8px;
  border-radius:999px;
  color:var(--nx-success-text,#067647);
  background:var(--nx-success-soft,rgba(18,183,106,.12));
  font-size:10px;
  font-weight:900;
  white-space:nowrap;
}
#wscm-start-btn{
  min-height:50px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  margin-top:2px;
  padding:0 18px;
  border:0;
  border-radius:14px;
  color:#fff;
  background:var(--wscm-grad);
  background-size:160% 100%;
  background-position:100% 0;
  box-shadow:0 12px 28px -12px rgba(var(--wscm-primary-rgb),.72);
  font-size:14px;
  font-weight:900;
  cursor:pointer;
  transition:transform .18s var(--wscm-ease),box-shadow .24s var(--wscm-ease),background-position .45s var(--wscm-ease),opacity .2s ease;
}
#wscm-start-btn svg{width:19px;height:19px;transition:transform .22s var(--wscm-ease)}
#wscm-start-btn:hover{background-position:0 0;transform:translateY(-1px);box-shadow:0 16px 32px -12px rgba(var(--wscm-primary-rgb),.78)}
#wscm-start-btn:hover svg{transform:translateX(3px)}
#wscm-start-btn:active{transform:scale(.985)}
#wscm-start-btn:focus-visible{outline:0;box-shadow:0 12px 28px -12px rgba(var(--wscm-primary-rgb),.72),var(--wscm-ring)}
#wscm-start-btn:disabled{opacity:.55;cursor:wait}
#wscm-start-status{
  min-height:18px;
  display:block;
  margin-top:-3px;
  text-align:center;
  color:var(--wscm-danger);
  font-size:11px;
  font-weight:700;
}

/* Chat */
.wscm-chat{height:100%;min-height:0;display:grid;grid-template-rows:minmax(0,1fr) auto}
.wscm-messages{
  min-height:0;
  overflow-y:auto;
  overscroll-behavior:contain;
  display:flex;
  flex-direction:column;
  gap:9px;
  padding:18px 14px 20px;
  background:
    radial-gradient(circle at 100% 0%,rgba(var(--wscm-primary-rgb),.045),transparent 30%),
    var(--wscm-surface-2);
  scrollbar-width:thin;
  scrollbar-color:var(--wscm-border-strong) transparent;
}
.wscm-messages::-webkit-scrollbar{width:8px}
.wscm-messages::-webkit-scrollbar-thumb{background:var(--wscm-border-strong);border:2px solid transparent;border-radius:999px;background-clip:content-box}
.wscm-bubble{
  max-width:84%;
  padding:10px 12px 8px;
  border:1px solid transparent;
  border-radius:17px;
  box-shadow:0 5px 16px rgba(15,17,38,.055);
  animation:wscm-message-in .24s var(--wscm-ease) both;
}
@keyframes wscm-message-in{from{opacity:0;transform:translateY(5px) scale(.985)}to{opacity:1;transform:none}}
.wscm-bubble p{margin:0;white-space:pre-wrap;word-break:break-word;font-size:13px;font-weight:500;line-height:1.9}
.wscm-bubble time{display:block;margin-top:3px;font-size:9px;font-weight:600;opacity:.56;direction:ltr}
.wscm-bubble.customer{align-self:flex-start;background:var(--wscm-surface);border-color:var(--wscm-border);border-bottom-right-radius:6px;color:var(--wscm-text)}
.wscm-bubble.admin{align-self:flex-end;background:var(--wscm-grad);color:#fff;border-bottom-left-radius:6px;box-shadow:0 8px 22px -12px rgba(var(--wscm-primary-rgb),.7)}
.wscm-bubble.ai{align-self:flex-end;background:rgba(var(--wscm-primary-rgb),.09);color:color-mix(in srgb,var(--wscm-primary) 72%,var(--wscm-text));border-color:rgba(var(--wscm-primary-rgb),.14);border-bottom-left-radius:6px}
.wscm-bubble.system{align-self:center;max-width:100%;padding:5px 10px;border:0;border-radius:999px;background:var(--wscm-surface-3);box-shadow:none;color:var(--wscm-muted)}
.wscm-bubble.system p{font-size:10px;font-weight:700}

/* Composer */
.wscm-compose{
  display:grid;
  grid-template-columns:minmax(0,1fr) 50px;
  align-items:end;
  gap:9px;
  padding:11px 12px 12px;
  border-top:1px solid var(--wscm-border);
  background:var(--wscm-surface);
  box-shadow:0 -8px 24px rgba(15,17,38,.025);
}
.wscm-compose-field{min-width:0}
.wscm-compose textarea{
  display:block;
  min-height:48px;
  max-height:112px;
  resize:none;
  overflow-y:auto;
  padding:12px 14px;
  border-radius:16px;
  font-size:14px;
  font-weight:500;
  line-height:1.65;
}
.wscm-send{
  width:50px;height:50px;
  display:grid;
  place-items:center;
  padding:0;
  border:0;
  border-radius:16px;
  color:#fff;
  background:var(--wscm-grad);
  background-size:160% 100%;
  background-position:100% 0;
  box-shadow:0 10px 24px -10px rgba(var(--wscm-primary-rgb),.75);
  cursor:pointer;
  transition:transform .18s var(--wscm-ease),box-shadow .24s var(--wscm-ease),background-position .45s var(--wscm-ease),opacity .18s ease;
}
.wscm-send svg{width:21px;height:21px;transition:transform .2s var(--wscm-ease),opacity .18s ease}
.wscm-send:hover{transform:translateY(-1px);background-position:0 0;box-shadow:0 14px 30px -10px rgba(var(--wscm-primary-rgb),.82)}
.wscm-send:hover svg{transform:translate(2px,-2px)}
.wscm-send:active{transform:scale(.94)}
.wscm-send:focus-visible{outline:0;box-shadow:0 10px 24px -10px rgba(var(--wscm-primary-rgb),.75),var(--wscm-ring)}
.wscm-send:disabled{opacity:.72;cursor:wait;transform:none}
.wscm-send.is-loading svg{opacity:0}
.wscm-send.is-loading::after{
  content:"";
  position:absolute;
  width:18px;height:18px;
  border:2px solid rgba(255,255,255,.35);
  border-top-color:#fff;
  border-radius:50%;
  animation:wscm-spin .7s linear infinite;
}
@keyframes wscm-spin{to{transform:rotate(360deg)}}
.wscm-send{position:relative}

/* State */
.wscm-start[hidden],.wscm-chat[hidden]{display:none!important}
html.wscm-chat-lock,body.wscm-chat-lock{overflow:hidden!important;overscroll-behavior:none!important}

/* Mobile */
@media(max-width:640px){
  .wscm-widget-root{left:10px;bottom:calc(96px + env(safe-area-inset-bottom))}
  .wscm-launcher{min-height:46px;padding-inline:14px 13px}
  .wscm-widget-root.is-open{
    position:fixed!important;
    inset:0!important;
    z-index:2147483000!important;
    width:100%!important;
    height:100%!important;
    pointer-events:none;
  }
  .wscm-widget-root.is-open .wscm-panel{
    pointer-events:auto;
    margin:0!important;
    border:0!important;
    border-radius:0!important;
    box-shadow:none!important;
    transform:translateY(12px)!important;
    transform-origin:center bottom!important;
    overflow:hidden!important;
    display:grid!important;
    grid-template-rows:auto minmax(0,1fr)!important;
    background:var(--wscm-surface)!important;
  }
  .wscm-widget-root.is-open .wscm-panel.is-visible{transform:none!important}
  .wscm-header{
    min-height:92px;
    padding:calc(12px + env(safe-area-inset-top)) 16px 12px;
  }
  .wscm-header-mark{width:40px;height:40px;flex-basis:40px}
  .wscm-close{width:42px;height:42px}
  .wscm-start{
    padding:22px 22px max(22px,env(safe-area-inset-bottom));
    justify-content:center;
  }
  .wscm-start-heading{padding:14px}
  .wscm-start input,
  .wscm-compose textarea{font-size:16px!important}
  .wscm-body,.wscm-chat,.wscm-messages{min-height:0}
  .wscm-widget-root.is-open .wscm-body{height:100%!important;overflow:hidden!important}
  .wscm-widget-root.is-open .wscm-chat{height:100%!important;overflow:hidden!important;grid-template-rows:minmax(0,1fr) auto!important}
  .wscm-widget-root.is-open .wscm-messages{overflow-y:auto!important;-webkit-overflow-scrolling:touch}
  .wscm-compose{
    position:relative!important;
    z-index:10!important;
    padding:10px 10px max(10px,env(safe-area-inset-bottom))!important;
    background:var(--wscm-surface)!important;
  }
}

/* Keep launcher above Nexo bottom navigation on tablets too. */
@media(min-width:641px) and (max-width:1023px){
  .wscm-widget-root{bottom:calc(96px + env(safe-area-inset-bottom))}
}

/* Desktop/tablet floating panel */
@media(min-width:641px){
  html.wscm-chat-lock,body.wscm-chat-lock{overflow:auto!important}
  .wscm-widget-root.is-open{
    position:fixed!important;
    inset:auto auto 18px 18px!important;
    width:auto!important;
    height:auto!important;
    pointer-events:auto!important;
  }
  .wscm-widget-root.is-open .wscm-panel{
    position:absolute!important;
    left:0!important;
    bottom:66px!important;
    top:auto!important;
    right:auto!important;
    width:min(398px,calc(100vw - 36px))!important;
    height:min(640px,calc(100vh - 100px))!important;
    max-width:398px!important;
    max-height:640px!important;
  }
}

/* Motion/accessibility */
@media(prefers-reduced-motion:reduce){
  .wscm-widget-root *, .wscm-widget-root *::before, .wscm-widget-root *::after{
    scroll-behavior:auto!important;
    animation-duration:.01ms!important;
    animation-iteration-count:1!important;
    transition-duration:.01ms!important;
  }
}

.wscm-contact-actions{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
  margin-top:9px;
}
.wscm-contact-action{
  display:inline-flex;
  align-items:center;
  gap:6px;
  min-height:34px;
  padding:6px 10px;
  border-radius:11px;
  border:1px solid rgba(var(--wscm-primary-rgb),.16);
  background:var(--wscm-surface);
  color:var(--wscm-text);
  text-decoration:none;
  font-size:11px;
  font-weight:800;
  direction:ltr;
  transition:transform .18s var(--wscm-ease),border-color .18s ease,background .18s ease;
}
.wscm-contact-action svg{width:17px;height:17px;fill:currentColor;stroke:currentColor;stroke-width:1.6}
.wscm-contact-action:hover{transform:translateY(-1px)}
.wscm-contact-action.telegram{color:#229ED9;background:#f1faff;border-color:#ccecff}
.wscm-contact-action.whatsapp{color:#128C7E;background:#effcf7;border-color:#cdeee4}
.wscm-contact-action.phone{color:var(--wscm-primary);background:rgba(var(--wscm-primary-rgb),.06)}

/* v0.3.18: keep contact actions visible above mobile composer. */
.wscm-bubble:has(.wscm-contact-actions){scroll-margin-bottom:18px}
@media(max-width:640px){
  .wscm-messages{padding-bottom:30px!important}
  .wscm-bubble:has(.wscm-contact-actions){max-width:92%}
  .wscm-contact-actions{display:grid;grid-template-columns:1fr;width:100%}
  .wscm-contact-action{width:100%;justify-content:center;min-height:40px;font-size:12px}
}
