/* Custom styles to complement Tailwind 2*/
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;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-content {
        height: calc(100vh - 80px);
    }

    /* بهبود نمایش در موبایل */
    .nav-group {
        padding: 0.5rem;
    }

    .nav-link {
        padding: 0.75rem;
    }
}

/* جلوگیری از اسکرول بدنه وقتی سایدبار باز است */
body.sidebar-open {
    overflow: hidden;
}

/* استایل برای دسکتاپ */
@media (min-width: 769px) {
    .sidebar {
        height: 100vh;
        position: fixed;
        top: 0;
        right: 0;
    }

    .sidebar-content {
        height: calc(100vh - 80px);
    }
}



