/* ===== استیو v2.5 — ویجتِ چت | Frosted Ember (لیکویید-گلس + نئومورفیسم، RTL، لایت/دارک) ===== */
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

#stv-root, #stv-root * { box-sizing: border-box; }
/* ضدِ نشتِ استایلِ قالبِ سایت — فقط ویژگی‌هایی که تمِ وردپرس تحمیل می‌کند خنثی می‌شوند
   (پس‌زمینه/حاشیه/سایه‌ی هر جزء را خودِ کامپوننت با اسکوپِ #stv-root صریح می‌گذارد) */
#stv-root button, #stv-root input, #stv-root textarea {
  margin: 0; font-family: 'Vazirmatn', Tahoma, sans-serif; font-weight: 600;
  text-transform: none; letter-spacing: normal; text-shadow: none; text-indent: 0;
  min-width: 0; min-height: 0; max-width: none; float: none;
  -webkit-appearance: none; appearance: none; outline: none;
}
/* آیکون‌های SVG ویجت — ضدِ قالب: بعضی تم‌ها (Woodmart و…) svg داخلِ دکمه را
   fill:none / max-width / display می‌کنند و آیکون (مثلاً ارسالِ عکس) نامرئی می‌شود. */
#stv-root svg { max-width: none; max-height: none; visibility: visible; opacity: 1; }
#stv-root button svg { display: block !important; pointer-events: none; margin: 0; }
/* بعضی قالب‌ها مستقیم pathِ داخلِ svg را fill:none می‌کنند — آیکون‌های پُر باید برگردند */
#stv-root #stv-launcher svg path { fill: #1a0e00 !important; }
#stv-root #stv-photo svg path { fill: currentColor !important; }
#stv-root #stv-send svg path { fill: #1f1000 !important; }
#stv-root {
  /* ── تمِ دارک (پیش‌فرض) ── */
  --stv-glass: rgba(20,20,25,.62);
  --stv-glass-edge: rgba(255,255,255,.10);
  --stv-neo: #26262c;            /* سطحِ نئومورفیکِ خاکستری */
  --stv-neo-hi: rgba(255,255,255,.055);
  --stv-neo-lo: rgba(0,0,0,.55);
  --stv-field: rgba(12,12,15,.66);
  --stv-text: #f1f1f4;
  --stv-muted: #9a9aa6;
  --stv-bot: rgba(40,40,47,.72);
  --stv-ember: #ff7a00;
  --stv-ember-2: #ff4d00;
  --stv-ember-soft: rgba(255,122,0,.16);
  --stv-online: #2bd673;

  font-family: 'Vazirmatn', Tahoma, sans-serif;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: light) {
  #stv-root {
    --stv-glass: rgba(255,255,255,.60);
    --stv-glass-edge: rgba(255,255,255,.85);
    --stv-neo: #eceef3;          /* سطحِ نئومورفیکِ سفید */
    --stv-neo-hi: #ffffff;
    --stv-neo-lo: rgba(28,40,66,.16);
    --stv-field: rgba(255,255,255,.7);
    --stv-text: #1b1b22;
    --stv-muted: #6c6c78;
    --stv-bot: rgba(255,255,255,.78);
    --stv-ember-soft: rgba(255,122,0,.12);
  }
}

/* ───────── لانچر (گویِ اخگر) ───────── */
#stv-launcher {
  position: fixed; bottom: 22px; left: 22px; z-index: 2147483000;
  width: 60px; height: 60px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(120% 120% at 30% 25%, #ff9a33 0%, var(--stv-ember) 45%, var(--stv-ember-2) 100%);
  box-shadow: 0 10px 26px rgba(255,77,0,.42), inset 0 1px 1px rgba(255,255,255,.35);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
#stv-launcher::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--stv-ember); animation: stv-pulse 2.6s ease-out infinite;
}
@keyframes stv-pulse { 0%{transform:scale(1);opacity:.5} 70%{transform:scale(1.5);opacity:0} 100%{opacity:0} }
#stv-launcher:hover { transform: scale(1.06); }
#stv-launcher:active { transform: scale(.96); }
#stv-root #stv-launcher svg { width: 28px !important; height: 28px !important; fill: #1a0e00 !important; position: relative; z-index: 1; transition: transform .25s; display: block !important; }
#stv-launcher .stv-badge { display: none; }
#stv-root.stv-is-open #stv-launcher svg { transform: rotate(-90deg); }
#stv-root.stv-is-open #stv-launcher::before { animation: none; }

/* ───────── پنجره‌ی شیشه‌ای ───────── */
#stv-panel {
  position: fixed; bottom: 96px; left: 22px; z-index: 2147483000;
  width: 392px; max-width: calc(100vw - 28px);
  height: 600px; max-height: calc(100vh - 130px);
  border-radius: 26px; overflow: hidden; display: none; flex-direction: column;
  background: var(--stv-glass);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  backdrop-filter: blur(26px) saturate(150%);
  box-shadow: 0 24px 70px rgba(0,0,0,.5), inset 0 0 0 1px var(--stv-glass-edge);
  opacity: 0; transform: translateY(16px) scale(.97);
  transition: opacity .24s ease, transform .26s cubic-bezier(.34,1.4,.5,1);
}
#stv-panel.stv-open { display: flex; opacity: 1; transform: none; }
/* لبه‌ی اخگری بالا */
#stv-panel::before {
  content: ""; position: absolute; top: 0; left: 18%; right: 18%; height: 1px; z-index: 3;
  background: linear-gradient(90deg, transparent, var(--stv-ember), transparent); opacity: .8;
}

/* ───────── هدرِ نازک ───────── */
#stv-head {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px; flex-shrink: 0;
  position: relative; z-index: 2;
}
#stv-head .stv-id { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
#stv-head .stv-ava {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; overflow: hidden;
  background: radial-gradient(120% 120% at 30% 25%, #ff9a33, var(--stv-ember) 55%, var(--stv-ember-2));
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: #1a0e00; font-size: 14px;
  box-shadow: 0 3px 10px rgba(255,77,0,.3), inset 0 0 0 1px rgba(255,255,255,.12);
}
#stv-head .stv-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
#stv-head .stv-id b { color: var(--stv-text); font-weight: 800; font-size: 14px; }
#stv-head .stv-id small { color: var(--stv-muted); font-size: 11px; font-weight: 300; display: flex; align-items: center; gap: 5px; }
#stv-head .stv-id small::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--stv-online); box-shadow: 0 0 6px var(--stv-online); }
/* دکمه‌های نئومورفیکِ هدر (اسکوپِ #stv-root تا قالبِ سایت رویشان اثر نگذارد) */
#stv-root .stv-neo-btn {
  width: 38px; height: 38px; padding: 0; border-radius: 13px; border: none; cursor: pointer; flex-shrink: 0;
  background: var(--stv-neo); color: var(--stv-muted);
  box-shadow: -3px -3px 6px var(--stv-neo-hi), 3px 3px 7px var(--stv-neo-lo);
  display: flex; align-items: center; justify-content: center; font-size: 19px; line-height: 1;
  transition: box-shadow .15s, color .15s, transform .1s;
}
#stv-root .stv-neo-btn:hover { color: var(--stv-ember); background: var(--stv-neo); }
#stv-root .stv-neo-btn:active { transform: scale(.96); box-shadow: inset -2px -2px 5px var(--stv-neo-hi), inset 3px 3px 6px var(--stv-neo-lo); }
#stv-root .stv-neo-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; display: block; }
#stv-root #stv-close { font-size: 22px; }
#stv-root #stv-close svg { display: none; }

/* ───────── بدنه ───────── */
#stv-body {
  flex: 1; overflow-y: auto; padding: 6px 16px 16px;
  display: flex; flex-direction: column; gap: 11px; position: relative; z-index: 1;
  overscroll-behavior: contain; scrollbar-width: thin;
}
#stv-body::-webkit-scrollbar { width: 5px; }
#stv-body::-webkit-scrollbar-thumb { background: var(--stv-ember-soft); border-radius: 3px; }

/* ── هیروِ صفحه‌ی اول (مثلِ چتِ AI) ── */
#stv-hero {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 8px 6px 4px; gap: 0;
  animation: stv-fade .4s ease both;
}
#stv-hero .stv-hero-ava {
  width: 76px; height: 76px; border-radius: 24px; margin-bottom: 18px; overflow: hidden;
  background: radial-gradient(120% 120% at 30% 25%, #ff9a33, var(--stv-ember) 55%, var(--stv-ember-2));
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: #1a0e00; font-size: 34px;
  box-shadow: 0 12px 34px rgba(255,77,0,.4), inset 0 0 0 1px rgba(255,255,255,.18);
}
#stv-hero .stv-hero-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* .stv-hero-t بود h1؛ ببین کامنت steve-chat.js کنار ساختِ همین المان. */
#stv-hero .stv-hero-t {
  margin: 0; font-size: 27px; font-weight: 800; letter-spacing: -.4px; color: var(--stv-text); line-height: 1.35;
}
#stv-hero .stv-hero-t .stv-wave { display: inline-block; }
#stv-hero p {
  margin: 9px 0 0; font-size: 13.5px; font-weight: 300; color: var(--stv-muted); line-height: 1.85; max-width: 290px;
}
/* چیپ‌های استارتِ نئومورفیک */
#stv-hero .stv-chips { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; margin-top: 24px; }
#stv-root .stv-chip {
  font-family: 'Vazirmatn', Tahoma, sans-serif; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--stv-text);
  background: var(--stv-neo); border: none; border-radius: 18px; padding: 10px 15px; margin: 0;
  display: inline-flex; align-items: center; gap: 7px; line-height: 1.4;
  box-shadow: -4px -4px 9px var(--stv-neo-hi), 5px 5px 11px var(--stv-neo-lo);
  transition: transform .14s, box-shadow .16s, color .16s;
  animation: stv-chip-in .4s cubic-bezier(.34,1.4,.5,1) both;
}
#stv-root .stv-chip .stv-i { font-size: 14.5px; line-height: 1; }
#stv-root .stv-chip:hover { transform: translateY(-2px); color: var(--stv-ember); background: var(--stv-neo); box-shadow: -4px -4px 9px var(--stv-neo-hi), 6px 6px 14px var(--stv-neo-lo); }
#stv-root .stv-chip:active { transform: translateY(0); box-shadow: inset -3px -3px 6px var(--stv-neo-hi), inset 4px 4px 8px var(--stv-neo-lo); }
@keyframes stv-chip-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes stv-fade { from { opacity: 0; } to { opacity: 1; } }

/* وقتی گفتگو شروع شد، هیرو می‌رود */
#stv-panel.stv-chatting #stv-hero { display: none; }

/* ── حباب‌های پیام ── */
.stv-msg {
  max-width: 84%; padding: 11px 14px; border-radius: 17px; font-size: 14px; line-height: 1.8;
  white-space: pre-wrap; word-wrap: break-word; animation: stv-pop .26s cubic-bezier(.34,1.4,.5,1) both;
}
@keyframes stv-pop { from { opacity: 0; transform: translateY(7px) scale(.98); } to { opacity: 1; transform: none; } }
.stv-bot {
  align-self: flex-start; color: var(--stv-text); border-bottom-right-radius: 5px;
  background: var(--stv-bot); box-shadow: inset 0 0 0 1px var(--stv-glass-edge);
}
.stv-user {
  align-self: flex-end; color: #1f1000; font-weight: 500; border-bottom-left-radius: 5px;
  background: linear-gradient(135deg, #ff9a33, var(--stv-ember) 60%, var(--stv-ember-2));
  box-shadow: 0 4px 14px rgba(255,77,0,.26);
}
.stv-msg strong { font-weight: 800; }
.stv-msg a { color: var(--stv-ember); text-decoration: none; border-bottom: 1px solid var(--stv-ember-soft); }
.stv-user a { color: #3a1c00; border-bottom-color: rgba(58,28,0,.4); }

/* نشانگرِ تایپ */
.stv-typing {
  align-self: flex-start; display: flex; gap: 4px; padding: 13px 15px; border-radius: 17px; border-bottom-right-radius: 5px;
  background: var(--stv-bot); box-shadow: inset 0 0 0 1px var(--stv-glass-edge); animation: stv-pop .2s ease both;
}
.stv-typing span { width: 7px; height: 7px; background: var(--stv-ember); border-radius: 50%; opacity: .5; animation: stv-bounce 1.2s infinite; }
.stv-typing span:nth-child(2) { animation-delay: .18s; }
.stv-typing span:nth-child(3) { animation-delay: .36s; }
@keyframes stv-bounce { 0%,60%,100% { transform: translateY(0); opacity: .4 } 30% { transform: translateY(-5px); opacity: 1 } }

.stv-photo-thumb { max-width: 188px; max-height: 188px; border-radius: 13px; display: block; }

/* ───────── نوارِ ورودی (نئومورفیکِ فرورفته + هاله‌ی اخگریِ نرم و یکنواخت) ───────── */
#stv-foot {
  flex-shrink: 0; padding: 14px 13px; position: relative; z-index: 2;
  display: flex; gap: 9px; align-items: flex-end;
}
#stv-root .stv-field-wrap {
  flex: 1; position: relative; display: flex; align-items: flex-end; gap: 6px;
  background: var(--stv-field); border: none; border-radius: 19px; padding: 5px 6px 5px 5px;
  box-shadow: inset 2px 2px 5px var(--stv-neo-lo), inset -2px -2px 5px var(--stv-neo-hi);
  transition: box-shadow .25s;
}
/* هاله‌ی اخگریِ یکنواخت دورِ فیلد — نرم، بدونِ لبه‌ی مستطیلی، بدونِ لکه‌ی یک‌طرفه */
#stv-root .stv-field-wrap::after {
  content: ""; position: absolute; inset: -4px; border-radius: 23px; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, var(--stv-ember) 0%, var(--stv-ember-2) 55%, transparent 78%);
  filter: blur(9px); opacity: .22; transition: opacity .35s;
}
#stv-foot.stv-focus .stv-field-wrap::after { opacity: .5; }
#stv-foot.stv-focus .stv-field-wrap { box-shadow: inset 2px 2px 5px var(--stv-neo-lo), inset -2px -2px 5px var(--stv-neo-hi); }
#stv-input {
  flex: 1; resize: none; max-height: 100px; min-height: 34px;
  background: transparent; border: none; outline: none;
  color: var(--stv-text); padding: 8px 10px; font-family: inherit; font-size: 14px; line-height: 1.5;
}
#stv-input::placeholder { color: var(--stv-muted); }
#stv-root #stv-photo {
  width: 38px; height: 38px; padding: 0; border-radius: 12px; border: none; cursor: pointer; flex-shrink: 0;
  background: transparent; color: var(--stv-muted); font-size: 0; line-height: 0;
  display: flex; align-items: center; justify-content: center; transition: color .15s, background .15s;
}
#stv-root #stv-photo:hover { color: var(--stv-ember); background: var(--stv-ember-soft); }
#stv-root #stv-photo:disabled { opacity: .4; cursor: default; }
#stv-root #stv-photo svg { width: 19px !important; height: 19px !important; fill: currentColor !important; stroke: none !important; display: block !important; }
#stv-root #stv-send {
  width: 46px; height: 46px; padding: 0; border-radius: 15px; border: none; cursor: pointer; flex-shrink: 0;
  background: linear-gradient(135deg, #ff9a33, var(--stv-ember) 55%, var(--stv-ember-2));
  display: flex; align-items: center; justify-content: center; font-size: 0; line-height: 0;
  box-shadow: 0 5px 16px rgba(255,77,0,.36); transition: transform .14s, box-shadow .18s, opacity .15s;
}
#stv-root #stv-send:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(255,77,0,.5); }
#stv-root #stv-send:active { transform: translateY(0); }
#stv-root #stv-send:disabled { opacity: .45; cursor: default; box-shadow: none; }
#stv-root #stv-send svg { width: 20px !important; height: 20px !important; fill: #1f1000 !important; stroke: none !important; display: block !important; transform: scaleX(-1); }

/* موبایل: تمام‌صفحه */
@media (max-width: 480px) {
  #stv-panel { bottom: 0; left: 0; right: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
  #stv-launcher { bottom: 18px; left: 18px; }
  #stv-root.stv-is-open #stv-launcher { display: none; }
  #stv-hero .stv-hero-t { font-size: 25px; }
}

/* احترام به کاهشِ حرکت */
@media (prefers-reduced-motion: reduce) {
  #stv-root *, #stv-root *::before, #stv-root *::after { animation: none !important; transition: none !important; }
}
