/* SHM custom aside (sidebar) overrides */

/* Width: slightly narrower than theme default */
:root {
  --shm-aside-width: calc(22rem - 120px);
  --shm-aside-collapsed-width: 5.25rem;
  --shm-aside-divider-top: 0px;
  --shm-header-offset: 0px;
  --shm-header-z-index: 1030;
}

/* When no aside is present, don't leave legacy spacing. */
body.user-content {
  margin-left: 0;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--shm-header-z-index);
}

.content {
  padding-top: calc(1rem + var(--shm-header-offset));
}

/* Desktop layout: single sidebar (no icon strip). */
@media (min-width: 1025px) {
  body.aside-active .header {
    left: var(--shm-aside-width);
  }

  body.aside-active .wrapper {
    padding-left: var(--shm-aside-width);
  }

  html.shm-aside-collapsed body.aside-active .header,
  body.aside-active.aside-collapsed .header {
    left: var(--shm-aside-collapsed-width);
  }

  html.shm-aside-collapsed body.aside-active .wrapper,
  body.aside-active.aside-collapsed .wrapper {
    padding-left: var(--shm-aside-collapsed-width);
  }
}

/* Sidebar container */
.aside-content.shm-aside {
  left: 0;
  width: var(--shm-aside-width);
  padding: 0;
  display: flex;
  flex-direction: column;
  background: var(--bs-bg-level-1);
  border-right: 0;
  overflow: visible;
}

html.shm-aside-collapsed body.aside-active .aside-content.shm-aside,
body.aside-active.aside-collapsed .aside-content.shm-aside {
  width: var(--shm-aside-collapsed-width);
}

.aside-content.shm-aside::after {
  content: "";
  position: absolute;
  top: var(--shm-aside-divider-top);
  right: 0;
  bottom: 0;
  width: 1px;
  background: var(--bs-border-color);
  pointer-events: none;
}

/* Keep the brand visible and compact */
.aside-content.shm-aside .shm-aside__brand {
  padding: 0.75rem 0.9rem;
  background: var(--bs-bg-level-1);
  overflow: hidden;
}

.aside-content.shm-aside .shm-aside__brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
}

.aside-content.shm-aside .shm-aside__brand-logo {
  display: block;
  height: 32px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.aside-content.shm-aside .shm-aside__brand-icon {
  display: none;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 0.7rem;
  object-fit: cover;
  flex: 0 0 auto;
}

.aside-content.shm-aside .shm-aside__menu-search {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--bs-border-color);
  background: var(--bs-bg-level-1);
}

.aside-content.shm-aside .shm-aside__menu-search .form-control {
  border-radius: 0.375rem;
}

/* Scrollable body area (SimpleBar) */
.aside-content.shm-aside .shm-aside__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
}

/* Keep scrolling but hide the visible scrollbar (SimpleBar + native). */
.aside-content.shm-aside .simplebar-track {
  display: none;
}
.aside-content.shm-aside .simplebar-content-wrapper {
  scrollbar-width: none;
}
.aside-content.shm-aside .simplebar-content-wrapper::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Sidebar menu rows: keep the item chrome, but drop the left edge line. */
.aside-content.shm-aside #infrastructure-menu .shm-menu__link {
  border-left: 0;
  position: relative;
  padding: 0.72rem 0.95rem;
  min-height: 3rem;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font-size: calc(1rem + 1px);
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.aside-content.shm-aside #infrastructure-menu .shm-menu__link.active {
  border-left: 0;
  background: rgba(var(--bs-primary-rgb), 0.12);
  border-color: rgba(var(--bs-primary-rgb), 0.18);
  color: var(--bs-primary);
}

.aside-content.shm-aside #infrastructure-menu .shm-menu__link:hover {
  background: var(--bs-bg-level-2);
}

.aside-content.shm-aside #infrastructure-menu .shm-menu__link.active .shm-menu__icon {
  color: var(--bs-primary);
  opacity: 1;
}

/* Header: compact server info chips (cPanel-like) */
.shm-header-left-cluster {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  width: fit-content;
  min-width: 0;
  max-width: 100%;
}

.header-wrap.header-wrap-block {
  min-width: 0;
  overflow: hidden;
}

.header-wrap.hstack {
  flex: 0 0 auto;
  margin-left: 0;
}

.shm-header-info {
  display: flex;
  gap: 0.75rem;
  min-width: 0;
  flex: 0 1 auto;
  flex-wrap: nowrap;
  overflow: hidden;
  white-space: normal;
}
.shm-header-info-box {
  display: flex;
  align-items: center;
  gap: 0;
  width: fit-content;
  flex: 0 1 auto;
  max-width: 100%;
  min-width: 0;
  min-height: calc(1.5em + 0.75rem + 2px);
  border: 1px solid var(--bs-border-color);
  border-radius: 0.75rem;
  overflow: hidden;
  background: var(--bs-bg-level-2);
  white-space: nowrap;
}
.shm-header-chip {
  display: inline-flex;
  flex: 0 1 auto;
  flex-direction: row;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
  padding: calc(0.4rem + 2px) 0.68rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1.1;
}
.shm-header-sep {
  display: inline-flex;
  align-items: center;
  padding: 0 0.15rem;
  color: var(--bs-text-level-1);
  opacity: 0.7;
  user-select: none;
}
.shm-header-chip__label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bs-text-level-1);
  flex: 0 0 auto;
  white-space: nowrap;
}
.shm-header-chip__value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1rem;
  font-weight: 600;
  color: var(--bs-text-level-3);
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}
.shm-header-chip__value--hostname {
  max-width: 240px;
}
.shm-header-chip__value--os {
  max-width: 360px;
}
.shm-header-chip__value--ip {
  max-width: 220px;
}
.shm-header-chip__value--uptime {
  max-width: 160px;
}
.shm-header-search-wrap {
  min-width: 220px;
  max-width: 340px;
  width: 280px;
}

.header-holder-desktop .header-wrap.hstack .btn,
.header-holder-desktop .header-wrap.hstack .account-link {
  font-size: calc(1rem + 1px);
}

.aside-content.shm-aside .shm-aside__edge-toggle {
  position: absolute;
  top: 50%;
  right: calc(-1 * (1.85rem - 7px) + 1px);
  width: calc(1.85rem - 7px);
  height: calc(4.6rem + 30px);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bs-border-color);
  border-left: 0;
  border-radius: 0 999px 999px 0;
  background: var(--bs-bg-level-1);
  color: var(--bs-text-level-2);
  box-shadow: var(--bs-box-shadow-sm);
  transform: translateY(-50%) translateX(0);
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.18s ease, transform 0.18s ease, background-color 0.18s ease, color 0.18s ease;
  z-index: 8;
}

.aside-content.shm-aside:hover .shm-aside__edge-toggle,
.aside-content.shm-aside:focus-within .shm-aside__edge-toggle,
.aside-content.shm-aside .shm-aside__edge-toggle:focus-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

.aside-content.shm-aside .shm-aside__edge-toggle:hover {
  background: var(--bs-bg-level-2);
  color: var(--bs-primary);
}

.aside-content.shm-aside .shm-aside__edge-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.92rem;
}

html.shm-aside-collapsed body.aside-active .aside-content.shm-aside .shm-aside__edge-toggle,
body.aside-active.aside-collapsed .aside-content.shm-aside .shm-aside__edge-toggle {
  right: calc(-1 * (1.5rem - 7px) + 1px);
  width: calc(1.5rem - 7px);
  height: calc(4rem + 30px);
}

@media (max-width: 1024.98px) {
  .aside-content.shm-aside .shm-aside__edge-toggle {
    display: none !important;
  }
}
.shm-header-chip__hint {
  font-weight: 500;
  color: var(--bs-text-level-2);
}
.shm-header-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.08rem 0.45rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 999px;
  background: var(--bs-bg-level-3);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--bs-text-level-2);
  vertical-align: middle;
}

html.shm-aside-collapsed body.aside-active .aside-content.shm-aside .shm-aside__brand,
body.aside-active.aside-collapsed .aside-content.shm-aside .shm-aside__brand {
  padding: 0.75rem 0.45rem;
}

html.shm-aside-collapsed body.aside-active .aside-content.shm-aside .shm-aside__brand-link,
body.aside-active.aside-collapsed .aside-content.shm-aside .shm-aside__brand-link {
  justify-content: center;
}

html.shm-aside-collapsed body.aside-active .aside-content.shm-aside .shm-aside__brand-logo,
body.aside-active.aside-collapsed .aside-content.shm-aside .shm-aside__brand-logo {
  display: none;
}

html.shm-aside-collapsed body.aside-active .aside-content.shm-aside .shm-aside__brand-icon,
body.aside-active.aside-collapsed .aside-content.shm-aside .shm-aside__brand-icon {
  display: inline-block;
}

html.shm-aside-collapsed body.aside-active .aside-content.shm-aside .shm-aside__menu-search,
body.aside-active.aside-collapsed .aside-content.shm-aside .shm-aside__menu-search {
  display: none;
}

html.shm-aside-collapsed body.aside-active .aside-content.shm-aside #top-menu-list,
body.aside-active.aside-collapsed .aside-content.shm-aside #top-menu-list {
  padding: 0 0.35rem 0.65rem;
}

html.shm-aside-collapsed body.aside-active .aside-content.shm-aside #infrastructure-menu .shm-menu__link,
body.aside-active.aside-collapsed .aside-content.shm-aside #infrastructure-menu .shm-menu__link {
  justify-content: center;
  gap: 0 !important;
  padding: 0.75rem 0.35rem;
  min-height: 3.35rem;
  border-radius: 0.95rem !important;
  margin: 0.12rem 0;
}

html.shm-aside-collapsed body.aside-active .aside-content.shm-aside #infrastructure-menu .shm-menu__icon,
body.aside-active.aside-collapsed .aside-content.shm-aside #infrastructure-menu .shm-menu__icon {
  width: auto;
  font-size: 1.2rem;
}

html.shm-aside-collapsed body.aside-active .aside-content.shm-aside #infrastructure-menu .shm-menu__label,
body.aside-active.aside-collapsed .aside-content.shm-aside #infrastructure-menu .shm-menu__label {
  display: none;
}

.shm-aside-tooltip {
  --bs-tooltip-bg: var(--bs-body-bg);
  --bs-tooltip-color: var(--bs-body-color);
  --bs-tooltip-opacity: 1;
  --bs-tooltip-max-width: none;
}

.shm-aside-tooltip .tooltip-inner {
  padding: 0.62rem 0.85rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 0.8rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: left;
  box-shadow: var(--bs-box-shadow-sm);
}

@media (max-width: 1500px) and (min-width: 1025px) {
  .header-container {
    gap: 0.75rem;
  }

  .header-wrap.hstack {
    gap: 0.4rem !important;
    margin-left: 0;
  }

  .shm-header-left-cluster {
    gap: 0.35rem;
  }

  .shm-header-info {
    gap: 0.55rem;
  }

  .shm-header-info-box {
    min-height: calc(1.5em + 0.75rem + 2px);
    border-radius: 0.65rem;
  }

  .shm-header-chip {
    gap: 0.35rem;
    padding: calc(0.36rem + 2px) 0.56rem;
  }

  .shm-header-sep {
    padding: 0 0.08rem;
  }

  .shm-header-chip__label {
    font-size: 0.74rem;
    letter-spacing: 0.045em;
  }

  .shm-header-chip__value {
    font-size: 0.94rem;
  }

  .shm-header-chip__value--hostname {
    max-width: 172px;
  }

  .shm-header-chip__value--os {
    max-width: 242px;
  }

  .shm-header-chip__value--ip {
    max-width: 150px;
  }

  .shm-header-chip__value--uptime {
    max-width: 96px;
  }

  .shm-header-search-wrap {
    min-width: 180px;
    max-width: 240px;
    width: 220px;
  }
}
