.ebs-layout {
  &__top-bar-mobile {
    display: none;
  }

  &__sidebar--untoggled.ebs-layout__sidebar--has-options {
    @media (min-width: 54.84714em) {
      .ebs-sidebar + .ebs-layout__container > .ebs-layout__content-wrapper,
      .ebs-sidebar + .ebs-layout__container + .ebs-layout__footer {
        width: calc(100% - 27.3936rem);
      }
    }

    @media (max-width: 54.84714em) {
      .ebs-sidebar.ebs-sidebar__mobile--closed {
        transform: translateX(-200%);
      }
    }
  }

  &__sidebar--toggled {
    .ebs-sidebar + .ebs-layout__container > .ebs-layout__content-wrapper,
    .ebs-sidebar + .ebs-layout__container + .ebs-layout__footer {
      // 57px
      width: calc(100% - 3.95224rem);
    }

    @media (max-width: 53.24124em) {
      .ebs-sidebar + .ebs-layout__container > .ebs-layout__content-wrapper,
      .ebs-sidebar + .ebs-layout__container + .ebs-layout__footer {
        width: 100%;
      }
    }

    &.ebs-layout__sidebar--has-options {
      @media (min-width: 53.24124em) {
        .ebs-sidebar + .ebs-layout__container > .ebs-layout__content-wrapper,
        .ebs-sidebar + .ebs-layout__container + .ebs-layout__footer {
          width: calc(100% - 17.75772rem);
        }
      }

      @media (max-width: 53.24124em) {
        .ebs-sidebar + .ebs-layout__container > .ebs-layout__content-wrapper,
        .ebs-sidebar + .ebs-layout__container + .ebs-layout__footer {
          width: 100%;
        }

        .ebs-sidebar.ebs-sidebar__mobile--closed {
          transform: translateX(-500%);
        }
      }

      .ebs-sidebar__item {
        border-right: none;
      }
    }
  }

  .ebs-sidebar + &__container > &__content-wrapper,
  .ebs-sidebar + &__container &__footer {
    transition: width $transition-time;
    margin-left: auto;

    // 191px
    width: calc(100% - #{rem($sidebar-width)});
  }

  &__top-bar + &__container > &__content-wrapper {
    position: relative;
    min-height: calc(100% - #{$layout-top-bar-height});
  }

  &__content {
    width: 100%;
    background-color: $layout-content-background;
    height: calc(100vh - #{$layout-top-bar-height * 2});
    margin: 0 auto;
    padding: rem(15px 25px);

    .ebs-breadcrumbs__wrapper {
      margin-bottom: rem(20px);

      + .ebs-card .ebs-card__header {
        padding-top: 0;
      }
    }
  }

  &__content.ebs-layout--has-footer {
    padding-bottom: rem($layout-footer-height);
  }

  &__top-bar + &__container,
  &__top-bar + .ebs-sidebar + &__container {
    height: calc(100vh - #{rem($layout-top-bar-height)});
    overflow: hidden auto;
  }

  &__container--has-fixed-footer &__content-wrapper {
    padding-bottom: rem($layout-footer-height);
  }

  &__container &__content {
    height: 100%;
  }

  &__footer {
    background-color: $layout-footer-background;
    height: rem($layout-footer-height);
    display: flex;
    align-items: center;
    color: $grey-300;

    &--fixed {
      border-top: $layout-footer-fixed-border;
      background: $white;
      position: fixed;
      bottom: 0;
      right: 0;
    }

    span {
      @include fontRegular;
      display: block;
      margin: 0 auto;
    }
  }

  &__top-bar + .ebs-sidebar {
    @include flex-column;
    margin-top: rem($layout-top-bar-height);
    height: calc(100vh - #{rem($layout-top-bar-height)});

    @include mq($until: small-desktop) {
      margin-top: 0;
      height: 100vh;
    }

    &--toggled .ebs-label {
      @include text-ellipsis;
      padding: rem(0 calc(#{$gutter-size} / 3));
    }
  }

  @include mq($until: small-desktop) {
    &__content-wrapper,
    &__footer {
      width: 100% !important;
    }

    &__top-bar {
      padding-left: 0;

      &-mobile {
        display: flex;
        align-items: center;

        &--toggler {
          cursor: pointer;
          position: relative;
          height: rem($layout-top-bar-height);
          width: rem($layout-top-bar-height);
          border-right: 1px solid $layout-top-bar-toggler-border-color;

          &:hover {
            background-color: var(--primary-000);

            .ebs-icon {
              color: $layout-top-bar-toggler-hover-color;
            }
          }

          .ebs-icon {
            position: absolute;
            left: 50%;
            top: 50%;
            color: $layout-top-bar-toggler-color;
            transform: translate(-50%, -50%);
          }
        }
      }
    }

    &__top-bar-title {
      display: none;
    }
  }
}

.ebs-layout__top-bar-top,
.ebs-layout__top-bar-bottom,
.ebs-layout__footer-bar-top,
.ebs-layout__footer-bar-bottom {
  user-select: none;
}

.ebs-layout__top-bar {
  height: rem($layout-top-bar-height);
  display: flex;
  align-items: center;
  transition: width $transition-time;
  width: 100%;
  padding: rem($gutter-size 24px);
  border-bottom: $layout-top-bar-border-color;
  background-color: $layout-top-bar-background;

  &--fixed {
    position: fixed;
    right: 0;
    top: 0;
    z-index: 3;

    + .ebs-sidebar + .ebs-layout__content-wrapper {
      padding-top: rem($layout-top-bar-height);
    }
  }

  &-title {
    cursor: pointer;
    font-size: rem(14px);
    @include fontBold;
    min-width: rem($sidebar-width - $gutter-size);

    img {
      max-width: rem($sidebar-logo-width);
    }

    svg:first-child {
      font-size: rem($sidebar-logo-width);
    }

    &::after {
      content: '';
      width: 1px;
      height: rem($layout-top-bar-height);
      border-right: 1px solid $layout-top-bar-toggler-border-color;
      position: absolute;
      top: 0;
      left: rem($sidebar-width - 1px);
    }
  }

  &-left {
    width: 100%;
    margin-left: rem($layout-top-bar-side-left-margin-left);
  }

  &-left ~ &-title {
    width: auto;
  }

  &-left,
  &-right {
    display: flex;
    align-items: center;
    white-space: nowrap;
  }

  &-right {
    margin-left: rem($layout-top-bar-side-right-margin-left);
    width: 100%;
    justify-content: flex-end;

    > *:not(:first-child) {
      margin-left: rem($base-size);
    }

    &-item {
      display: flex;
      align-items: center;
      margin-left: rem($gutter-size);

      > *:not(:first-child) {
        margin-left: rem($gutter-size);
      }
    }
  }
}
