/* RTL Support for Sidebar */
html[dir="rtl"] [data-slot="sidebar-wrapper"] {
  direction: rtl;
}

html[dir="rtl"] [data-slot="sidebar"] {
  direction: rtl;
}

/* Fix sidebar positioning for RTL */
html[dir="rtl"] [data-side="left"] {
  right: 0;
  left: auto !important;
}

html[dir="rtl"] [data-side="right"] {
  left: 0;
  right: auto !important;
}

/* Fix sidebar border for RTL */
html[dir="rtl"] [data-side="left"] {
  border-left: 1px solid var(--sidebar-border);
  border-right: none !important;
}

html[dir="rtl"] [data-side="right"] {
  border-right: 1px solid var(--sidebar-border);
  border-left: none !important;
}

/* Fix sidebar collapse for RTL */
html[dir="rtl"] [data-collapsible="offcanvas"][data-side="left"] {
  right: calc(var(--sidebar-width) * -1) !important;
  left: auto !important;
}

html[dir="rtl"] [data-collapsible="offcanvas"][data-side="right"] {
  left: calc(var(--sidebar-width) * -1) !important;
  right: auto !important;
}

/* Fix sidebar rail for RTL */
html[dir="rtl"] [data-sidebar="rail"] {
  transform: translateX(50%) !important;
}

/* Fix sidebar menu items for RTL */
html[dir="rtl"] [data-sidebar="menu-button"] {
  text-align: right;
}

html[dir="rtl"] [data-sidebar="menu-action"] {
  right: auto;
  left: 1rem;
}

html[dir="rtl"] [data-sidebar="menu-badge"] {
  right: auto;
  left: 1rem;
}

/* Fix sidebar menu sub items for RTL */
html[dir="rtl"] [data-sidebar="menu-sub"] {
  border-left: none;
  border-right: 1px solid var(--sidebar-border);
  margin-left: 0;
  margin-right: 0.875rem;
  padding-left: 0;
  padding-right: 0.625rem;
}

/* Fix sidebar group action for RTL */
html[dir="rtl"] [data-sidebar="group-action"] {
  right: auto;
  left: 0.75rem;
}

/* Fix sidebar menu item with children for RTL */
html[dir="rtl"] .group-has-data-[sidebar=menu-action]/menu-item:pr-8 {
  padding-right: 0.5rem !important;
  padding-left: 2rem !important;
}