/* ============================================
   MR CALL OF - css/chat.css
   استایل صفحه چت پشتیبانی
============================================ */

body.chat-body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ---------- هدر چت ---------- */
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid #eceef1;
  flex-shrink: 0;
}

.chat-header .ch-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffb800, #ff7a00);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #ffffff;
  font-size: 15px;
  flex-shrink: 0;
}

.chat-header .ch-info { flex: 1; }

.chat-header .ch-name {
  font-size: 14px;
  font-weight: 800;
  color: #15161a;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-header .ch-status {
  font-size: 11px;
  color: #48c78e;
  margin-top: 2px;
}

.verified-badge {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #2ea6ff;
  color: #15161a;
  font-size: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---------- بدنه چت ---------- */
.chat-body-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-row {
  display: flex;
  margin-bottom: 6px;
  max-width: 100%;
}

/* توجه: چون صفحه RTLه، flex-start بصری میره سمت راست و flex-end سمت چپ.
   برای اینکه پیام «من» همیشه راست و پیام «بقیه» همیشه چپ بمونه (مثل تلگرام/واتساپ)،
   این دوتا برعکسِ اسمشون تنظیم شدن - عمداً. */
.msg-row.me { justify-content: flex-start; }
.msg-row.other { justify-content: flex-end; }

.msg-bubble {
  max-width: 76%;
  padding: 9px 12px 7px;
  border-radius: 16px;
  position: relative;
  font-size: 13.5px;
  line-height: 1.7;
  word-wrap: break-word;
}

.msg-row.me .msg-bubble {
  background: linear-gradient(145deg, #ffb800, #ff7a00);
  color: #ffffff;
  border-bottom-right-radius: 5px;
}

.msg-row.other .msg-bubble {
  background: #f1f1f4;
  color: #1c1d22;
  border: 1px solid #eceef1;
  border-bottom-left-radius: 5px;
}

.msg-sender {
  font-size: 11.5px;
  font-weight: 800;
  color: #ffb800;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.msg-text {
  white-space: pre-wrap;
}

.msg-text.deleted {
  font-style: italic;
  opacity: 0.6;
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
  margin-top: 3px;
  font-size: 10px;
}

.msg-row.me .msg-meta { color: rgba(20,21,26,0.6); }
.msg-row.other .msg-meta { color: #6b6d78; }

.msg-edited-tag { font-style: italic; }

/* ---------- کوت ریپلای داخل حباب ---------- */
.msg-reply-quote {
  background: rgba(0,0,0,0.12);
  border-right: 3px solid rgba(0,0,0,0.35);
  border-radius: 8px;
  padding: 5px 8px;
  margin-bottom: 6px;
  font-size: 11.5px;
}

.msg-row.other .msg-reply-quote {
  background: rgba(255,255,255,0.05);
  border-right: 3px solid #ffb800;
}

.msg-reply-quote .rq-name {
  font-weight: 800;
  color: #ff7a00;
  margin-bottom: 2px;
}
.msg-row.other .msg-reply-quote .rq-name { color: #ffb800; }

.msg-reply-quote .rq-text {
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- نوار پاسخ در حال نوشتن ---------- */
.reply-preview-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: #fbfbfc;
  border-top: 1px solid #eceef1;
  border-right: 3px solid #ffb800;
}
.reply-preview-bar.show { display: flex; }

.reply-preview-bar .rp-content { flex: 1; overflow: hidden; }
.reply-preview-bar .rp-name { font-size: 12px; font-weight: 800; color: #ffb800; }
.reply-preview-bar .rp-text {
  font-size: 11.5px; color: #6c6d78;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reply-preview-bar .rp-close {
  width: 26px; height: 26px; border-radius: 50%;
  background: #eceef1; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #6c6d78; flex-shrink: 0;
}

/* ---------- نوار ورودی ---------- */
.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #eceef1;
  flex-shrink: 0;
}

.chat-input-bar textarea {
  flex: 1;
  resize: none;
  max-height: 90px;
  min-height: 40px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid #e9eaee;
  color: #15161a;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}
.chat-input-bar textarea::placeholder { color: #6b6d78; }

.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffb800, #ff7a00);
  color: #ffffff;
  border: none;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.send-btn:active { transform: scale(0.92); }

.edit-mode-tag {
  font-size: 11px;
  color: #ffb800;
  padding: 4px 14px 0;
  display: none;
}
.edit-mode-tag.show { display: block; }

/* ---------- منوی اکشن پیام (Bottom Sheet) ---------- */
.action-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.action-overlay.show { opacity: 1; visibility: visible; }

.action-sheet {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  background: #fbfbfc;
  border-radius: 20px 20px 0 0;
  z-index: 41;
  transform: translateY(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  padding: 8px 0 24px;
  border-top: 1px solid #eceef1;
}
.action-sheet.show { transform: translateY(0); }

.action-sheet .handle {
  width: 40px; height: 4px; background: #e2e3e8;
  border-radius: 4px; margin: 8px auto 10px;
}

.action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #1c1d22;
}
.action-item:active { background: #f1f1f4; }
.action-item .a-icon { font-size: 16px; width: 22px; text-align: center; }
.action-item.danger { color: #ff6b6b; }

/* ---------- لیست گفتگوهای خرید ---------- */
.my-threads-title {
  padding: 12px 16px 6px;
  font-size: 11.5px;
  font-weight: 800;
  color: #71727c;
}

.my-thread-item {
  margin: 0 16px 8px;
  background: #fbfbfc;
  border: 1px solid #eceef1;
  border-radius: 12px;
  padding: 10px 14px;
}

.my-thread-item .mt-title {
  font-size: 12.5px;
  font-weight: 800;
  color: #ffb800;
  margin-bottom: 3px;
}

.my-thread-item .mt-sub {
  font-size: 11px;
  color: #71727c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- پیام‌های اعلان همگانی (با پس‌زمینه) ---------- */
.msg-row.notification-msg { max-width: 100%; }
.notification-bubble {
  max-width: 88%;
  min-width: 60%;
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.notification-bubble .msg-text { color: #15161a; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.notification-bubble .msg-meta { color: rgba(255,255,255,.8); }
.msg-text a { color: inherit; text-decoration: underline; }
.msg-row.other .msg-text a { color: #ffb800; }

/* ============================================
   افزوده‌ها: چت عمومی (community.html)
============================================ */
.community-msg-bubble { max-width: 82%; }
.community-sender {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px; cursor: pointer;
  font-size: 12px; font-weight: 800; color: #15161a;
}
.community-avatar {
  width: 24px; height: 24px; border-radius: 50%; object-fit: cover;
  background: #e9eaee; flex-shrink: 0; border: 1px solid #e2e3e8;
}
.community-public-id {
  font-size: 10px; color: #75767f; font-weight: 700; direction: ltr;
}
.community-msg-media {
  max-width: 100%; border-radius: 12px; margin: 6px 0; display: block; max-height: 320px;
}
.mention-tag {
  color: #ffb800; font-weight: 800; cursor: pointer;
}
.community-attach-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; background: #f1f1f4; flex-shrink: 0; cursor: pointer;
}
.community-media-preview {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: #fbfbfc; border-top: 1px solid #eceef1;
}
.community-media-preview img, .community-media-preview video {
  max-height: 70px; border-radius: 10px;
}
.community-media-remove {
  width: 24px; height: 24px; border-radius: 50%; background: rgba(255,107,107,.15);
  color: #ff6b6b; display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; flex-shrink: 0;
}
