/* Shared recommendation shell: sidebar, submenu drawers, and topbar search. */

:root {
  --app-shell-sidebar-width: 220px;
  --app-shell-sidebar-compact-width: 56px;
  --app-shell-sidebar-icon-size: 1.25rem;
  --app-shell-sidebar-item-padding-x: 0.75rem;
  --app-shell-sidebar-item-padding-y: 0.5rem;
  --app-shell-offcanvas-width: 280px;
  --app-shell-topbar-min-height: 3.25rem;
  --app-shell-z-topbar: 30;
  --app-shell-z-offcanvas: 40;
  --app-shell-z-search-panel: 45;
  --app-shell-submenu-fade-duration: 0.22s;
}

.app-shell {
  flex-direction: column;
  align-items: stretch;
}

.app-shell__frame {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}

.app-shell.is-sidebar-compact {
  --nav-offcanvas-left: var(--app-shell-sidebar-compact-width);
}

.app-shell.is-sidebar-pinned {
  --nav-offcanvas-left: var(--app-shell-sidebar-width);
}

/* Sidebar */
.app-shell .app-sidebar {
  width: var(--app-shell-sidebar-width) !important;
  align-self: stretch !important;
  height: 100%;
  min-height: 100%;
  transition: width 0.2s ease;
}

.app-shell.is-frame-hidden {
  min-height: calc(100dvh - 8rem);
}

.app-shell.is-frame-hidden .app-sidebar {
  position: sticky;
  top: 0;
  height: auto;
  min-height: 100%;
  align-self: stretch;
}

.app-shell.is-sidebar-compact .app-sidebar {
  width: var(--app-shell-sidebar-compact-width) !important;
}

.app-shell.is-sidebar-pinned .sidebar-label {
  display: inline !important;
}

.app-shell.is-sidebar-compact .sidebar-label {
  display: none !important;
}

.app-sidebar .nav-link,
.app-sidebar__pin-toggle {
  gap: 0.5rem;
  padding: var(--app-shell-sidebar-item-padding-y) var(--app-shell-sidebar-item-padding-x);
}

.app-sidebar .nav-link > .bi,
.app-sidebar__pin-toggle > .bi {
  align-items: center;
  display: inline-flex;
  flex: 0 0 var(--app-shell-sidebar-icon-size);
  font-size: var(--app-shell-sidebar-icon-size);
  justify-content: center;
  line-height: 1;
  width: var(--app-shell-sidebar-icon-size);
}

.app-shell.is-sidebar-compact .app-sidebar .nav-link,
.app-shell.is-sidebar-compact .app-sidebar__pin-toggle {
  justify-content: center !important;
  padding-inline: 0.5rem;
}

.app-sidebar .nav-link {
  border-radius: 0.35rem;
  color: rgba(255, 255, 255, 0.92);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.app-sidebar .nav-pills .nav-link:hover,
.app-sidebar .nav-pills .nav-link:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  outline: none;
}

.app-sidebar .nav-pills .nav-link.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.app-sidebar .nav-pills .nav-link.active:hover,
.app-sidebar .nav-pills .nav-link.active:focus-visible {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}

.app-sidebar__pin-toggle {
  border-radius: 0.35rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.app-sidebar__pin-toggle:hover,
.app-sidebar__pin-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  outline: none;
  text-decoration: none;
}

/* Submenu drawer links */
.submenu-offcanvas .nav-link {
  border-radius: 0.35rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.submenu-offcanvas .nav-link:hover,
.submenu-offcanvas .nav-link:focus-visible {
  background: #eef4f8;
  color: var(--brand-navy);
  outline: none;
}

.submenu-offcanvas .nav-link.active {
  background: var(--brand-navy);
  color: #fff;
}

.submenu-offcanvas .nav-link.active:hover,
.submenu-offcanvas .nav-link.active:focus-visible {
  background: var(--brand-navy-soft);
  color: #fff;
}

.app-shell__main {
  min-width: 0;
  min-height: 0;
}

.app-shell.is-search-active .app-shell__main::before {
  background: rgba(15, 23, 42, 0.12);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 20;
}

.app-shell__content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* Frame-clipped offcanvas drawers sit below the full-width topbar. */
.mockup-offcanvas-scope .offcanvas {
  z-index: var(--app-shell-z-offcanvas);
}

/* Right-side drawers inside the nav frame (visibility settings, etc.). */
.mockup-offcanvas-scope .app-shell__frame .offcanvas.offcanvas-end {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  max-height: 100% !important;
}

/* Right-side drawers mounted on the shell (page-specific panels). */
.mockup-offcanvas-scope > .offcanvas.offcanvas-end {
  position: absolute !important;
  top: var(--app-shell-topbar-min-height) !important;
  right: 0 !important;
  bottom: 0 !important;
  left: auto !important;
  height: auto !important;
  max-height: none !important;
}

/* Full-height submenu drawer clipped to the simulated device frame. */
.mockup-offcanvas-scope .offcanvas.submenu-offcanvas {
  position: absolute !important;
  top: 0 !important;
  bottom: 0 !important;
  left: var(--nav-offcanvas-left, var(--app-shell-sidebar-width)) !important;
  width: var(--app-shell-offcanvas-width) !important;
  height: 100% !important;
  max-height: 100% !important;
  box-shadow: 0.25rem 0 0.75rem rgba(15, 23, 42, 0.08);
  opacity: 0;
  transform: none !important;
  transition: opacity var(--app-shell-submenu-fade-duration) ease;
}

.mockup-offcanvas-scope .offcanvas.submenu-offcanvas.showing,
.mockup-offcanvas-scope .offcanvas.submenu-offcanvas.show:not(.hiding) {
  opacity: 1;
}

.mockup-offcanvas-scope .offcanvas.submenu-offcanvas.hiding {
  opacity: 0;
}

.mockup-offcanvas-scope .offcanvas.submenu-offcanvas.submenu-offcanvas--instant {
  transition: none !important;
}

/* Topbar spans the full shell width above sidebar and drawers. */
.app-topbar {
  flex: 0 0 auto;
  min-height: var(--app-shell-topbar-min-height);
  width: 100%;
  z-index: var(--app-shell-z-topbar);
}

.app-topbar__search-wrap {
  max-width: 34rem;
  position: relative;
  width: 100%;
}

.app-topbar__secondary-btn {
  background: var(--bs-body-secondary-bg, #f8fafc);
  border-color: var(--brand-border);
  color: var(--brand-navy);
}

.app-topbar__secondary-btn:hover,
.app-topbar__secondary-btn:focus-visible {
  background: #eef4f8;
  border-color: var(--brand-border);
  color: var(--brand-navy);
  outline: none;
}

.app-topbar__secondary-btn.active,
.app-topbar__secondary-btn[aria-expanded="true"] {
  background: var(--brand-navy);
  border-color: var(--brand-navy);
  color: #fff;
}

.app-topbar__secondary-btn.active:hover,
.app-topbar__secondary-btn.active:focus-visible,
.app-topbar__secondary-btn[aria-expanded="true"]:hover,
.app-topbar__secondary-btn[aria-expanded="true"]:focus-visible {
  background: var(--brand-navy-soft);
  border-color: var(--brand-navy-soft);
  color: #fff;
  outline: none;
}

/* Visibility settings drawer */
.visibility-offcanvas {
  --bs-offcanvas-width: min(22rem, 100%);
}

.visibility-offcanvas__section + .visibility-offcanvas__section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
}

.visibility-offcanvas__heading {
  color: var(--brand-navy);
  font-weight: 700;
  margin-bottom: 0.65rem;
}

.visibility-offcanvas__well {
  background: var(--bs-body-secondary-bg, #f8fafc);
  border: 1px solid var(--brand-border);
  border-radius: 0.35rem;
  overflow: hidden;
}

.visibility-offcanvas__well .list-group {
  border: 0;
  border-radius: 0;
}

.visibility-offcanvas__well .list-group-item {
  background-color: transparent;
  border-left: 0;
  border-right: 0;
}

.visibility-offcanvas__well .list-group-item:first-child {
  border-top: 0;
}

.visibility-offcanvas__well .list-group-item-action {
  cursor: pointer;
}

.visibility-offcanvas__well .list-group-item-action:hover,
.visibility-offcanvas__well .list-group-item-action:focus-within {
  background: #eef4f8;
}

.visibility-offcanvas__role-detail-panel {
  background: var(--bs-body-secondary-bg, #f8fafc);
  border-top: 1px solid var(--brand-border);
  padding: 0.75rem 0.85rem;
}

.visibility-offcanvas__role-detail-panel p:last-child,
.visibility-offcanvas__role-detail-panel ul:last-child {
  margin-bottom: 0;
}

.visibility-offcanvas__caution {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 0.35rem;
  padding: 0.55rem 0.65rem;
}

/* App-wide search combobox */
.app-search {
  --app-search-type-bg: var(--bs-body-secondary-bg, #f8fafc);
  --app-search-type-width: 4.75rem;
  position: relative;
}

.app-search .dropdown-menu {
  --bs-dropdown-link-active-bg: var(--brand-navy);
  --bs-dropdown-link-active-color: var(--text-inverse);
  --bs-dropdown-link-hover-bg: #eef4f8;
  --bs-dropdown-link-hover-color: var(--brand-navy);
}

.app-search .dropdown-item.active,
.app-search .dropdown-item:active {
  background-color: var(--brand-navy);
  color: var(--text-inverse);
}

.app-search__field {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  background: var(--bs-body-secondary-bg, #f8fafc);
  overflow: visible;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-search__field:focus-within,
.app-search.is-expanded .app-search__field {
  border-color: var(--brand-navy-soft);
  box-shadow: 0 0 0 3px rgba(53, 93, 115, 0.12);
  background: #fff;
}

.app-search__filter-btn {
  border: 0;
  border-right: 1px solid var(--brand-border);
  background: var(--app-search-type-bg);
  color: var(--brand-navy);
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  white-space: nowrap;
  border-radius: 999px 0 0 999px;
}

.app-search__filter-btn:hover,
.app-search__filter-btn:focus-visible {
  background: #eef4f8;
  outline: none;
}

.app-search__input {
  border: 0;
  background: transparent;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
}

.app-search__input:focus {
  outline: none;
  box-shadow: none;
}

.app-search__submit {
  border: 0;
  border-radius: 0 999px 999px 0;
  background: var(--brand-navy);
  color: #fff;
  padding: 0 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-search__submit:hover,
.app-search__submit:focus-visible {
  background: var(--brand-navy-soft);
  outline: none;
}

.app-search__panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 0.4rem;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
  padding: 0.25rem 0;
  z-index: var(--app-shell-z-search-panel);
  max-height: 18rem;
  overflow: auto;
}

.app-search__panel[hidden] {
  display: none !important;
}

.app-search__result {
  display: grid;
  grid-template-columns: var(--app-search-type-width) minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  font-size: 0.88rem;
  color: var(--text-strong);
}

.app-search__result:hover,
.app-search__result:focus-visible,
.app-search__result.is-active {
  background: #f3ede4;
  outline: none;
}

.app-search__result:hover .app-search__result-icon,
.app-search__result:focus-visible .app-search__result-icon,
.app-search__result.is-active .app-search__result-icon {
  background: var(--app-search-type-bg);
}

.app-search__result-icon {
  align-items: center;
  background: var(--app-search-type-bg);
  border-right: 1px solid var(--brand-border);
  color: var(--brand-navy);
  display: flex;
  font-size: 1rem;
  justify-content: center;
  width: 100%;
}

.app-search__result-body {
  align-self: center;
  min-width: 0;
  padding: 0.55rem 0.75rem;
}

.app-search__result-title {
  display: block;
  font-weight: 600;
  line-height: 1.25;
}

.app-search__result-meta {
  display: block;
  font-size: 0.76rem;
  color: #667085;
  line-height: 1.25;
}

.app-search__result-date {
  align-self: center;
  color: #667085;
  font-size: 0.76rem;
  padding: 0.55rem 0.85rem 0.55rem 0;
  white-space: nowrap;
}

.app-search__result:not(:has(.app-search__result-date)) .app-search__result-body {
  padding-right: 0.85rem;
}
