body.has-sidebar .departments-sidebar {
  position: fixed;
  top: 92px; /* 60px (main header) + 32px (sub-header) */
  bottom: 0;
  left: 0;
  width: 180px;
  background-color: #131a22;
  color: white;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}

.departments-heading {
  font-size: 16px;
  font-weight: 700;
  margin: 0 20px 12px 20px;
}

.department-link {
  display: flex;
  align-items: center;
  padding: 10px 24px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  position: relative;
  transition: all 0.2s ease;
  min-height: 42px;
  box-sizing: border-box;
  border-left: 3px solid transparent;
}

.department-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-left-color: #ffa724;
}

.department-link.selected-brand,
.department-link.active {
  background-color: rgba(255, 167, 36, 0.16);
  color: #fff;
  border-left-color: #ffa724;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  font-weight: 600;
}

.department-group {
  position: relative;
}

.submenu {
  visibility: hidden;
  opacity: 0;
  position: fixed;
  left: 180px; /* Sidebar width */
  top: 92px; /* 60px (main header) + 32px (sub-header) */
  bottom: 0;
  width: 320px;
  background-color: #182430;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.22);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 100; /* Above sub-header (z-index: 99) */
  transition: visibility 0s 0.2s, opacity 0.2s ease;
  padding: 16px 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
  max-height: calc(100vh - 92px); /* Ensure it doesn\'t overflow viewport */
}

.department-subgroup {
  position: relative;
}

.department-subgroup > .submenu {
  position: fixed;
  left: 500px; /* sidebar width (180px) + first submenu width (320px) */
  background-color: #1e2d3c;
}

/* Ensure nested submenus don't create multiple scrollbars */
.department-subgroup > .submenu {
  max-height: none;
  overflow: visible;
}

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

.submenu::-webkit-scrollbar-track {
  background: transparent;
}

.submenu::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.submenu.active {
  visibility: visible;
  opacity: 1;
  transition-delay: 0s;
}

.submenu .submenu-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 14px;
  padding: 0 26px;
}

.submenu .submenu-item {
  display: block;
  padding: 10px 18px;
  color: rgba(230, 238, 247, 0.92);
  text-decoration: none;
  font-size: 14px;
  border-radius: 6px;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.submenu .submenu-item:hover {
  background-color: rgba(255, 255, 255, 0.14);
  color: #fff;
  transform: translateX(4px);
}

.submenu .view-all-link {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid transparent;
}

.submenu .view-all-link:hover {
  background-color: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

.submenu .submenu-empty {
  color: #8da1b8;
  font-size: 13px;
  padding: 12px 16px;
}

.submenu .department-link {
  padding: 10px 24px;
  font-size: 13px;
  white-space: nowrap;
  transition: all 0.2s ease;
  min-height: 40px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  border-left: 3px solid transparent;
}

.submenu .department-link:last-child {
  border-bottom: none;
}

.submenu .department-link:hover {
  background-color: rgba(255, 255, 255, 0.14);
  padding-left: 30px; /* Keep the slide effect */
  border-left-color: #ffa724;
}

.submenu .department-link.selected-brand,
.submenu .department-link.active {
  background-color: rgba(255, 180, 71, 0.16);
  border-left-color: #ffa724;
  color: #fff;
}

/* Ensure consistent height for all submenu levels */
.department-subgroup .submenu .department-link {
  padding: 10px 24px;
  min-height: 40px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.department-subgroup .submenu .department-link:hover {
  padding-left: 30px; /* Consistent hover effect */
}

.expandable {
  background-color: rgba(255, 255, 255, 0.05);
}

.expandable::after {
  content: "›";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: bold;
  transition: transform 0.2s ease;
  line-height: 1;
}

.expandable.active {
  background-color: rgba(255, 255, 255, 0.15);
}

.expandable.active::after {
  transform: translateY(-50%) rotate(90deg);
}

@media (max-width: 800px) {
  body.has-sidebar .submenu {
    position: static;
    width: auto;
    box-shadow: none;
    background-color: rgba(0, 0, 0, 0.2);
    display: none;
    visibility: visible;
    opacity: 1;
    transition: none;
  }
  body.has-sidebar .submenu.active {
    display: block;
  }
  
  body.has-sidebar .submenu .department-link {
    padding: 10px 24px;
    min-height: 38px;
    display: flex;
    align-items: center;
  }

  body.has-sidebar .department-link {
    padding: 10px 24px;
    min-height: 38px;
  }

  body.has-sidebar .submenu .department-link:hover {
    padding-left: 30px; /* Adjusted for mobile */
  }
  
  /* Mobile styling for All Products link */
  body.has-sidebar .department-link[href="javascript:void(0)"][onclick="loadAllProducts()"] {
    padding: 10px 24px;
    min-height: 38px;     
  }
}

/* Special styling for "All Products" link to align with other items */
body.has-sidebar .department-link[href="javascript:void(0)"][onclick="loadAllProducts()"] {
  padding: 10px 24px;
  min-height: 42px;
}

body.has-sidebar .department-subgroup:hover > .submenu,
body.has-sidebar .department-subgroup > .submenu.active {
  display: block;
  visibility: visible;
  opacity: 1;
  z-index: 101;
}
