[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;
  padding: .25rem;
  overflow: hidden;
}

.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: 3.25rem;
  max-width: 100%;
  height: auto;
  max-height: 2rem;
  margin: 0 auto;
  object-fit: contain;
}

.sidebar-visibility-dropdown .dropdown-menu {
  min-width: 15rem;
  z-index: 1040;
}

.sidebar-visibility-check {
  opacity: 0;
}

[data-sidebar-visibility].active .sidebar-visibility-check {
  opacity: 1;
}

@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: 5.25rem;
    flex-direction: column;
    gap: 0 !important;
    padding: .25rem;
  }

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

  #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 .sidebar-visibility-dropdown > button {
    width: 2rem;
    height: 2rem;
    padding: 0;
  }

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

  #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.dashboard,
  #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) {
    flex: 0 0 100% !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 0 !important;
  }

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

  #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 .btn-toggle::after {
    content: none;
  }

  #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-group-nav {
    
          .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%;
            }
    
            &[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;
          }
        }
      }
    }
  }
}
