/* ==========================================================================
   chat-widget.css — دستیار هوشمند شایگان (پنجرهٔ شناور در همهٔ صفحات + نسخهٔ درون‌صفحه‌ای /chat)
   مستقل از variables.css و inner-pages.css تا در صفحهٔ سینماتیک تیره و صفحات روشن یکسان دیده شود.
   ========================================================================== */
.sh-chat{
  --c-navy:#0b2047; --c-navy-2:#1b4380; --c-gold:#c9984f; --c-gold-soft:#e3bc7c;
  --c-ink:#12305c; --c-ink-soft:#3a5683; --c-faint:#6f84a8; --c-line:rgba(18,48,92,.12);
  --c-bg:#f7f2ea; --c-surface:#fff; --c-ease:cubic-bezier(.16,1,.3,1);
  font-family:"Vazirmatn","Tahoma",sans-serif; direction:rtl; color:var(--c-ink-soft);
}
.sh-chat *{box-sizing:border-box;}

/* ---------- launcher ---------- */
.sh-chat-launcher{
  position:fixed; left:18px; bottom:18px; z-index:9998;
  display:flex; align-items:center; gap:.55rem; padding:.7rem 1.05rem .7rem .85rem;
  border:0; border-radius:999px; cursor:pointer; font:inherit; font-size:.9rem; font-weight:700;
  color:#fff; background:linear-gradient(135deg,var(--c-navy),var(--c-navy-2));
  box-shadow:0 14px 30px -12px rgba(6,15,38,.6),0 0 0 1px rgba(227,188,124,.35) inset;
  transition:transform .3s var(--c-ease),opacity .3s;
}
.sh-chat-launcher:hover{transform:translateY(-2px);}
.sh-chat-launcher .dot{width:9px;height:9px;border-radius:50%;background:#4ade80;box-shadow:0 0 0 3px rgba(74,222,128,.25);}
.sh-chat-launcher svg{width:20px;height:20px;}
.sh-chat.is-open .sh-chat-launcher{opacity:0;pointer-events:none;transform:scale(.9);}

/* ---------- panel ---------- */
.sh-chat-panel{
  position:fixed; left:18px; bottom:18px; z-index:9999; width:min(380px,calc(100vw - 24px));
  height:min(600px,calc(100vh - 36px)); display:flex; flex-direction:column; overflow:hidden;
  background:var(--c-surface); border-radius:22px; border:1px solid var(--c-line);
  box-shadow:0 30px 60px -20px rgba(6,15,38,.55);
  opacity:0; transform:translateY(14px) scale(.98); pointer-events:none;
  transition:opacity .28s var(--c-ease),transform .28s var(--c-ease);
}
.sh-chat.is-open .sh-chat-panel{opacity:1;transform:none;pointer-events:auto;}
.sh-chat.is-inline .sh-chat-panel{
  position:relative; left:auto; bottom:auto; width:100%; height:min(620px,74vh); z-index:auto;
  opacity:1; transform:none; pointer-events:auto; box-shadow:0 14px 34px -18px rgba(18,48,92,.35);
}
.sh-chat.is-inline .sh-chat-launcher,.sh-chat.is-inline .sh-chat-close{display:none;}

.sh-chat-head{display:flex;align-items:center;gap:.7rem;padding:.9rem 1.1rem;flex-shrink:0;color:#fff;
  background:linear-gradient(135deg,var(--c-navy),var(--c-navy-2));}
.sh-chat-avatar{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;flex-shrink:0;font-size:1.05rem;
  background:rgba(255,255,255,.14);box-shadow:0 0 0 1px rgba(227,188,124,.45) inset;}
.sh-chat-head strong{display:block;font-size:.93rem;line-height:1.4;}
.sh-chat-head span{display:block;font-size:.72rem;color:rgba(255,255,255,.72);}
.sh-chat-close{margin-inline-start:auto;width:34px;height:34px;border-radius:50%;border:0;cursor:pointer;color:#fff;
  background:rgba(255,255,255,.1);font-size:1.2rem;line-height:1;}
.sh-chat-close:hover{background:rgba(255,255,255,.2);}

.sh-chat-log{flex:1;overflow-y:auto;padding:1rem;display:flex;flex-direction:column;gap:.75rem;background:var(--c-bg);
  overscroll-behavior:contain;}
.sh-msg{max-width:86%;padding:.65rem .9rem;border-radius:16px;font-size:.87rem;line-height:1.85;white-space:pre-line;
  word-wrap:break-word;animation:shMsgIn .32s var(--c-ease);}
@keyframes shMsgIn{from{opacity:0;transform:translateY(6px);}}
.sh-msg.bot{align-self:flex-start;background:var(--c-surface);color:var(--c-ink-soft);border:1px solid var(--c-line);border-bottom-right-radius:4px;}
.sh-msg.user{align-self:flex-end;color:#fff;background:linear-gradient(135deg,var(--c-navy),var(--c-navy-2));border-bottom-left-radius:4px;}
.sh-msg a{color:var(--c-gold);font-weight:700;text-decoration:underline;text-underline-offset:3px;}
.sh-msg.user a{color:var(--c-gold-soft);}
.sh-msg.note{align-self:center;max-width:94%;font-size:.78rem;text-align:center;background:rgba(74,222,128,.12);
  color:#166534;border:1px solid rgba(74,222,128,.35);border-radius:12px;}
.sh-typing{align-self:flex-start;display:flex;gap:4px;padding:.75rem .95rem;background:var(--c-surface);border:1px solid var(--c-line);border-radius:16px;}
.sh-typing i{width:6px;height:6px;border-radius:50%;background:var(--c-faint);animation:shBlink 1.2s infinite ease-in-out;}
.sh-typing i:nth-child(2){animation-delay:.2s;} .sh-typing i:nth-child(3){animation-delay:.4s;}
@keyframes shBlink{0%,80%,100%{opacity:.25;}40%{opacity:1;}}

.sh-chat-chips{display:flex;gap:.4rem;flex-wrap:wrap;padding:.55rem .9rem 0;background:var(--c-surface);}
.sh-chat-chips button{font:inherit;font-size:.76rem;font-weight:600;padding:.35rem .75rem;border-radius:999px;cursor:pointer;
  color:var(--c-ink);background:rgba(18,48,92,.05);border:1px solid var(--c-line);}
.sh-chat-chips button:hover{border-color:var(--c-gold);color:var(--c-navy);}

.sh-chat-form{display:flex;gap:.5rem;padding:.7rem .8rem;border-top:1px solid var(--c-line);background:var(--c-surface);flex-shrink:0;}
.sh-chat-form textarea{flex:1;resize:none;font:inherit;font-size:.88rem;line-height:1.6;max-height:110px;padding:.6rem .85rem;
  border-radius:14px;border:1.5px solid var(--c-line);background:var(--c-bg);color:var(--c-ink);}
.sh-chat-form textarea:focus{outline:none;border-color:var(--c-gold);}
.sh-chat-send{width:44px;height:44px;flex-shrink:0;align-self:flex-end;border:0;border-radius:50%;cursor:pointer;color:#fff;
  background:linear-gradient(135deg,var(--c-navy),var(--c-navy-2));display:grid;place-items:center;}
.sh-chat-send:disabled{opacity:.5;cursor:default;}
.sh-chat-send svg{width:19px;height:19px;transform:scaleX(-1);}
.sh-chat-foot{font-size:.68rem;color:var(--c-faint);text-align:center;padding:0 .8rem .55rem;background:var(--c-surface);}
.sh-chat-foot a{color:var(--c-ink);font-weight:700;}

.sh-chat :focus-visible{outline:2px solid var(--c-gold);outline-offset:2px;}

@media (max-width:520px){
  .sh-chat-launcher{left:12px;bottom:12px;}
  .sh-chat:not(.is-inline) .sh-chat-panel{left:0;bottom:0;width:100vw;height:100dvh;border-radius:0;border:0;}
}
@media (prefers-reduced-motion:reduce){
  .sh-chat-panel,.sh-chat-launcher,.sh-msg{transition:none;animation:none;}
  .sh-typing i{animation:none;opacity:.6;}
}
