:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --sidebar-text: #cbd5e1;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --sidebar-width: 250px;
  --topbar-height: 60px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  font-size: 14px;
  line-height: 1.8;
}

a { color: inherit; text-decoration: none; }

/* ===== چیدمان کلی ===== */
.layout { display: flex; min-height: 100vh; }

/* ===== سایدبار ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0; right: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-brand {
  padding: 20px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid var(--sidebar-hover);
}
.sidebar-menu { list-style: none; padding: 12px 0; }
.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: var(--sidebar-text);
  transition: background 0.15s;
  font-size: 14px;
}
.sidebar-menu li a:hover,
.sidebar-menu li a.active { background: var(--sidebar-hover); color: #fff; }
.sidebar-section { padding: 14px 20px 6px; font-size: 11px; color: #64748b; }

/* ===== محتوای اصلی ===== */
.main { flex: 1; margin-right: var(--sidebar-width); display: flex; flex-direction: column; }

/* ===== تاپ‌بار ===== */
.topbar {
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-weight: 700; font-size: 16px; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.notif-bell { position: relative; font-size: 20px; }
.notif-badge {
  position: absolute; top: -6px; left: -8px;
  background: #ef4444; color: #fff; font-size: 10px;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

.content { padding: 24px; flex: 1; }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 20px; }

/* ===== کارت‌های آماری ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ===== کارت معمولی ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 20px; }

/* ===== جدول ===== */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: right; border-bottom: 1px solid var(--border); }
.table th { background: #f8fafc; font-weight: 700; color: var(--text-muted); font-size: 13px; }
.table tbody tr:hover { background: #f8fafc; }

/* ===== بَج وضعیت ===== */
.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-purple { background: #ede9fe; color: #6d28d9; }

/* ===== دکمه ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: #16a34a; color: #fff; }
.btn-danger  { background: #dc2626; color: #fff; }
.btn-light   { background: #f1f5f9; color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ===== فرم ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 700; font-size: 13px; }
.form-input, input[type="text"], input[type="password"], input[type="number"],
input[type="date"], textarea, select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
}
.form-input:focus, input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ===== پیام‌ها ===== */
.messages { list-style: none; margin-bottom: 16px; }
.messages li {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 8px; font-size: 13px;
}
.messages li.success { background: #dcfce7; color: #15803d; }
.messages li.error   { background: #fee2e2; color: #b91c1c; }
.messages li.info    { background: #dbeafe; color: #1d4ed8; }
.messages li.warning { background: #fef9c3; color: #a16207; }

/* ===== صفحه‌بندی ===== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; }
.pagination a, .pagination span {
  padding: 7px 13px; border-radius: 8px; background: var(--card-bg);
  border: 1px solid var(--border); font-size: 13px;
}
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== صفحه ورود ===== */
.login-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e293b, #2563eb);
}
.login-box {
  background: #fff; padding: 40px; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); width: 380px; max-width: 92%;
}
.login-box h1 { font-size: 22px; margin-bottom: 6px; text-align: center; }
.login-box .subtitle { text-align: center; color: var(--text-muted); margin-bottom: 24px; font-size: 13px; }

/* ===== ابزارهای کوچک ===== */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }

/* ===== واکنش‌گرا ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(100%); transition: transform 0.2s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-right: 0; }
  .menu-toggle { display: block !important; }
}
.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; }
