.rui-breadcrumbs {
  margin-top: 20px;
  margin-bottom: 20px;

  @include media-breakpoint-between(xs, sm) {
  margin-top: 6px;
  }
}

.breadcrumb,
.coursefilesbreadcrumb {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;

  z-index: 0;

  @include font-size($breadcrumb-font-size);
  list-style: none;

  @include media-breakpoint-between(xs, sm) {
    width: max-content;
    justify-content: center;
    margin: 0 auto;
  }
}

.breadcrumbs-container {
  @include media-breakpoint-up(lg) {
    width: 100%;
  }

  @include media-breakpoint-between(xs, sm) {
    margin-left: auto;
    margin-right: auto;
    padding: 0 0 5px;
    overflow-x: auto;

    .pagelayout-incourse &,
    .pagelayout-course & {
      width: calc(100% - 100px);
    }
  }

}

.breadcrumb--in-content {
  margin: 0;
}

.breadcrumb-item {
  display: flex;
  color: $breadcrumb-color;

  &:hover {
    color: $link-hover-color;
  }

  .theme-dark & {
    color: $dm-breadcrumb-color;
  }

  &:first-child {
    a {
      color: $body-color-light;

      .theme-dark & {
        color: $dm-body-color-light;
      }
    }
  }

  .text-truncate {
    max-width: 300px;
  }

  // The separator between breadcrumbs (by default, a forward-slash: "/")
  +.breadcrumb-item {

    &::before {
      display: inline-flex; // Suppress underlining of the separator in modern browsers
      align-items: center;
      padding-right: $breadcrumb-item-padding;
      font-size: 10px;
      color: $breadcrumb-divider-color;
      content: escape-svg($breadcrumb-divider);

      .theme-dark & {
        color: $dm-breadcrumb-divider-color;
      }
    }
  }

  &.breadcrumb-item--last {
    opacity: .6;
  }

  // IE9-11 hack to properly handle hyperlink underlines for breadcrumbs built
  // without `<ul>`s. The `::before` pseudo-element generates an element
  // *within* the .breadcrumb-item and thereby inherits the `text-decoration`.
  //
  // To trick IE into suppressing the underline, we give the pseudo-element an
  // underline and then immediately remove it.
  +.breadcrumb-item:hover::before {
    text-decoration: underline;
  }

  // stylelint-disable-next-line no-duplicate-selectors
  +.breadcrumb-item:hover::before {
    text-decoration: none;
  }


  &.active {
    color: $breadcrumb-active-color;

    &:after {
      content: '';
      background-color: var(--primary-color-100);

      border-radius: $btn-border-radius;

      position: absolute;
      left: -3px;
      top: -2px;
      width: calc(100% + 6px);
      height: calc(100% + 4px);
      z-index: -1;

      .theme-dark & {
        background-color: $dm-gray-700;
      }
    }

    .theme-dark & {
      color: $dm-breadcrumb-active-color;
    }
  }

  .breadcrumbs-textonly {
    margin: 0.25rem 0;
    display: grid;
    color: $breadcrumb-active-color;
  }

  a,
  .breadcrumbs-textonly {
    position: relative;
    display: inline-flex;
    z-index: 1;

    padding: 3px 0;
    margin: .25rem 8px .25rem 0;

    transition: $transition-base;
  }

  a {
    color: $breadcrumb-color;
    font-weight: $font-weight-medium;

    .theme-dark & {
      color: $dm-breadcrumb-color;
    }

    .text-truncate {
      display: inline-block;
      max-width: 200px;
    }

    &:hover {
      text-decoration: none;
      color: var(--main-theme-color);

      .theme-dark & {
        color: $dm-breadcrumb-active-color;
      }
    }
  }
}