@use "sass:map";
// --- State "sidebar-collapsed"

// Normal state
body.sidebar-collapsed {
  .sidebar {
    margin-left: -$sidebar-width;
  }
}

// Workaround for IE bug, more info:
// https://stackoverflow.com/a/25850649

// Reverted state
@media (min-width: 1px) and (max-width: #{map.get($grid-breakpoints, 'lg') - .02px}) {

  .sidebar {
    // Sidebar default state (on mobile)
    margin-left: -$sidebar-width;
  }

  // Sidebar collapsed state (on mobile)
  body.sidebar-collapsed .sidebar {
    margin-left: 0;
  }
}

// --- Search sidebar
.sidebar .sidebar-search {
  padding: $sidebar-link-padding;
  display: flex;
  align-items: center;
  background: rgba($primary,0.1);

  i {
    margin-right: .75rem;
    font-size: 1.1rem;
    color: $sidebar-link-icon-active-color;
  }

  input, input:focus {
    color: $sidebar-link-active-color;
    padding: 0;
    border: none;
    background-color: transparent;
    box-shadow: none;
  }
}

// --- Vanilla sidebar
.sidebar {
  min-width: $sidebar-width;
  max-width: $sidebar-width;
  transition: $sidebar-transition;
  direction: ltr;
  background: $sidebar-bg;
  position: fixed;
}

.sidebar-content {
  transition: $sidebar-transition;
  display: flex;
  height: 100vh;
  flex-direction: column;
  background: $sidebar-bg;
}

.sidebar-nav {
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
  flex-grow: 1;
}

// Sidebar links
.sidebar-link,
a.sidebar-link {
  display: flex;
  align-items: center;
  padding: $sidebar-link-padding;
  font-weight: $sidebar-link-font-weight;
  transition: background .1s ease-in-out;
  position: relative;
  text-decoration: none;
  cursor: pointer;
  border-left-style: solid;
  border-left-width: 3px;
  color: $sidebar-link-color;
  background: $sidebar-link-bg;
  border-left-color: $sidebar-link-border-left-color;

  i,
  svg {
    margin-right: .75rem;
    font-size: 1.1rem;
    color: $sidebar-link-icon-color;
  }
}

.sidebar-link:focus {
  outline: 0;
}

.sidebar-link:hover {
  color: $sidebar-link-hover-color;
  background: $sidebar-link-hover-bg;
  border-left-color: $sidebar-link-hover-border-left-color;

  i,
  svg {
    color: $sidebar-link-icon-hover-color;
  }
}

.sidebar-item.active > .sidebar-link,
.sidebar-item.active .sidebar-link:hover {
  color: $sidebar-link-active-color;
  background: $sidebar-link-active-bg;
  border-left-color: $sidebar-link-active-border-left-color;

  i,
  svg {
    color: $sidebar-link-icon-active-color;
  }
}

// Sidebar brand
.sidebar-brand {
  font-weight: $sidebar-brand-font-weight;
  font-size: $sidebar-brand-font-size;
  padding: $sidebar-brand-padding-y $sidebar-brand-padding-x;
  display: block;
  color: $sidebar-brand-color;

  &:hover {
    text-decoration: none;
    color: $sidebar-brand-color;
  }

  &:focus {
    outline: 0;
  }
}

// Toggle states
.sidebar-toggle {
  cursor: pointer;
  width: 26px;
  height: 26px;
  display: flex;
}


.sidebar-toggle {
  margin-right: $spacer;
}

// Sidebar header
.sidebar-header {
  background: transparent;
  padding: $sidebar-header-padding;
  font-size: $sidebar-header-font-size;
  color: $sidebar-header-color;
}

// Badge
.sidebar-badge {
  position: absolute;
  right: 15px;
  top: 14px;
  z-index: 1;
}

// Sidebar bottom
.sidebar-cta-content {
  padding: $sidebar-cta-padding;
  margin: $sidebar-cta-margin;
  border-radius: $sidebar-cta-border-radius;

  background: $sidebar-cta-bg;
  color: $sidebar-cta-color;
}

.sidebar-dropdown {

  .sidebar-item.active .sidebar-link {
    color: $primary;
    background: transparent;
  }

  .sidebar-item .sidebar-link:hover {
    background: transparent;
  }

  .sidebar-link {
    background: transparent;
    border-left: 0;
    color: $gray-500;
    font-size: 90%;
    font-weight: $font-weight-normal;
    padding-right: 1.5rem;
    padding-left: 3.25rem;

    &:hover::before {
      transform: translateX(4px);
    }

    &::before {
      content: "→";
      display: inline-block;
      left: -14px;
      position: relative;
      transform: translateX(0);
      transition: all .1s ease;
    }
  }

  .sidebar-dropdown .sidebar-link {
    padding-right: 1.5rem;
    padding-left: 4.5rem;
  }

}

.sidebar [data-bs-toggle=collapse]:after {
  border: solid;
  border-width: 0 0.075rem 0.075rem 0;
  content: " ";
  display: inline-block;
  padding: 2px;
  position: absolute;
  right: 1.5rem;
  top: calc(50% - 3px);
  transform: rotate(45deg);
  transition: all .2s ease-out;
}

.sidebar [data-bs-toggle=collapse][aria-expanded=true]:after {
  transform: rotate(-135deg);

}
