/*
 * Host shell compatibility contract.
 *
 * These rules support application-owned navigation and
 * load for every admin theme, including the default/no-theme rollback path.
 */

.sidebar[data-collapsed="true"] .crm-clickable-navigation-parent-row {
  justify-content: center;
  gap: 0;
}

.sidebar[data-collapsed="true"] .crm-clickable-navigation-parent-link {
  flex: 0 0 auto;
  margin-inline: 0;
}

.sidebar[data-collapsed="true"] .crm-clickable-navigation-parent-toggle {
  display: none;
}

/*
 * Keep the visible compact rail icon-only without removing route and utility
 * labels from the accessibility tree. This intentionally overrides the
 * renderer's legacy display:none rule for .nav-text in collapsed mode.
 */
:root[data-admin-sidebar-collapsed="true"] #sidebar .nav-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  display: block;
}

:root[data-admin-sidebar-collapsed="true"] #sidebar .nav-text[aria-hidden="true"] {
  display: none;
}

.sidebar[data-collapsed="true"] .sidebar-collapse-action {
  gap: 0;
}

.sidebar[data-collapsed="true"] .sidebar-utility {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-inline: 0;
  padding-inline: 0;
}

/*
 * Below the renderer's 1024px drawer breakpoint, go-admin pins
 * #sidebar-mobile-toggle at a fixed 12px inset as a 40px box outside the page
 * header flow. Reserve that footprint inside the header so the breadcrumb,
 * title, and actions start beside the toggle instead of beneath it, and keep
 * the header row at least as tall as the toggle. The values mirror the
 * renderer's physical placement; remove this once go-admin reserves the space.
 */
@media (max-width: 1023px) {
  .admin-page-header.admin-page-header {
    --crm-mobile-nav-toggle-inset: 12px;
    --crm-mobile-nav-toggle-size: 40px;
    padding-left: calc(2 * var(--crm-mobile-nav-toggle-inset) + var(--crm-mobile-nav-toggle-size));
  }

  .admin-page-header__row {
    min-height: var(--crm-mobile-nav-toggle-size);
  }
}
