/* =========================
   عمومی / 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;
}
