/* =========================
   عمومی / Global Styles
========================= */
body {
  font-family: "Tahoma", sans-serif;
  background: linear-gradient(135deg, #c4c0d4, #9fa3d6, #7d8db2);
  color: #1c1c1c;
  margin: 0;
  padding-top: 200px; /* برای هدر و منو */
  direction: rtl;
  line-height: 1.5;
  transition: background 0.5s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.login-page {
  padding-top: 0; /* حذف پدینگ بالا برای صفحه لاگین */
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh; /* فرم وسط صفحه */
  background: linear-gradient(135deg, #c4c0d4, #9fa3d6, #7d8db2);
}

/* =========================
   صفحه ورود / Login Page
========================= */
.login-container {
  background: linear-gradient(145deg, #b8a4d0, #9980c2);
  padding: 30px 40px;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  text-align: center;
  width: 360px;
  max-width: 90vw; /* جلوگیری از بزرگ شدن بیش از حد */
  margin: 0 auto;
  animation: fadeIn 1s ease forwards;
  position: relative;
  z-index: 10;
  color: #fff;
  box-sizing: border-box;
}

.login-container img {
  max-width: 150px;
  height: auto;
  margin: 0 auto 20px;
  display: block;
  animation: slideDown 1s ease forwards;
}

.login-container .welcome-text {
  font-size: 1.3em;
  font-weight: 600;
  margin-bottom: 5px;
  color: #fff;
}

.login-container .company-name {
  font-weight: bold;
  margin-bottom: 20px;
  color: #f0dfff;
}

.login-container input {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-sizing: border-box;
  background: #f5f2fa;
  transition: all 0.3s ease;
  text-align: left;
  font-size: 1em;
  outline-offset: 2px;
  direction: ltr; /* برای رمز عبور و ورودی‌های لاتین */
}

.login-container input:focus {
  border-color: #6a1b9a;
  box-shadow: 0 0 8px rgba(106, 27, 154, 0.4);
  outline: none;
}

.login-container button {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #6a1b9a, #4a1275);
  color: #fff;
  font-size: 1em;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.4s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

.login-container button:hover {
  background: linear-gradient(135deg, #4a1275, #3a0f5a);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.3);
}

.login-container .alert {
  color: #ff4c4c;
  margin-top: 10px;
  font-size: 0.9em;
  font-weight: 600;
}

/* ریسپانسیو */
@media (max-width: 768px) {
  .login-container {
    width: 90%;
    padding: 20px;
    margin-top: 0;
  }
  .login-container img {
    max-width: 120px;
  }
  .login-container .welcome-text {
    font-size: 1.1em;
  }
  .login-container .company-name {
    font-size: 1.2em;
  }
  .login-container button {
    font-size: 0.95em;
  }
}
/* فقط اختصاصی برای جدول مخاطبین */
/* استفاده از کلاس عمومی کارت، پس تعریف نشد */

.contacts-table {
  width: 100%;
  border-collapse: separate; /* برای گردی گوشه‌ها */
  border-spacing: 0;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  background: linear-gradient(145deg, #a28ac9, #8960b0); /* هماهنگ با کارت */
}

/* گرد کردن گوشه‌های جدول */
.contacts-table thead tr th:first-child {
  border-top-right-radius: 15px;
}
.contacts-table thead tr th:last-child {
  border-top-left-radius: 15px;
}
.contacts-table tbody tr:last-child td:first-child {
  border-bottom-right-radius: 15px;
}
.contacts-table tbody tr:last-child td:last-child {
  border-bottom-left-radius: 15px;
}

/* سلول‌ها */
.contacts-table th, .contacts-table td {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
  vertical-align: middle;
  color: #fff;
  white-space: nowrap;
}

/* تغییر سایز آواتار فقط در این صفحه */
.contacts-table .avatar {
  width: 40px;  /* اگر توی پروژه سایز پیش‌فرض متفاوت است */
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #b8a4d0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.25);
}

/* ورودی جستجو */
#searchInput {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid #b8a4d0;
  background: #f5f2fa;
  color: #4a1275;
  box-sizing: border-box;
  transition: border-color 0.3s ease;
}

#searchInput:focus {
  border-color: #6a1b9a;
  outline: none;
  box-shadow: 0 0 8px rgba(106, 27, 154, 0.5);
}

/* ریسپانسیو */
/* موبایل و تبلت: جدول بلاک و اسکرول‌پذیر */
@media (max-width: 768px) {
  .contacts-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    border-radius: 15px;
  }

  .contacts-table thead {
    display: none;
  }

  .contacts-table tbody tr {
    display: block;
    margin-bottom: 15px;
    background: linear-gradient(145deg, #a28ac9, #8960b0);
    border-radius: 15px;
    padding: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.25);
  }

  .contacts-table tbody tr td {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    white-space: normal;
    color: #fff;
    font-size: 14px;
  }

  .contacts-table tbody tr td:last-child {
    border-bottom: none;
  }

  .contacts-table tbody tr td::before {
    content: attr(data-label);
    font-weight: 700;
    flex-basis: 40%;
    text-align: right;
    color: #dcd6f7;
  }

  .contacts-table .avatar {
    margin-left: 10px;
  }
}

/* =========================
   دکمه‌ها / Buttons
========================= */
button,
.btn-save {
  background: linear-gradient(135deg, #6a1b9a, #4a1275);
  color: #fff;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 500;
  transition: all 0.4s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

button:hover,
.btn-save:hover {
  background: linear-gradient(135deg, #4a1275, #3a0f5a);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

button:active,
.btn-save:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* =========================
   فرم‌ها و ورودی‌ها / Forms & Inputs
========================= */
input,
select,
textarea {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #999;
  width: 100%;
  box-sizing: border-box;
  background: #f5f2fa;
  transition: all 0.3s ease;
  font-size: 1em;
  font-family: "Tahoma", sans-serif;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #6a1b9a;
  box-shadow: 0 0 8px rgba(106, 27, 154, 0.3);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 80px;
}
/* =========================
   کارت‌ها و جدول‌ها / Cards & Tables
========================= */
.container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 10px;
  box-sizing: border-box;
}

.card {
  background: linear-gradient(145deg, #a28ac9, #8960b0);
  color: #fff;
  padding: 15px 20px;
  margin-bottom: 15px;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  cursor: default;
}

.card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}
/* =========================
   کاتالوگ محصولات / Catalog Cards
========================= */
.card.catalog-card {
  background: linear-gradient(145deg, #a28ac9, #8960b0);
  color: #fff;
  padding: 15px 20px;
  margin-bottom: 15px;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  cursor: default;

  /* ویژگی‌های اختصاصی کاتالوگ */
  background-color: #fff !important; /* اگر می‌خوای رنگ پس‌زمینه سفید باشه و جایگزین بشه */
  color: #333 !important; /* متن خاکستری تیره */
  border-radius: 10px; /* کمی گردتر */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  padding: 15px 20px;
}

.card.catalog-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.card.catalog-card h2 {
  font-size: 1.3em;
  margin-bottom: 10px;
  color: #444;
}

.card.catalog-card p {
  color: #555;
  line-height: 1.4;
  margin-bottom: 10px;
}

.card.catalog-card a {
  color: #6a1b9a;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.card.catalog-card a:hover {
  color: #4a1275;
  text-decoration: underline;
}

/* دکمه‌های عملیات کارت */
.card.catalog-card .card-actions {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 5px;
}

.card.catalog-card .card-actions button {
  background-color: #6a1b9a;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 0.85em;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.card.catalog-card .card-actions button:hover {
  background-color: #4a1275;
}
/* گرد کردن گوشه‌های جدول */
#catalogTable {
  border-collapse: separate; /* مهم: باید separate باشه تا border-radius کار کنه */
  border-spacing: 0; /* فاصله بین سلول‌ها صفر بشه */
  border-radius: 15px; /* گرد کردن گوشه‌ها */
  overflow: hidden; /* جلوگیری از بیرون زدگی */
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25); /* سایه مثل کارت */
}

/* گرد کردن گوشه‌های سلول‌های ردیف اول (header) */
#catalogTable thead tr th:first-child {
  border-top-right-radius: 15px;
}

#catalogTable thead tr th:last-child {
  border-top-left-radius: 15px;
}

/* گرد کردن گوشه‌های سلول‌های ردیف آخر (footer یا tbody آخر) */
#catalogTable tbody tr:last-child td:first-child {
  border-bottom-right-radius: 15px;
}

#catalogTable tbody tr:last-child td:last-child {
  border-bottom-left-radius: 15px;
}


table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  font-family: "Tahoma", sans-serif;
}

th, td {
  border: 1px solid #ccc;
  padding: 10px 12px;
  text-align: center;
  vertical-align: middle;
}

th {
  background: #7d5bb3;
  font-weight: 600;
  color: #fff;
  user-select: none;
}

td {
  background: #a28ac9;
  color: #fff;
}

/* =========================
   مودال‌ها / Modals
========================= */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1050;
}

.modal-content {
  background: linear-gradient(145deg, #b99bdc, #9b80c2);
  padding: 25px 30px;
  border-radius: 15px;
  width: 90%;
  max-width: 500px;
  position: relative;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  color: #fff;
  font-family: "Tahoma", sans-serif;
  max-height: 90vh;
  overflow-y: auto;
}

.close {
  position: absolute;
  top: 12px;
  right: 15px;
  cursor: pointer;
  font-size: 1.5em;
  font-weight: bold;
  color: #fff;
  transition: color 0.3s ease;
  user-select: none;
}

.close:hover {
  color: #ff4c4c;
}

/* =========================
   آواتار / Avatar
========================= */
.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 10px;
  border: 2px solid #6a1b9a;
  transition: transform 0.3s ease;
  cursor: pointer;
}

.avatar:hover {
  transform: scale(1.05);
}

/* =========================
   هشدار / Alert
========================= */
.alert {
  color: #ff4c4c;
  margin-top: 10px;
  font-size: 0.9em;
  font-weight: 600;
  font-family: "Tahoma", sans-serif;
}

/* =========================
   هدر داشبورد / Dashboard Header
========================= */
.dashboard-header {
  background: linear-gradient(135deg, #7d5bb3, #5a2a8c);
  color: #fff;
  padding: 20px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  position: fixed;
  top: 60px;
  left: 0;
  width: 100%;
  z-index: 999;
  font-family: "Tahoma", sans-serif;
  user-select: none;
}

.dashboard-header .logo img {
  height: 55px;
  user-select: none;
}

.dashboard-header #datetime-display,
.dashboard-header .user-info div {
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  user-select: text;
}

.dashboard-header .user-info {
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  direction: ltr;
}
/* =========================
   منوی داشبورد / Dashboard Menu
========================= */
#dashboard-menu {
  background: linear-gradient(135deg, #5a2a8c, #7d5bb3);
  color: #fff;
  padding: 12px 25px;
  border-radius: 0 0 20px 20px;
  margin-bottom: 25px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  position: fixed;
  top: 140px;
  left: 0;
  width: 100%;
  z-index: 998;
  display: flex;
  justify-content: center;
  font-family: "Tahoma", sans-serif;
}

#dashboard-menu ul {
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
  justify-content: center;
}

#dashboard-menu li {
  display: inline-block;
}

#dashboard-menu a {
  color: #fff;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.15);
  user-select: none;
}

#dashboard-menu a:hover,
#dashboard-menu a.active {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
}

/* =========================
   کارت‌های داشبورد / Dashboard Cards
========================= */
.card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 10px;
  padding: 0 15px;
  box-sizing: border-box;
}

.dashboard-card {
  background: linear-gradient(145deg, #a28ac9, #8960b0);
  padding: 20px;
  border-radius: 18px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.25);
  flex: 1 1 calc(33.333% - 15px);
  min-width: 220px;
  cursor: pointer;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  color: #fff;
  display: flex;
  flex-direction: column;
}

.dashboard-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.dashboard-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 10px;
  user-select: none;
}

/* =========================
   ناوبری اصلی سه ردیفه / Fixed Navbar 3 Rows
========================= */
.fixed-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #5a2a8c, #7d5bb3);
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  border-radius: 0 0 20px 20px;
  display: flex;
  flex-direction: column;
  width: 100%;
  font-family: "Tahoma", sans-serif;
}

/* ردیف‌ها */
.fixed-navbar .navbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: 5px 20px;
  box-sizing: border-box;
}

/* ردیف اول – لوگو و تاریخ */
.fixed-navbar .top-row {
  justify-content: space-between;
}

.logo-company {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  user-select: none;
}

.logo-company img {
  height: 50px;
  user-select: none;
}

.logo-company .company-name {
  font-size: 1.4rem;
  font-weight: bold;
  margin-top: 5px;
  color: #fff;
  user-select: none;
}

/* ریسپانسیو */
@media (max-width: 1024px) {
  .dashboard-card {
    flex: 1 1 calc(50% - 15px);
    min-width: 200px;
  }

  #dashboard-menu ul {
    flex-wrap: wrap;
    gap: 15px;
  }
}

@media (max-width: 768px) {
  #dashboard-menu {
    padding: 10px 15px;
    top: 120px;
  }

  .dashboard-card {
    flex: 1 1 100%;
    min-width: auto;
  }

  .fixed-navbar .navbar-row {
    flex-direction: column;
    gap: 8px;
  }
}
/* ردیف دوم – نام و سمت کاربر (چپ‌چین) */
.fixed-navbar .middle-row {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start !important; /* override وسط‌چین */
  width: 100%;
  direction: ltr;
  padding-left: 20px;   /* فضای دو طرف */
  padding-right: 20px;
  box-sizing: border-box;
  gap: 15px;
}

.fixed-navbar .middle-row .user-info {
  direction: ltr;          /* چپ به راست */
  text-align: left;        /* متن چپ‌چین */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: #fff;
  font-weight: 600;
  user-select: none;
}

.fixed-navbar .middle-row .user-info #current-title,
.fixed-navbar .middle-row .user-info #current-fullname {
  margin: 0;
  padding: 0;
  line-height: 1.3;
}

/* ردیف سوم – لینک‌ها */
.fixed-navbar .bottom-row {
  display: flex;
  justify-content: center;
  margin-top: 5px;
  padding-top: 5px;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-list {
  list-style: none;
  display: flex;
  gap: 15px;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-list li {
  display: inline-block;
}

.nav-list li a {
  text-decoration: none;
  color: #fff;
  padding: 5px 12px;
  border-radius: 5px;
  font-weight: 600;
  transition: background-color 0.3s ease, transform 0.3s ease;
  user-select: none;
}

.nav-list li a.active,
.nav-list li a:hover {
  background-color: #3f1f7a;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(63, 31, 122, 0.6);
}

#datetime-display {
  font-size: 0.95rem;
  color: #fff;
  margin-top: 5px;
  user-select: none;
  font-weight: 600;
}

/* ریسپانسیو */
@media (max-width: 768px) {
  .fixed-navbar .middle-row {
     justify-content: flex-start !important; /* از وسط به چپ */
    padding-left: 10px;
    padding-right: 10px;
  }
  .fixed-navbar .middle-row .user-info {
    direction: ltr !important;       /* جهت متن چپ به راست */
    text-align: left !important;     /* متن چپ‌چین */
    align-items: flex-start !important; /* آیتم‌ها هم چپ چین */
  }
  
  .nav-list {
    justify-content: center;
    gap: 10px;
  }

  .nav-list li a {
    padding: 6px 10px;
    font-size: 0.9rem;
  }
}

/* =========================
   انیمیشن‌ها / Animations
========================= */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================
   ریسپانسیو / Responsive
========================= */
@media (max-width: 1024px) {
  .dashboard-card {
    flex: 1 1 calc(50% - 15px);
    min-width: 200px;
  }
  #dashboard-menu ul {
    flex-wrap: wrap;
    gap: 15px;
  }
}

@media (max-width: 768px) {
  body {
    padding-top: 150px;
  }
  body.login-page {
    padding-top: 0;
  }
  .login-container {
    width: 90%;
    padding: 20px;
    margin-top: 0;
  }
  .login-container img {
    max-width: 120px;
  }
  .login-container .welcome-text {
    font-size: 1.1em;
  }
  .login-container .company-name {
    font-size: 1.2em;
  }
  .login-container button {
    font-size: 0.95em;
  }
  .card-row {
    flex-direction: column;
  }
  #dashboard-menu ul {
    flex-direction: column;
    gap: 10px;
    justify-content: flex-start;
  }
  #announcementsContainer {
    justify-content: center;
  }
  .announcement-card {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .dashboard-card {
    flex: 1 1 100%;
  }
  .fixed-navbar .navbar-row {
    flex-direction: column;
    align-items: center;
  }
  .logo-company {
    margin-bottom: 10px;
  }
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
  }
}

/* =========================
   کارت اطلاعیه / مجله الکترونیکی / Announcements Card
========================= */
#announcementsContainer {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
  justify-content: flex-start;
}

.announcement-card {
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 15px;
  width: 100%;
  max-width: 400px;
  background-color: #fff;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.announcement-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.announcement-card img {
  width: 100%;
  border-radius: 5px;
  margin-bottom: 10px;
  object-fit: cover;
}

.announcement-card h2 {
  font-size: 1.2em;
  margin-bottom: 8px;
  color: #333;
}

.announcement-card p {
  margin-bottom: 10px;
  color: #555;
  line-height: 1.4;
}

.announcement-card small {
  color: #888;
  font-size: 0.85em;
}

/* دکمه‌های عملیات کارت */
.card-actions {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 5px;
}

.card-actions button {
  background-color: #007BFF;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 0.8em;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.card-actions button:hover {
  background-color: #0056b3;
}
.no-hover-card:hover {
  transform: none !important;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25) !important;
}
.back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  border: none;
  border-radius: 6px;
}
.container {
  position: relative;
}

.back-btn {
  position: absolute;
  top: 0;
  left: 0;
  padding: 8px 16px;
  cursor: pointer;
}
/* =========================================
   GLOBAL INCOMING MESSAGE MODAL
   DARK PREMIUM - LIGHTER VERSION
========================================= */

#globalIncomingMessageModal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    direction: rtl;
}

#globalIncomingMessageModal.show {
    display: block;
}


/* =========================================
   OVERLAY
========================================= */

#globalIncomingMessageModal .global-message-overlay {

    position: fixed;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    box-sizing: border-box;

    background:
        radial-gradient(
            circle at 50% 35%,
            rgba(96,165,250,.20),
            transparent 42%
        ),
        rgba(15,23,42,.68);

    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);

    animation:
        globalMessageOverlayIn
        .25s ease;
}


/* =========================================
   MAIN MODAL
========================================= */

#globalIncomingMessageModal .global-message-modal {

    position: relative;

    width: min(460px, 100%);

    /*
       ارتفاع کنترل شده مودال
    */
    height: min(600px, calc(100vh - 60px));
    height: min(600px, calc(100dvh - 60px));

    /*
       جلوگیری از بیرون زدن مودال
    */
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);

    /*
       هدر و دکمه‌ها ثابت می‌مانند
    */
    display: flex;
    flex-direction: column;

    box-sizing: border-box;

    direction: rtl;

    background:
        linear-gradient(
            145deg,
            #243b63 0%,
            #294568 48%,
            #1f3555 100%
        );

    border:
        1px solid rgba(255,255,255,.16);

    border-radius:
        26px;

    padding:
        0 25px 25px;

    overflow:
        hidden;

    box-shadow:

        0 35px 90px
        rgba(0,0,0,.38),

        0 0 50px
        rgba(59,130,246,.16);

    animation:
        globalMessageModalIn
        .35s
        cubic-bezier(.16,1,.3,1);
}


/* =========================================
   COLOR GLOW
========================================= */

#globalIncomingMessageModal
.global-message-modal::before {

    content: "";

    position: absolute;

    top: -80px;
    right: -70px;

    width: 230px;
    height: 230px;

    border-radius: 50%;

    background:
        radial-gradient(
            circle,
            rgba(96,165,250,.38),
            transparent 70%
        );

    pointer-events: none;
}


/* =========================================
   TOP COLOR LINE
========================================= */

#globalIncomingMessageModal
.global-message-modal::after {

    content: "";

    position: absolute;

    top: 0;
    right: 0;
    left: 0;

    height: 4px;

    background:
        linear-gradient(
            90deg,
            #818cf8,
            #60a5fa,
            #22d3ee
        );
}


/* =========================================
   CLOSE
========================================= */

#globalIncomingMessageModal
.global-message-close {

    position: absolute;

    top: 16px;
    left: 16px;

    z-index: 10;

    width: 36px;
    height: 36px;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 0;

    border:
        1px solid rgba(255,255,255,.14);

    border-radius: 50%;

    background:
        rgba(255,255,255,.09);

    color:
        rgba(255,255,255,.82);

    font-family:
        Arial, sans-serif;

    font-size:
        22px;

    line-height:
        1;

    cursor:
        pointer;

    transition:
        .2s ease;
}

#globalIncomingMessageModal
.global-message-close:hover {

    background:
        rgba(255,255,255,.18);

    color:
        #ffffff;

    transform:
        rotate(90deg);
}


/* =========================================
   HEADER
========================================= */

#globalIncomingMessageModal
.global-message-header {

    position: relative;

    display: flex;

    align-items: center;

    gap: 15px;

    padding:
        30px 8px 22px 45px;

    min-height:
        90px;

    box-sizing:
        border-box;

    /*
       هدر ثابت
    */
    flex:
        0 0 auto;
}


/* =========================================
   AVATAR
========================================= */

#globalIncomingMessageModal
.global-message-header img {

    width: 62px;
    height: 62px;

    min-width: 62px;
    min-height: 62px;

    border-radius:
        19px;

    object-fit:
        cover;

    border:
        3px solid
        rgba(255,255,255,.88);

    background:
        #48658c;

    box-shadow:
        0 8px 25px
        rgba(0,0,0,.25);
}


/* =========================================
   SENDER
========================================= */

#globalIncomingMessageModal
.global-message-sender {

    max-width:
        260px;

    overflow:
        hidden;

    text-overflow:
        ellipsis;

    white-space:
        nowrap;

    color:
        #ffffff;

    font-size:
        18px;

    font-weight:
        700;

    line-height:
        1.5;
}


/* =========================================
   LABEL
========================================= */

#globalIncomingMessageModal
.global-message-label {

    display:
        inline-flex;

    align-items:
        center;

    gap:
        7px;

    margin-top:
        6px;

    padding:
        5px 10px;

    border-radius:
        20px;

    background:
        rgba(147,197,253,.14);

    border:
        1px solid
        rgba(147,197,253,.20);

    color:
        #bfdbfe;

    font-size:
        11px;

    font-weight:
        600;
}


/* =========================================
   STATUS DOT
========================================= */

#globalIncomingMessageModal
.global-message-label::before {

    content: "";

    width:
        6px;

    height:
        6px;

    border-radius:
        50%;

    background:
        #38bdf8;

    box-shadow:
        0 0 0 3px
        rgba(56,189,248,.12),

        0 0 10px
        rgba(56,189,248,.65);
}


/* =========================================
   DIVIDER
========================================= */

#globalIncomingMessageModal
.global-message-header::after {

    content: "";

    position:
        absolute;

    right:
        8px;

    left:
        8px;

    bottom:
        0;

    height:
        1px;

    background:
        rgba(255,255,255,.14);
}


/* =========================================
   MESSAGE BODY
   فقط متن این قسمت اسکرول می‌شود
========================================= */

#globalIncomingMessageModal
.global-message-body {

    position:
        relative;

    margin-top:
        21px;

    padding:
        17px 18px;

    /*
       ارتفاع پایه
    */
    min-height:
        58px;

    /*
       حداکثر ارتفاع بخش متن
       تا دکمه‌های پایین جابه‌جا نشوند
    */
    max-height:
        300px;

    /*
       فقط خود متن اسکرول شود
    */
    overflow-y:
        auto;

    overflow-x:
        hidden;

    flex:
        0 1 auto;

    box-sizing:
        border-box;

    border:
        1px solid
        rgba(255,255,255,.12);

    border-radius:
        16px;

    background:
        rgba(255,255,255,.085);

    color:
        #f1f5f9;

    font-size:
        14px;

    line-height:
        1.95;

    word-break:
        break-word;

    text-align:
        right;

    box-shadow:
        inset 0 1px 0
        rgba(255,255,255,.035);

    /*
       Firefox scrollbar
    */
    scrollbar-width:
        thin;

    scrollbar-color:
        rgba(147,197,253,.45)
        transparent;
}


/* =========================================
   MESSAGE BODY SCROLLBAR
   Chrome / Edge
========================================= */

#globalIncomingMessageModal
.global-message-body::-webkit-scrollbar {

    width:
        6px;
}

#globalIncomingMessageModal
.global-message-body::-webkit-scrollbar-track {

    background:
        transparent;

    margin:
        8px 0;
}

#globalIncomingMessageModal
.global-message-body::-webkit-scrollbar-thumb {

    background:
        rgba(147,197,253,.40);

    border-radius:
        20px;
}

#globalIncomingMessageModal
.global-message-body::-webkit-scrollbar-thumb:hover {

    background:
        rgba(147,197,253,.65);
}


/* =========================================
   ATTACHMENTS
========================================= */

#globalIncomingMessageModal
.global-message-attachment {

    margin-top:
        10px;

    max-width:
        100%;

    /*
       پیوست‌ها ثابت هستند
    */
    flex:
        0 0 auto;
}

#globalIncomingMessageModal
.global-message-attachment img {

    display:
        block;

    max-width:
        100%;

    max-height:
        230px;

    margin-top:
        8px;

    border-radius:
        15px;

    object-fit:
        contain;

    border:
        1px solid
        rgba(255,255,255,.14);
}

#globalIncomingMessageModal
.global-message-attachment audio {

    width:
        100%;

    margin-top:
        8px;
}


/* =========================================
   ACTIONS
========================================= */

#globalIncomingMessageModal
.global-message-actions {

    display:
        flex;

    gap:
        11px;

    margin-top:
        22px;

    /*
       دکمه‌ها ثابت می‌مانند
    */
    flex:
        0 0 auto;
}


/* =========================================
   BUTTON BASE
========================================= */

#globalIncomingMessageModal
.global-message-actions button {

    flex:
        1;

    height:
        47px;

    border:
        none;

    border-radius:
        13px;

    padding:
        0 16px;

    font-family:
        inherit;

    font-size:
        13px;

    font-weight:
        600;

    cursor:
        pointer;

    transition:
        .2s ease;
}


/* =========================================
   OPEN BUTTON
========================================= */

#globalIncomingMessageModal
.global-message-open {

    background:
        linear-gradient(
            135deg,
            #3b82f6,
            #6366f1
        );

    color:
        #ffffff;

    box-shadow:
        0 8px 22px
        rgba(59,130,246,.32);
}

#globalIncomingMessageModal
.global-message-open:hover {

    transform:
        translateY(-2px);

    box-shadow:
        0 12px 28px
        rgba(59,130,246,.45);

    filter:
        brightness(1.08);
}


/* =========================================
   DISMISS BUTTON
========================================= */

#globalIncomingMessageModal
.global-message-dismiss {

    background:
        rgba(255,255,255,.09);

    color:
        #e2e8f0;

    border:
        1px solid
        rgba(255,255,255,.14) !important;
}

#globalIncomingMessageModal
.global-message-dismiss:hover {

    background:
        rgba(255,255,255,.16);

    color:
        #ffffff;
}


/* =========================================
   ACTIVE
========================================= */

#globalIncomingMessageModal
.global-message-actions button:active {

    transform:
        scale(.97);
}


/* =========================================
   ANIMATIONS
========================================= */

@keyframes globalMessageOverlayIn {

    from {
        opacity:
            0;
    }

    to {
        opacity:
            1;
    }
}


@keyframes globalMessageModalIn {

    from {

        opacity:
            0;

        transform:
            translateY(-30px)
            scale(.93);
    }

    to {

        opacity:
            1;

        transform:
            translateY(0)
            scale(1);
    }
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 500px) {

    #globalIncomingMessageModal
    .global-message-overlay {

        padding:
            14px;
    }


    #globalIncomingMessageModal
    .global-message-modal {

        width:
            100%;

        /*
           ارتفاع کمتر در موبایل
        */
        height:
            min(540px, calc(100vh - 28px));

        height:
            min(540px, calc(100dvh - 28px));

        max-height:
            calc(100vh - 28px);

        max-height:
            calc(100dvh - 28px);

        padding:
            0 19px 20px;

        border-radius:
            21px;
    }


    #globalIncomingMessageModal
    .global-message-header {

        gap:
            12px;

        padding:
            26px 5px 19px 40px;
    }


    #globalIncomingMessageModal
    .global-message-header img {

        width:
            52px;

        height:
            52px;

        min-width:
            52px;

        min-height:
            52px;

        border-radius:
            16px;
    }


    #globalIncomingMessageModal
    .global-message-sender {

        max-width:
            190px;

        font-size:
            15px;
    }


    #globalIncomingMessageModal
    .global-message-body {

        margin-top:
            18px;

        padding:
            14px;

        font-size:
            13px;

        /*
           متن در موبایل کمی کوتاه‌تر
        */
        max-height:
            240px;
    }


    #globalIncomingMessageModal
    .global-message-actions {

        gap:
            8px;

        margin-top:
            18px;
    }


    #globalIncomingMessageModal
    .global-message-actions button {

        height:
            43px;

        font-size:
            12px;
    }
}