/* Responsive sidebar behavior: desktop fixed, tablet collapsed, mobile drawer */
.hide-menu {
  background: transparent;
  border: 0;
}

.sidebar-backdrop {
  display: none;
}

.topbar-page-title {
  display: inline-flex;
  align-items: center;
  max-width: 260px;
  margin: 0 10px 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar #side-menu > li.active > a {
  border-left: 3px solid #22c55e !important;
  background: rgba(34, 197, 94, 0.16) !important;
}

.sidebar #side-menu .submenu .nav-second-level > li.active > a {
  display: block !important;
  margin: 4px 0 4px 20px !important;
  border-left: 3px solid #22c55e !important;
  border-radius: 6px !important;
  background: rgba(34, 197, 94, 0.14) !important;
  color: #f8fafc !important;
}

.sidebar .submenu {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.sidebar .submenu.open {
  max-height: 400px;
  opacity: 1;
}

.sidebar .submenu > .nav-second-level {
  display: block;
}

.sidebar .fa.arrow:before {
  content: "\f107" !important;
  display: inline-block;
  transition: transform 0.28s ease;
}

.sidebar li.open > a > .fa.arrow:before {
  transform: rotate(180deg);
}

@media (min-width: 1025px) {
  body #menu,
  body.hide-sidebar #menu,
  body.page-small #menu {
    width: 260px !important;
    margin-left: 0 !important;
  }

  body #wrapper,
  body #header,
  body.hide-sidebar #wrapper,
  body.hide-sidebar #header,
  body.page-small #wrapper,
  body.page-small #header {
    margin-left: 260px !important;
  }

  .hide-menu {
    display: none !important;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  body #menu,
  body.hide-sidebar #menu,
  body.page-small #menu {
    width: 60px !important;
    margin-left: 0 !important;
    overflow-x: hidden;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body #wrapper,
  body #header,
  body.hide-sidebar #wrapper,
  body.hide-sidebar #header,
  body.page-small #wrapper,
  body.page-small #header {
    margin-left: 60px !important;
    transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }

  body:not(.sidebar-open) #menu .menu-text,
  body:not(.sidebar-open) #menu .sub-menu-text,
  body:not(.sidebar-open) #menu .arrow,
  body:not(.sidebar-open) #menu .badge {
    opacity: 0 !important;
    width: 0 !important;
    max-width: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-block !important;
    transition: opacity 0.2s ease, width 0.2s ease;
  }

  body:not(.sidebar-open) #menu .nav-second-level {
    max-height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body:not(.sidebar-open) #side-menu > li > a {
    position: relative;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding-left: 0 !important;
    padding-right: 0 !important;
    min-height: 40px;
    text-align: center;
  }

  body:not(.sidebar-open) #menu li a i.menu-icon {
    float: none !important;
    margin: 0 !important;
    width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  body:not(.sidebar-open) #side-menu > li > a[data-label]::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    background: rgba(15, 23, 42, 0.95);
    color: #fff;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1300;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  }

  body:not(.sidebar-open) #side-menu > li > a[data-label]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
  }

  body.sidebar-open #menu {
    width: 260px !important;
  }

  body.sidebar-open #wrapper,
  body.sidebar-open #header {
    margin-left: 260px !important;
  }

  .hide-menu {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  .topbar-page-title {
    max-width: 180px;
  }

  body:not(.sidebar-open) #menu .submenu,
  body:not(.sidebar-open) #menu .submenu.open {
    max-height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }

  body:not(.sidebar-open) #menu .submenu .nav-second-level > li {
    display: none !important;
  }
}

@media (max-width: 640px) {
  body #header,
  body #wrapper,
  body.hide-sidebar #header,
  body.hide-sidebar #wrapper,
  body.page-small #header,
  body.page-small #wrapper {
    margin-left: 0 !important;
  }

  body #menu,
  body.hide-sidebar #menu,
  body.page-small #menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100% !important;
    max-width: none;
    margin-left: 0 !important;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1200;
  }

  #menu.mobile-open {
    transform: translateX(0);
  }

  .hide-menu {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
    z-index: 1190;
  }

  #menu.mobile-open + .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar-page-title {
    max-width: 120px;
    font-size: 14px;
  }
}
