/**
 * MR -> show: Automerge widget
 *
 */

.space-children {
  @include clearfix;

  > * {
    float: left;
  }

  > *:not(:last-child) {
    margin-right: 10px;
  }
}

.mr-state-widget {
  color: $gl-text-color;
  border: 1px solid $border-color;
  border-radius: 2px;
  line-height: 28px;

  .mr-widget-heading,
  .mr-widget-section,
  .mr-widget-footer {
    padding: $gl-padding;
    border-top: solid 1px $border-color;
  }

  .mr-widget-footer {
    padding: 0;
  }

  form {
    margin-bottom: 0;

    .clearfix {
      margin-bottom: 0;
    }
  }

  label {
    margin-bottom: 0;
  }

  .btn {
    font-size: $gl-font-size;

    &[disabled] {
      opacity: 0.3;
    }

    &.btn-xs {
      line-height: 1;
      padding: 5px 10px;
      margin-top: 1px;
    }

    &.dropdown-toggle {
      .fa {
        color: inherit;
      }
    }
  }

  .accept-merge-holder {
    .accept-action {
      display: inline-block;
      float: left;

      .accept-merge-request {
        &.ci-pending,
        &.ci-running {
          @include btn-blue;
        }

        &.ci-skipped,
        &.ci-failed,
        &.ci-canceled,
        &.ci-error {
          @include btn-red;
        }
      }
    }

    .accept-control {
      display: inline-block;
      float: left;
      margin: 0;
      margin-left: 20px;
      padding: 5px;
      padding-top: 8px;
      line-height: 20px;

      &.right {
        float: right;
        padding-right: 0;
      }

      .modify-merge-commit-link {
        padding: 0;

        background-color: transparent;
        border: 0;

        color: $gl-text-color;

        &:hover,
        &:focus {
          text-decoration: underline;
        }
      }

      .merge-param-checkbox {
        margin: 0;
      }

      a .fa-question-circle {
        color: $gl-text-color-secondary;

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

  .ci-widget {
    color: $gl-text-color;
    display: flex;

    @media (max-width: $screen-xs-max) {
      flex-wrap: wrap;
    }
  }

  .mr-widget-icon {
    font-size: 22px;
    margin-right: $status-icon-margin;
  }

  .ci-status-icon svg {
    width: $status-icon-size;
    height: $status-icon-size;
    margin: 3px 0;
    position: relative;
    overflow: visible;
    display: block;
  }

  .mr-widget-pipeline-graph {
    padding: 0 4px;

    .dropdown-menu {
      z-index: 300;
    }

    .ci-action-icon-wrapper {
      line-height: 16px;
    }
  }

  .mini-pipeline-graph-dropdown-toggle {
    vertical-align: top;
  }

  .normal {
    line-height: 28px;
  }

  .capitalize {
    text-transform: capitalize;
  }

  .label-branch {
    @extend .ref-name;

    color: $gl-text-color;
    font-weight: $gl-font-weight-bold;
    overflow: hidden;
    word-break: break-all;

    &.label-truncated {
      position: relative;
      display: inline-block;
      width: 250px;
      margin-bottom: -3px;
      white-space: nowrap;
      text-overflow: clip;
      line-height: 14px;

      &::after {
        position: absolute;
        content: '...';
        right: 0;
        font-family: $regular_font;
        background-color: $gray-light;
      }
    }
  }

  .mr-widget-body {
    @include clearfix;

    &.media > *:first-child {
      margin-right: 10px;
    }

    .approve-btn {
      margin-right: 5px;
    }

    h4 {
      float: left;
      font-weight: $gl-font-weight-bold;
      font-size: 14px;
      line-height: inherit;
      margin-top: 0;
      margin-bottom: 0;

      &.has-conflicts .fa-exclamation-triangle {
        color: $gl-warning;
      }

      time {
        font-weight: $gl-font-weight-normal;
      }
    }

    .btn-grouped {
      margin-left: 0;
      margin-right: 7px;
    }

    label {
      font-weight: $gl-font-weight-normal;
    }

    .spacing {
      margin: 0 0 0 10px;
    }

    .bold {
      font-weight: $gl-font-weight-bold;
      color: $gl-gray-light;
    }

    .state-label {
      font-weight: $gl-font-weight-bold;
      padding-right: 10px;
    }

    .danger {
      color: $gl-danger;
    }

    .spacing,
    .bold {
      vertical-align: middle;
    }

    .dropdown-menu {
      li a {
        padding: 5px;
      }

      .merge-opt-icon {
        line-height: 1.5;
      }

      .merge-opt-title {
        margin-left: 8px;
      }
    }

    .dropdown-toggle {
      .fa {
        margin-left: 0;
        color: inherit;
      }
    }

    .has-custom-error {
      display: inline-block;
    }

    @media (max-width: $screen-xs-max) {
      p {
        font-size: 13px;
      }

      .btn-grouped {
        float: none;
        margin-right: 0;
      }

      .accept-action {
        width: 100%;
        text-align: center;
      }

      .accept-control {
        width: 100%;
        text-align: center;
        margin: 0;
      }
    }

    .commit-message-editor {
      label {
        padding: 0;
      }
    }

    &.mr-widget-empty-state {
      line-height: 20px;

      .artwork {
        margin-bottom: $gl-padding;
      }

      .text {
        span {
          font-weight: $gl-font-weight-bold;
        }

        p {
          margin-top: $gl-padding;
        }
      }
    }
  }

  .mr-widget-help {
    padding: 10px 16px 10px 48px;
    font-style: italic;
  }

  .ci-coverage {
    float: right;
  }

  .stop-env-container {
    color: $gl-text-color;
    float: right;

    a {
      color: $gl-text-color;
    }
  }
}

.mr-widget-body-controls {
  flex-wrap: wrap;
}

.mr_source_commit,
.mr_target_commit {
  margin-bottom: 0;

  .commit {
    margin: 0;
    padding: 10px;
    list-style: none;

    &:hover {
      background: none;
    }
  }
}

.commits-empty {
  text-align: center;

  h4 {
    padding-top: 20px;
    padding-bottom: 10px;
  }

  svg {
    width: 230px;
  }
}

.nothing-here-block {
  img {
    width: 230px;
  }
}

.mr-list {
  .merge-request {
    padding: 10px  0 10px 15px;
    position: relative;
    display: -webkit-flex;
    display: flex;

    .issue-info-container {
      -webkit-flex: 1;
      flex: 1;
    }

    .merge-request-title {
      margin-bottom: 2px;

      .ci-status-link {

        svg {
          height: 16px;
          width: 16px;
          position: relative;
          top: 3px;
        }

        &:hover,
        &:focus {
          text-decoration: none;
        }
      }
    }
  }

  .merge-request-labels {
    display: inline-block;
  }
}

.merge-request-angle {
  text-align: center;
  margin: 0 auto;
  font-size: 2em;
  line-height: 1.1;
}

// hide mr close link for inline diff comment form
.diff-file .close-mr-link,
.diff-file .reopen-mr-link {
  display: none;
}

#modal_merge_info .modal-dialog {
  .dark {
    margin-right: 40px;
  }

  .btn-clipboard {
    margin-right: 20px;
    margin-top: 5px;
    position: absolute;
    right: 0;
  }
}

.mr-links {
  padding-left: $status-icon-size + $status-icon-margin;
}

.mr-info-list {
  clear: left;
  position: relative;
  padding-top: 4px;

  p {
    margin: 0;
    position: relative;
    padding: 4px 0;

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

  &.mr-memory-usage {
    p {
      float: left;
    }

    .memory-graph-container {
      float: left;
      margin-left: 5px;
    }
  }
}

.mr-source-target {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  background-color: $gray-light;
  border-radius: $border-radius-default $border-radius-default 0 0;
  padding: $gl-padding / 2 $gl-padding;

  .dropdown-toggle .fa {
    color: $gl-text-color;
  }
}

.panel-new-merge-request {
  .panel-heading {
    padding: 5px 10px;
    font-weight: $gl-font-weight-bold;
    line-height: 25px;
  }

  .panel-body {
    padding: 10px 5px;
  }

  .panel-footer {
    padding: 0;

    .btn {
      min-width: auto;
    }
  }

  .commit {
    .commit-row-title {
      margin-bottom: 4px;
    }

    .item-title {
      @media (min-width: $screen-sm-min) {
        width: 45%;
      }
    }

    .avatar {
      left: 0;
      top: 2px;
    }
  }

  .btn-clipboard {
    margin-right: 5px;
    padding: 0;
    background: transparent;
  }

  .ci-status-link {
    margin-right: 5px;
  }
}

.merge-request-select {
  padding-left: 5px;
  padding-right: 5px;
  margin-bottom: 10px;

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

  @media (min-width: $screen-xs-min) {
    float: left;
    width: 50%;
    margin-bottom: 0;
  }

  .dropdown-menu-toggle {
    width: 100%;
  }

  .dropdown-menu {
    left: 5px;
    right: 5px;
    width: auto;
  }
}

.issuable-form-select-holder {
  display: inline-block;
  width: 250px;

  .dropdown-menu-toggle {
    width: 100%;
  }
}

.target-branch-select-dropdown-container {
  position: relative;
}

.assign-to-me-link {
  padding-left: 12px;
  white-space: nowrap;
}

.table-holder {
  .ci-table {

    th {
      background-color: $white-light;
      color: $gl-text-color-secondary;
    }
  }
}

.merged-buttons {
  .btn {
    float: left;
  }
}

.mr-version-controls {
  position: relative;
  background: $gray-light;
  color: $gl-text-color;
  z-index: 199;

  .mr-version-menus-container {
    display: -webkit-flex;
    display: flex;
    -webkit-align-items: center;
    align-items: center;
    padding: 16px;
  }

  .content-block {
    padding: $gl-padding-top $gl-padding;
  }

  .comments-disabled-notif {
    line-height: 28px;

    .btn {
      margin-left: 5px;
    }
  }

  .mr-version-dropdown,
  .mr-version-compare-dropdown {
    margin: 0 7px;
  }

  .dropdown-title {
    color: $gl-text-color;
  }

  .fa-info-circle {
    color: $orange-500;
    padding-right: 5px;
  }
}

.merge-request-tabs-holder {
  top: $header-height;
  z-index: 200;
  background-color: $white-light;
  border-bottom: 1px solid $border-color;

  @media (min-width: $screen-sm-min) {
    position: sticky;
    position: -webkit-sticky;
  }

  &.affix {
    left: 0;
    transition: right .15s;

    @media (max-width: $screen-xs-max) {
      right: 0;
    }

    .merge-request-tabs-container {
      padding-left: $gl-padding;
      padding-right: $gl-padding;
    }
  }

  .nav-links {
    border: 0;
  }
}

.with-performance-bar .merge-request-tabs-holder {
  top: $header-height + $performance-bar-height;
}

.merge-request-tabs {
  display: flex;
  margin-bottom: 0;
  padding: 0;
}

.limit-container-width {
  .merge-request-tabs-container {
    max-width: $limited-layout-width;
    margin-left: auto;
    margin-right: auto;

    .inner-page-scroll-tabs {
      background-color: $white-light;
      margin-left: -$gl-padding;
      padding-left: $gl-padding;
    }
  }
}

.merge-request-tabs-container {
  display: flex;
  justify-content: space-between;

  @media (max-width: $screen-xs-max) {
    flex-direction: column-reverse;
  }
}

.limit-container-width:not(.container-limited) {
  .merge-request-tabs-holder:not(.affix) {
    .merge-request-tabs-container {
      max-width: $limited-layout-width - ($gl-padding * 2);
    }
  }
}

.mr-memory-usage {
  p.usage-info-loading .usage-info-load-spinner {
    margin-right: 10px;
    font-size: 16px;
  }
}

.fork-sprite {
  margin-right: -5px;
}
