/* promptAllChat v2 — Telegram-like layout, IRANSansWeb everywhere */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'IRANSansWeb', sans-serif;
  /* این خط رو اضافه کن */
}

@font-face {
  font-family: 'IRANSansWeb';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/IRANSansWeb.ttf') format('truetype');
  font-display: block;
}

:root {
  --bg: #151515;
  --panel: #2a2a2a;
  --panel2: #2b2b2b;
  --text: #ffffff;
  --muted: #b4b4b4;
  --primary: #1da8ff;
  --bubble: rgba(22, 22, 22, 0.3);
  --bubbleMe: rgba(138, 138, 138, 0.4);
  --border: rgba(255, 255, 255, .07);
  --shadow: 0 10px 28px rgba(0, 0, 0, .38);
  --font: "IRANSansWeb", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Tahoma, Arial;
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%
}

a {
  color: inherit;
  text-decoration: none
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .02);
  border-radius: 999px;
  color: var(--text);
}

.pill:hover {
  background: rgba(255, 255, 255, .05)
}

.pill.small {
  padding: 6px 10px;
  font-size: 13px;
  display: none;
}

.btn-primary {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  margin-top: 8px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.5s ease-in-out;
}

.btn-primary:hover{
  box-shadow: 0px 0px 20px rgb(46, 166, 255);
}

.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed
}

.btn-ghost {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .02);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, .05)
}

.btn-danger {
  border: 1px solid rgba(255, 90, 90, .35);
  background: rgba(255, 90, 90, .12);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer
}

.btn-danger:hover {
  background: rgba(255, 90, 90, .18)
}

.link {
  color: var(--primary)
}

.alert {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 90, 90, .14);
  border: 1px solid rgba(255, 90, 90, .35);
  margin: 10px 0
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px
}

label {
  display: block;
  color: var(--muted);
  margin-top: 10px;
  margin-bottom: 6px;
  font-size: 13px
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  outline: none;
  font-size: 16px
}

textarea {
  resize: none;
  height: 30px;
  scrollbar-width: none;
}

input:focus,
textarea:focus,
select:focus {
  border: 1px solid ;
  border-color: rgba(137, 137, 137, 0.6)
}

.login-body {
  background-color: var(--bg);
  background-image:
  linear-gradient(to right, var(--border) 1px, transparent 1px), /* خطوط عمودی */
  linear-gradient(to bottom, var(--border) 1px, transparent 1px); /* خطوط افقی */

  background-size: 35px 35px; 
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px
}

.login-card {
  width: min(420px, 92vw);
  background-color: rgba(41, 41, 41, 0.3);
  backdrop-filter: blur(3px);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow)
}

.brand {
  font-weight: 900;
  font-size: 22px
}

.subtitle {
  color: var(--muted);
  margin-top: 2px;
  margin-bottom: 16px
}

.app-shell {
  height: 100%;
  display: grid;
  grid-template-columns: 360px 1fr
}

.sidebar {
  border-left: 1px solid var(--border);
  background: linear-gradient(180deg, rgb(22, 22, 22), rgba(20, 20, 20, 0.94));
  display: flex;
  flex-direction: column;
  min-width: 260px
}

.sidebar-top {
  padding: 14px;
  border-bottom: 1px solid var(--border)
}

.me {
  display: flex;
  gap: 10px;
  align-items: center
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(46, 166, 255, .9), rgba(110, 231, 183, .7));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #08131d;
  overflow: hidden;
  flex: 0 0 40px
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block
}

.avatar.big {
  width: 84px;
  height: 84px;
  flex: 0 0 84px;
  font-size: 28px;
  border-radius: 20px
}

.me-meta {
  display: flex;
  flex-direction: column
}

.me-name {
  font-weight: 900
}

.me-sub {
  color: var(--muted);
  font-size: 12px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.top-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

.sidebar-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border)
}

.tab-btn {
  flex: 1;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0);
  color: var(--muted);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 900
}

.tab-btn.active {
  color: var(--text);
  border-color: rgba(137, 137, 137, 0.55);
  background: rgba(113, 113, 113, 0.12);
  box-shadow: 0px, 0px, 12px rgb(113, 133, 113);
}

.sidebar-title {
  padding: 10px 14px;
  color: var(--muted);
  font-size: 12px
}

.room-list {
  overflow: auto;
  flex: 1
}

.room-list.compact .room-item {
  padding: 10px 14px
}

.room-item {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer
}

.room-item:hover {
  background: rgba(255, 255, 255, .04)
}

.room-item.active {
  background: rgba(142, 142, 142, 0.12)
}

.room-item .meta {
  color: var(--muted);
  font-size: 12px
}

.room-item.muted {
  color: var(--muted);
  cursor: default
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px
}

.user-row .uavatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex: 0 0 34px
}

.user-row .uavatar img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.user-row .uname {
  font-weight: 900
}

.user-row .ubio {
  color: var(--muted);
  font-size: 12px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.chat {
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image:
  linear-gradient(to right, var(--border) 1px, transparent 1px), /* خطوط عمودی */
  linear-gradient(to bottom, var(--border) 1px, transparent 1px); /* خطوط افقی */

  background-size: 35px 35px; 
  /* min-height: 100vh;  */
  margin: 0;
  max-width: 100vw;
  max-height: 100%;
  overflow-x: hidden;
}

.chat-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgb(22, 22, 22);
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px
}

.chat-header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: var(--muted);
  overflow: hidden
}

.btn-back{
    display: none;
}

.btn-back button{
  font-size: 20px;
  color: white;
  background-color: transparent;
  width: 30px;
  height: 30px;
  border-radius: 80px;
  border: none;
  margin: 0;
  padding: 0;
}

.chat-title {
  font-weight: 900
}

.chat-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%
}

.dot.offline {
  background: rgba(255, 90, 90, .7)
}

.dot.online {
  background: rgba(110, 231, 183, .85)
}

/* --- پیام‌های کلی --- */
.messages {
  flex: 1;
  overflow: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px; /* فاصله بین ردیف پیام‌ها */
  
  /* برای اینکه متن‌های خیلی بلند شکسته بشن */
  word-wrap: break-word; 
  overflow-wrap: break-word; /* مشابه word-wrap */
  white-space: pre-wrap; /* حفظ خطوط جدید و فاصله‌ها */
  scrollbar-width: none;
}

/* --- ردیف پیام (شامل آواتار و حباب پیام) --- */
.msg-row {
  display: flex;
  gap: 10px; /* فاصله بین آواتار و حباب پیام */
  align-items: flex-end; /* چیدن عناصر در پایین ردیف */
}

/* --- ردیف پیام‌های خودت --- */
.msg-row.me {
  flex-direction: row-reverse; /* حباب پیام و آواتار رو برعکس کن (راست به چپ) */
  margin-left: 50px; /* یه فضای خالی سمت چپ بذار تا با سایدبار یا لبه صفحه تداخل نکنه */
}

/* --- آواتار در ردیف پیام --- */
.msg-row .mavatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: var(--muted);
  flex-shrink: 0; /* جلوی فشرده شدن آواتار رو بگیر */
}

.msg-row .mavatar img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* وقتی پیام خودت هست، آواتار سمت راست قرار بگیره */
.msg-row.me .mavatar {
  /* چون flex-direction: row-reverse; کردیم، آواتار خود به خود میره سمت راست */
}

/* --- حباب پیام --- */
.msg {
  /* max-width رو طوری تنظیم کن که حباب پیام خیلی پهن نشه */
  /* 86% از عرض صفحه + 10px فاصله از راست + 12px padding داخلی */
  max-width: min(740px, 86%); 
  padding: 10px 12px;
  border-radius: 18px; /* گوشه‌های گرد */
  background: var(--bubble);
  backdrop-filter: blur(3px);
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .2);
  display: flex; /* برای اینکه بتونیم زمان رو ببریم پایین */
  flex-direction: column; /* عناصر داخل حباب (متن، زمان) رو عمودی بچین */
  margin-left: 10px; /* فاصله از آواتار */
}

/* --- حباب پیام‌های خودت --- */
.msg.me {
  background: var(--bubbleMe);
  backdrop-filter: blur(3px);
  /* چون flex-direction: row-reverse; کردیم، این حباب به سمت راست میره */
}

/* --- قسمت بالای حباب (اسم فرستنده و زمان) --- */
.msg .top {
  width: 100%;
  display: flex;
  align-items: baseline; /* متن و زمان رو هم‌خط و مرتب کن */
  justify-content: space-between;
  gap: 5px;
  margin-bottom: 4px; /* کمی فاصله از متن اصلی */
}

.msg .user {
  font-weight: 800;
  font-size: 13px; /* کمی کوچکتر از متن اصلی */
  color: rgb(255, 255, 255); /* رنگ اسم فرستنده */
}

.msg .time {
  color: var(--muted);
  font-size: 11px; /* زمان رو کوچکتر کن */
  white-space: nowrap; /* زمان رو توی یه خط نگه دار */
}

/* --- متن اصلی پیام --- */
.msg .body {
  width: 100%;
  line-height: 1.65;
  margin-top: 4px; /* کمی فاصله از بخش top */
  font-size: 15px; /* اندازه متن پیام */
  margin: 0;
  max-width: 430px;
  text-align: right;
}

.msg .file {
  margin-top: 0px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  height: min-content;
  max-height: 430px;
  max-width: 430px;
}

.msg .file .file-box{
  display: flex;
  justify-content: center;
}

.msg .file .file-box .file-inf{
  max-width: 200px;
  margin-right: 6px;
  max-height: 60px;
}

.msg .file .file-inf .name{
  margin: 0;
  padding: 0;
  transform: translateY(-50px);
  font-size: 12px;
  display: block;
  color: white;
}

.msg .file .file-inf .meta{
  margin: 0;
  padding: 0;
  font-size: 8px;
  display: block;
  transform: translateY(-120px);
  color: var(--muted);
}

.msg .file .dwn-btn{
  justify-content: center;
  padding: 0px;
  color: rgb(255, 255, 255);
  width: 60px;
  height: 60px;
  background-color: rgb(255, 191, 52);
  border-radius: 12px;
  border: rgb(255, 210, 159) solid 1px;
  gap: 0;
  transition: all 0.5s ease-in-out;
  overflow: hidden;
}

.msg .file .dwn-btn a{
  margin: 0;
  padding: 0;
  display: block;
  text-decoration: none;
  text-align: center;
}

.msg .file .dwn-btn:hover{
  box-shadow: 0px 0px 20px rgb(255, 191, 52);
  transform: translateY(-2px);
}

.msg .file .dwn-btn a .icond{
  transform: translateY(-40px);
  max-width: 25px;
  max-height: 25px;
  border: none;
  cursor: pointer;
}

.msg .file .name {
  font-weight: 900;
  display: none;
}

.msg .file .meta {
  color: var(--muted);
  font-size: 12px;
  display: none;
}

.msg .file .imgs {
  transform: translate(0px, 5px);
  object-fit: cover;
  border-radius: 12px;
  width: 420px;
  height: 420px;
  max-width: 420px;
  max-height: 420px;
  border: 1px solid var(--border)
}

.msg .file .imgs:hover{
  transition: 0.3s ease-in-out;
  filter: blur(2px);
  cursor: zoom-in;
}

/* --- برای وقتی که صفحه کوچک است (mobile view) --- */
@media (max-width: 720px) {
  /* ... (استایل‌های قبلی که برای موبایل تعریف کردی) ... */
  
  .msg-row.me {
    margin-left: 0; /* فاصله رو بردار تا پیام‌ها تا لبه صفحه برن */
  }
  .msg-row .msg {
    max-width: 86%; /* عرض رو کمی بیشتر کن */
  }

  .msg .body {
    max-width: 280px;
  }

  .msg .file {
  margin-top: 0px;
  margin-bottom: 4px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  height: min-content;
  max-height: 260px;
  max-width: 260px;
}

.msg .file .file-box .file-inf{
  max-width: 200px;
  margin-right: 6px;
  max-height: 60px;
}

.msg .file .file-inf .name{
  margin: 0;
  padding: 0;
  transform: translateY(-50px);
  font-size: 12px;
  max-width: 190px;
  max-height: 30px;
  display: block;
  color: white;
}

  .msg .file .imgs {
  transform: translate(0px, 5px);
  object-fit: cover;
  border-radius: 12px;
  width: 250px;
  height: 250px;
  max-width: 250px;
  max-height: 250px;
  border: 1px solid var(--border)
  }
}


.composer {
  padding: 10px 12px;
  padding-bottom: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: rgba(22, 22, 22, 0.55);
  backdrop-filter: blur(10px);
  justify-content: center;
  justify-items: center;
}

.composer textarea {
  min-height: 46px;
  max-height: 140px
}

.file-input {
  display: none
}

.upload-preview {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px
}

.modal-card {
  width: min(520px, 95vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border)
}

.modal-title {
  font-weight: 900
}

.modal-body {
  padding: 12px 14px;
  max-height: 70vh;
  overflow: auto
}

.admin-body {
  padding: 18px;
  background-color: var(--bg);
  
  background-image:
  linear-gradient(to right, var(--border) 1px, transparent 1px), /* خطوط عمودی */
  linear-gradient(to bottom, var(--border) 1px, transparent 1px); /* خطوط افقی */

  background-size: 35px 35px; 
  
}

.admin-shell {
  max-width: 1100px;
  margin: 0 auto
}

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px
}

.card {
  background-color: rgba(41, 41, 41, 0.3);
  backdrop-filter: blur(3px);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  /* box-shadow: var(--shadow); */
}

.card h3 {
  margin: 0 0 10px 0
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 10px
}

.row>* {
  flex: 1
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 14px 0
}

.table {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden
}

.thead,
.trow {
  display: grid;
  grid-template-columns: 1.2fr .7fr .5fr 1fr
}

.thead {
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  font-size: 12px
}

.thead>div,
.trow>div {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border)
}

.trow:last-child>div {
  border-bottom: 0
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px
}

.thead.uploads,
.trow.uploads {
  grid-template-columns: 1.6fr .7fr .7fr .5fr .9fr .5fr
}

.thead.rooms,
.trow.rooms {
  grid-template-columns: 1.5fr .7fr .6fr .9fr .5fr
}

@media (max-width: 720px) {
  .chat {
    display: none;
    max-width: 100vw;
    max-height: 100%;
    overflow-x: hidden;
  }
  .btn-back{
    font-size: 12px;
    display: block;
  }

  .app-shell {
    grid-template-columns: 1fr
  }

  .sidebar {
    border-left: 0;
    border-bottom: 1px solid var(--border);
    display: flex;
  }

  .grid {
    grid-template-columns: 1fr
  }
}