:root {
  --bg-primary: #313338;
  --bg-secondary: #2b2d31;
  --bg-tertiary: #1e1f22;
  --accent: #5865f2; /* Discord Blurple */
  --accent-hover: #4752c4;
  --text-normal: #dbdee1;
  --text-muted: #949ba4;
  --danger: #da373c;
  --success: #23a559;
  --input-bg: #1e1f22;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  direction: ltr;
  background-color: var(--bg-tertiary);
  color: var(--text-normal);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
}

/* کانتینر اصلی فرم‌ها */
.auth-container {
  background-color: var(--bg-primary);
  padding: 32px;
  border-radius: 8px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
  text-align: center;
}

.logo {
  font-size: 24px;
  font-weight: bold;
  color: var(--text-normal);
  margin-bottom: 8px;
  display: inline-block;
}

.logo span {
  color: var(--accent);
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 14px;
}

/* استایل فرم‌ها */
.form-group {
  margin-bottom: 20px;
  text-align: left;
}
.log-out{
        width: 100%;
    padding: 12px;
     background-color: #da373c44;
    color: rgb(248, 229, 229);
   border: 1px solid #da373c;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
}
.log-out:hover{ 
     background-color: #f9000844;
    color: rgb(255, 255, 255);
   border: 1px solid #ff0008;

}
label {
    text-align: center;
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 8px;
  text-transform: uppercase;
}

input[type="text"],
input[type="password"],
input[type="tel"] {
  width: 100%;
  padding: 10px;
  background-color: var(--input-bg);
  border: none;
  border-radius: 4px;
  color: var(--text-normal);
  font-size: 16px;
  transition: 0.2s;
}

input:focus {
  outline: none;
  background-color: black;
}

button.btn-primary {
  width: 100%;
  padding: 12px;
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-top: 10px;
}

button.btn-primary:hover {
  background-color: var(--accent-hover);
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

.link:hover {
  text-decoration: underline;
}

.error-msg {
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 15px;
  background: rgba(218, 55, 60, 0.1);
  padding: 10px;
  border-radius: 4px;
  display: none; /* پیش‌فرض مخفی */
}
/* --- Layouts --- */
body {
  background-color: var(--bg-tertiary);
  font-family: "Segoe UI", sans-serif;
}

.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Server Sidebar */
.server-sidebar {
  width: 72px;
  background-color: var(--bg-tertiary);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 12px;
  padding-bottom: 12px;
  /* مرحله 9: کل نوار دیگر اسکرول نمی‌شود؛ فقط بخش لیست سرورها (پایین‌تر) اسکرول
       می‌شود تا آیکون DM بالا و تنظیمات/سرچ پایین همیشه ثابت بمانند */
  overflow: visible;
}

/* مرحله 9، مورد 5: ناحیه‌ی اسکرول‌شونده‌ی لیست سرورها (بین جداکننده‌ی بالا و
   جداکننده‌ی پایین) */
.server-list-scroll {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0; /* بدون این، فرزند flex به‌درستی جمع/اسکرول نمی‌شود */
  overflow-y: auto;
  overflow-x: hidden;
}

.server-icon {
  width: 48px;
  height: 48px;
  background-color: var(--bg-primary);
  border-radius: 50%;
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: 0.2s;
  color: var(--text-normal);
  font-size: 16px;
  font-weight: bold;
  overflow: hidden;
}

.server-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.server-icon:hover {
  border-radius: 16px;
  background-color: var(--accent);
  color: white;
}

.server-icon.active {
  border-radius: 16px;
  background-color: var(--accent);
}

.separator {
  width: 32px;
  height: 2px;
  background-color: var(--bg-secondary);
  margin: 8px 0;
}

/* Channel Sidebar */
.channel-sidebar {
  width: 240px;
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
}

.server-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: bold;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.server-header:hover {
  background-color: #35373c;
}

.channel-list-container {
  flex: 1;
  padding: 16px 8px;
  overflow-y: auto;
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 4px;
  padding: 0 8px;
  cursor: default;
}

.channel-item {
  padding: 6px 8px;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  margin-bottom: 2px;
}

.channel-item:hover {
  background-color: var(--bg-primary);
  color: var(--text-normal);
}

.channel-item .hashtag {
  font-size: 20px;
  margin-left: 6px;
  color: var(--text-muted);
}

.channel-item span {
  flex: 1;
}

.settings-trigger {
  opacity: 0;
  padding: 4px;
}

.channel-item:hover .settings-trigger {
  opacity: 1;
}

/* User Panel */
.user-panel {
  height: 52px;
  background-color: var(--bg-tertiary);
  display: flex;
  align-items: center;
  padding: 0 8px;
}

.user-panel .avatar img {
  width: 32px;
  height: 32px;
  border-radius: 50%;

  margin-right: 8px;
}

.user-info {
  flex: 1;
  font-size: 14px;
}

.username {
  font-weight: bold;
  color: var(--text-normal);
}
.status {
  font-size: 12px;
  color: var(--text-muted);
}

/* Main Chat Area */
.chat-area {
  flex: 1;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  position: relative;
}

.empty-state,
.welcome-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: var(--text-muted);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  padding: 50px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
  background-color: var(--bg-primary);
  padding: 24px;
  border-radius: 8px;
  width: 400px;
  margin-top: auto;
  margin-bottom: auto;
  margin-left: auto;
  margin-right: auto;
  position: relative;
}

.close {
  color: #aaa;
  float: left;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}
/* --- Chat Styles --- */
.chat-header {
  height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--bg-tertiary);
  font-weight: bold;
  color: var(--text-normal);
}

.chat-header .topic {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: normal;
  margin-right: 10px;
}

.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
}

.message-wrapper {
  display: flex;
  padding: 8px 16px;
  margin-top: 4px;
  position: relative;
}

.message-wrapper:hover {
  background-color: rgba(4, 4, 5, 0.07);
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-left: 16px;
  cursor: pointer;
}

.message-content {
  flex: 1;
}

.message-header {
  display: flex;
  align-items: baseline;
  margin-bottom: 4px;
}

.message-username {
  font-weight: 500;
  color: var(--text-normal);
  margin-right: 8px;
  cursor: pointer;
}

.message-username:hover {
  text-decoration: underline;
}

.message-timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.message-text {
  color: #dcddde;
  font-size: 1rem;
  line-height: 1.375rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.mention {
  background-color: rgba(88, 101, 242, 0.3);
  color: #dee0fc;
  border-radius: 3px;
  padding: 0 2px;
  cursor: pointer;
}

.reply-preview {
  border-left: 2px solid var(--text-muted);
  padding-left: 8px;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Input Area */
.chat-input-area {
  padding: 0 16px 24px 16px;
  background-color: var(--bg-primary);
}

.input-wrapper {
  background-color: var(--input-bg);
  border-radius: 8px;
  padding: 0 16px;
  display: flex;
  align-items: center;
}

.chat-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-normal);
  padding: 11px 0;
  resize: none;
  height: 44px; /* Initial height */
  max-height: 200px;
  font-family: inherit;
  font-size: 1rem;
}

.chat-textarea:focus {
  outline: none;
}

.emoji-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
}

.emoji-btn:hover {
  color: var(--text-normal);
}

/* Context Menu */
#context-menu {
  display: none;
  position: absolute;
  background-color: var(--bg-primary);
  border-radius: 4px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
  width: 200px;
  z-index: 1000;
  padding: 8px 0;
}

.menu-item {
  padding: 8px 12px;
  color: var(--text-normal);
  cursor: pointer;
  font-size: 14px;
}

.menu-item:hover {
  background-color: var(--accent);
  color: white;
}

.menu-item.danger {
  color: var(--danger);
}

.menu-separator {
  height: 1px;
  background-color: var(--bg-tertiary);
  margin: 4px 0;
}

/* Typing Indicator */
.typing-indicator {
  padding: 0 16px 8px 72px;
  font-size: 12px;
  color: var(--text-normal);
  font-style: italic;
  height: 20px;
}

/* Unread Badge */
.unread-badge {
  background-color: var(--danger);
  color: white;
  border-radius: 50%;
  padding: 0 5px;
  font-size: 10px;
  margin-right: auto;
}
/* --- DM Styles --- */
.dm-sidebar-header {
  padding: 16px;
}

.search-box {
  background-color: var(--bg-tertiary);
  border-radius: 4px;
  padding: 8px;
  display: flex;
  align-items: center;
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-normal);
  width: 100%;
  margin-right: 8px;
  outline: none;
}

.search-results {
  position: absolute;
  top: 60px;
  left: 72px; /* Sidebar width */
  width: 240px;
  background: var(--bg-primary);
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.search-result-item {
  padding: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.search-result-item:hover {
  background-color: var(--bg-secondary);
}

.dm-item {
  padding: 8px;
  display: flex;
  align-items: center;
  cursor: pointer;
  border-radius: 4px;
  margin-bottom: 2px;
  position: relative;
}

.dm-item:hover {
  background-color: var(--bg-primary);
}

.dm-item.active {
  background-color: var(--bg-tertiary); /* Slightly darker */
}

.dm-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-left: 10px;
  position: relative;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  position: absolute;
  bottom: 0;
  right: 0;
  border: 2px solid var(--bg-secondary);
}

.status-online {
  background-color: var(--success);
}
.status-offline {
  background-color: var(--text-muted);
}
.status-dnd {
  background-color: var(--danger);
}

.dm-info {
  flex: 1;
  overflow: hidden;
}

.dm-username {
  font-weight: 500;
  color: var(--text-normal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-preview {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-badge {
  background-color: var(--danger);
  color: white;
  border-radius: 10px;
  padding: 0 6px;
  font-size: 10px;
  min-width: 18px;
  text-align: center;
}

.dm-search-results .dm-avatar {
  width: 40px;
  height: 40px;
}
/* =========================================================
   مرحله 8 — رفع باگ‌های گزارش‌شده:
   1) پنل کشویی لیست اعضای سرور (مالک/نقش هر عضو)
   2) دکمه ارسال پیام + دکمه پیوست فایل/رسانه (حداکثر 20MB)
   3) پیش‌نمایش پیوست انتخاب‌شده و نمایش عکس/ویدیو/صدا/فایل در چت
   4) بهبود ظاهری + انیمیشن‌های کوچک برای حس زنده‌تر بودن رابط کاربری
   ========================================================= */

/* --- ظرف اصلی چت + پنل اعضا کنار هم --- */
.chat-body {
  flex: 1;
  display: flex;
  min-height: 0; /* برای اسکرول درست فرزندان */
}

.chat-body .chat-container {
  flex: 1;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.chat-header-actions i {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 18px;
  transition:
    color 0.15s ease,
    transform 0.1s ease;
}

.chat-header-actions i:hover {
  color: var(--text-normal);
  transform: scale(1.08);
}

/* پنل اعضا: به‌صورت پیش‌فرض بسته (عرض صفر) و با کلاس open باز می‌شود -
   دقیقاً همان رفتار «کشویی» که درخواست شده بود */
.member-list-panel {
  width: 0;
  opacity: 0;
  overflow: hidden;
  background-color: var(--bg-secondary);
  flex-shrink: 0;
  padding: 0;
  transition:
    width 0.22s ease,
    opacity 0.18s ease,
    padding 0.22s ease;
  white-space: nowrap;
}

.member-list-panel.open {
  width: 240px;
  opacity: 1;
  padding: 16px 10px;
  overflow-y: auto;
  white-space: normal;
}

.member-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 12px 6px 4px;
}

.member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 6px;
  transition: background-color 0.15s ease;
  cursor: default;
}

.member-row:hover {
  background-color: var(--bg-primary);
}

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.member-role-dot {
  display: none; /* رنگ نقش همین الان روی نام هم قابل تشخیص هست؛ نقطه برای نسخه‌های بعدی رزرو شده */
}

.member-name {
  font-size: 14px;
  color: var(--text-normal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-role {
  font-size: 11px;
  color: var(--text-muted);
}

.member-owner-badge {
  color: #f0b232;
  font-size: 13px;
}

/* --- دکمه‌های ارسال و پیوست (قبلاً فقط Enter کار می‌کرد) --- */
.chat-input-area .input-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.attach-btn,
.send-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition:
    color 0.15s ease,
    background-color 0.15s ease,
    transform 0.1s ease;
  flex-shrink: 0;
}

.attach-btn:hover {
  color: var(--text-normal);
  background-color: var(--bg-tertiary);
}

.send-btn {
  color: var(--text-muted);
}

.send-btn:hover {
  color: var(--text-normal);
  background-color: var(--bg-tertiary);
}

.attach-btn:active,
.send-btn:active {
  transform: scale(0.88);
}

.send-btn.sending {
  opacity: 0.5;
  pointer-events: none;
  animation: sendPulse 0.6s ease-in-out infinite;
}

@keyframes sendPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

/* --- نوار پیش‌نمایش فایل انتخاب‌شده، قبل از ارسال --- */
.attachment-preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-tertiary);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 16px 8px;
  font-size: 13px;
  color: var(--text-normal);
  animation: fadeSlideDown 0.15s ease-out;
}

.attachment-preview-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.attachment-preview-size {
  color: var(--text-muted);
}

.attachment-remove {
  margin-right: auto;
  color: var(--danger);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.attachment-remove:hover {
  transform: scale(1.15);
}

/* --- نمایش رسانه/فایل داخل حباب پیام --- */
.chat-attachment-image {
  max-width: 320px;
  max-height: 320px;
  border-radius: 8px;
  margin-top: 6px;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.15s ease;
}

.chat-attachment-image:hover {
  opacity: 0.9;
}

.chat-attachment-video,
.chat-attachment-audio {
  max-width: 360px;
  border-radius: 8px;
  margin-top: 6px;
  display: block;
}

.chat-attachment-file {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-tertiary);
  padding: 10px 14px;
  border-radius: 8px;
  margin-top: 6px;
  max-width: 300px;
  text-decoration: none;
  color: var(--text-normal);
  transition: background-color 0.15s ease;
}

.chat-attachment-file:hover {
  background-color: var(--bg-primary);
}

/* --- صفحه‌ی خوش‌آمد بازطراحی‌شده (وقتی کاربر هیچ سرور/چتی انتخاب نکرده) --- */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  padding: 24px;
  animation: fadeIn 0.35s ease-out;
}

.welcome-screen h1 {
  font-size: 30px;
  margin-bottom: 8px;
}

.welcome-screen h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.welcome-screen p {
  color: var(--text-muted);
  max-width: 380px;
}

.welcome-btn {
  width: auto !important;
  padding: 10px 20px !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.welcome-btn-secondary {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-normal) !important;
}

.welcome-btn-secondary:hover {
  background-color: var(--bg-primary) !important;
}

/* --- انیمیشن‌های کوچک عمومی برای حس زنده‌تر شدن رابط کاربری --- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeSlideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes messagePop {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-wrapper {
  animation: messagePop 0.18s ease-out;
}

.search-results,
.dm-search-results {
  animation: fadeSlideDown 0.15s ease-out;
}

.modal-content {
  animation: fadeSlideDown 0.18s ease-out;
}

.btn-primary {
  transition:
    transform 0.1s ease,
    background-color 0.15s ease,
    opacity 0.15s ease;
}

.btn-primary:active {
  transform: scale(0.97);
}

.server-icon {
  transition:
    border-radius 0.2s ease,
    background-color 0.2s ease,
    transform 0.12s ease;
}

.server-icon:active {
  transform: scale(0.92);
}

.channel-item,
.dm-item {
  transition:
    background-color 0.15s ease,
    transform 0.1s ease;
}

/* =========================================================
   مرحله 9 — درخواست‌های جدید:
   1) محدودیت ساخت سرور برای کاربر عادی (فقط CSS مربوط به مخفی/نمایش نیست،
      منطق آن در index.php و create_server.php است)
   2) چیدمان پیام‌ها: پیام خودم راست، پیام دیگران چپ (شبیه واتس‌اپ/تلگرام)
   3) دکمه سرچ سرور + تنظیمات + خط جداکننده در پایین نوار سرورها
   4) اسکرول‌بار سفارشی برای ناحیه‌ی پیام‌ها
   5) اسکرول‌بار سفارشی برای لیست سرورها (با ثابت ماندن آیکون DM و تنظیمات/سرچ)
   ========================================================= */

/* --- اسکرول‌بار سفارشی سایت (به‌جای اسکرول‌بار پیش‌فرض مرورگر) --- */
.custom-scrollbar {
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: #202225 transparent; /* Firefox: thumb track */
}

.custom-scrollbar::-webkit-scrollbar {
  width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: #202225;
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: var(--accent);
}

/* لیست سرورها عمودی است، پس اسکرول‌بار افقی نمی‌خواهیم و عرضش باید کوچک‌تر باشد
   تا فضای نوار باریک ۷۲ پیکسلی را نگیرد */
.server-list-scroll.custom-scrollbar::-webkit-scrollbar {
  width: 4px;
}

/* --- چیدمان پیام‌ها: پیام خودم سمت راست، پیام دیگران سمت چپ --- */
.message-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 16px;
  margin-top: 2px;
  max-width: 100%;
}
.message-username:hover {
  color: #5865f2;
}
.message-wrapper .message-avatar {
  margin-left: 0;
  flex-shrink: 0;
}

.message-wrapper .message-content {
  flex: 0 1 auto;
  max-width: 500px;
  min-width: 80px;
  box-shadow: 0pc 0px 8px 0px #0a0a0a45;
  /* background-color: rgba(0, 0, 0, 0.315); */
  padding: 8px 12px;
  border-radius: 7px;
  direction: ltr;
}

/* پیام‌های خودم: می‌چسبند به راست (چیدمان پیش‌فرض DOM: آواتار سپس حباب، در
   صفحه‌ی RTL یعنی آواتار بیرونی‌ترین/راست‌ترین عنصر است) */
.message-wrapper.own-message {
  justify-content: flex-start;
}

/*  {
     background-color: rgba(33, 9, 63, 0.465);
  
} */

.message-wrapper.own-message .message-text,
.message-wrapper.own-message .message-username {
  color: #ffffff;
}

.message-wrapper.own-message .message-timestamp {
  color: rgba(255, 255, 255, 0.75);
}

/* پیام‌های دیگران: می‌چسبند به چپ، آواتار بیرونی‌ترین/چپ‌ترین عنصر است */
/* .message-wrapper.other-message {
    flex-direction: row-reverse;
    justify-content: flex-start;
    direction: ltr;
    
} */

@media (max-width: 700px) {
  .message-wrapper .message-content {
    max-width: 350px;
  }
}

/* =========================================================
   Stage 9 — Reply UI, Status Picker, Member Moderation, Lightbox
   ========================================================= */

/* --- نوار پیش‌نمایش Reply --- */
.reply-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background-color: var(--bg-tertiary);
  border-right: 3px solid var(--accent);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0 16px 8px;
  font-size: 13px;
  color: var(--text-normal);
}

.reply-preview-bar-content {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.reply-preview-bar-text {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

/* --- Status قابل کلیک روی پنل کاربر --- */
.status-clickable {
  cursor: pointer;
}

.status-clickable:hover {
  text-decoration: underline;
}

/* --- منوی کشویی مشترک (Status Picker / Member Moderation) --- */
.status-picker-menu {
  position: fixed;
  bottom: 68px;
  left: 16px;
  background-color: var(--bg-primary, #2b2d31);
  border-radius: 6px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.32);
  min-width: 170px;
  z-index: 2000;
  padding: 6px 0;
}

.status-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-normal);
  cursor: pointer;
  white-space: nowrap;
}

.status-picker-item:hover {
  background-color: var(--accent);
  color: #fff;
}

.status-picker-item.danger-text {
  color: var(--danger);
}

.status-picker-item.danger-text:hover {
  color: #fff;
}

.static-dot {
  position: static !important;
  border: none !important;
  display: inline-block;
}

/* رنگ وضعیت Idle که قبلاً تعریف نشده بود */
.status-idle {
  background-color: #f0b232;
}

/* --- دکمه منوی مدیریت عضو (⋮) در لیست اعضا (فقط برای Owner نمایش داده می‌شود) --- */
.member-mod-btn {
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.member-row:hover .member-mod-btn {
  opacity: 1;
}

.member-mod-btn:hover {
  color: var(--text-normal);
}

/* --- Lightbox نمایش تصویر در همان صفحه (به‌جای باز شدن در تب جدید) --- */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 5000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 28px;
  font-size: 34px;
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

