@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #1e3a5f;
  --primary-light: #2d5282;
  --secondary: #2e7d32;
  --accent: #f57c00;
  --danger: #c62828;
  --warning: #f9a825;
  --info: #0277bd;
  --surface: #ffffff;
  --surface-alt: #f5f7fa;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-muted: #718096;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
  background: #f0f4f8;
  color: var(--text);
  direction: rtl;
  text-align: right;
  font-size: 14px;
  line-height: 1.7;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
  position: fixed;
  right: 0;
  top: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  transition: transform 0.3s;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  text-align: center;
}

.sidebar-brand .logo-icon {
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-size: 22px;
  color: white;
}

.sidebar-brand h6 {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  line-height: 1.5;
}

.sidebar-brand small {
  color: rgba(255,255,255,0.65);
  font-size: 11px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-section-title {
  padding: 8px 20px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s;
  border-right: 3px solid transparent;
  margin: 2px 0;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-right-color: #f57c00;
}

.sidebar-nav a .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sidebar-footer .avatar {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-footer .user-name {
  color: white;
  font-size: 13px;
  font-weight: 600;
}

.sidebar-footer .user-role {
  color: rgba(255,255,255,0.6);
  font-size: 11px;
}

.sidebar-footer .logout-btn {
  display: block;
  text-align: center;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
  padding: 7px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 12px;
  transition: all 0.2s;
}

.sidebar-footer .logout-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* ─── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
  margin-right: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.topbar .breadcrumb {
  margin: 0;
  font-size: 12px;
  background: none;
  padding: 0;
}

.page-content {
  padding: 28px;
  flex: 1;
}

/* ─── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h5 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.card-body { padding: 20px; }

/* ─── Stat Cards ───────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-icon.purple { background: #f3e8ff; color: #7c3aed; }
.stat-icon.teal { background: #ccfbf1; color: #0d9488; }

.stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ─── Badges / Status ──────────────────────────────────────────────────────── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-needs_revision { background: #dbeafe; color: #1e40af; }
.badge-rejected { background: #fee2e2; color: #991b1b; }

.badge-priority-normal { background: #f1f5f9; color: #475569; }
.badge-priority-important { background: #fef3c7; color: #92400e; }
.badge-priority-urgent { background: #fee2e2; color: #991b1b; }

/* ─── Tables ───────────────────────────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.data-table thead th {
  background: var(--primary);
  color: white;
  padding: 12px 14px;
  font-weight: 600;
  white-space: nowrap;
}

table.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

table.data-table tbody tr:hover {
  background: #f8fafc;
}

table.data-table tbody td {
  padding: 11px 14px;
  vertical-align: middle;
}

/* ─── Forms ────────────────────────────────────────────────────────────────── */
.form-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  direction: rtl;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); color: white; }
.btn-success { background: var(--secondary); color: white; }
.btn-success:hover { background: #1b5e20; color: white; }
.btn-warning { background: var(--accent); color: white; }
.btn-warning:hover { background: #e65100; color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b71c1c; color: white; }
.btn-info { background: var(--info); color: white; }
.btn-info:hover { background: #01579b; color: white; }
.btn-light { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-light:hover { background: #e2e8f0; color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

/* ─── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ─── Login Page ───────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5282 50%, #1a365d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .icon-wrap {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 28px;
  color: white;
  box-shadow: 0 8px 20px rgba(30,58,95,0.3);
}

.login-logo h4 {
  color: var(--primary);
  font-weight: 800;
  font-size: 16px;
}

.login-logo p {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
}

/* ─── Messages ──────────────────────────────────────────────────────────────── */
.message-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  position: relative;
  transition: box-shadow 0.2s;
}

.message-card:hover { box-shadow: var(--shadow-md); }

.message-card.priority-urgent { border-right: 4px solid var(--danger); }
.message-card.priority-important { border-right: 4px solid var(--accent); }
.message-card.priority-normal { border-right: 4px solid var(--info); }

/* ─── File Upload ───────────────────────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  background: var(--surface-alt);
}

.upload-area:hover {
  border-color: var(--primary);
  background: #eff6ff;
}

.upload-area .icon { font-size: 36px; margin-bottom: 10px; }

/* ─── Pagination ──────────────────────────────────────────────────────────── */
.pagination-wrap {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 16px 0;
}

.pagination-wrap a, .pagination-wrap span {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text);
  transition: all 0.2s;
}

.pagination-wrap a:hover { background: var(--primary); color: white; border-color: var(--primary); }
.pagination-wrap .current { background: var(--primary); color: white; border-color: var(--primary); font-weight: 700; }

/* ─── Progress Bar ──────────────────────────────────────────────────────────── */
.progress-bar-wrap {
  background: #e2e8f0;
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--primary), var(--info));
  transition: width 0.5s ease;
}

/* ─── Empty State ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h5 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ─── Hamburger / Mobile ────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  transition: all 0.3s;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(260px); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-right: 0; }
  .hamburger { display: flex; }
  .page-content { padding: 16px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
}

/* ─── Utilities ──────────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted) !important; }
.fw-bold { font-weight: 700; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--secondary) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--accent) !important; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.me-2 { margin-left: 8px; }
.ms-2 { margin-right: 8px; }
.p-0 { padding: 0; }
.w-100 { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
