/* «سانی» — animated site assistant (public/v2/js/sunny.js). Lives in the bottom-left corner (RTL: the trailing side). */
.sny { --sz: 92px; --sny-bg: var(--surface, #fff); --sny-text: var(--text, #111318); --sny-text-2: var(--text-2, #474D58); --sny-line: var(--line, rgba(17,19,24,.08));
  position: fixed; left: 18px; bottom: 18px; z-index: 1050; font-family: var(--font, "Vazir", Tahoma, sans-serif); direction: rtl; pointer-events: none; }
.sny * { box-sizing: border-box; }
@media (max-width: 860px) { .sny { --sz: 70px; left: 10px; bottom: calc(88px + env(safe-area-inset-bottom)); } }

/* ---------- the character ---------- */
.sny-bot { position: relative; width: var(--sz); height: var(--sz); pointer-events: auto; cursor: pointer; transform: translateX(calc(-100% - 40px)); transition: transform .7s cubic-bezier(.34,1.56,.64,1); -webkit-tap-highlight-color: transparent; }
.sny-bot:focus-visible { outline: 3px solid #2E90FA; outline-offset: 4px; border-radius: 50%; }
.sny.is-peek .sny-bot { transform: translateX(-52%) rotate(28deg); }
.sny.is-in .sny-bot { transform: none; }
.sny.is-hidden .sny-bot { transform: translateX(calc(-100% - 40px)); }
.sny-svg { width: 100%; height: 100%; overflow: visible; display: block; filter: drop-shadow(0 10px 18px rgba(242,166,0,.38)); }
.sny-body { transform-origin: 70px 76px; transform-box: view-box; animation: sny-breathe 3.2s ease-in-out infinite; }
.sny-tilt { transform-origin: 70px 70px; transform-box: view-box; transition: transform .35s ease-out; }
.sny-rays { transform-origin: 70px 70px; transform-box: view-box; animation: sny-spin 22s linear infinite; }
.sny.is-fast .sny-rays { animation-duration: 2.4s; }
.sny-eye { transform-box: fill-box; transform-origin: center; transition: transform .09s; }
.sny-eye.blink { transform: scaleY(.08); }
.sny-pupil { transition: transform .12s ease-out; }
.sny-hand-r { transform-box: fill-box; transform-origin: 20% 90%; }
.sny.is-wave .sny-hand-r { animation: sny-wave .5s ease-in-out 4 alternate; }
.sny-alt, .sny-glasses, .sny-hearts, .sny-zzz, .sny-sweat, .sny-dots, .sny-wink { opacity: 0; transition: opacity .2s; }

/* moods (data-mood on .sny) */
.sny[data-mood="happy"] .m-happy, .sny[data-mood="cool"] .m-cool, .sny[data-mood="wink"] .m-wink, .sny[data-mood="think"] .m-think,
.sny[data-mood="wow"] .m-wow, .sny[data-mood="sad"] .m-sad, .sny[data-mood="love"] .m-love, .sny[data-mood="sleep"] .m-sleep, .sny[data-mood="dizzy"] .m-wow { opacity: 1; }
.sny[data-mood="happy"] .b-def, .sny[data-mood="cool"] .b-def, .sny[data-mood="wink"] .b-def, .sny[data-mood="love"] .b-def, .sny[data-mood="sleep"] .b-def { opacity: 1; }
.sny[data-mood="wow"] .b-up, .sny[data-mood="dizzy"] .b-up { opacity: 1; }
.sny[data-mood="sad"] .b-sad { opacity: 1; }
.sny[data-mood="think"] .b-think { opacity: 1; }
.sny[data-mood="cool"] .sny-glasses { opacity: 1; }
.sny[data-mood="love"] .sny-hearts { opacity: 1; }
.sny[data-mood="love"] .sny-eyes, .sny[data-mood="cool"] .sny-eyes { opacity: 0; }
.sny[data-mood="sleep"] .sny-eye { transform: scaleY(.08); }
.sny[data-mood="sleep"] .sny-zzz { opacity: 1; }
.sny[data-mood="sleep"] .sny-body { animation-duration: 5s; }
.sny[data-mood="sad"] .sny-sweat { opacity: 1; }
.sny[data-mood="think"] .sny-dots { opacity: 1; }
.sny[data-mood="wink"] .sny-eye-l { transform: scaleY(.08); }
.sny[data-mood="wink"] .sny-wink { opacity: 1; }
.sny[data-mood="wow"] .sny-eye { transform: scale(1.12); }
.sny-cheek { transition: opacity .3s; opacity: .5; }
.sny.is-blush .sny-cheek { opacity: .95; }
.sny-zzz text { animation: sny-z 2.4s ease-in-out infinite; }
.sny-zzz text:nth-child(2) { animation-delay: .8s; }
.sny-zzz text:nth-child(3) { animation-delay: 1.6s; }
.sny-dots circle { animation: sny-dot 1.2s ease-in-out infinite; }
.sny-dots circle:nth-child(2) { animation-delay: .2s; }
.sny-dots circle:nth-child(3) { animation-delay: .4s; }
.sny-hearts path { animation: sny-beat .7s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }

/* tricks */
.sny.is-jump .sny-bot { animation: sny-jump .65s cubic-bezier(.3,1.6,.5,1); }
.sny.is-spin .sny-svg { animation: sny-roll .9s cubic-bezier(.5,0,.3,1); }
.sny.is-squash .sny-svg { animation: sny-squash .45s ease; }
.sny.is-shake .sny-svg { animation: sny-shake .5s ease 2; }
.sny.is-dizzy .sny-tilt { animation: sny-wobble .6s ease-in-out infinite; }
.sny.is-duck .sny-bot { transform: translateY(78%); }
.sny.is-near .sny-body { animation-duration: 1.2s; }
.sny-badge { position: absolute; top: 2px; right: 2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: #F04438; color: #fff; font-size: 11px; font-weight: 900; display: none; place-items: center; box-shadow: 0 0 0 3px var(--sny-bg); }
.sny.has-badge .sny-badge { display: grid; animation: sny-pop .4s cubic-bezier(.34,1.56,.64,1); }

/* the "edge tab" shown when the user put Sunny to rest */
.sny-tab { position: fixed; left: 0; bottom: 30%; width: 30px; height: 54px; border-radius: 0 16px 16px 0; background: linear-gradient(180deg, #FFE36E, #FFC400); box-shadow: 0 8px 20px -6px rgba(242,166,0,.6); border: 0; cursor: pointer; pointer-events: auto; display: none; font-size: 18px; padding: 0; }
.sny.is-hidden .sny-tab { display: block; animation: sny-tab 2.4s ease-in-out infinite; }

/* ---------- speech bubble ---------- */
.sny-say { position: absolute; left: calc(var(--sz) + 10px); bottom: calc(var(--sz) * .45); width: max-content; max-width: min(280px, calc(100vw - var(--sz) - 44px)); padding: 12px 14px; border-radius: 18px 18px 18px 4px;
  background: var(--sny-bg); color: var(--sny-text); box-shadow: 0 18px 40px -14px rgba(17,19,24,.35), 0 0 0 1px var(--sny-line); font-size: 13.5px; line-height: 1.85; font-weight: 600;
  pointer-events: auto; opacity: 0; transform: translateY(8px) scale(.94); transform-origin: left bottom; transition: opacity .25s, transform .3s cubic-bezier(.34,1.56,.64,1); visibility: hidden; }
.sny-say.show { opacity: 1; transform: none; visibility: visible; }
.sny-say[data-tone="warn"] { box-shadow: 0 18px 40px -14px rgba(17,19,24,.35), inset 0 0 0 1.5px #FDB022; }
.sny-say[data-tone="love"] { box-shadow: 0 18px 40px -14px rgba(17,19,24,.35), inset 0 0 0 1.5px #FDA4AF; }
.sny-say[data-tone="ok"] { box-shadow: 0 18px 40px -14px rgba(17,19,24,.35), inset 0 0 0 1.5px #6CE9A6; }
.sny-say-x { position: absolute; top: 4px; left: 6px; width: 22px; height: 22px; border: 0; background: none; color: var(--sny-text-2); font-size: 16px; line-height: 1; cursor: pointer; border-radius: 50%; }
.sny-say-x:hover { background: var(--sny-line); }
.sny-say p { margin: 0 0 0 18px; }
.sny-say a { display: inline-flex; margin-top: 8px; padding: 5px 12px; border-radius: 999px; background: #FFD400; color: #111318 !important; font-weight: 800; font-size: 12px; text-decoration: none; }
@media (max-width: 860px) { .sny-say { bottom: calc(var(--sz) + 6px); left: 4px; border-radius: 18px 18px 18px 4px; } }

/* ---------- chat panel ---------- */
.sny-chat { position: absolute; left: 0; bottom: calc(var(--sz) + 14px); width: min(380px, calc(100vw - 20px)); height: min(600px, calc(100vh - var(--sz) - 60px)); display: flex; flex-direction: column;
  border-radius: 24px; background: var(--sny-bg); color: var(--sny-text); box-shadow: 0 30px 80px -24px rgba(17,19,24,.45), 0 0 0 1px var(--sny-line); overflow: hidden; pointer-events: auto;
  opacity: 0; visibility: hidden; transform: translateY(16px) scale(.96); transform-origin: left bottom; transition: opacity .25s, transform .35s cubic-bezier(.34,1.56,.64,1), visibility .25s; }
.sny.is-open .sny-chat { opacity: 1; visibility: visible; transform: none; }
@media (max-width: 860px) { .sny-chat { position: fixed; left: 8px; right: 8px; width: auto; bottom: calc(88px + env(safe-area-inset-bottom) + var(--sz) + 8px); height: min(560px, calc(100vh - 220px)); } }
.sny-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: radial-gradient(320px 120px at 100% 0, rgba(255,212,0,.35), transparent 70%), #111318; color: #fff; }
.sny-head .av { width: 40px; height: 40px; flex: none; }
.sny-head b { display: block; font-weight: 900; font-size: 15px; }
.sny-head small { color: #FFE14D; font-size: 11.5px; font-weight: 600; }
.sny-head .sp { flex: 1; }
.sny-hbtn { width: 34px; height: 34px; border-radius: 12px; border: 0; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; font-size: 16px; display: grid; place-items: center; }
.sny-hbtn:hover { background: rgba(255,255,255,.16); }
.sny-hbtn[aria-pressed="true"] { background: #FFD400; color: #111318; }
.sny-log { flex: 1; overflow-y: auto; padding: 14px 12px 6px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; overscroll-behavior: contain; }
.sny-log > * { flex-shrink: 0; }
.sny-msg { max-width: 88%; padding: 9px 13px; border-radius: 18px; font-size: 13.5px; line-height: 1.9; white-space: pre-line; word-wrap: break-word; animation: sny-in .3s ease both; }
.sny-msg.bot { align-self: flex-start; background: var(--surface-2, #F9F8F5); box-shadow: inset 0 0 0 1px var(--sny-line); border-bottom-right-radius: 6px; }
.sny-msg.me { align-self: flex-end; background: #FFD400; color: #111318; font-weight: 700; border-bottom-left-radius: 6px; }
.sny-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; border-radius: 18px; background: var(--surface-2, #F9F8F5); }
.sny-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--sny-text-2); animation: sny-dot 1s ease-in-out infinite; }
.sny-typing i:nth-child(2) { animation-delay: .15s; } .sny-typing i:nth-child(3) { animation-delay: .3s; }
.sny-links { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; max-width: 92%; }
.sny-links a { padding: 6px 12px; border-radius: 999px; background: #111318; color: #fff !important; font-size: 12px; font-weight: 800; text-decoration: none; }
[data-theme="dark"] .sny-links a { background: #FFD400; color: #111318 !important; }
.sny-chips { display: flex; gap: 6px; padding: 8px 12px 0; overflow-x: auto; scrollbar-width: none; }
.sny-chips::-webkit-scrollbar { display: none; }
.sny-chips button { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong, rgba(17,19,24,.14)); background: var(--sny-bg); color: var(--sny-text); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.sny-chips button:hover { border-color: #F2C200; background: rgba(255,212,0,.14); }
.sny-form { display: flex; gap: 8px; padding: 10px 12px 12px; }
.sny-form input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line-strong, rgba(17,19,24,.14)); background: var(--surface-2, #F9F8F5); color: var(--sny-text); font: inherit; font-size: 14px; outline: none; }
.sny-form input:focus { border-color: #F2C200; box-shadow: 0 0 0 3px rgba(255,212,0,.3); }
.sny-form button { width: 44px; height: 44px; flex: none; border-radius: 14px; border: 0; background: #FFD400; color: #111318; font-size: 18px; cursor: pointer; display: grid; place-items: center; }
.sny-form button:disabled { opacity: .5; }

/* cards */
.sny-card { align-self: stretch; border-radius: 18px; background: var(--sny-bg); box-shadow: inset 0 0 0 1px var(--sny-line), 0 6px 16px -10px rgba(17,19,24,.2); overflow: hidden; font-size: 13px; animation: sny-in .35s ease both; }
.sny-prod { display: grid; grid-template-columns: 92px 1fr; gap: 0; }
.sny-prod img { width: 92px; height: 120px; object-fit: cover; background: #fff; align-self: start; margin: 8px 8px 8px 0; border-radius: 12px; }
.sny-prod .in { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.sny-prod b { font-size: 13px; line-height: 1.7; font-weight: 800; }
.sny-prod .cat { font-size: 11px; color: var(--sny-text-2); }
.sny-prod .pr { font-weight: 900; font-size: 14px; }
.sny-prod .pr s { color: var(--sny-text-2); font-weight: 500; font-size: 11.5px; margin-inline-start: 6px; }
.sny-prod .desc { font-size: 12px; line-height: 1.8; color: var(--sny-text-2); margin: 2px 0; }
.sny-prod .row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.sny-prod .out { font-size: 11.5px; font-weight: 800; color: #B42318; }
.sny-qty { display: inline-flex; align-items: center; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line-strong, rgba(17,19,24,.14)); }
.sny-qty button { width: 26px; height: 30px; border: 0; background: none; color: var(--sny-text); font-size: 15px; cursor: pointer; }
.sny-qty span { min-width: 18px; text-align: center; font-weight: 800; }
.sny-btn { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px; border-radius: 10px; border: 0; background: #FFD400; color: #111318 !important; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; text-decoration: none; }
.sny-btn.ghost { background: var(--surface-sunk, #F1F0EB); color: var(--sny-text) !important; }
.sny-order { padding: 12px 14px; display: grid; gap: 6px; }
.sny-order .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sny-order .st { padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 800; background: #E0F2FE; color: #026AA2; }
.sny-order .st[data-c="2"] { background: #DCFAE6; color: #067647; }
.sny-order .st[data-c="3"], .sny-order .st[data-c="4"], .sny-order .st[data-c="x"] { background: #FEE4E2; color: #B42318; }
.sny-order .st[data-c="5"], .sny-order .st[data-c="1"] { background: #FEF0C7; color: #B54708; }
.sny-order .muted { color: var(--sny-text-2); font-size: 12px; }
.sny-order .bc { display: flex; align-items: center; gap: 6px; font-family: monospace; font-size: 12px; direction: ltr; justify-content: flex-end; }
.sny-order .late { color: #B42318; font-weight: 700; font-size: 12px; }
.sny-list { margin: 0; padding: 10px 14px; list-style: none; display: grid; gap: 6px; }
.sny-list li { line-height: 1.8; font-size: 12.5px; padding-bottom: 6px; border-bottom: 1px dashed var(--sny-line); }
.sny-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.sny-copy { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.sny-copy code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; font-size: 12px; }
.sny-eval { padding: 12px 14px; display: grid; grid-template-columns: 78px 1fr; gap: 12px; align-items: center; }
.sny-ring { width: 78px; height: 78px; position: relative; }
.sny-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 900; }
.sny-bars { display: grid; gap: 4px; }
.sny-bars div { display: grid; grid-template-columns: 1fr 60px; align-items: center; gap: 6px; font-size: 11px; }
.sny-bars i { display: block; height: 6px; border-radius: 6px; background: var(--surface-sunk, #F1F0EB); position: relative; overflow: hidden; }
.sny-bars i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 6px; background: var(--c); }
.sny-grade { grid-column: 1 / -1; font-weight: 800; font-size: 12.5px; }

/* keyframes */
@keyframes sny-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.025, .975) translateY(1.5px); } }
@keyframes sny-spin { to { transform: rotate(360deg); } }
@keyframes sny-wave { from { transform: rotate(-18deg); } to { transform: rotate(26deg); } }
@keyframes sny-jump { 0% { transform: translateY(0) scale(1, 1); } 25% { transform: translateY(4px) scale(1.12, .85); } 55% { transform: translateY(-34px) scale(.92, 1.1); } 80% { transform: translateY(2px) scale(1.08, .92); } 100% { transform: none; } }
@keyframes sny-roll { to { transform: rotate(360deg); } }
@keyframes sny-squash { 0%, 100% { transform: none; } 40% { transform: scale(1.18, .8); } 70% { transform: scale(.94, 1.06); } }
@keyframes sny-shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px) rotate(-6deg); } 75% { transform: translateX(5px) rotate(6deg); } }
@keyframes sny-wobble { 0%, 100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg); } }
@keyframes sny-z { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(10px, -16px); } }
@keyframes sny-dot { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
@keyframes sny-beat { from { transform: scale(.9); } to { transform: scale(1.12); } }
@keyframes sny-pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes sny-tab { 0%, 100% { width: 30px; } 50% { width: 38px; } }
@keyframes sny-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .sny-body, .sny-rays, .sny-zzz text, .sny-dots circle, .sny-hearts path, .sny-tab { animation: none !important; }
  .sny-bot { transition: none; }
}
@media print { .sny { display: none !important; } }

/* long text from taught answers / product descriptions (white-space keeps the admin's line breaks) */
.sny-note { padding: 10px 14px; font-size: 12.5px; line-height: 1.95; white-space: pre-line; max-height: 260px; overflow-y: auto; overscroll-behavior: contain; }
/* 👍 / 👎 under an answer */
.sny-rate { align-self: flex-start; display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--sny-text-2); padding: 0 4px; }
.sny-rate button { border: 0; background: transparent; cursor: pointer; font-size: 15px; line-height: 1; padding: 4px 6px; border-radius: 10px; filter: grayscale(.6); opacity: .8; transition: transform .15s, filter .15s; }
.sny-rate button:hover, .sny-rate button.on { filter: none; opacity: 1; transform: scale(1.15); background: var(--sny-line); }
.sny-rate button:disabled { cursor: default; }
.sny-msg { white-space: pre-line; }
