.suggest-colors {
  margin-top: 5px;

  a {
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: inline-block;
    margin-right: 10px;
    margin-bottom: 10px;
    text-decoration: none;
  }

  &.suggest-colors-dropdown {
    margin-top: 10px;
    margin-bottom: 10px;
    border-radius: $border-radius-base;
    overflow: hidden;

    a {
      border-radius: 0;
      width: (100% / 7);
      margin-right: 0;
      margin-bottom: -5px;
    }
  }
}

.dropdown-menu-labels {
  .dropdown-content {
    max-height: 135px;
  }
}

.dropdown-new-label {
  .dropdown-content {
    max-height: initial;
  }
}

.dropdown-label-color-input {
  position: relative;
  margin-bottom: 10px;

  &.is-active {
    padding-left: 32px;
  }
}

.dropdown-label-color-preview {
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  border-top-left-radius: $border-radius-base;
  border-bottom-left-radius: $border-radius-base;
}

.color-label {
  padding: 0 $grid-size;
  line-height: 16px;
  border-radius: $label-border-radius;
  color: $white-light;
}

.dropdown-labels-error {
  padding: 5px 10px;
  margin-bottom: 10px;
  background-color: $red-500;
  color: $white-light;
}

.manage-labels-list {
  padding: 0;
  margin-bottom: 0;

  > li:not(.empty-message):not(.is-not-draggable) {
    background-color: $white-light;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    padding: $gl-padding;
    border-radius: $border-radius-default;
    border: 1px solid $gray-100;

    &:last-child {
      margin-bottom: 0;
    }

    &.sortable-ghost {
      opacity: 0.3;
    }

    .prioritized-labels & {
      box-shadow: 0 1px 2px $issue-boards-card-shadow;
      cursor: move;
      cursor: grab;
      border: 0;

      &:active {
        cursor: grabbing;
      }
    }
  }

  .btn-action {
    .fa {
      font-size: 18px;
      vertical-align: middle;
      pointer-events: none;
    }

    &:hover {
      color: $blue-600;

      &.remove-row {
        color: $red-500;
      }
    }
  }

  .color-label {
    padding: $gl-padding-4 $grid-size;
  }
}

.prioritized-labels {
  margin-bottom: 30px;

  .add-priority {
    display: none;
    color: $gray-light;
  }

  li:hover {
    .draggable-handler {
      display: inline-block;
      opacity: 1;
    }
  }
}

.other-labels {
  .remove-priority {
    display: none;
  }
}

.filtered-labels {
  font-size: 0;
  padding: 12px 16px;

  .label-row {
    margin-top: 4px;
    margin-bottom: 4px;

    &:not(:last-child) {
      margin-right: 8px;
    }
  }

  .label-remove {
    border-left: 1px solid $label-remove-border;
    z-index: 3;
    border-radius: $label-border-radius;
    padding: 6px 10px 6px 9px;

    &:hover {
      box-shadow: inset 0 0 0 80px $label-remove-border;
    }
  }

  .btn {
    color: inherit;
  }

  a.btn {
    padding: 0;

    .has-tooltip {
      top: 0;
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
      line-height: 1.1;
    }
  }
}

.label-options-toggle {
  width: 100%;
}

.label-subscription {
  vertical-align: middle;

  .dropdown-group-label a {
    cursor: pointer;
  }
}

.label-subscribe-button {
  width: 105px;
  font-weight: 200;

  .label-subscribe-button-icon {
    &[disabled] {
      opacity: 0.5;
      pointer-events: none;
    }
  }

  .label-subscribe-button-loading {
    display: none;
  }

  &.disabled {
    .label-subscribe-button-icon {
      display: none;
    }

    .label-subscribe-button-loading {
      display: block;
    }
  }
}

.label-link {
  display: inline-flex;
  vertical-align: text-bottom;

  &:hover .color-label {
    text-decoration: underline;
  }

  .label {
    vertical-align: inherit;
    font-size: $label-font-size;
  }
}

.labels-container {
  background-color: $gray-light;
  border-radius: $border-radius-default;
  padding: $gl-padding $gl-padding-8;
}

.label-actions-list {
  list-style: none;
  flex-shrink: 0;
  text-align: right;
  padding: 0;
  position: relative;
  margin: 0;
}

.label-badge {
  color: $gray-900;
  font-weight: $gl-font-weight-normal;
  padding: $gl-padding-4 $gl-padding-8;
  border-radius: $border-radius-default;
  font-size: $label-font-size;
}

.label-badge-blue {
  background-color: $theme-blue-100;
}

.label-badge-gray {
  background-color: $gray-100;
}

.label-links {
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}

.label-link-item {
  padding: 0;
}

.label-description {
  .description-text {
    margin-bottom: 10px;

    .admin-labels & {
      margin-bottom: 0;
    }
  }
}

.label-list-item {
  .content-list &::before,
  .content-list &::after {
    content: none;
  }

  .label-name {
    width: 150px;
    flex-shrink: 0;

    .badge {
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
    }
  }

  .label-description {
    flex-grow: 1;

    a {
      color: $blue-600;
    }
  }

  .label {
    padding: 4px $grid-size;
    font-size: $label-font-size;
    position: relative;
    top: $gl-padding-4;
  }

  .label-action {
    color: $gray-800;
    cursor: pointer;

    svg {
      fill: $gray-800;
    }

    &:hover {
      color: $blue-600;

      svg {
        fill: $blue-600;
      }
    }

    &.remove-row {
      &:hover {
        color: $red-500;

        svg {
          fill: $red-500;
        }
      }
    }
  }
}

@media (max-width: map-get($grid-breakpoints, md)-1) {
  .manage-labels-list {
    > li:not(.empty-message):not(.is-not-draggable) {
      flex-wrap: wrap;
    }

    .label-name {
      order: 1;
      flex-grow: 1;
      width: auto;
      max-width: 100%;
    }

    .label-actions-list {
      order: 2;
      flex-shrink: 1;
      text-align: left;
    }

    .label-links {
      white-space: normal;
    }

    .label-description {
      order: 3;
      width: 100%;

      > .append-right-default.prepend-left-default {
        margin-left: 0;
        margin-right: 0;
      }
    }
  }
}

@media (max-width: 910px) {
  .priority-badge {
    display: block;
    width: 100%;
    margin-left: 0;
    margin-top: $gl-padding;

    .label-badge {
      display: inline-block;
    }
  }
}

.priority-labels-empty-state .svg-content img {
  max-width: $priority-label-empty-state-width;
}

.scoped-label-tooltip-title {
  color: $indigo-300;
}

.scoped-label-wrapper {
  max-width: 100%;
  vertical-align: top;

  .badge {
    text-overflow: ellipsis;
    overflow-x: hidden;
  }

  &.label-link .color-label a {
    color: inherit;
  }

  .color-label {
    padding-right: $gl-padding-24;
    max-width: 100%;
  }

  .scoped-label {
    position: absolute;
    top: 4px;
    right: 8px;
    padding: 0;
    margin: 0;
    line-height: $gl-line-height;
  }
}

// Label inside title of Delete Label Modal
.modal-header .page-title {
  .scoped-label-wrapper {
    .scoped-label {
      line-height: 20px;
    }

    span.color-label {
      padding-right: $gl-padding-24;
    }
  }
}

// Don't hide the overflow in system messages
.system-note-message,
.issuable-detail {
  .scoped-label-wrapper {
    .badge {
      overflow: initial;
    }
  }
}
