@import url("https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@latest/dist/font-face.css");

:root {
  --bg: #f7f7fb;
  --bg-grad: linear-gradient(180deg, #f8f7ff 0%, #eef0ff 100%);
  --card: #ffffff;
  --stroke: #e5e7eb;
  --shadow: 0 8px 28px rgba(17, 24, 39, 0.1);
  --text: #111827;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-soft: #e6edff;
  --primary-strong: #1d4ed8;
  --success: #16a34a;
  --danger: #ef4444;
  --warning: #f59e0b;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-grad);
  color: var(--text);
  font-family: "Vazirmatn", "Segoe UI", "IRANSans", "Tahoma", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  direction: rtl;
  text-align: right;
}

a {
  color: var(--primary);
  text-decoration: none;
}

p {
  margin: 0;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 18px 80px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
  direction: ltr;
}

.layout-main {
  direction: rtl;
}

.topbar {
  background: linear-gradient(120deg, #f8faff, #eef2ff);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid #e5e7eb;
  border-radius: 0 0 18px 18px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-right {
  text-align: right;
}

.topbar-title {
  font-weight: 800;
  font-size: 16px;
  margin: 0;
}

.topbar-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: var(--text);
}

.brand-title {
  font-size: 15px;
  color: #0f172a;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

.brand-icon-img {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: cover;
  display: inline-block;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
  border: 1px solid #e5e7eb;
  background: #fff;
}

.brand-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--muted);
  padding: 7px 10px;
  border-radius: 10px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
  font-size: 13px;
}

.nav-links a:hover,
.nav-links a.active {
  border-color: #d1d5db;
  background: var(--primary-soft);
  color: var(--primary);
}

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px 16px 18px;
  margin-bottom: 14px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.card-title {
  font-size: 18px;
  margin: 0;
}

.card-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: #c7cdd6;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

.btn-primary {
  background: #f0f5ff;
  color: #1d4ed8;
  border-color: #c7d2fe;
  font-weight: 600;
}

.btn-ghost {
  background: #fff;
}

.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border-color: #fecdd3;
}

.btn-block {
  width: 100%;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary);
  font-size: 12px;
  border: 1px solid #e0e7ff;
}

.badge-success {
  background: #ecfdf3;
  color: #15803d;
  border-color: #bbf7d0;
}

.badge-danger {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecdd3;
}

.badge-warning {
  background: #fffbeb;
  color: #b45309;
  border-color: #fef3c7;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.table-wrapper {
  width: 100%;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 12px 10px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
  color: #1f2937;
}

th {
  font-weight: 700;
  background: #fafafa;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:hover {
  background: #f8fafc;
}

.sort-ind {
  font-size: 12px;
  color: var(--muted);
}

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  font-size: 13px;
  color: var(--muted);
}

.input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus,
select:focus,
textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.35);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.note {
  font-size: 13px;
  color: var(--muted);
}

.error-box {
  background: #fef2f2;
  border: 1px solid #fecdd3;
  color: #b91c1c;
  padding: 10px 12px;
  border-radius: 12px;
  margin: 8px 0 4px;
  font-size: 13px;
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--stroke);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
  background: #fff;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg-grad);
}

.auth-card {
  width: min(420px, 100%);
  padding: 24px 24px 26px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.auth-card::before,
.auth-card::after {
  content: "";
  position: absolute;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.12), transparent 65%);
  filter: blur(24px);
  z-index: 0;
}

.auth-card::before {
  top: -70px;
  left: -40px;
}

.auth-card::after {
  bottom: -80px;
  right: -30px;
}

.auth-card > * {
  position: relative;
  z-index: 1;
}

.auth-title {
  margin: 0 0 6px;
  font-size: 22px;
}

.auth-subtitle {
  margin: 0 0 16px;
  color: var(--muted);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.table-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f3f4f6;
  border: 1px solid var(--stroke);
  color: var(--text);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 12px;
  background: #eef2ff;
  color: var(--primary);
}

.tag-ok {
  background: #ecfdf3;
  color: #15803d;
}

.tag-bad {
  background: #fef2f2;
  color: #b91c1c;
}

.table-slim td,
.table-slim th {
  padding: 10px 8px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  align-items: start;
}

.sidebar {
  background: linear-gradient(180deg, #eef2ff 0%, #e8e9ff 100%);
  border: 1px solid #e0e7ff;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
  padding: 14px;
}

.sidebar-header {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-direction: row-reverse;
  text-align: right;
}

.sidebar .brand-icon {
  width: 44px;
  height: 44px;
}

.sidebar .brand-icon-img {
  width: 44px;
  height: 44px;
}

.sidebar-title {
  margin: 0;
  font-weight: 800;
}

.sidebar-sub {
  margin: 2px 0 0;
  color: #4b5563;
  font-size: 13px;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.nav-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  direction: rtl;
  gap: 8px;
}

.nav-pill.active {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #2563eb;
}

.pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 13px;
  direction: rtl;
}

.pill-label {
  color: #6b7280;
  flex: 1 1 auto;
}

.pill-value {
  font-weight: 700;
  color: #111827;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #111827;
  font-size: 12px;
  border: 1px solid #e2e8f0;
}

.chip-danger {
  background: #fef2f2;
  border-color: #fecdd3;
  color: #b91c1c;
}

.search-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.04);
  margin-bottom: 10px;
}

.search-input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  color: #111827;
  font-size: 14px;
}

.search-input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.35);
}

.info-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.kpi-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.04);
  display: grid;
  gap: 4px;
}

body.dark .kpi-card {
  background: #111827;
  border-color: rgba(255, 255, 255, 0.1);
}

.kpi-label {
  color: #6b7280;
  font-size: 13px;
}

.kpi-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.controls-row .input,
.controls-row select {
  max-width: 160px;
}

.chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 12px;
}

.cards-mobile {
  display: none;
  gap: 10px;
}

.card-mobile {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.05);
  display: grid;
  gap: 6px;
}

body.dark .card-mobile {
  background: #111827;
  border-color: rgba(255, 255, 255, 0.08);
}

.card-mobile-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.card-mobile-actions {
  margin-top: 8px;
}

.info-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.04);
}

.info-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.info-card p {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

.table-card {
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
}

.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(8px);
  border-top: 1px solid #e5e7eb;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.07);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  z-index: 50;
}

.bottom-nav-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 10px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  color: #0f172a;
  font-size: 12px;
  text-decoration: none;
  flex: 1 1 90px;
  max-width: 140px;
}

.bottom-nav a.active {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #2563eb;
  font-weight: 700;
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
    direction: rtl;
  }

  .layout-main {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    border-radius: 0 0 14px 14px;
  }

  table {
    min-width: 480px;
  }

  .sidebar {
    display: none;
  }

  .page {
    padding: 14px 12px 120px;
  }

  .info-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .card {
    padding: 14px;
  }

  .card-title {
    font-size: 18px;
  }

  th,
  td {
    font-size: 13px;
  }

  table {
    min-width: 360px;
  }

  .btn {
    width: 100%;
  }

  .nav-links {
    width: 100%;
  }

  .bottom-nav {
    display: block;
  }

  .page {
    padding: 12px 10px 140px;
  }
}

/* محدوده تبلت کوچک تا میانی */
@media (min-width: 641px) and (max-width: 914px) {
  .layout {
    grid-template-columns: 1fr;
    direction: rtl;
  }

  .layout-main {
    width: 100%;
  }

  .sidebar {
    display: none;
  }

  .bottom-nav {
    display: block;
  }

  .page {
    padding: 14px 12px 140px;
  }
}

/* Overrides for RTL layout elements */
.sidebar-header {
  flex-direction: row-reverse;
  text-align: right;
}

.nav-pill {
  direction: rtl;
  justify-content: space-between;
  gap: 8px;
}


@media (max-width: 640px) {
  table {
    display: none;
  }
  .cards-mobile {
    display: grid;
  }
}
