/* Custom styles to complement Tailwind */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Vazirmatn', 'Segoe UI', 'Roboto', sans-serif;
  direction: rtl;
}

.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .nav-text {
  display: none;
}

.sidebar.collapsed {
  width: 3.5rem;
}

.nav-link.active {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  border-right: 3px solid #047857;
}

.nav-icon {
  width: 1.25rem;
  height: 1.25rem;
  transition: transform 0.2s ease, color 0.2s ease;
}

.nav-link:hover .nav-icon {
  transform: scale(1.2) rotate(5deg);
  color: #055958;
}

.sidebar.collapsed .nav-icon {
  margin: 0 auto;
}

.btn-primary {
  box-shadow: 0 4px 20px -4px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 8px 30px -6px rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

.card, .stat-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* .card:hover, .stat-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 40px -8px rgba(16, 185, 129, 0.25);
} */

.submenu {
  transition: all 0.3s ease;
  max-height: 0;
  overflow: hidden;
}

.nav-item.open .submenu {
  max-height: 500px;
}

.nav-item.open .nav-arrow {
  transform: rotate(180deg);
}

.nav-arrow {
  transition: transform 0.3s ease;
}

.nav-item:hover .nav-icon {
  transform: scale(1.1);
  color: #055958;
}

.sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
  border-left: 1px solid #e5e7eb;
}

.nav-link.active {
  background: rgba(5, 89, 91, 0.1);
  color: #05595B;
  border-right: 3px solid #05595B;
}

.nav-link:hover:not(.active) {
  background: rgba(5, 89, 91, 0.05);
}

.sidebar {
  box-shadow: 4px 0 15px rgba(5, 89, 91, 0.1);
}

.card, .stat-card {
  box-shadow: 0 4px 20px -4px rgba(5, 89, 91, 0.1);
}

.card:hover, .stat-card:hover {
  box-shadow: 0 12px 40px -8px rgba(5, 89, 91, 0.2);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn-outline:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-outline.bg-red-500 {
  background-color: #ef4444;
  border-color: #ef4444;
  color: white;
}

.btn-outline.bg-red-500:hover {
  background-color: #dc2626;
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-outline.text-gray-900 {
  background-color: transparent;
  border-color: #d1d5db;
  color: #111827;
}

.btn-outline.text-gray-900:hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}

.btn-outline:active {
  transform: translateY(1px);
}

.btn-outline i {
  margin-right: 8px;
  transition: transform-oxo 0.2s ease;
}

.btn-outline:hover i {
  transform: scale(1.1);
}

.btn-outline.bg-red-500:hover {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.colored-toast.swal2-icon-success {
  background-color: #a5dc86 !important;
}

.colored-toast.swal2-icon-error {
  background-color: #f27474 !important;
}

.colored-toast.swal2-icon-warning {
  background-color: #f8bb86 !important;
}

.colored-toast.swal2-icon-info {
  background-color: #3fc3ee !important;
}

.colored-toast.swal2-icon-question {
  background-color: #87adbd !important;
}

.colored-toast .swal2-title,
.colored-toast .swal2-close,
.colored-toast .swal2-html-container {
  color: white;
}

.swal2-container,
.swal2-popup,
.swal2-toast {
  z-index: 99999 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  /* Table responsiveness */
  .min-w-full {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  table {
    width: 100%;
    min-width: 600px; /* Ensure table has minimum width for readability */
  }

  th, td {
    padding: 8px 12px;
    font-size: 0.875rem; /* Smaller font size for mobile */
  }

  /* Form responsiveness */
  .flex-col.md\\:flex-row {
    flex-direction: column;
  }

  .w-full {
    width: 100%;
  }

  select, input {
    font-size: 0.875rem; /* Smaller font size for inputs */
    padding: 0.5rem;
  }

  label {
    font-size: 0.875rem;
  }

  /* Modal responsiveness */
  #image-modal .bg-white {
    max-width: 90vw;
    max-height: 90vh;
    padding: 1rem;
  }

  #modal-image {
    max-height: 60vh;
  }

  /* Button adjustments */
  .btn-primary,
  .btn-outline {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }

  /* Sidebar adjustments */
  .sidebar {
    width: 100%;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar.collapsed {
    width: 100%;
  }

  .nav-icon {
    width: 1rem;
    height: 1rem;
  }
}

@media (max-width: 640px) {
  /* Further table adjustments for smaller screens */
  th, td {
    font-size: 0.75rem;
    padding: 6px 8px;
  }

  /* Convert table to card-like layout for very small screens */
  table {
    display: block;
  }

  thead {
    display: none; /* Hide table headers on very small screens */
  }

  tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem;
  }

  td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    font-size: 0.875rem;
    border-bottom: 1px solid #e5e7eb;
  }

  td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #374151;
    width: 40%;
  }

  td:last-child {
    border-bottom: none;
  }

  /* Modal further adjustments */
  #image-modal .bg-white {
    max-width: 95vw;
    padding: 0.5rem;
  }

  #modal-image {
    max-height: 50vh;
  }
}



.max-w-8xl {
    max-width: 97rem;
}




/* رفع مشکل cursor برای دکمه‌ها */
button, 
.btn, 
[type='button'], 
[type='submit'], 
[type='reset'] {
    cursor: pointer;
}

/* رفع مشکل modal backdrop */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.modal {
    backdrop-filter: blur(4px);
}

/* برای SweetAlert2 */
/* .swal2-container {
    background-color: rgba(0, 0, 0, 0.4) !important;
} */

.swal2-popup {
    background: #fff !important;
    border-radius: 0.5rem !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
}

/* رفع مشکلات دیگر */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

/* برای منوهای کشویی */
.nav-item.group .nav-link {
    cursor: pointer;
}

/* رفع مشکل transition ها */
.sidebar {
    transition: transform 0.3s ease, width 0.3s ease !important;
}

.submenu {
    transition: max-height 0.3s ease, opacity 0.3s ease !important;
}

/* رفع مشکل hover states */
.nav-link:hover {
    background: rgba(5, 89, 91, 0.05) !important;
}

.nav-link.active:hover {
    background: rgba(5, 89, 91, 0.15) !important;
}

/* برای آیکون‌ها */
[data-lucide] {
    transition: transform 0.2s ease, color 0.2s ease;
}

.nav-link:hover [data-lucide] {
    transform: scale(1.1);
    color: #05595B;
}








/* Fallback برای آیکون‌هایی که load نمی‌شوند */
.icon-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    background: #e5e7eb;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #6b7280;
}

/* برای آیکون‌های کوچک در منو */
.w-4.h-4.icon-fallback {
    width: 1rem;
    height: 1rem;
    font-size: 0.6rem;
}



/* استایل‌های جدید برای سایدبار اسکرول شونده */
.sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
    border-left: 1px solid #e5e7eb;
    box-shadow: 4px 0 15px rgba(5, 89, 91, 0.1);
    /* اضافه کردن اسکرول عمودی */
    overflow-y: auto;
    overflow-x: hidden;
}

/* استایل برای محتوای سایدبار */
.sidebar-content {
    height: calc(100vh - 80px); /* ارتفاع کل منهای هدر */
    overflow-y: auto;
}

/* هدر سایدبار ثابت */
.sidebar-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 20;
    border-bottom: 1px solid #e5e7eb;
}

/* استایل اسکرول بار سفارشی برای سایدبار */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* برای موبایل */
@media (max-width: 768px) {
  .sidebar {
    width: 85vw;
    max-width: 320px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-content {
    height: 100vh;
    overflow-y: auto;
    padding-bottom: 100px;
    display: flex;
    flex-direction: column;
  }

  /* بهبود نمایش محتوای سایدبار */
  .nav-group {
    padding: 0.5rem;
  }

  .nav-link {
    padding: 0.75rem;
    min-height: 50px;
  }

  /* اطمینان از نمایش دکمه خروج */
  .nav-group:last-child {
    margin-top: auto;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid #e5e7eb;
    padding-top: 15px;
    padding-bottom: 20px;
  }
}

/* جلوگیری از اسکرول بدنه وقتی سایدبار باز است */
body.sidebar-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
  height: 100% !important;
}

/* backdrop برای وقتی سایدبار باز است */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  backdrop-filter: blur(2px);
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}





/* استایل‌های عمومی برای تمام Modal ها */
.fixed.inset-0 {
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.bg-black {
    background-color: rgba(0, 0, 0, 0.5) !important;
}

.bg-opacity-50 {
    background-color: rgba(0, 0, 0, 0.5) !important;
}

/* اضافه کردن backdrop blur برای زیبایی بیشتر */
.fixed.inset-0.bg-black.bg-opacity-50 {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* برای حالت‌های مختلف opacity */
.bg-opacity-25 {
    background-color: rgba(0, 0, 0, 0.25) !important;
}

.bg-opacity-75 {
    background-color: rgba(0, 0, 0, 0.75) !important;
}

/* استایل برای modal content */
.bg-white {
    /* box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); */
}

/* بهبود نمایش در موبایل */
@media (max-width: 768px) {
    .fixed.inset-0 {
        background-color: rgba(0, 0, 0, 0.6) !important;
    }
}