/* فونت فارسی */
@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap");

/* استایل‌های کلی */
body {
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  background-color: #f8f9fa;
  direction: rtl;
}

.navbar-brand {
  font-weight: 600;
}

/* کارت‌ها */
.card {
  border: none;
  border-radius: 10px;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
  background-color: #fff;
  border-bottom: 1px solid #dee2e6;
  font-weight: 500;
}

/* دکمه‌ها */
.btn {
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-group-sm > .btn {
  padding: 0.25rem 0.5rem;
}

/* --- بخش جدید برای اصلاح گوشه‌های دکمه‌ها در حالت RTL --- */
.btn-group > .btn:first-child:not(:last-child) {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.btn-group > .btn:last-child:not(:first-child) {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.btn-group > .btn:not(:first-child):not(:last-child) {
  border-radius: 0;
}
/* --- پایان بخش جدید --- */

/* جداول */
.table {
  margin-bottom: 0;
}

.table thead th {
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  background-color: #f8f9fa;
}

.table tbody tr:hover {
  background-color: #f8f9fa;
}

/* فرم‌ها */
.form-label {
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.form-control,
.form-select {
  border-radius: 8px;
  border: 1px solid #ced4da;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.input-group-text {
  background-color: #f8f9fa;
  border: 1px solid #ced4da;
  /* اصلاح برای RTL */
  border-radius: 0 8px 8px 0;
}

/* صفحه لاگین */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* آیکون‌ها */
.fa-check {
  color: #198754;
}

.fa-times {
  color: #dc3545;
}

/* Badge ها */
.badge {
  font-size: 0.75em;
  padding: 0.375rem 0.5rem;
}

/* Progress bar */
.progress {
  height: 8px;
  border-radius: 4px;
  background-color: #e9ecef;
}

.progress-bar {
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* Alert ها */
.alert {
  border-radius: 8px;
  border: none;
}

.alert-dismissible .btn-close {
  padding: 0.75rem 0.75rem;
}

/* Modal ها */
.modal-content {
  border-radius: 10px;
  border: none;
}

.modal-header {
  border-bottom: 1px solid #dee2e6;
  background-color: #f8f9fa;
}

/* Navigation */
.navbar {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.nav-link {
  transition: color 0.15s ease-in-out;
}

.nav-link:hover {
  color: rgba(255, 255, 255, 0.9) !important;
}

/* Stats Cards */
.card.bg-primary,
.card.bg-success,
.card.bg-danger,
.card.bg-warning {
  border: none;
  color: white !important;
}

.card.bg-primary .card-body,
.card.bg-success .card-body,
.card.bg-danger .card-body,
.card.bg-warning .card-body {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

/* کد */
code {
  background-color: #f8f9fa;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.875em;
  color: #e83e8c;
}

/* جدول responsive */
.table-responsive {
  border-radius: 8px;
}

/* انیمیشن‌ها */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeIn 0.3s ease-in-out;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .container-fluid {
    padding: 0.5rem;
  }

  .card {
    margin-bottom: 1rem;
  }

  .btn-group .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
  }

  h2 {
    font-size: 1.5rem;
  }
}

/* --- بخش کامل شده برای حالت تاریک --- */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #1a1a1a;
    color: #e0e0e0;
  }

  .text-muted {
    color: #888 !important;
  }

  /* Cards */
  .card {
    background-color: #2a2a2a;
    border: 1px solid #444;
  }

  .card-header {
    background-color: #333;
    border-bottom: 1px solid #444;
    color: #f5f5f5;
  }

  /* Tables */
  .table {
    color: #e0e0e0;
  }

  .table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
  }

  .table-striped > tbody > tr:nth-of-type(even) > * {
    color: #e0e0e0;
  }

  .table-hover > tbody > tr:hover > * {
    color: #ffffff;
    --bs-table-accent-bg: #3a3a3a;
  }

  .table thead th {
    background-color: #333;
    border-color: #444;
  }

  /* Forms */
  .form-control,
  .form-select {
    background-color: #333;
    border-color: #555;
    color: #e0e0e0;
  }

  .form-control:focus,
  .form-select:focus {
    background-color: #333;
    border-color: #80bdff;
    color: #e0e0e0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
  }

  .input-group-text {
    background-color: #3a3a3a;
    border-color: #555;
    color: #e0e0e0;
  }

  /* Modals */
  .modal-content {
    background-color: #2a2a2a;
  }

  .modal-header {
    background-color: #333;
    border-bottom-color: #444;
  }

  .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
  }

  /* Dropdown menu from navbar */
  .dropdown-menu {
    background-color: #2a2a2a;
    border-color: #444;
  }
  .dropdown-item {
    color: #e0e0e0;
  }
  .dropdown-item:hover {
    background-color: #3a3a3a;
    color: #ffffff;
  }
}

/* Utility classes */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shadow-sm {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}
