/* ==========================================================================
   app.css — ادغام تمام فایل‌های CSS پروژه در یک فایل
   --------------------------------------------------------------------------
   این فایل جایگزین این فایل‌ها شده است:
     - src/dark-mode.css   (متغیرهای تم روشن/تاریک)
     - src/dashboard.css   (صفحات پنل)
     - style.css           (صفحه ورود)
     - style-res.css       (خالی بود)
     - fonts/font.css      (فونت)

   چون style.css و dashboard.css قوانین متضاد روی `*` و `body` و `.spinner`
   داشتند، آن قوانین با کلاس body اسکوپ شده‌اند تا رفتار قبلی حفظ شود:
     <body class="page-login">      → صفحه ورود (login.php)
     <body class="page-dashboard">  → صفحات پنل

   ترتیب بخش‌ها عمداً همان ترتیب لود قبلی است تا cascade عوض نشود:
     متغیرها → قوانین مشترک → پنل → ورود → فونت (آخر، چون !important دارد)
   ========================================================================== */

/* ==========================================================================
   1) متغیرهای تم  (از src/dark-mode.css)
   ========================================================================== */

/* ==================== LIGHT THEME (default) ==================== */
:root {
  --bg-body: #f0f2f5;
  --bg-card: #ffffff;
  --bg-header: #4a5fc1;
  --bg-container: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-sidebar-hover: #f0f2ff;
  --bg-sidebar-active: #e8ebff;
  --bg-modal: #ffffff;
  --bg-input: #ffffff;
  --bg-nav: #f1f1f1;
  --bg-table-hover: #f5f7ff;
  --bg-table-stripe: #fafafa;
  --bg-pagination: #f0f0f0;
  --bg-spinner: #ddd;
  --bg-spinner-top: #4a5fc1;
  --bg-footer: rgba(74, 95, 193, 0.08);
  --bg-code-input: #f8f8f8;
  --bg-overlay: rgba(0, 0, 0, 0.4);
  --bg-expert: #f5f5f5;
  --bg-header-toggle: rgba(255, 255, 255, 0.15);
  --bg-header-toggle-hover: rgba(255, 255, 255, 0.25);
  --bg-input-disabled: #f5f5f5;

  --text-primary: #2d3748;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-header: #ffffff;
  --text-footer: #6b7280;
  --text-white: #ffffff;
  --text-link: #4a5fc1;
  --text-nav-link: #374151;

  --border-color: #d1d5db;
  --border-light: #e5e7eb;
  --border-input: #d1d5db;
  --border-pagination: #d1d5db;
  --border-header: rgba(255, 255, 255, 0.2);

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-header: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-sidebar: -2px 0 12px rgba(0, 0, 0, 0.1);

  --color-primary: #4a5fc1;
  --color-primary-hover: #3d50a8;
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-table-header: #4a5fc1;
  --color-pagination-active-bg: #4a5fc1;
  --color-focus: #4a5fc1;
  --color-check: #16a34a;
}

/* ==================== DARK THEME ==================== */
[data-theme="dark"] {
  --bg-body: #0d0d1a;
  --bg-card: #1a1a30;
  --bg-header: #141428;
  --bg-container: #1a1a30;
  --bg-sidebar: #141428;
  --bg-sidebar-hover: #222244;
  --bg-sidebar-active: #2a2a50;
  --bg-modal: #1e1e38;
  --bg-input: #222244;
  --bg-nav: #1a1a30;
  --bg-table-hover: #222244;
  --bg-table-stripe: #16162e;
  --bg-pagination: #222244;
  --bg-spinner: #333;
  --bg-spinner-top: #667eea;
  --bg-footer: rgba(0, 0, 0, 0.5);
  --bg-code-input: #222244;
  --bg-overlay: rgba(0, 0, 0, 0.6);
  --bg-expert: #222244;
  --bg-header-toggle: rgba(255, 255, 255, 0.1);
  --bg-header-toggle-hover: rgba(255, 255, 255, 0.18);
  --bg-input-disabled: #1a1a30;

  --text-primary: #e2e8f0;
  --text-secondary: #a0aec0;
  --text-muted: #718096;
  --text-header: #e2e8f0;
  --text-footer: #a0aec0;
  --text-white: #ffffff;
  --text-link: #818cf8;
  --text-nav-link: #c8d0dc;

  --border-color: #333355;
  --border-light: #252545;
  --border-input: #333355;
  --border-pagination: #333355;
  --border-header: rgba(255, 255, 255, 0.1);

  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-header: 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-sidebar: -2px 0 12px rgba(0, 0, 0, 0.3);

  --color-primary: #667eea;
  --color-primary-hover: #5563d1;
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-table-header: #2d2d5e;
  --color-pagination-active-bg: #667eea;
  --color-focus: #818cf8;
  --color-check: #22c55e;
}

/* ==================== APPLY TO BODY ==================== */
body {
  background: var(--bg-body) !important;
}

/* ==========================================================================
   2) قوانین مشترک هر دو فایل (یکسان بودند → یک‌بار تعریف شده)
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: tahoma;
}

.hide {
  display: none !important;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   3) صفحات پنل  (از src/dashboard.css)  —  body.page-dashboard
   ========================================================================== */

/* ==================== DASHBOARD LAYOUT ==================== */
body.page-dashboard {
  background: var(--bg-body);
  min-height: 100vh;
  direction: rtl;
  /*
     جلوگیری از اسکرول افقی، بدون شکستنِ position: sticky.
     نکته‌ی مهم: overflow-x: hidden باعث می‌شود body به کانتینرِ اسکرول تبدیل
     شود و آن‌وقت هدر و بنرِ چسبان دیگر نسبت به پنجره نمی‌چسبند. overflow-x: clip
     همان کلیپِ افقی را می‌دهد ولی کانتینرِ اسکرول نمی‌سازد و sticky سالم می‌ماند.
     hidden به‌عنوان fallback برای مرورگرهای خیلی قدیمی اول می‌آید.
  */
  overflow-x: hidden;
  overflow-x: clip;
}

.dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.dashboard-body {
  display: flex;
  flex: 1;
}

/* ==================== HEADER ==================== */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-header);
  box-shadow: var(--shadow-header);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right .brand {
  font-size: 16px;
  font-weight: bold;
  color: var(--text-header);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ==================== USER MENU (منوی کشویی هدر) ==================== */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 2px solid var(--border-header);
  border-radius: 50%;
  background: var(--bg-header-toggle);
  cursor: pointer;
  overflow: hidden;
  line-height: 0;
  display: block;
  transition: 0.2s;
}

.user-menu-trigger:hover {
  transform: scale(1.06);
  background: var(--bg-header-toggle-hover);
}

.header-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 215px;
  padding: 8px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  z-index: 1100;
  display: none;
  flex-direction: column;
  gap: 2px;
}

.user-menu.open .user-menu-dropdown {
  display: flex;
  animation: userMenuIn 0.16s ease both;
}

@keyframes userMenuIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-menu-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px 10px;
}

.user-menu-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.user-menu-welcome {
  font-size: 11px;
  color: var(--text-secondary);
}

.user-menu-sep {
  height: 1px;
  background: var(--border-light);
  margin: 2px 0 4px;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  text-align: right;
  text-decoration: none;
  cursor: pointer;
  transition: 0.15s;
}

.user-menu-item:hover {
  background: var(--bg-sidebar-hover);
}

.user-menu-logout {
  color: var(--color-danger);
}

.user-menu-logout:hover {
  background: rgba(220, 38, 38, 0.1);
}

/* ==================== IMPERSONATE BANNER ====================
   وقتی ادمین با حساب کاربر دیگری وارد شده، این نوار زیر هدر می‌آید.
   عمدا پررنگ است تا ناخواسته فراموش نشود که با حساب خودتان نیستید. */
.impersonate-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 9px 16px;
  background: var(--color-warning);
  color: #fff;
  font-size: 13px;
  position: sticky;
  top: 52px;
  z-index: 99;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.impersonate-icon {
  font-size: 16px;
}

.impersonate-text b {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.impersonate-back {
  padding: 4px 14px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.impersonate-back:hover {
  background: #fff;
  color: var(--color-warning);
}

@media (max-width: 600px) {
  .impersonate-banner {
    font-size: 12px;
    padding: 8px 12px;
    gap: 8px;
    position: static;
  }
}

/* ==================== SITE LOGO (هدر) ==================== */
.header-logo {
  height: 28px;
  max-width: 110px;
  object-fit: contain;
  border-radius: 4px;
}

/* ==================== SITE MESSAGES BOX (کادر پیام‌های اطلاع‌رسانی) ==================== */
/* ==================== نوار بالای صفحه (هدر + بنرها) ==================== */
/*
   کل نوار بالا در یک ظرفِ sticky واحد است تا هدر و بنرِ پیام‌ها هنگام اسکرول
   با هم بالای صفحه ثابت بمانند. قبلاً هر کدام جداگانه sticky بودند و بنرِ
   پیام‌ها در بعضی مرورگرها نمی‌چسبید. داخلِ این ظرف، هدر و بنرها static می‌شوند
   و خودِ ظرف می‌چسبد.
*/
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-topbar .dashboard-header,
.app-topbar .impersonate-banner,
.app-topbar .site-messages-box {
  position: static;
}

.site-messages-box {
  /* روی صفحات قدیمیِ بدونِ ظرفِ app-topbar باز هم زیر هدر می‌چسبد */
  position: sticky;
  top: 52px;
  z-index: 95; /* بالای محتوا، زیر هدر (۱۰۰) */
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 20px;
  /* پس‌زمینه‌ی سبزِ چشم‌گیر با متن سفید */
  background: var(--color-success, #16a34a);
  border-bottom: 2px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.site-message-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-inline-start: 4px solid #fff;
}

.site-message-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1.6;
  color: #fff;
}

.site-message-text {
  flex: 1;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  line-height: 1.85;
}

.site-message-close {
  color: rgba(255, 255, 255, 0.85);
}
.site-message-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.site-message-close {
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 6px;
  transition: 0.15s;
  line-height: 1.6;
}

.site-message-close:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-primary);
}

/* ==================== HAMBURGER ==================== */
.hamburger {
  display: block;
  background: var(--bg-header-toggle);
  border: 1px solid var(--border-header);
  border-radius: 8px;
  font-size: 22px;
  cursor: pointer;
  padding: 6px 10px;
  color: var(--text-header);
  transition: 0.2s;
  line-height: 1;
}

.hamburger:hover {
  background: var(--bg-header-toggle-hover);
}

.hamburger:active {
  transform: scale(0.95);
}

/* ==================== SIDEBAR ==================== */
.dashboard-sidebar {
  position: fixed;
  top: 0;
  right: -270px;
  height: 100vh;
  width: 250px;
  background: var(--bg-sidebar);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: right 0.3s ease;
  overflow-y: auto;
}

.dashboard-sidebar.open {
  right: 0;
}

/* ==================== SIDEBAR PROFILE (بخش بالای سایدبار) ==================== */
.sidebar-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 16px 18px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-avatar-btn {
  width: 78px;
  height: 78px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--bg-sidebar-hover);
  cursor: pointer;
  line-height: 0;
  overflow: hidden;
  transition: 0.2s;
}

.sidebar-avatar-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.sidebar-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.sidebar-fullname {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.6;
  word-break: break-word;
}

.sidebar-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  border-radius: 8px;
  background: var(--color-danger);
  color: #fff;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  transition: 0.2s;
}

.sidebar-logout-btn:hover {
  background: var(--color-danger-hover);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 10px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  text-decoration: none;
  color: var(--text-nav-link);
  font-size: 14px;
  font-weight: 500;
  border-radius: 0;
  transition: 0.2s;
  margin: 0 8px;
  border-radius: 8px;
}

.sidebar-nav a:hover {
  background: var(--bg-sidebar-hover);
}

.sidebar-nav a.active {
  background: var(--bg-sidebar-active);
  color: var(--color-primary);
}

.sidebar-nav .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

/* سربرگ هر دسته‌ی منو (عمومی، تیکت‌ها، کاربران و دسترسی‌ها، ...) */
.sidebar-section-label {
  padding: 14px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.sidebar-nav > .sidebar-section-label:first-child {
  padding-top: 4px;
}

/* ==================== SIDEBAR ACCORDION (گروه‌های جمع‌شونده) ==================== */
.sidebar-section {
  margin: 2px 8px;
}

.sidebar-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  transition: 0.15s;
}

.sidebar-section-toggle:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-primary);
}

.sidebar-section.open .sidebar-section-toggle {
  color: var(--color-primary);
}

.sidebar-section-chevron {
  font-size: 13px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.sidebar-section.open .sidebar-section-chevron {
  transform: rotate(-90deg);
}

.sidebar-section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.sidebar-section.open .sidebar-section-content {
  max-height: 320px;
}

.sidebar-section-content a {
  margin: 0 8px 2px;
}

/* ==================== SIDEBAR OVERLAY ==================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 999;
}

.sidebar-overlay.show {
  display: block;
}

/* ==================== CONTENT AREA ==================== */
.dashboard-content {
  flex: 1;
  padding: 24px;
  overflow-x: auto;
  min-height: calc(100vh - 52px);
}

.page-title {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 16px;
  font-weight: 600;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  transition: 0.2s;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-danger {
  background: var(--color-danger);
  color: white;
}

.btn-danger:hover {
  background: var(--color-danger-hover);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* ==================== PAGINATION ==================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  flex-wrap: wrap;
  padding: 10px 0;
}

.pagination-summary {
  width: 100%;
  color: var(--text-muted, #6b7280);
  font-size: 12px;
  text-align: center;
}

.pagination-btn {
  padding: 8px 14px;
  border: 1px solid var(--border-pagination);
  background: var(--bg-pagination);
  color: var(--text-primary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: 0.2s;
  min-width: 36px;
  text-align: center;
}

.pagination-btn:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.pagination-btn.active {
  background: var(--color-pagination-active-bg);
  color: white;
  border-color: var(--color-pagination-active-bg);
  font-weight: bold;
}

.pagination-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-btn.disabled:hover {
  background: var(--bg-pagination);
  color: var(--text-primary);
  border-color: var(--border-pagination);
}

/* ==================== FOOTER ==================== */
.dashboard-footer {
  text-align: center;
  padding: 8px 16px;
  background: var(--bg-footer);
  color: var(--text-footer);
  font-size: 12px;
  width: 100%;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .dashboard-content {
    padding: 16px 12px;
  }

  .dashboard-header {
    padding: 10px 14px;
  }

  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrapper table {
    min-width: 700px;
  }

  .sidebar-nav a {
    padding: 14px 16px;
    margin: 0 4px;
  }
}

@media (max-width: 480px) {
  .dashboard-content {
    padding: 12px 8px;
  }

  .page-title {
    font-size: 15px;
  }
}

/* ==================== TRANSITION & ANIMATIONS (legacy) ==================== */

/* ==================== MODAL POSITIONING ==================== */
.modal {
  z-index: 2000;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--bg-modal);
  padding: 24px;
  border-radius: 12px;
  width: 100%;
  max-width: 450px;
  box-shadow: var(--shadow-card);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

/* Close button styles for modals */
/* اسکوپ شده: صفحه ورود هم .close_modal دارد با استایل خودش در login.php.
   بدون اسکوپ، font-weight: bold به صفحه ورود نشت می‌کرد. */
.page-dashboard .close_modal,
.page-dashboard .closeModal {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: bold;
  background: none;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.page-dashboard .close_modal:hover,
.page-dashboard .closeModal:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-primary);
}

/* Form styling within modals */
.modal-content .form-group {
  margin-bottom: 16px;
}

.modal-content .form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-primary);
}

.modal-content .form-group input,
.modal-content .form-group textarea,
.modal-content .form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s;
  box-sizing: border-box;
  background: var(--bg-input);
  color: var(--text-primary);
}

.modal-content .form-group input:focus,
.modal-content .form-group textarea:focus,
.modal-content .form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modal-content .modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

.modal-content .modal-buttons .btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.modal-content .modal-buttons .btn-primary {
  background: var(--color-primary);
  color: white;
}

.modal-content .modal-buttons .btn-primary:hover {
  background: var(--color-primary-hover);
}

.modal-content .modal-buttons .btn-danger {
  background: var(--color-danger);
  color: white;
}

.modal-content .modal-buttons .btn-danger:hover {
  background: var(--color-danger-hover);
}

/* ==================== UTILITY ==================== */
/* اسپینر صفحات پنل — اسکوپ شده چون با اسپینر صفحه ورود فرق دارد */
.page-dashboard .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--bg-spinner);
  border-top: 4px solid var(--bg-spinner-top);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

.status-select {
  width: 100%;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid var(--border-input);
  background: var(--bg-code-input);
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
}

/* ==================== SELECT2 ====================
   استایل پیش‌فرض Select2 روشن است و با تم تاریک نمی‌خواند.
   اینجا با متغیرهای تم هماهنگش می‌کنیم تا در هر دو حالت درست باشد. */
.select2-container--default .select2-selection--multiple,
.select2-container--default .select2-selection--single {
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: 6px;
}

/* ارتفاع کادر باید با محتوا بالا و پایین برود.
   پیش‌فرض Select2 یک padding-bottom و چیدمان inline دارد که باعث
   فضای خالی ثابت می‌شد؛ با flex حذف می‌شود. */
.select2-container--default .select2-selection--multiple {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 0;
}

.select2-container--default
  .select2-selection--multiple
  .select2-selection__rendered {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;

  margin: 0;
  padding: 3px 5px;
  line-height: 1;
}

.select2-container--default
  .select2-selection--multiple
  .select2-search--inline {
  display: flex;
  align-items: center;
  margin: 0;
}

.select2-container--default.select2-container--focus
  .select2-selection--multiple,
.select2-container--default.select2-container--open
  .select2-selection--multiple {
  border-color: var(--color-primary);
}

.select2-container--default
  .select2-selection--multiple
  .select2-selection__choice {
  background: var(--color-primary);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
  padding: 2px 7px;
  margin: 0; /* فاصله را gap کانتینر می‌دهد */
  line-height: 1.6;
  display: flex;
  align-items: center;
}

.select2-container--default
  .select2-selection--multiple
  .select2-selection__choice__remove {
  color: rgba(255, 255, 255, 0.85);
  border: none;
  margin-left: 4px;
}

.select2-container--default
  .select2-selection--multiple
  .select2-selection__choice__remove:hover {
  background: transparent;
  color: #fff;
}

.select2-container--default .select2-search--inline .select2-search__field {
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  height: 20px;
  line-height: 20px;
  margin: 0;
  padding: 0;
}

.select2-dropdown {
  background: var(--bg-card);
  border: 1px solid var(--border-input);
  border-radius: 8px;
  z-index: 3000; /* بالاتر از مودال‌ها */
}

.select2-container--default .select2-results__option {
  color: var(--text-primary);
  font-size: 13px;
}

.select2-container--default
  .select2-results__option--highlighted[aria-selected] {
  background: var(--color-primary);
  color: #fff;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
  background: var(--bg-sidebar-active);
  color: var(--text-primary);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  color: var(--text-primary);
  border-radius: 6px;
}

.select2-container--default
  .select2-selection--multiple
  .select2-selection__placeholder {
  color: var(--text-muted);
}

/* ظاهر یکپارچه Select2 در تمام صفحات و مودال‌ها */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  background-color: #eaf3ff !important;
  color: #111 !important;
  padding: 6px 10px !important;
}

.select2-container--default .select2-selection--single {
  min-height: 40px;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__rendered {
  color: #111 !important;
  line-height: 26px;
  padding: 0 4px !important;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__placeholder,
.select2-container--default .select2-search--inline .select2-search__field {
  color: #111 !important;
}

.select2-container--default
  .select2-selection--multiple
  .select2-selection__rendered {
  padding: 0 !important;
}

.select2-container--default
  .select2-selection--multiple
  .select2-selection__choice {
  background-color: #dbeafe !important;
  border: 1px solid #bfdbfe !important;
  color: #111 !important;
  padding: 4px 10px !important;
}

.select2-container--default
  .select2-selection--multiple
  .select2-selection__choice__remove,
.select2-container--default
  .select2-selection--multiple
  .select2-selection__choice__remove:hover {
  color: #111 !important;
}

/* ==================== AVATAR PICKER (بالای مودال پروفایل) ==================== */
.avatar-picker {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 6px;
  padding: 12px 10px;
  border-radius: 10px;
  background: var(--bg-code-input);
  border: 1px solid var(--border-light);
}

.avatar-option {
  flex: 0 0 56px;
  min-width: 0;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  overflow: hidden;
  line-height: 0;
  transition: 0.2s;
}

.avatar-option img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.avatar-option:hover {
  transform: scale(1.07);
}

/* آواتار انتخاب‌شده: حاشیه ۳ پیکسلی آبی */
.avatar-option.selected {
  border-color: var(--color-primary);
}

.form-description {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 5px;
  line-height: 1.5;
}

.table-style {
  border-radius: 12px;
  overflow: hidden;
  font-size: 14px;
  margin-top: 5px;
}

/* ==================== TABLE STYLING ==================== */
.table-wrapper {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: var(--bg-card);
}

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
}

.table-wrapper thead {
  background: var(--color-table-header);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.table-wrapper thead th,
.table-wrapper thead td {
  padding: 14px 12px;
  font-weight: 600;
  font-size: 14px;
  text-align: right;
  border-bottom: 2px solid var(--color-table-header);
  color: white;
}

.table-wrapper tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  text-align: right;
  color: var(--text-primary);
  vertical-align: middle;
}

.table-wrapper tbody tr {
  transition: background-color 0.15s ease;
}

.table-wrapper tbody tr:hover {
  background: var(--bg-table-hover);
}

.table-wrapper tbody tr:last-child td {
  border-bottom: none;
}

/* ==================== ACTIVE ROW HIGHLIGHT ==================== */
.table-wrapper tbody tr.active-row {
  background: var(--bg-table-hover);
  border-right: 3px solid var(--color-primary);
}

.table-wrapper tbody tr.active-row:hover {
  background: var(--bg-sidebar-active);
}

/* ==================== RESPONSIVE ENHANCEMENTS ==================== */
@media (max-width: 480px) {
  .modal-content {
    width: 95%;
    padding: 16px;
    max-height: 85vh;
  }

  .modal-content .modal-buttons {
    flex-direction: column;
  }

  .modal-content .modal-buttons .btn {
    width: 100%;
    padding: 12px;
  }

  .page-dashboard .close_modal,
  .page-dashboard .closeModal {
    width: 28px;
    height: 28px;
    font-size: 18px;
    top: 10px;
    left: 10px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .modal-content {
    max-width: 400px;
  }
}

/* ==================== DARK MODE ADJUSTMENTS ==================== */
[data-theme="dark"] .modal-content {
  background: #252540;
  border: 1px solid #2a2a3d;
}

[data-theme="dark"] .modal-content h3 {
  color: #e0e0e0;
}

[data-theme="dark"] .modal-content .form-group label {
  color: #a0a0a0;
}

[data-theme="dark"] .modal-content .form-group input,
[data-theme="dark"] .modal-content .form-group textarea,
[data-theme="dark"] .modal-content .form-group select {
  background: #2a2a3d;
  border-color: #444;
  color: #e0e0e0;
}

[data-theme="dark"] .modal-content .form-group input:focus,
[data-theme="dark"] .modal-content .form-group textarea:focus,
[data-theme="dark"] .modal-content .form-group select:focus {
  border-color: #667eea;
}

[data-theme="dark"] .modal-content .modal-buttons .btn-primary {
  background: #667eea;
}

[data-theme="dark"] .modal-content .modal-buttons .btn-primary:hover {
  background: #5563d1;
}

[data-theme="dark"] .modal-content .modal-buttons .btn-danger {
  background: #c0392b;
}

[data-theme="dark"] .modal-content .modal-buttons .btn-danger:hover {
  background: #a93226;
}

[data-theme="dark"] .modal-content .close_modal,
[data-theme="dark"] .modal-content .closeModal {
  color: #a0a0a0;
}

[data-theme="dark"] .modal-content .close_modal:hover,
[data-theme="dark"] .modal-content .closeModal:hover {
  background: #2a2a3d;
  color: #e0e0e0;
}

/* ==================== LEGACY MODAL SUPPORT ==================== */
/* Legacy modal class for backward compatibility */
.legacy-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.legacy-modal.show {
  display: flex;
}

.legacy-modal-content {
  background: white;
  padding: 24px;
  border-radius: 12px;
  max-width: 450px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Legacy close button */
.legacy-modal-close {
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 18px;
  cursor: pointer;
  color: #666;
  font-weight: bold;
  background: none;
  border: none;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.legacy-modal-close:hover {
  background: #f0f0f0;
  color: #333;
}

/* ==========================================================================
   4) صفحه ورود  (از style.css)  —  body.page-login
   ========================================================================== */

/* اسکوپ‌شده: در style.css این قانون روی `*` بود (که خود body را هم می‌گرفت).
   خود `.page-login` هم آمده چون `.page-login *` فقط فرزندان را می‌گیرد نه body را.
   ویژگی‌مندی (0,1,0) برابر کلاس‌هاست، اما چون `.text-align-center` و بقیه
   پایین‌تر تعریف شده‌اند، در تساوی آن‌ها برنده می‌شوند — دقیقا مثل قبل. */
.page-login,
.page-login * {
  text-align: right;
}

body.page-login {
  min-height: 100vh;
  height: 100vh;
  background:
    radial-gradient(
      circle at 15% 15%,
      rgba(102, 126, 234, 0.16),
      transparent 45%
    ),
    radial-gradient(
      circle at 85% 85%,
      rgba(102, 126, 234, 0.12),
      transparent 45%
    ),
    var(--bg-body);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  margin: 0;
  padding-bottom: 60px;
}

.login-box {
  width: 100%;
  max-width: 25rem;
  padding: 28px;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow:
    var(--shadow-card),
    0 12px 32px rgba(0, 0, 0, 0.08);
  animation: cardIn 0.45s ease both;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* اسپینر صفحه ورود — اسکوپ شده چون با اسپینر پنل فرق دارد */
.page-login .spinner {
  width: 32px;
  height: 32px;
  margin: 4px auto 16px;
  border: 3px solid var(--border-input);
  border-top: 3px solid var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.login-box h2 {
  margin-bottom: 25px;
  color: var(--text-primary);
}

.input-box {
  margin-bottom: 20px;
  text-align: right;
}

.input-box input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  outline: none;
  transition: 0.3s;
  background: var(--bg-input);
  color: var(--text-primary);
}

.input-box input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 5px rgba(102, 126, 234, 0.5);
}

.login-btn {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 8px;
  background: var(--color-primary);
  color: var(--text-white);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.login-btn:hover,
.btn-style:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

.login-btn:active,
.btn-style:active {
  transform: translateY(0);
}

.login-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-style {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 8px;
  background: var(--color-primary);
  color: var(--text-white);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.extra {
  margin-top: 15px;
  font-size: 13px;
}

.extra a {
  text-decoration: none;
  color: var(--text-link);
}

.txt_login {
  font-size: 13px;
}

.login-box .logo img {
  width: 80px;
}

.text-align-center {
  text-align: center;
}

.mt-3 {
  margin-top: 3px;
}

.w60 {
  width: 60%;
}

.btn-captcha {
  width: 100%;
  text-align: center;
  font-weight: bold;
  padding: 5px;
}

.footer-text {
  align-items: center;
  direction: rtl;
  color: var(--text-footer);
  font-family: inherit;
  position: sticky;
  bottom: 0;
  background: var(--bg-footer);
  width: 100%;
  text-align: center;
  padding: 0px;
  margin: 0px;
  border-radius: 5px 5px 0px 0px;
}

.footer-version {
  font-size: 10.5px;
  font-weight: 500;
  opacity: 0.7;
}

.footer-status {
  font-size: 10.5px;
  opacity: 0.55;
}

/* فوتر: دقیقا وسط پایین صفحه، بدون پس‌زمینه، کوچک و کم‌رنگ */
.footerTextC {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  max-width: 94%;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 4px 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-footer);
  text-align: center;
}

.footer-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.footer-dot {
  opacity: 0.4;
  font-size: 9px;
}

.footer-credit {
  margin: 0;
  text-align: center;
  font-size: 10px;
  opacity: 0.55;
  line-height: 1.6;
}

.btn_link_aparat {
  margin-top: 10px !important;
  color: lightsalmon;
  text-decoration: none;
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  /* background: lightsalmon; */
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s;
  text-align: center;
  margin-top: 5px;
  display: block;
  animation:
    wiggle 3s infinite,
    pulse 2s infinite;
}

@keyframes wiggle {
  0% {
    box-shadow: 0 0 0 0 rgba(234, 170, 102, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(234, 170, 102, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(234, 170, 102, 0);
  }
}

/* ==========================================================================
   5) فونت  (از fonts/font.css)
   آخر قرار گرفته چون !important دارد و باید بر همه چیز غلبه کند — مثل قبل
   ========================================================================== */
@font-face {
  font-family: "Vazirmatn";
  src:
    url("../fonts/Vazir.woff2") format("woff2"),
    url("../fonts/Vazir.woff") format("woff");
  font-weight: normal;
}

/* @font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazir-Bold-FD.woff2') format('woff2'),
         url('../fonts/Vazir-Bold-FD.woff') format('woff');
    font-weight: bold;
} */

body,
* {
  font-family: "Vazirmatn" !important;
}

/* تقویم شمسی باید بالاتر از مودال‌ها و لایه‌های پنل نمایش داده شود. */
jdp-overlay {
  z-index: 12000 !important;
}

jdp-container {
  z-index: 12001 !important;
}
