// Object Browser Container

@keyframes sidebar-toggle-button-before-highlight {
  0% {
    background: @sidebarToggleButtonHighlightColor;
  }

  25% {
    background: @sidebarToggleButtonHighlightColor;
  }

  50% {
    background: @sidebarToggleButtonHighlightColor;
  }

  75% {
    background: @blue;
  }

  100% {
    background: @blue;
  }
}

@keyframes sidebar-toggle-button-highlight {
  0% {
    opacity: @sidebarToggleButtonNormalOpacity;
  }

  25% {
    opacity: 1;
  }

  50% {
    opacity: @sidebarToggleButtonNormalOpacity;
  }

  100% {
    opacity: @sidebarToggleButtonNormalOpacity;
  }

  100% {
    opacity: @sidebarToggleButtonNormalOpacity;
  }
}

@media only screen and (max-width: @largestMobileScreen) {
  .has-toolbar {
    .sidebar-container {
      top: 100px;
      bottom: 0;
      height: calc(100vh - 100px);
    }
  }

  .has-toolbar-collapsed {
    .sidebar-container {
      top: 20px;
      bottom: 0;
      height: calc(100vh - 20px);
    }
  }
}

.ui.button.full-size-sidenav-btn {
  position: absolute;
  top: 0;
  padding: 12px 6px;
  background: transparent;
}

.full-size-icon {
  height: @fullSizeIcon !important;
  color: #bac5c7;
}

.sidebar-container {
  position: fixed;
  z-index: 150;
  top: 0;
  right: 0;
  width: 375px;
  height: 100vh;
  background-color: #fff;
  box-shadow: 0 1px 2px 0 #c7d5d8;
  transition: right 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045),
    height 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045),
    width 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045),
    top 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045);

  &.collapsed {
    right: -355px;

    .tabs-wrapper {
      opacity: 0;
      transition: opacity 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045);
    }
  }

  &.full-size {
    width: calc(100% - @toolbarWidth);

    &.no-toolbar {
      width: calc(100% - @toolbarWidthMin);
    }
  }

  @media (max-width: 400px) {
    width: 100vw;
    max-width: 375px;

    &.collapsed {
      right: calc(-100vw + 20px);
    }
  }

  .ui.raised.segments {
    display: flex;
    height: 100%;
    flex-direction: column;
  }

  button {
    // Default reset for button
    padding: 0;
    border: 0;
    background: transparent;
    text-align: initial;

    &:focus {
      outline: none;
    }
  }

  .trigger,
  .trigger:focus,
  .trigger:hover {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 0;
    width: 20px;
    height: 80px;
    padding: 0;
    margin-top: -40px;
    animation: sidebar-toggle-button-highlight
      @sidebarToggleButtonAnimationsDuration;
    animation-iteration-count: @sidebarToggleButtonIterations;
    background: transparent;
    border-radius: 0;
    opacity: @sidebarToggleButtonNormalOpacity;
    transition: opacity 0.3s;
  }

  .trigger:hover {
    opacity: 0.3;
    transition: opacity 0.3s;
  }

  .trigger:before {
    position: relative;
    left: 8px;
    display: block;
    width: 4px;
    height: 100%;
    animation: sidebar-toggle-button-before-highlight
      @sidebarToggleButtonAnimationsDuration;
    animation-iteration-count: 3;
    background: @blue;
    content: '';
  }

  .tab-wrapper {
    height: calc(100% - 61px);
    padding: 0;
    border-bottom: none;
    overflow-x: hidden;
    overflow-y: auto;

    > * {
      display: none;
    }

    > :last-child {
      display: block;
    }
  }

  .tabs-wrapper {
    height: 100%;

    .formtabs.menu {
      a:first-child {
        margin-left: 36px;
      }
    }
  }

  .tab-forbidden {
    margin: calc(50% - 24px) auto;
    color: #bac5c7;
  }

  header {
    display: flex;
    height: 60px;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    border-bottom: 4px solid #b8c6c8;

    .icon {
      padding-right: 10px;
    }

    h2 {
      flex: 1 0 auto;
      margin: 0 !important;
      color: #517776;
      font-size: 16px;
    }

    form {
      flex: 1 0 auto;
    }

    .search {
      width: 100%;

      input {
        border: none;
      }
    }

    a {
      display: flex;
    }

    &.pulled {
      justify-content: flex-start;
      padding-right: 10px;
      padding-left: 10px;

      button {
        margin-right: 10px;
        cursor: pointer;
      }
    }
  }

  .ui.segment:not(.tab) {
    border-bottom: 1px solid #b8c6c8;
  }

  .ui.segment.tabbed-actions {
    display: flex;
    justify-content: space-around;
    padding: 0;
    border-top: 1px solid #b8c6c8;
    border-bottom: 1px solid #b8c6c8;

    .ui.buttons {
      width: 100%;

      .button:last-child {
        border-radius: 0;
      }
    }

    .ui.basic.active.button {
      background-color: #edf1f2 !important;
    }
  }

  .ui.segment.object-listing {
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: scroll;
  }

  .ui.icon.button {
    &:hover {
      background-color: #edf1f2 !important;
    }
  }

  ul {
    flex: 1 0 auto;
    margin: 0;

    li {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 0 10px 5px;
      cursor: pointer;

      .ui.basic.icon.button {
        margin-right: 5px;
      }

      &.selected-item {
        background-color: @tealBackground;

        .right-arrow-icon:hover {
          background: #fff;
        }
      }

      &.disabled {
        opacity: 0.5;
      }

      .right-arrow-icon {
        border-radius: 4px;
      }

      .right-arrow-icon:hover {
        background: #edf1f2;
      }

      .right-arrow-link-mode {
        display: flex;
        width: 50px;
        justify-content: flex-end;
      }

      span {
        display: flex;
        align-items: center;

        .icon {
          padding-right: 10px;
        }
      }
    }
  }

  .ui.segment.form.actions,
  .ui.segment.form.sidebar-image-data {
    padding-bottom: 1em;
  }

  .ui.accordion {
    .title {
      display: flex;
      justify-content: space-between;
    }

    .content {
      padding: 0;
    }
  }

  .infos {
    color: @grey;
    font-size: 0.8rem !important;
  }
}

#sidebar .pusher.expanded {
  margin-left: 375px;
}

#sidebar .pusher {
  margin-left: 20px;
  transition: margin-left 0.3s cubic-bezier(0.6, -0.28, 0.735, 0.045);
}

#sidebar-properties {
  header {
    border-bottom: 2px solid #b8c6c8;
  }
}

// Animation
.sidebar-container {
}

.sidebar-container-enter {
  .sidebar-container;

  transform: translate(100%, 0%);
}

.sidebar-container-enter.sidebar-container-enter-active {
  .sidebar-container;

  transform: translate(0%, 0%);
  transition: transform 0.5s cubic-bezier(0.09, 0.11, 0.24, 0.91);
}

.sidebar-container-enter-done {
  .sidebar-container;
}

.sidebar-container-exit {
  .sidebar-container;

  transform: translate(0%, 0%);
  transition: transform 0.5s cubic-bezier(0.09, 0.11, 0.24, 0.91);
}

.sidebar-container-exit.sidebar-container-exit-active {
  .sidebar-container;

  transform: translate(100%, 0%);
  transition: transform 0.5s cubic-bezier(0.09, 0.11, 0.24, 0.91);
}

.sidebar-metadata-container {
  display: flex;
  justify-content: space-between;
}

.field-file-name {
  display: flex;
  align-items: flex-end;
  padding: 20px 0;
  overflow-wrap: anywhere;
}

.field-image_size,
.align-tools {
  display: flex !important;
  align-items: center;

  .ui.icon.button {
    padding: 4px;
    margin-left: 4px;
    border-radius: 1px;
    color: @brown !important;

    &:hover {
      background-color: #edf1f2 !important;
    }
  }

  .ui.buttons:first-child .ui.icon.button {
    margin-left: 0;
  }

  .ui.active.basic.icon.button {
    border: 1px solid #2996da;
    background: transparent !important;
  }
}

// #field-image_size .ui.grid > .stretched.row > .column {
//   flex-direction: row;
// }

.image-sizes-text {
  width: 24px;
  font-size: @20px;
  line-height: 24px;
  text-align: center;
}

.ui.icon.input + button {
  position: absolute;
  top: 0;
  right: 10px;
  width: 2.67142857em;
  height: 100%;
  padding: 4px;
  margin: 0;
  border-radius: 1px;
  color: @brown !important;
  line-height: 1;
  text-align: center;

  &:hover {
    background-color: #edf1f2 !important;
  }
}

// Breadcrumbs of sidebar

.sidebar-container {
  .home-icon {
    padding-left: 5px;
  }

  .ui.breadcrumb .divider {
    margin-right: 5px;
    margin-left: 5px;
  }
}
