/* only applies when app-layout-clone is added */
.app-layout-clone {
  display: flex;
  /* height: 100vh; */
  height: auto;
  /* overflow: hidden; */
}
.app-menu {
  display: flex;
  flex-direction: column;
  height: 100%;
  /* overflow: hidden; */
}
#scrollbar {
  flex: 1;
  overflow-y: auto;
  min-height: 0; /* Important for flex scrolling */
  scroll-behavior: smooth;
}

.sidebar-bottom {
  flex-shrink: 0;
  margin-top: auto;
  padding: 10px 0;
  z-index: 9999;
}
.app-layout-clone .topbar-clone {
  flex: 0 0 auto;
  width: 250px;
  max-width: 100%;
  flex-direction: column;
  justify-content: space-between;
  /* min-height: 100vh; */
  height:auto;
  /* overflow-y: hidden; */
  position: relative;
}

.app-layout-clone .main-content {
  display: flex;
  /* flex: 0 0 82%; */
  flex: 1;
  flex-direction: column;
  max-width: 100%;
  height: auto;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
}

.sidebar-menu-scroll {
  flex: 0 0 auto;
  /* overflow-y: auto; */
  min-height: auto;
  overflow: visible;
  padding-bottom: 0; /* prevent content from touching bottom */
}

.app-layout-clone .main-content > *:not(.footer) {
  flex: 1;
}

.footer {
  margin-top: auto;
  flex-shrink: 0;
}

.app-layout-clone .topbar-clone.collapsed {
  flex: 0 0 0%;
  max-width: 0;
  overflow: hidden;
}

/* Adjust main content when sidebar is collapsed */
/* .app-layout-clone:has(.topbar-clone.collapsed) .main-content {
  flex: 0 0 100%;
  max-width: 100%;
} */

/* Smooth transition for layout changes */
.app-layout-clone .topbar-clone {
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: width; /* GPU acceleration */
}

.app-layout-clone .main-content {
  transition: flex 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: flex;
}

/*
.app-layout-clone .modal {
  position: fixed !important;      
  inset: 0;                
  width: 100vw;             
  height: 100%;
}

.app-layout-clone .modal-dialog {
  margin: auto;
  position: fixed;
  
  left: 37%;
  width: 500px;
  max-width: 100vw !important;
}
  */
.app-layout-clone .modal-backdrop {
  position: fixed;
  top: 0;
  left: 0; /* Start from left edge, not 20% */
  width: 100vw; /* Full viewport width */
  height: 100vh;
  /* background-color: rgba(0, 0, 0, 0.5); */
  z-index: 1040; /* Above sidebar */
}
/* Make sidebar non-interactive when modal is open */
.app-layout-clone .topbar-clone {
  position: relative;
  z-index: 1; /* Below modal */
}

/* When modal is open, prevent interaction with sidebar */
body.modal-open .app-layout-clone .topbar-clone {
  pointer-events: none; /* Disable clicks */
}
.app-layout-clone .main-content .flex-right {
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1040px) {
  .app-layout-clone .topbar-clone {
    display: none;
  }
  .app-layout-clone .main-content {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

.app-layout-clone .main-content .page-info-header1 {
    position: relative !important;
    /* top: 0; */
    left: calc(20% + 20px);        /* 20% for sidebar + 20px main-content padding */
    width: calc(80% - 40px);
    min-height: 50px;
    /* display: flex; */
    /* align-items: center; */
    margin: auto;
    padding: 0 16px;   /* optional */
    box-sizing: border-box;
    z-index: 9;
}
.app-layout-clone .main-content .page-info-header {
    position: relative !important;  /* Stays in document flow */
    top: 0;
    width: 100%;
    /*margin-left: 20px; */
    /*margin-right: 20px; */
    min-height: 50px;
    height: 50px;
    display: flex !important;
    align-items: center !important;
    margin-top: 0;
    margin-bottom: 0 !important;
    padding: 0;
    box-sizing: border-box;
    z-index: 9;
    background-color: #fff;
}
.app-layout-clone .main-content .popup-overlay {
    position: fixed;
    inset: 0;                 /* replaces top: 0, left: 0, right: 0, bottom: 0 */
    margin-left: inherit;     /* respects main-content's computed left offset */
    width: auto;
    height: auto;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    pointer-events: auto;
}

@media (min-width: 1040px) {
  .nav-item {
  position: relative;
  overflow: visible;
}

#scrollbar .navbar-nav,
#scrollbar ul.nav {
  overflow: visible;
}
  /* Force menu dropdowns to expand vertically downwards */
.main-content .menu-dropdown,
.menu_dropdown {
  width: 90%;
  font-family: "Gantari, sans-serif";
  position: relative;
  top: 100%;
  left: 0;
  display: none; /* Hidden by default, NOT flex */
  flex-direction: column;
  background: #1e1e2f; 
  padding: 10px;
  margin: 0;
  overflow-y: auto;
  margin-top: 8px; /* Space below Configure button */
  list-style: none;
  z-index: 1000;
  border-radius: 4px; /* Optional: rounded corners */
}

.menu-dropdown.show,
.menu_dropdown.show {
  display: flex !important;
  animation: dropdownSlide 0.2s ease-out;
  scroll-margin-top: 20px;
  overflow-y: auto;
}
/* Then in your existing .main-content .menu-dropdown rule, add overflow: visible */
.main-content .menu-dropdown,
.menu_dropdown {
  /* ... your existing styles ... */
  overflow: visible; /* ADD THIS LINE */
}
@keyframes dropdownSlide {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

  /* Ensure items inside stack vertically */
  .menu-dropdown .nav-item,
  .menu_dropdown .nav-item {
    display: block;
    width: 100%;
  }
  
  .menu-dropdown .nav-link,
  .menu_dropdown .nav-link {
    display: block;
    padding: 4px 16px;
    font-family: "Gantari, sans-serif";
  }
.nav-link:hover {
  color: #438eff !important;
  /* background: rgba(67, 142, 255, 0.1); */
}
 .subList {
  width: 90%;
  /* min-width: max-content; */
  max-width: 90%;
  box-sizing: border-box;
  /* overflow: hidden; */
  /* white-space: nowrap; */
  text-overflow: ellipsis;
  display: none;
  transition: all 0.3s ease-in-out;
  padding-left: 8px; /* indent sublists */
  margin-left: 5px;
  margin-top: 5px;
}
.subList.d-block {
  display: block !important;
  height: auto; /* Critical for wrapped content */
  min-height: fit-content;
}

.subList.d-none {
  display: none !important;
}
.subList .nav-link {
  display: block;
  padding: 4px 16px;
  font-size: 13px; /* slightly smaller text */
  color: #b8b8b8; /* lighter text color */
  white-space: normal;
  word-break: normal;
  height: auto;
  min-height: fit-content;
  font-family: "Gantari, sans-serif" !important;
  /* overflow-wrap: normal; */
}

.nav-link > a:not(.nav-link) {
  pointer-events: none;
}
.subList .nav-link:hover {
  color: #438eff;
  text-decoration: underline;
  /* background: rgba(67, 142, 255, 0.1); */
}

.subList.show {
  display: block;
  height: auto;
  animation: dropdownSlide 0.2s ease-out;
}

  /* Show sublist when parent is hovered */
  /* .nav-item:hover > .subList {
    display: block !important;
    animation: dropdownSlide 0.2s ease-out;
  } */

  /* Sublist links style */
/* .subList .nav-link {
  display: block;
  padding: 6px 16px;
} */

 .nav .nav-item .nav-link[data-bs-toggle="collapse"]::after,
.menu-dropdown .nav-item > a[href^="#"] {
  display: flex;
  align-items: center;
  justify-content: space-between; /* Spreads content and ::after apart */
}
.menu-dropdown .nav-item > a[href^="#"]::after {
  content: "+";
  /* float: right; */
  font-weight: bold;
  margin-left: auto;
  margin-right: 2px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

/* When sublist is open, show minus */
.menu-dropdown .nav-item > a[href^="#"][aria-expanded="true"]::after {
  content: "−";
}
}