/* Sidebar Fix - Make it collapsible and scrollable */

/* Enable scrolling for vertical menu */
.layout-menu-fixed .layout-menu .menu-inner,
.layout-menu-fixed-offcanvas .layout-menu .menu-inner {
  max-height: 100vh;
  overflow-y: auto !important;
  padding-bottom: 80px; /* Extra space for bottom items */
}

/* Smooth scrolling */
.menu-inner {
  scroll-behavior: smooth;
}

/* Custom scrollbar styling */
.menu-inner::-webkit-scrollbar {
  width: 6px;
}

.menu-inner::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

.menu-inner::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.menu-inner::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Fix menu toggle button to work properly */
.layout-menu-toggle {
  cursor: pointer !important;
  transition: transform 0.3s ease;
}

/* Make menu collapsible on desktop */
.layout-menu-collapsed .layout-menu {
  width: 80px !important;
}

.layout-menu-collapsed .menu-text {
  display: none;
}

.layout-menu-collapsed .app-brand-text {
  display: none;
}

/* Transition for smooth collapse */
.layout-menu {
  transition: width 0.3s ease, margin 0.3s ease;
}

/* Ensure the toggle button rotates when menu is collapsed */
.layout-menu-expanded .layout-menu-toggle i {
  transform: rotate(180deg);
}

/* Mobile menu fixes */
@media (max-width: 1199.98px) {
  .layout-menu {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .layout-menu-expanded .layout-menu {
    transform: translateX(0);
  }
  
  .layout-overlay {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  
  .layout-menu-expanded .layout-overlay {
    opacity: 1;
    pointer-events: all;
  }
}

/* Fix for bottom menu items visibility */
.menu-inner > ul:last-child,
.menu-inner > li:last-child {
  margin-bottom: 20px;
}

/* Ensure menu inner has proper height calculation */
.layout-menu .menu-inner {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px); /* Account for header */
}

/* Make sure PerfectScrollbar works */
.ps {
  overflow: hidden !important;
  overflow-anchor: none;
  -ms-overflow-style: none;
  touch-action: auto;
  -ms-touch-action: auto;
}

.ps__rail-y {
  width: 6px;
  opacity: 0;
  transition: opacity 0.2s;
  right: 0;
}

.ps:hover .ps__rail-y,
.ps--focus .ps__rail-y,
.ps--scrolling-y .ps__rail-y {
  opacity: 0.6;
}

.ps .ps__rail-y:hover,
.ps .ps__rail-y:focus,
.ps .ps__rail-y.ps--clicking {
  opacity: 0.9;
}
