html[dir="rtl"] .module table {
    direction: rtl;
}

html[dir="rtl"] .module table th,
html[dir="rtl"] .module table td {
    text-align: right !important;
    padding: 0.75rem !important;
}

/* Optional: Fix caption if needed */
html[dir="rtl"] .module caption {
    padding-right: 0.75rem !important;
    text-align: right;
}

/* Navigation positioning fix for RTL */
html[dir="rtl"] nav[class*="-right-2"] {
    right: auto !important;
    left: -0.5rem !important;
}

html[dir="rtl"] #logout-form button {
    text-align: right !important;
}

/* Active/inactive row highlights */
#result_list > tbody > tr.is-active {
    background-color: rgba(4, 120, 87, 0.1); /* Light green */
}

#result_list > tbody > tr.is-inactive {
    background-color: rgba(220, 38, 38, 0.1); /* Light red */
}

#result_list > tbody > tr.is-active:hover,
#result_list > tbody > tr.is-inactive:hover {
    background-color: rgba(0, 0, 0, 0.08);
}


html[dir="rtl"] .actionlist .border-t {
    flex-direction: row-reverse !important;
}

@media (max-width: 600px) {
    .related-widget-wrapper-link,  /* The action buttons themselves */
    .related-widget-wrapper .add-related,
    .related-widget-wrapper .change-related,
    .related-widget-wrapper .delete-related,
    .related-widget-wrapper .view-related {
      display: none !important;
    }
}
@media (max-width: 1024px) {
    /* Make select and its parent divs take full width */
    html[dir="rtl"] .form-row select,
    html[dir="rtl"] .form-row .flex-col.grow,
    html[dir="rtl"] .form-row .flex-col,
    html[dir="rtl"] .form-row .flex-row {
      width: 100% !important;
      min-width: 0 !important;
      max-width: 100% !important;
      box-sizing: border-box !important;
    }
    /* Also for select2 containers */
    html[dir="rtl"] .form-row .select2-container {
      width: 100% !important;
      min-width: 0 !important;
      max-width: 100% !important;
    }
    /* Remove any horizontal overflow on the parent */
    html[dir="rtl"] .form-row {
      overflow-x: visible !important;
    }
  }

@media (max-width: 1024px) {
  /* Normalize padding for all label containers in RTL */
  html[dir="rtl"] .form-row [class*="before\\:content-"]::before,
  html[dir="rtl"] .form-row [class*="before\\:content-"],
  html[dir="rtl"] .form-row label,
  html[dir="rtl"] .form-row span,
  html[dir="rtl"] .form-row .field-label {
    box-sizing: border-box;
  }
  /* If you want to target the cell itself for extra consistency: */
  html[dir="rtl"] .form-row td[class^='field-'] {
    padding-right: 1rem !important;
    padding-left: 0 !important;
  }
}

/* move the history box to the left */
@media (min-width: 720px) {
  html[dir="rtl"] .border-base-200.flex .ml-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
  }
}



/* Custom style for Select2 single select */
.select2-container--default .select2-selection--single {
    background-color: #f8fafc;
    border: 2px solid #2563eb;
    border-radius: 8px;
    min-height: 38px;
    font-size: 1rem;
    color: #222;
    transition: border-color 0.2s;
}

.select2-container--default .select2-selection--single:focus {
    border-color: #1d4ed8;
    outline: none;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #222;
    line-height: 36px;
    padding-left: 12px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
    right: 8px;
}


.select2-results__option,
.autocomplete-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: none !important;
  direction: rtl;
}
/* Only apply wide Select2 styles inside Django admin inlines */
.inline-group .select2-container,
.inline-group .select2-container--default .select2-selection--single,
.inline-group .related-widget-wrapper {
  min-width: 250px !important;
  width: 100% !important;
  max-width: 100% !important;
}

.inline-group .select2-dropdown {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  right: 0 !important;
  left: auto !important;
}





/* Main container */
.dal-admin-style.select2-container {
  border: 1px solid rgb(55, 48, 115) !important;
  border-radius: 6px !important;
  background: #0e2a1e !important;
  color: #c3dfd2 !important;
  width: 100% !important;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05) !important;
  font-size: 14px !important;
  line-height: 20px !important;
}

/* Selection area */
.dal-admin-style .select2-selection {
  border: none !important;
  border-radius: 4px !important;
  background: transparent !important;
  color: #c3dfd2 !important;
  height: 38px !important;
  padding: 6px 12px !important;
}

/* Dropdown arrow */
.dal-admin-style .select2-selection__arrow {
  height: 36px !important;
  right: 8px !important;
}

/* Dropdown menu */
.dal-admin-style ~ .select2-dropdown {
  border-color: #275d46 !important;
  background: #0e2a1e !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

/* Dropdown items */
.dal-admin-style ~ .select2-dropdown .select2-results__option {
  color: #c3dfd2 !important;
  padding: 8px 12px !important;
}

/* Hover states */
.dal-admin-style.select2-container--focus .select2-selection,
.dal-admin-style .select2-selection:hover {
  border-color: #3a7d5d !important;
  box-shadow: 0 0 0 1px #3a7d5d !important;
}

/* RTL support */
[dir="rtl"] .dal-admin-style .select2-selection__arrow {
  left: 8px !important;
  right: auto !important;
}

.select2-selection__clear::after {
  display: none !important;
}

.list-footer-display {
  display: none;
}
#id_user_permissions_from {
  min-height: 200px !important;   /* Or a suitable height */
  max-height: 300px !important;   /* To allow scrolling */
  overflow-y: auto !important;
}