/**
 * MR -> show: Automerge widget
 *
 */
.mr-state-widget {
  background: $background-color;
  color: $gl-gray;
  border: 1px solid $border-color;
  @include border-radius(2px);

  form {
    margin-bottom: 0;
    .clearfix {
      margin-bottom: 0;
    }
  }

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

      .accept_merge_request {
        &.ci-pending,
        &.ci-running {
          @include btn-orange;
        }

        &.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;
        a {
          color: $gl-gray;
        }
      }

      .remove_source_checkbox {
        margin: 0;
      }
    }
  }

  .ci_widget {
    border-bottom: 1px solid #eef0f2;

    svg {
      margin-right: 4px;
      position: relative;
      top: 1px;
      overflow: visible;
    }

    &.ci-success {
      color: $gl-success;

      a.environment {
        color: inherit;
      }
    }

    &.ci-success_with_warnings {
      color: $gl-success;

      i {
        color: $gl-warning;
      }
    }

    &.ci-skipped {
      background-color: #eee;
      color: #888;
    }

    &.ci-pending {
      color: $gl-warning;
    }

    &.ci-running {
      color: $blue-normal;
    }

    &.ci-failed,
    &.ci-error {
      color: $gl-danger;
    }

    &.ci-canceled {
      color: $gl-gray;
    }

    a.monospace {
      color: inherit;
    }
  }

  .mr-widget-body,
  .ci_widget,
  .mr-widget-footer {
    padding: $gl-padding;
  }

  .normal {
    color: #5c5d5e;
  }

  .mr-widget-body {
    h4 {
      font-weight: 600;
      font-size: 17px;
      margin: 5px 0;
      color: $gl-gray-dark;

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

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

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

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

      p {
        font-size: 13px;
      }

      .btn,
      .btn-group,
      .accept-action {
        margin-bottom: 4px;
      }

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

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

  .mr-widget-footer {
    border-top: 1px solid #eee;
  }

  .ci-coverage {
    float: right;
  }
}

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

  .commit {
    margin: 0;
    padding-top: 2px;
    padding-bottom: 2px;
    list-style: none;
    &:hover {
      background: none;
    }
  }
}

.label-branch {
  color: $gl-gray-dark;
  font-family: $monospace_font;
  font-weight: bold;
  overflow: hidden;
  font-size: 90%;
  margin: 0 3px;
  word-break: break-all;
}

.mr-list {
  .merge-request {
    padding: 10px 15px;
    position: relative;

    .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-no-comments {
    opacity: 0.5;
  }
}

.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 {
  width: 600px;

  .btn-clipboard {
    @extend .pull-right;

    margin-right: 20px;
    margin-top: 5px;
    position: absolute;
    right: 0;
  }
}

.mr-source-target {
  line-height: 31px;
}

.builds {
  .table-holder {
    overflow-x: scroll;
  }
}

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

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

  .panel-footer {
    padding: 5px 10px;

    .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;
    }

    .commit-row-info {
      line-height: 20px;
    }
  }

  .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;
}

.table-holder {
  .builds {

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

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

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

.merge-request-details {

  .title {
    margin-bottom: 20px;
  }
}
