[data-bs-theme="dark"] {
  .btn-toggle::after {
    content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%28255,255,255,.5%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 10l5-5 5 5'/%3e%3c/svg%3e");
  }
}

.sidebar-header-controls {
  min-height: 4.5rem;
  padding: .5rem .75rem;
}

.sidebar-logo-toggle {
  min-width: 0;
  height: 3.5rem;
  padding: .25rem;
  overflow: hidden;
}

.sidebar-item-wrapper>[data-navigation-action],
#navigation .sidebar-item-wrapper>.pin-item {
  color: inherit;
}

#navigation .pin-item {
  --bs-icon-link-transform: translate3d(0, .125rem, 0);
  --bs-link-hover-color-rgb: var(--bs-secondary-rgb);
}

#navigation .sidebar-pinned-badge {
  flex-shrink: 0;
}

.sidebar-logo-full {
  display: block;
  width: 100%;
}

.sidebar-logo-full img {
  width: 100%;
  max-width: 100%;
  max-height: 3rem;
  object-fit: contain;
}

.sidebar-logo-compact {
  width: 3rem;
  max-width: 3rem;
  height: 3rem;
  max-height: 3rem;
  margin: 0 auto;
  object-fit: contain;
}

@media (min-width: 768px) {

  #navigation,
  .sidebar {
    flex: 0 0 clamp(15rem, 20vw, 19rem);
    width: clamp(15rem, 20vw, 19rem);
    min-width: 15rem;
    max-width: 19rem;
    transition: flex-basis .28s ease, width .28s ease, min-width .28s ease, max-width .28s ease;
  }

  #navigation.is-compact,
  .sidebar.is-compact {
    flex-basis: 5rem;
    width: 5rem;
    min-width: 5rem;
    max-width: 5rem;
  }

  #navigation .sidebar-menu-label,
  #navigation .pin-item,
  #navigation [data-drag-handle],
  #navigation [data-pinned-drag-handle],
  #navigation .offcanvas-footer span {
    max-width: 14rem;
    opacity: 1;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width .2s ease, opacity .16s ease, margin .2s ease, padding .2s ease;
  }

  #navigation.is-compact .sidebar-header-controls {
    min-height: 4.5rem;
    gap: 0 !important;
    padding: .5rem;
  }

  #navigation.is-compact .sidebar-logo-toggle {
    flex: 1 1 auto !important;
    width: 100%;
    height: 3.5rem;
    padding: 0;
  }

  #navigation.is-compact .sidebar-logo-full {
    display: none !important;
  }

  #navigation.is-compact .sidebar-logo-full img {
    display: none !important;
  }

  #navigation.is-compact .sidebar-logo-compact {
    display: block !important;
  }

  #navigation.is-compact .navigation-groups {
    padding: .5rem 0 !important;
  }

  #navigation.is-compact .offcanvas-body {
    scrollbar-gutter: stable both-edges;
  }

  #navigation.is-compact:not(.sidebar-pinned-only) .navigation-groups .collapse {
    display: block;
  }

  #navigation.is-compact .sidebar-group-toggle-wrapper {
    justify-content: center;
    gap: 0 !important;
  }

  #navigation.is-compact .sidebar-group-toggle-wrapper>.btn-toggle,
  #navigation.is-compact .sidebar-group-toggle-wrapper>a:not(.pin-item),
  #navigation.is-compact .sidebar-item-wrapper {
    flex: 0 0 2.75rem !important;
    justify-content: center;
    width: 2.75rem !important;
    height: 2.75rem;
    margin-left: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow: hidden;
  }

  #navigation.is-compact .sidebar-item-wrapper>a:not(.pin-item),
  #navigation.is-compact .sidebar-item-wrapper>[data-navigation-action] {
    flex: 0 0 100% !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0 !important;
    gap: 0 !important;
  }

  #navigation.is-compact .sidebar-item-wrapper>.btn-toggle {
    flex: 0 0 100% !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0 !important;
    gap: 0 !important;
  }

  #navigation.is-compact .sidebar-item-wrapper {
    margin-right: auto !important;
    margin-left: auto !important;
  }

  #navigation.is-compact #pinned-items .sidebar-item-wrapper {
    position: relative;
    overflow: visible;
  }

  #navigation.is-compact .sidebar-pinned-badge {
    position: absolute;
    top: -.2rem;
    right: -.35rem;
    border: 2px solid var(--bs-body-bg);
    z-index: 1;
  }

  #navigation.is-compact :is(.sidebar-group-toggle-wrapper, .sidebar-item-wrapper)>:is(a:not(.pin-item), .btn-toggle, [data-navigation-action])>i {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
  }

  #navigation.is-compact .sidebar-menu-label,
  #navigation.is-compact .pin-item,
  #navigation.is-compact [data-drag-handle],
  #navigation.is-compact [data-pinned-drag-handle],
  #navigation.is-compact .offcanvas-footer span,
  #navigation.is-compact .tc-group-badge,
  #navigation.is-compact .tc-sidebar-badges {
    max-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0;
    pointer-events: none;
  }

  #navigation.is-compact .pin-item,
  #navigation.is-compact [data-drag-handle],
  #navigation.is-compact [data-pinned-drag-handle],
  #navigation.is-compact .tc-group-badge,
  #navigation.is-compact .tc-sidebar-badges {
    flex: 0 0 0 !important;
    min-width: 0;
    width: 0;
    border-width: 0 !important;
  }

  #navigation.is-compact .sidebar-group-toggle-wrapper>.btn-toggle::after,
  #navigation.is-compact .sidebar-item-wrapper>.btn-toggle::after {
    content: none !important;
    display: none !important;
  }

  #navigation.is-compact [data-update-notice] {
    display: none !important;
  }
}

#navigation.sidebar-pinned-only .navigation-groups>.sidebar-group:not(:first-child) {
  display: none;
}

#navigation .pinned-items .sidebar-item.is-dragging {
  opacity: .55;
}

#navigation .pinned-items .sidebar-item.is-drop-target {
  outline: 2px dashed rgba(var(--bs-primary-rgb), .5);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {

  #navigation,
  .sidebar,
  #navigation .sidebar-menu-label,
  #navigation .pin-item,
  #navigation [data-drag-handle],
  #navigation [data-pinned-drag-handle],
  #navigation .offcanvas-footer span {
    transition: none !important;
  }
}

#navigation,
.sidebar {

  background-color: var(--cin-bg-elevated) !important;
  border-right: 1px solid var(--cin-border) !important;
  box-shadow: var(--cin-shadow-sm);
  z-index: 1030;

  .offcanvas-md {

    &.bg-body-tertiary {
      background-color: var(--cin-bg-elevated) !important;
    }

    .navigation-groups {

      padding: var(--cin-spacing);

      .sidebar-group {

        margin-bottom: var(--cin-spacing-xs);

        &.is-dragging {
          opacity: .6;
        }

        &.is-drop-target {
          outline: 2px dashed rgba(var(--bs-primary-rgb), .5);
          outline-offset: 2px;
        }


        .sidebar-item-wrapper {

          &:not(.btn-primary):hover {
            --bs-btn-color: #fff;
            --bs-btn-bg: #0067b4;
            --bs-btn-border-color: #0067b4;
            --bs-btn-hover-color: #fff;
            --bs-btn-hover-bg: rgb(0, 87.55, 153);
            --bs-btn-hover-border-color: rgb(0, 82.4, 144);
            --bs-btn-focus-shadow-rgb: 38, 126, 191;
            --bs-btn-active-color: #fff;
            --bs-btn-active-bg: rgb(0, 82.4, 144);
            --bs-btn-active-border-color: rgb(0, 77.25, 135);
            --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
            --bs-btn-disabled-color: #fff;
            --bs-btn-disabled-bg: #0067b4;
            --bs-btn-disabled-border-color: #0067b4;
          }

          a {
            color: inherit;
          }
        }

        .sidebar-group-toggle-wrapper {

          .btn-toggle {
            padding: .25rem .5rem;
            font-weight: 600;
            color: var(--bs-emphasis-color);
            background-color: transparent;
            display: inline-flex;
            align-items: center;
            gap: .25rem;
            width: 100%;

            &:hover,
            &:focus {
              color: rgba(var(--bs-emphasis-color-rgb), .85);
              background-color: var(--bs-primary-bg);
            }

            &::after {
              margin-left: auto;
              line-height: 0;
              /* content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%280,0,0,.5%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 10l5-5 5 5'/%3e%3c/svg%3e"); */
              transition: transform .35s ease;
              transform-origin: 50% 50%;

              content: "";
              display: inline-block;
              width: 16px;
              height: 16px;
              content: '';
              background-color: currentColor;

              -webkit-mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 10l5-5 5 5'/%3e%3c/svg%3e");
              mask-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 10l5-5 5 5'/%3e%3c/svg%3e");
              -webkit-mask-size: contain;
              mask-size: contain;
            }

            &[aria-expanded="true"] {
              color: rgba(var(--bs-emphasis-color-rgb), .85);
            }

            &.collapsed::after,
            &[aria-expanded="false"]::after {
              transform: rotate(180deg);
            }
          }

          a:not(.btn-primary):hover {
            --bs-btn-color: #fff;
            --bs-btn-bg: #0067b4;
            --bs-btn-border-color: #0067b4;
            --bs-btn-hover-color: #fff;
            --bs-btn-hover-bg: rgb(0, 87.55, 153);
            --bs-btn-hover-border-color: rgb(0, 82.4, 144);
            --bs-btn-focus-shadow-rgb: 38, 126, 191;
            --bs-btn-active-color: #fff;
            --bs-btn-active-bg: rgb(0, 82.4, 144);
            --bs-btn-active-border-color: rgb(0, 77.25, 135);
            --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
            --bs-btn-disabled-color: #fff;
            --bs-btn-disabled-bg: #0067b4;
            --bs-btn-disabled-border-color: #0067b4;
          }
        }
      }
    }
  }
}
