/* ============================================================
   ۱) گفتگوی عمومی (/chat) در تم شب — خوانا
   ۲) آواتار در کانال‌ها و گروه‌ها — پیدا و روشن
   ============================================================ */

/* ---------- گفتگوی عمومی: تم شب ---------- */
html[data-theme="dark"] body #chatFeed,
html[data-theme="dark"] body .chat-feed,
html[data-theme="dark"] body .chat-messages,
html[data-theme="dark"] body .chat-scroll {
  background-color: #0E1020 !important; background-image: none !important;
}
html[data-theme="dark"] body .chat-shell,
html[data-theme="dark"] body .chat-wrap,
html[data-theme="dark"] body #chatOnline,
html[data-theme="dark"] body .chat-composer,
html[data-theme="dark"] body .chat-input-wrap {
  background-color: #1B1D36 !important; background-image: none !important;
  border-color: rgba(255,255,255,.11) !important;
}

/* ظرف پیام هرگز زمینه نگیرد — تنها حباب رنگ دارد */
html[data-theme="dark"] body .chat-msg,
html[data-theme="dark"] body .chat-msg > div:not(.chat-msg-bubble):not(.chat-bubble),
html[data-theme="dark"] body .chat-msg-body,
html[data-theme="dark"] body .chat-msg-head {
  background-color: transparent !important; background-image: none !important;
  border: 0 !important; box-shadow: none !important;
}

/* حباب */
html[data-theme="dark"] body .chat-msg-bubble,
html[data-theme="dark"] body .chat-bubble {
  background-color: #262A48 !important; background-image: none !important;
  border: 1px solid rgba(255,255,255,.14) !important;
  border-radius: 16px 16px 16px 5px !important;
  color: #F2F4FF !important; -webkit-text-fill-color: #F2F4FF !important;
  padding: 12px 15px !important; width: fit-content !important; max-width: 100% !important;
  box-shadow: none !important;
}
html[data-theme="dark"] body .chat-msg.is-me .chat-msg-bubble,
html[data-theme="dark"] body .chat-msg.is-mine .chat-msg-bubble,
html[data-theme="dark"] body .chat-msg[data-hf-side="me"] .chat-msg-bubble {
  background-color: #5B21D6 !important; border-color: #6D2EEA !important;
  border-radius: 16px 16px 5px 16px !important;
  color: #FFFFFF !important; -webkit-text-fill-color: #FFFFFF !important;
}
html[data-theme="dark"] body .chat-msg-bubble *,
html[data-theme="dark"] body .chat-bubble * {
  color: inherit !important; -webkit-text-fill-color: inherit !important;
  background-color: transparent !important;
}
html[data-theme="dark"] body .chat-msg-text {
  color: inherit !important; -webkit-text-fill-color: inherit !important;
  background-color: transparent !important;
}

/* نام و ساعت بیرون حباب */
html[data-theme="dark"] body .chat-msg-name,
html[data-theme="dark"] body .chat-msg-head b {
  color: #E8EBF9 !important; -webkit-text-fill-color: #E8EBF9 !important;
}
html[data-theme="dark"] body .chat-msg-time,
html[data-theme="dark"] body .chat-msg time {
  color: #979EBD !important; -webkit-text-fill-color: #979EBD !important;
}

/* جداکنندهٔ تاریخ */
html[data-theme="dark"] body .chat-date,
html[data-theme="dark"] body .chat-day,
html[data-theme="dark"] body .day-sep,
html[data-theme="dark"] body [class*="date-sep"] {
  align-self: center !important; width: auto !important; max-width: max-content !important;
  margin: 2px auto !important; padding: 5px 15px !important; border-radius: 999px !important;
  background-color: #262A48 !important; border: 1px solid rgba(255,255,255,.14) !important;
  color: #D8DCEE !important; -webkit-text-fill-color: #D8DCEE !important;
  font-size: 11.5px !important; font-weight: 700 !important; box-shadow: none !important;
}

/* دکمه‌های زیر پیام */
html[data-theme="dark"] body .chat-msg button,
html[data-theme="dark"] body .chat-like {
  background-color: rgba(255,255,255,.09) !important; background-image: none !important;
  border: 1px solid rgba(255,255,255,.2) !important;
  color: #E6E9F7 !important; -webkit-text-fill-color: #E6E9F7 !important;
}
html[data-theme="dark"] body .chat-msg.is-me button,
html[data-theme="dark"] body .chat-msg.is-mine button {
  background-color: rgba(255,255,255,.2) !important;
  border-color: rgba(255,255,255,.45) !important;
  color: #FFFFFF !important; -webkit-text-fill-color: #FFFFFF !important;
}

/* نوار آنلاین */
html[data-theme="dark"] body #chatOnline .online-pill {
  background-color: rgba(34,197,94,.18) !important; border-color: rgba(34,197,94,.36) !important;
  color: #86EFAC !important; -webkit-text-fill-color: #86EFAC !important;
}
html[data-theme="dark"] body #chatOnline .chat-online-toggle {
  background-color: rgba(124,77,255,.22) !important; border-color: rgba(124,77,255,.4) !important;
  color: #C9B6FF !important; -webkit-text-fill-color: #C9B6FF !important;
}
html[data-theme="dark"] body #chatOnline .chat-who {
  background-color: rgba(255,255,255,.08) !important; border-color: rgba(255,255,255,.16) !important;
  color: #F2F4FF !important; -webkit-text-fill-color: #F2F4FF !important;
}

/* کادر نوشتن */
html[data-theme="dark"] body .chat-composer textarea,
html[data-theme="dark"] body #chatText {
  background-color: #262A48 !important; background-image: none !important;
  border: 1px solid rgba(255,255,255,.22) !important;
  color: #F2F4FF !important; -webkit-text-fill-color: #F2F4FF !important;
  caret-color: #A78BFA !important;
}
html[data-theme="dark"] body .chat-composer textarea::placeholder,
html[data-theme="dark"] body #chatText::placeholder {
  color: #949BBA !important; -webkit-text-fill-color: #949BBA !important; opacity: 1 !important;
}
html[data-theme="dark"] body .chat-composer button[type="submit"],
html[data-theme="dark"] body #chatSend {
  background-color: #6D28D9 !important; background-image: none !important;
  border-color: transparent !important;
  color: #FFFFFF !important; -webkit-text-fill-color: #FFFFFF !important;
}

/* آواتار گفتگوی عمومی */
html[data-theme="dark"] body .chat-msg-avatar,
html[data-theme="dark"] body .chat-avatar {
  border: 2px solid rgba(255,255,255,.22) !important;
  color: #FFFFFF !important; -webkit-text-fill-color: #FFFFFF !important;
}

/* ============================================================
   آواتار در کانال‌ها و گروه‌ها (kx)
   ============================================================ */
.kx .kx-av, .kx .kx-ico, .kx .kx-avs > * {
  color: #FFFFFF !important;
  -webkit-text-fill-color: #FFFFFF !important;
  font-weight: 800 !important;
  display: grid !important;
  place-items: center !important;
  overflow: hidden !important;
  flex-shrink: 0 !important;
  text-shadow: 0 1px 2px rgba(0,0,0,.22);
}
.kx .kx-av { border: 2px solid rgba(255,255,255,.35) !important; }
html[data-theme="dark"] .kx .kx-av { border-color: rgba(255,255,255,.24) !important; }
.kx .kx-av img, .kx .kx-avs img, .kx .kx-ico img {
  width: 100% !important; height: 100% !important; object-fit: cover !important; display: block !important;
}
/* آیکون فهرست: حرف اول با رنگ برند روی زمینهٔ کم‌رنگ */
.kx .kx-ico {
  color: var(--c-brand) !important; -webkit-text-fill-color: var(--c-brand) !important;
  text-shadow: none;
  font-size: 16px !important;
}
html[data-theme="dark"] .kx .kx-ico { color: #C6B4FF !important; -webkit-text-fill-color: #C6B4FF !important; }
.kx .kx-ico.is-ch { color: #0B7A9B !important; -webkit-text-fill-color: #0B7A9B !important; }
html[data-theme="dark"] .kx .kx-ico.is-ch { color: #8EE0FB !important; -webkit-text-fill-color: #8EE0FB !important; }
/* آواتار اعضا در سربرگ: حاشیهٔ هم‌رنگ کارت تا هم‌پوشانی خوانا بماند */
.kx .kx-avs > * {
  border: 2px solid var(--c-card) !important;
  font-size: 11px !important;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.kx .kx-avs .kx-more-av {
  background: var(--c-tint) !important;
  color: var(--c-ink2) !important; -webkit-text-fill-color: var(--c-ink2) !important;
  text-shadow: none;
}
