/* Homdorong Chat Glow v1 — ارتقای گرافیکی صفحهٔ گفتگو (فقط CSS؛ آخرین فایل CSS).
   برگشت: خط link مربوط به chat-glow را از index.html حذف کنید. */
:root{
 --cg-wall-a:#e9f1ee;--cg-wall-b:#f5f2e9;--cg-dot:rgba(12,111,99,.07);
 --cg-out-a:#12806f;--cg-out-b:#0a5f55;
 --cg-in:#ffffff;--cg-shadow:0 1px 1.5px rgba(16,44,40,.10),0 6px 16px -8px rgba(16,44,40,.22);
 --cg-glass:rgba(255,255,255,.82);
}
[data-theme=dark]{--cg-wall-a:#0c1618;--cg-wall-b:#101d1e;--cg-dot:rgba(120,210,190,.045);--cg-in:#1b2c2f;--cg-glass:rgba(18,31,34,.82);--cg-shadow:0 1px 1.5px rgba(0,0,0,.35),0 6px 16px -8px rgba(0,0,0,.55)}
@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--cg-wall-a:#0c1618;--cg-wall-b:#101d1e;--cg-dot:rgba(120,210,190,.045);--cg-in:#1b2c2f;--cg-glass:rgba(18,31,34,.82);--cg-shadow:0 1px 1.5px rgba(0,0,0,.35),0 6px 16px -8px rgba(0,0,0,.55)}}

/* ---- متن‌های راهنمای اضافه ---- */
#hd-bold-toolbar,html body .chat-bottom-note{display:none!important}

/* ---- سربرگ گفتگو (شیشه‌ای) ---- */
html body .chat-header{
 background:var(--cg-glass)!important;backdrop-filter:saturate(1.4) blur(14px);-webkit-backdrop-filter:saturate(1.4) blur(14px);
 border-bottom:1px solid color-mix(in srgb,var(--hp-line) 70%,transparent)!important;
 box-shadow:0 8px 24px -18px rgba(16,44,40,.45)!important;position:relative;z-index:5;gap:12px;
}
html body .chat-header .avatar{width:44px;height:44px;border-radius:50%!important;box-shadow:0 0 0 2px var(--hp-surface),0 0 0 3.5px color-mix(in srgb,var(--hp-teal) 55%,transparent)!important}
html body .chat-heading strong{font-size:16.5px;font-weight:800;letter-spacing:0}
html body .chat-heading small{display:inline-flex;align-items:center;gap:6px}
html body .header-tools{display:flex;gap:6px}
html body .chat-panel .icon-btn{width:40px;height:40px;display:grid;place-items:center;transition:background .18s,transform .12s,color .18s}
html body .chat-panel .icon-btn:active:not(:disabled){transform:scale(.92)}

/* ---- زمینهٔ پیام‌ها ---- */
html body .messages{
 background-color:var(--cg-wall-a)!important;
 background-image:
  radial-gradient(circle at 12% 8%,color-mix(in srgb,var(--hp-teal) 11%,transparent),transparent 42%),
  radial-gradient(circle at 92% 92%,color-mix(in srgb,var(--hp-brass) 14%,transparent),transparent 46%),
  radial-gradient(var(--cg-dot) 1.2px,transparent 1.4px)!important;
 background-size:auto,auto,22px 22px!important;background-attachment:local!important;
 padding:18px clamp(12px,4vw,44px) 22px!important;scroll-behavior:smooth;
}

/* ---- جداکنندهٔ روز: حباب شناور ---- */
html body .day-sep{justify-content:center;margin:16px 0 8px!important;gap:0}
html body .day-sep::before,html body .day-sep::after{display:none}
html body .day-sep span{
 background:var(--cg-glass)!important;backdrop-filter:blur(8px);border:1px solid color-mix(in srgb,var(--hp-line) 80%,transparent)!important;
 box-shadow:0 2px 8px -4px rgba(16,44,40,.3)!important;padding:4px 14px!important;border-radius:999px!important;
 font-size:12px;font-weight:700;color:var(--hp-muted)!important;
}

/* ---- حباب‌ها ---- */
@keyframes cg-pop{from{opacity:0;transform:translateY(8px) scale(.97)}to{opacity:1;transform:none}}
html body .message-row .message-bubble{
 position:relative;padding:8px 13px 6px!important;border:0!important;border-radius:18px!important;
 box-shadow:var(--cg-shadow)!important;animation:cg-pop .22s ease-out both;max-width:min(78%,34rem);
 overflow-wrap:anywhere;word-break:normal;
}
html body .message-row.theirs .message-bubble{background:var(--cg-in)!important;border-start-end-radius:5px!important}
html body .message-row.mine .message-bubble{
 background:linear-gradient(155deg,var(--cg-out-a),var(--cg-out-b))!important;color:#fff!important;border-start-start-radius:5px!important;
}
html body .message-row.cont:not(.mine) .message-bubble{border-start-end-radius:18px!important}
html body .message-row.cont.mine .message-bubble{border-start-start-radius:18px!important}
html body .message-bubble p{font-size:15px;line-height:1.85;white-space:pre-wrap}
html body .message-bubble .sender-name{font-size:12.5px;margin-bottom:1px}

/* ---- ساعت و تیک: در گوشهٔ حباب، کنار هم و کوچک ---- */
html body .message-meta{justify-content:flex-end;gap:5px!important;margin-top:1px;font-size:10.5px;line-height:1;opacity:.9;direction:ltr}
html body .message-meta time{font-size:10.5px;font-variant-numeric:tabular-nums}
html body .message-meta .tick{font-size:11px;letter-spacing:-2px!important}
html body .message-meta .tick.read{color:#8fe3ff!important}
html body .hd-v12-edited{font-size:10.5px;opacity:.75;margin-inline-start:4px}

/* ---- پیوست‌ها و تصویر ---- */
html body .attachment{display:flex;gap:10px;padding:8px!important;margin-top:4px;border-radius:14px!important;background:color-mix(in srgb,var(--hp-teal) 8%,transparent)!important}
html body .message-row.mine .attachment{background:rgba(255,255,255,.14)!important}
html body .attachment-icon{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;flex:none;background:rgba(12,111,99,.14);color:var(--hp-teal)}
html body .message-row.mine .attachment-icon{background:rgba(255,255,255,.2);color:#fff}
html body .attachment-content{min-width:0;display:flex;flex-direction:column;gap:6px}
html body .attachment-content strong{font-size:12.5px;font-weight:600;direction:ltr;text-align:start;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:.9}
html body .media-preview{display:block;width:100%;max-width:300px;max-height:340px;object-fit:cover;border-radius:12px;box-shadow:0 4px 14px -6px rgba(0,0,0,.45);cursor:zoom-in}
html body .attachment-content a{font-size:12px;font-weight:700;text-decoration:none;opacity:.9}
html body .attachment-content audio{width:min(240px,100%);height:36px}

/* ---- نوار ارسال: قرص شناور ---- */
html body .composer{
 margin:0 10px calc(10px + env(safe-area-inset-bottom))!important;padding:6px!important;border:1px solid color-mix(in srgb,var(--hp-line) 80%,transparent)!important;
 border-radius:26px!important;background:var(--cg-glass)!important;backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);
 box-shadow:0 10px 30px -14px rgba(16,44,40,.45)!important;align-items:flex-end;gap:4px!important;
}
html body .composer textarea,html body .composer .hd-growing-composer{
 border:0!important;background:transparent!important;box-shadow:none!important;border-radius:20px!important;padding:11px 8px!important;font-size:15px;
}
html body .composer textarea:focus,html body .composer .hd-growing-composer:focus{box-shadow:none!important;background:transparent!important}
html body .composer:focus-within{border-color:color-mix(in srgb,var(--hp-teal) 60%,transparent)!important;box-shadow:0 0 0 3px color-mix(in srgb,var(--hp-teal) 14%,transparent),0 10px 30px -14px rgba(16,44,40,.45)!important}
html body .composer .attach-btn,html body .composer .record-btn{width:42px;height:42px;border-radius:50%!important;display:grid;place-items:center;flex:none}
html body .composer .record-btn.recording{background:#e5484d!important;color:#fff!important;animation:cg-rec 1.1s ease-in-out infinite}
@keyframes cg-rec{50%{box-shadow:0 0 0 8px rgba(229,72,77,.18)}}
html body .send-btn{
 width:44px;height:44px;min-width:44px;padding:0!important;border-radius:50%!important;display:grid;place-items:center;flex:none;
 background:linear-gradient(145deg,var(--cg-out-a),var(--cg-out-b))!important;box-shadow:0 6px 14px -6px rgba(10,95,85,.8)!important;
 transition:transform .15s,opacity .2s,box-shadow .2s;
}
html body .send-btn svg{transform:scaleX(-1)}
html body .send-btn:hover:not(:disabled){transform:translateY(-1px) scale(1.04)}
html body .send-btn:active:not(:disabled){transform:scale(.94)}
html body .send-btn:disabled{background:color-mix(in srgb,var(--hp-muted) 35%,var(--hp-surface))!important;box-shadow:none!important;opacity:1}

/* ---- لابی ---- */
html body .welcome-empty .empty-symbol{background:linear-gradient(145deg,var(--cg-out-a),var(--cg-out-b))!important;color:#fff!important;box-shadow:0 14px 28px -14px rgba(10,95,85,.8)!important;border-radius:26px!important}

@media (max-width:820px){
 html body .message-row .message-bubble{max-width:84%}
 html body .composer{margin:0 6px calc(6px + env(safe-area-inset-bottom))!important}
}
@media (prefers-reduced-motion:reduce){html body .message-row .message-bubble{animation:none}}

/* دم‌های قدیمی حباب حذف شد؛ گوشهٔ تیز کوچک جایگزین است */
html body .message-row .message-bubble::before,html body .message-row .message-bubble::after{display:none!important;content:none!important}
html body form.composer textarea,html body form.composer textarea.hd-growing-composer{background:transparent!important;border:0!important;box-shadow:none!important}

/* برچسب پیام منتقل‌شده (مثل واتساپ) */
html body .hd-fwd-label{font-size:11.5px;font-style:italic;opacity:.68;margin:0 0 2px;display:flex;align-items:center;gap:4px;line-height:1.6}

/* ======================= Chat Pro: فهرست گفتگوها ======================= */
html body .conversation-item{
 display:flex;gap:12px;align-items:center;padding:11px 14px!important;margin:2px 8px!important;width:calc(100% - 16px)!important;
 border-radius:16px!important;border:0!important;transition:background .16s,transform .1s;position:relative;
}
html body .conversation-item:active{transform:scale(.985)}
html body .conversation-item .avatar{width:52px!important;height:52px!important;flex:none;border-radius:50%!important;font-size:19px;box-shadow:0 0 0 2px rgba(255,255,255,.08)}
html body .conversation-item.active{background:linear-gradient(90deg,rgba(201,163,79,.20),rgba(255,255,255,.07))!important}
html body .conversation-item.active::before{content:"";position:absolute;inset-block:14px;inset-inline-start:-8px;width:4px;border-radius:4px;background:var(--hp-brass)}
html body .conversation-copy{min-width:0;flex:1;display:flex;flex-direction:column;gap:3px}
html body .conversation-copy .row-top{display:flex;align-items:baseline;justify-content:space-between;gap:8px}
html body .conversation-copy .row-top strong{font-size:15.5px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
html body .conversation-copy .row-top time{font-size:11.5px;color:var(--hp-side-muted);flex:none;font-variant-numeric:tabular-nums}
html body .conversation-copy .row-top time.has-unread{color:var(--hp-brass)!important;font-weight:700}
html body .conversation-copy .row-bottom{display:flex;align-items:center;justify-content:space-between;gap:8px}
html body .conversation-copy .preview{font-size:13px;color:var(--hp-side-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1}
html body .conversation-copy .preview[data-kind]::before{margin-inline-end:5px;font-style:normal;opacity:.9}
html body .conversation-copy .preview[data-kind=image]::before{content:"🖼"}
html body .conversation-copy .preview[data-kind=video]::before{content:"🎬"}
html body .conversation-copy .preview[data-kind=audio]::before{content:"🎙"}
html body .conversation-copy .preview[data-kind=file]::before{content:"📎"}
html body .conversation-item:has(time.has-unread) .preview{color:var(--hp-side-ink);font-weight:600}
html body .conversation-item .badge{
 min-width:21px;height:21px;padding:0 6px;border-radius:999px!important;display:grid;place-items:center;flex:none;
 background:var(--hp-brass)!important;color:var(--hp-brass-ink)!important;font-size:11.5px;font-weight:800;box-shadow:0 3px 8px -3px rgba(201,163,79,.8)
}

/* ======================= Chat Pro: پیام‌ها ======================= */
html body .chat-panel{position:relative}
html body .message-row{position:relative;touch-action:pan-y}
html body .message-row.cont .sender-name{display:none}
html body .message-row.cont{margin-top:1px!important}
html body .message-row.hd-swiping .message-bubble{transition:none!important;animation:none!important}
html body .message-row.hd-swiping::after{
 content:"↩";position:absolute;top:50%;inset-inline-start:14px;transform:translateY(-50%) scale(.6);width:34px;height:34px;border-radius:50%;
 display:grid;place-items:center;background:var(--cg-glass);color:var(--hp-teal);font-size:18px;box-shadow:0 3px 10px -4px rgba(0,0,0,.4);opacity:.6;transition:transform .12s,opacity .12s
}
html body .message-row.hd-swipe-ready::after{transform:translateY(-50%) scale(1);opacity:1;background:var(--hp-teal);color:#fff}
html body .message-row.mine.hd-swiping::after{inset-inline-start:auto;inset-inline-end:14px}

/* نقل‌قول پاسخ */
html body .hd2-reply,html body .hd-reply-preview{
 border:0!important;border-inline-start:4px solid var(--hp-teal)!important;border-radius:12px!important;
 background:color-mix(in srgb,var(--hp-teal) 9%,var(--hp-surface))!important;margin:0 8px 6px!important;box-shadow:none!important
}

/* واکنش‌ها */
html body .hd-react-row{display:flex;flex-wrap:wrap;gap:4px;margin:4px 0 2px}
html body .hd-react-pill{
 display:inline-flex;align-items:center;gap:3px;height:24px;padding:0 8px;border-radius:999px;font-size:13px;line-height:1;cursor:pointer;
 border:1px solid color-mix(in srgb,currentColor 18%,transparent);background:color-mix(in srgb,currentColor 8%,transparent);color:inherit;
}
html body .hd-react-pill .n{font-size:11px;font-weight:700}
html body .hd-react-pill .n:empty{display:none}
html body .hd-react-pill.mine{background:color-mix(in srgb,var(--hp-brass) 30%,transparent);border-color:var(--hp-brass)}
@keyframes cg-heart{0%{box-shadow:0 0 0 0 rgba(229,72,77,.5)}100%{box-shadow:0 0 0 14px rgba(229,72,77,0)}}
html body .message-bubble.hd-heart-pop{animation:cg-heart .5s ease-out}

/* دکمهٔ رفتن به آخرین پیام */
html body .hd-jump{
 position:absolute;inset-inline-start:16px;bottom:92px;z-index:8;width:44px;height:44px;border-radius:50%;border:0;cursor:pointer;
 background:var(--hp-surface);color:var(--hp-teal);box-shadow:0 8px 20px -8px rgba(0,0,0,.5);display:grid;place-items:center;
 opacity:0;transform:translateY(10px) scale(.9);pointer-events:none;transition:opacity .18s,transform .18s;
}
html body .hd-jump.show{opacity:1;transform:none;pointer-events:auto}
html body .hd-jump-ico{font-size:20px;font-weight:800;line-height:1}
html body .hd-jump-n{
 position:absolute;top:-8px;inset-inline-end:-4px;min-width:20px;height:20px;padding:0 5px;border-radius:999px;display:grid;place-items:center;
 background:var(--hp-brass);color:var(--hp-brass-ink);font-size:11px;font-weight:800
}
html body .hd-jump-n[hidden]{display:none}

/* پخش‌کنندهٔ صوتی */
html body .hd-aud{display:flex;align-items:center;gap:10px;min-width:min(250px,64vw);padding:2px 0}
html body .hd-aud-play{width:38px;height:38px;border-radius:50%;border:0;flex:none;cursor:pointer;display:grid;place-items:center;background:var(--hp-teal);color:#fff;position:relative}
html body .message-row.mine .hd-aud-play{background:#fff;color:var(--cg-out-b)}
html body .hd-aud-play::before{content:"";border-inline-start:11px solid currentColor;border-block:7px solid transparent;margin-inline-start:-2px}
html body .hd-aud.playing .hd-aud-play::before{border:0;width:11px;height:13px;margin:0;transform:none;background:linear-gradient(90deg,currentColor 0 36%,transparent 36% 64%,currentColor 64%)}
html body .hd-aud-wave{flex:1;height:30px;display:flex;align-items:center;gap:2px;cursor:pointer;min-width:90px}
html body .hd-aud-wave i{flex:1;min-width:2px;border-radius:2px;background:currentColor;opacity:.3;transition:opacity .1s}
html body .hd-aud-wave i.on{opacity:1}
html body .hd-aud-time{font-size:11.5px;font-variant-numeric:tabular-nums;opacity:.85;flex:none;min-width:34px}
html body .hd-aud-speed{border:0;border-radius:999px;padding:3px 7px;font-size:11px;font-weight:800;cursor:pointer;background:color-mix(in srgb,currentColor 16%,transparent);color:inherit;flex:none}

/* ======================= آنلاین، در حال نوشتن، دستهٔ عکس ======================= */
html body .conversation-item .avatar,html body .chat-header .avatar{position:relative;overflow:visible}
html body .conversation-item[data-online="1"] .avatar::after,html body .chat-header[data-online="1"] .avatar::after{
 content:"";position:absolute;inset-block-end:1px;inset-inline-end:1px;width:13px;height:13px;border-radius:50%;
 background:#2fd37b;border:2.5px solid var(--hp-side);box-shadow:0 0 0 0 rgba(47,211,123,.6);animation:cg-online 2.4s ease-out infinite
}
html body .chat-header[data-online="1"] .avatar::after{border-color:var(--hp-surface)}
@keyframes cg-online{70%{box-shadow:0 0 0 7px rgba(47,211,123,0)}100%{box-shadow:0 0 0 0 rgba(47,211,123,0)}}
html body .hd-v13-status:not(.off){color:#1fae67!important;font-weight:700}
html body .hd-v13-typing{display:none!important} /* جایش را حباب شناور می‌گیرد */

html body .hd-typing{
 position:absolute;inset-inline-end:16px;bottom:84px;z-index:7;display:flex;align-items:center;gap:8px;padding:7px 13px;border-radius:18px;
 background:var(--cg-glass);backdrop-filter:blur(10px);box-shadow:var(--cg-shadow);font-size:12.5px;color:var(--hp-muted);
 opacity:0;transform:translateY(8px);pointer-events:none;transition:opacity .18s,transform .18s
}
html body .hd-typing.show{opacity:1;transform:none}
html body .hd-typing-dots{display:inline-flex;gap:3px;align-items:center}
html body .hd-typing-dots i{width:6px;height:6px;border-radius:50%;background:var(--hp-teal);animation:cg-dot 1.1s ease-in-out infinite}
html body .hd-typing-dots i:nth-child(2){animation-delay:.15s}html body .hd-typing-dots i:nth-child(3){animation-delay:.3s}
@keyframes cg-dot{0%,60%,100%{transform:translateY(0);opacity:.45}30%{transform:translateY(-4px);opacity:1}}

/* عکس‌های پشت‌سرهم: دستهٔ فشرده با حباب‌های چسبیده */
html body .message-group[data-hd-photo] .message-row{margin-block:1px!important}
html body .message-group[data-hd-photo] .message-bubble{padding:3px!important;width:min(230px,66vw)}
html body .message-group[data-hd-photo] .attachment{padding:0!important;margin:0!important;background:none!important;display:block}
html body .message-group[data-hd-photo] .attachment-icon,
html body .message-group[data-hd-photo] .attachment-content>strong,
html body .message-group[data-hd-photo] .attachment-content>a{display:none!important}
html body .message-group[data-hd-photo] .media-preview{width:100%;max-width:none;aspect-ratio:4/3;max-height:none;border-radius:15px;box-shadow:none}
html body .message-group[data-hd-photo=first] .message-bubble,html body .message-group[data-hd-photo=mid] .message-bubble{border-end-start-radius:6px!important;border-end-end-radius:6px!important}
html body .message-group[data-hd-photo=mid] .message-bubble,html body .message-group[data-hd-photo=last] .message-bubble{border-start-start-radius:6px!important;border-start-end-radius:6px!important}
html body .message-group[data-hd-photo=first] .message-meta,html body .message-group[data-hd-photo=mid] .message-meta{display:none!important}
html body .message-group[data-hd-photo=last] .message-meta{padding:2px 6px 1px}

/* ======================= کارت پیش‌نمایش لینک ======================= */
html body .hd-lp{
 display:block;margin:6px -4px 2px;border-radius:12px;overflow:hidden;text-decoration:none!important;color:inherit!important;
 background:color-mix(in srgb,currentColor 9%,transparent);border-inline-start:4px solid var(--hp-brass);max-width:340px;
}
html body .message-row.theirs .hd-lp{background:color-mix(in srgb,var(--hp-teal) 8%,var(--cg-in))}
html body .hd-lp-img{display:block;width:100%;aspect-ratio:1.91/1;object-fit:cover;background:color-mix(in srgb,currentColor 12%,transparent)}
html body .hd-lp-body{padding:8px 10px 9px;display:flex;flex-direction:column;gap:2px;direction:auto;text-align:start}
html body .hd-lp-site{font-size:11px;opacity:.7;direction:ltr;text-align:start;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
html body .hd-lp-title{font-size:13.5px;font-weight:800;line-height:1.6;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
html body .hd-lp-desc{font-size:12.5px;line-height:1.7;opacity:.85;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
html body .hd-lp:active{opacity:.9}
