@font-face {
  font-family: "B Titr";
  src: url("/fonts/B-Titr-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand-primary: #dc2626;
  --brand-primary-dark: #b91c1c;
  --brand-accent: #f59e0b;
  --brand-bg: #fff5f5;
  --brand-gold: #d4af37;
  --brand-gold-light: #f5d992;
  --brand-gold-dark: #8a6d1a;
  --font-titr: "B Titr", "BTitr", Titr, Lalezar, Vazirmatn, Tahoma, sans-serif;
}

html, body {
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  background-color: var(--brand-bg);
  min-height: 100%;
}

.site-navbar {
  background: linear-gradient(90deg, var(--brand-primary-dark), var(--brand-primary));
}

.site-navbar .navbar-brand {
  color: #fff;
}

.site-footer {
  background: #fff;
  color: #6b7280;
  border-top: 1px solid #e5e7eb;
}

a {
  text-decoration: none;
}

.btn-brand {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

.btn-brand:hover {
  background-color: var(--brand-primary-dark);
  border-color: var(--brand-primary-dark);
  color: #fff;
}

.card {
  border-radius: 1rem;
  border: 1px solid #eceaf5;
  box-shadow: 0 2px 10px rgba(31, 23, 71, 0.04);
}

.card-header {
  border-bottom: 1px solid #eceaf5;
}

.form-control, .form-select {
  border: 1.5px solid #e3e0f0;
  border-radius: .6rem;
  padding: .55rem .9rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 .2rem rgba(185, 28, 28, .12);
}

.form-label {
  font-weight: 600;
  font-size: .875rem;
  color: #3b3454;
  margin-bottom: .4rem;
}

.form-check-input:checked {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.form-switch .form-check-input {
  width: 2.6em;
  height: 1.4em;
}

.btn {
  border-radius: .6rem;
  font-weight: 600;
}

.btn-brand {
  box-shadow: 0 4px 12px rgba(185, 28, 28, .25);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .55rem;
}

.badge {
  border-radius: .5rem;
  font-weight: 600;
  padding: .4em .7em;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #8b86a1;
}

.empty-state i {
  font-size: 2.5rem;
  color: #d7d3ea;
  display: block;
  margin-bottom: .75rem;
}

.auth-card {
  max-width: 420px;
  margin: 4rem auto;
}

/* ---------------- Admin panel ---------------- */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 270px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--brand-primary-dark), #b91c1c);
  color: #fff;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.admin-sidebar .brand {
  padding: 1.4rem 1.25rem 1.1rem;
  font-weight: 800;
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  gap: .6rem;
}

.admin-sidebar .brand .brand-icon {
  width: 38px;
  height: 38px;
  border-radius: .7rem;
  background: rgba(255,255,255,.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.admin-sidebar .nav-link {
  color: rgba(255,255,255,.82);
  padding: .7rem 1.25rem;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: .65rem;
  font-weight: 500;
  font-size: .93rem;
  position: relative;
  transition: background-color .15s ease, color .15s ease;
}

.admin-sidebar .nav-link i {
  font-size: 1.05rem;
  width: 1.3rem;
  text-align: center;
}

.admin-sidebar .nav-link.active,
.admin-sidebar .nav-link:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.admin-sidebar .nav-link.active {
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--brand-accent);
}

html[dir="rtl"] .admin-sidebar .nav-link.active { box-shadow: inset -3px 0 0 var(--brand-accent); }

.admin-sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  font-size: .78rem;
  color: rgba(255,255,255,.55);
  border-top: 1px solid rgba(255,255,255,.1);
}

.admin-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background: #fff;
  border-bottom: 1px solid #f3e5e5;
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
  row-gap: .5rem;
}

.admin-topbar h5 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-toggle-btn {
  border: 1.5px solid #e5e2f0;
  background: #fff;
  color: var(--brand-primary-dark);
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: .65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.sidebar-toggle-btn:hover {
  background: var(--brand-bg);
}

.admin-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 10, 40, .45);
  z-index: 1040;
}

.admin-backdrop.show {
  display: block;
}

.admin-user-chip {
  background: var(--brand-bg);
  border-radius: 2rem;
  padding: .35rem .9rem .35rem .4rem;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.admin-user-chip .avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
}

@media (max-width: 991.98px) {
  .admin-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    height: 100vh;
    z-index: 1050;
    transition: transform .28s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.3);
  }

  html[dir="rtl"] .admin-sidebar { right: 0; transform: translateX(100%); }
  html[dir="ltr"] .admin-sidebar { left: 0; transform: translateX(-100%); }

  .admin-sidebar.show {
    transform: translateX(0) !important;
  }
}

@media (min-width: 992px) {
  .sidebar-toggle-btn,
  .admin-backdrop {
    display: none !important;
  }
}

@media (max-width: 575.98px) {
  .admin-topbar { padding: .75rem 1rem !important; }
  main.admin-main { padding: 1rem !important; }
  .admin-user-chip span.chip-name { display: none; }
}

.stat-card {
  border-radius: 1rem;
  padding: 1.25rem;
  color: #fff;
  box-shadow: 0 10px 24px -8px rgba(31, 23, 71, .35);
  transition: transform .15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: .8rem;
  background: rgba(255,255,255,.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 800;
}

.bg-grad-1 { background: linear-gradient(135deg, #ef4444, #f87171); }
.bg-grad-2 { background: linear-gradient(135deg, #059669, #34d399); }
.bg-grad-3 { background: linear-gradient(135deg, #d97706, #fbbf24); }
.bg-grad-4 { background: linear-gradient(135deg, #dc2626, #f87171); }

.table-actions .btn { margin-inline-start: .25rem; }

.badge-status-active { background-color: #059669; }
.badge-status-inactive { background-color: #9ca3af; }

/* ---------------- Admin tables ---------------- */
.table {
  --bs-table-hover-bg: #f7f5fc;
}

.table > thead {
  background: #f9f8fd;
}

.table > thead th {
  font-size: .8rem;
  font-weight: 700;
  color: #6b6480;
  text-transform: none;
  border-bottom-width: 1px;
  padding: .85rem 1rem;
  white-space: nowrap;
}

.table > tbody td {
  padding: .85rem 1rem;
  vertical-align: middle;
}

.table > tbody tr {
  transition: background-color .1s ease;
}

@media (max-width: 767.98px) {
  table.table-cards, table.table-cards thead {
    display: none;
  }

  table.table-cards, table.table-cards tbody, table.table-cards tr, table.table-cards td {
    display: block;
    width: 100%;
  }

  table.table-cards tbody tr {
    background: #fff;
    border: 1px solid #eceaf5;
    border-radius: .9rem;
    margin-bottom: .85rem;
    padding: .4rem .25rem;
    box-shadow: 0 2px 10px rgba(31, 23, 71, .05);
  }

  table.table-cards td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .9rem;
    border: none;
    text-align: end;
  }

  table.table-cards td:not(:last-child) {
    border-bottom: 1px dashed #eeecf5;
  }

  table.table-cards td[data-label]::before {
    content: attr(data-label);
    font-weight: 700;
    font-size: .78rem;
    color: #8b86a1;
    text-align: start;
    flex-shrink: 0;
  }

  table.table-cards td:empty,
  table.table-cards td[data-label=""]::before {
    display: none;
  }

  table.table-cards td.table-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  table.table-cards td.table-actions::before {
    display: none;
  }
}

/* ---------------- Sortable section-order list ---------------- */
.sortable-list .list-group-item {
  border: 1.5px solid #eceaf5;
  border-radius: .75rem !important;
  margin-bottom: .5rem;
  padding: .8rem 1rem;
  background: #fff;
  transition: box-shadow .15s ease, border-color .15s ease;
}

.sortable-list .list-group-item:hover {
  border-color: #d7d1ee;
  box-shadow: 0 4px 12px rgba(31, 23, 71, .06);
}

.sortable-list .drag-handle {
  cursor: grab;
  font-size: 1.2rem;
  color: #b7b1cf;
}

.sortable-list .item-index {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-bg);
  color: var(--brand-primary-dark);
  font-size: .78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sortable-list .sortable-ghost {
  opacity: .4;
}

.sortable-list .sortable-chosen {
  box-shadow: 0 8px 20px rgba(185, 28, 28, .18) !important;
  border-color: var(--brand-primary) !important;
}

/* ---------------- Form section cards ---------------- */
.form-section-card {
  border: 1px solid #eceaf5;
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  background: #fff;
}

.form-section-card + .form-section-card {
  margin-top: 0;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1rem;
  color: #7f1d1d;
  margin-bottom: 1.1rem;
  padding-bottom: .8rem;
  border-bottom: 1px solid #f1effa;
}

.form-section-title i {
  width: 34px;
  height: 34px;
  border-radius: .65rem;
  background: var(--brand-bg);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.form-actions-bar {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #eceaf5;
  padding: 1rem 1.25rem;
  margin: 1.5rem -1px -1px;
  border-radius: 0 0 1rem 1rem;
  display: flex;
  gap: .6rem;
  z-index: 5;
}
