// Copyright 2017 Palantir Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0.

@import "../../common/variables";

$select-padding: $pt-spacing;

.#{$ns}-select-popover {
  .#{$ns}-popover-content {
    // use padding on container rather than margin on input group
    // because top margin leaves some empty space with no background color.
    padding: $select-padding;
  }

  .#{$ns}-input-group {
    margin-bottom: 0;
  }

  .#{$ns}-menu {
    // offset the padding added by the select componenent so menu can remain full width with padding on either side
    // this is important so menu dividers can be full width, and so that menu items can have padding to the left and right
    // for menu items
    margin-left: -$select-padding;
    margin-right: -$select-padding;
    max-height: $select-popover-max-height;
    max-width: $select-popover-max-width;
    overflow: auto;
    padding: 0 $select-padding;

    &:not(:first-child) {
      // adjust padding to account for that on .#{$ns}-popover-content above
      padding-top: $select-padding;
    }
  }

  &.#{$ns}-popover-match-target-width {
    width: 100%;

    .#{$ns}-menu {
      max-width: none;
      min-width: 0;
    }
  }
}
