@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/vazirmatn-variable.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --sidebar: #111827;
  --sidebar-2: #1f2937;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #7c3aed;
  --primary-2: #6d28d9;
  --accent: #ec4899;
  --success: #059669;
  --success-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --info: #2563eb;
  --info-bg: #eff6ff;
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.06);
  --radius: 16px;
  --sidebar-w: 268px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }

/* ---------- Auth ---------- */
body.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(124, 58, 237, 0.18), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(236, 72, 153, 0.14), transparent 42%),
    linear-gradient(160deg, #0f172a, #1e1b4b 55%, #111827);
}
.auth-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border-radius: 22px;
  padding: 32px 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 14px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.auth-brand .mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.auth-brand strong { display: block; font-size: 1.15rem; }
.auth-brand span { color: var(--muted); font-size: 0.85rem; }
.auth-card h1 { margin: 0; font-size: 1.35rem; }
.auth-card .hint { margin: 0; color: var(--muted); font-size: 0.82rem; }

/* ---------- Shell ---------- */
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
}
.sidebar {
  background: linear-gradient(180deg, var(--sidebar), #0b1220);
  color: #e5e7eb;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  flex-shrink: 0;
}
.sidebar-brand strong { display: block; color: #fff; font-size: 1rem; }
.sidebar-brand span { display: block; color: #9ca3af; font-size: 0.78rem; }
.nav-label {
  margin: 0 12px 8px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: #6b7280;
  text-transform: uppercase;
}
.sidebar-nav { display: grid; gap: 4px; flex: 1; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: #d1d5db;
  transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-link.is-active {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.28), rgba(236, 72, 153, 0.12));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--primary);
}
.nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.nav-icon svg { width: 18px; height: 18px; }
.sidebar-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}

.admin-main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.topbar-title p { margin: 2px 0 0; color: var(--muted); font-size: 0.86rem; }
.topbar-meta { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  display: none;
  place-items: center;
  cursor: pointer;
  color: var(--text);
}
.icon-btn svg { width: 18px; height: 18px; }
.content { padding: 22px 24px 40px; display: grid; gap: 18px; }

/* ---------- UI atoms ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
}
.stat-card .stat-label { color: var(--muted); font-size: 0.86rem; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-foot { font-size: 0.78rem; color: var(--muted); }
.stat-card.is-users .stat-value { color: var(--info); }
.stat-card.is-content .stat-value { color: var(--primary); }
.stat-card.is-sections .stat-value { color: var(--accent); }
.stat-card.is-jobs .stat-value { color: var(--warn); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 { margin: 0; font-size: 1.02rem; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.82rem; }
.panel-body { padding: 18px; }
.panel-body.tight { padding: 0; }

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid .full { grid-column: 1 / -1; }
.stack { display: grid; gap: 12px; }

label {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  color: #374151;
  font-weight: 500;
}
label.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}
input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: #c4b5fd;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
textarea { resize: vertical; min-height: 84px; }

.btn, button {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform .12s ease, filter .12s ease;
}
.btn:hover, button:hover { filter: brightness(1.05); }
.btn:active, button:active { transform: translateY(1px); }
.btn.secondary, button.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
}
.btn.danger, button.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}
.btn.sm, button.sm { padding: 7px 10px; font-size: 0.8rem; border-radius: 10px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.table-wrap { overflow: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
.table th, .table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  vertical-align: middle;
  font-size: 0.9rem;
}
.table th {
  background: #f9fafb;
  color: #4b5563;
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fafafa; }
.table .thumb {
  width: 56px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  background: #f3f4f6;
}
.table .thumb.wide {
  width: 96px;
  height: 56px;
}
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; }
.empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill-soft { background: #f3e8ff; color: #6d28d9; }
.pill-ok { background: var(--success-bg); color: var(--success); }
.pill-off { background: #f3f4f6; color: #6b7280; }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-info { background: var(--info-bg); color: var(--info); }

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); color: #065f46; border-color: #a7f3d0; }
.alert-error { background: var(--danger-bg); color: #991b1b; border-color: #fecaca; }
.alert-info { background: var(--info-bg); color: #1e40af; border-color: #bfdbfe; }

.quick-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.quick-link {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease;
}
.quick-link:hover {
  border-color: #ddd6fe;
  transform: translateY(-1px);
}
.quick-link strong { display: block; margin-bottom: 4px; }
.quick-link span { color: var(--muted); font-size: 0.82rem; }

.section-block { margin-top: 4px; }
.section-meta { color: var(--muted); font-size: 0.82rem; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 30;
}

@media (max-width: 1100px) {
  .stats, .quick-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: var(--sidebar-w);
    z-index: 40;
    transform: translateX(110%);
    transition: transform .2s ease;
  }
  .admin-shell.sidebar-open .sidebar { transform: translateX(0); }
  .admin-shell.sidebar-open + .sidebar-backdrop { display: block; }
  .icon-btn.sidebar-toggle { display: grid; }
  .grid2, .form-grid, .grid3 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .content { padding: 16px; }
  .topbar { padding: 14px 16px; }
  .stats, .quick-links { grid-template-columns: 1fr; }
  .table { min-width: 600px; }
}
