// Lightning Design System 2.264.0-beta.1
// Copyright (c) 2015-present, salesforce.com, inc. All rights reserved
// Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license

/**
 * Error popovers are used to notify the user of errors on the page
 *
 * If the elements within the error popover exceed 150px, use the `.slds-popover__body_scrollable`  modifier on the body element.
 *
 * In some cases, such as displaying a list of menu items, padding may not be necessary in the popover body. To remove the padding, add the `slds-p-around_none" utility class to the body element.
 *
 * @summary Initializes an error non-modal dialog
 *
 * @name error
 * @selector .slds-popover_error
 * @restrict .slds-popover
 * @support dev-ready
 * @variant
 */

.slds-popover_error {

  .slds-popover__header {
    background-color: var(--slds-g-color-error-base-30, #{$color-background-error-dark});
    color: var(--slds-g-color-neutral-base-100, #{$color-text-inverse});
    padding-left: $spacing-small;
  }

  .slds-popover__footer {
    background-color: transparent;

    .slds-button {
      text-decoration: none;

      &.slds-button_neutral {
        color: $brand-accessible;
      }
    }
  }

  &.slds-nubbin_top,
  &.slds-nubbin--top,
  &.slds-nubbin_top-left,
  &.slds-nubbin--top-left,
  &.slds-nubbin_top-right,
  &.slds-nubbin--top-right,
  &.slds-nubbin_left-top,
  &.slds-nubbin--left-top,
  &.slds-nubbin_right-top,
  &.slds-nubbin--right-top {

    &:before {
      background-color: var(--slds-g-color-error-base-30, #{$color-background-error-dark});
    }
  }

  .slds-popover__body {
    padding-left: 2.5rem;
  }
}

.slds-popover_error,
.slds-popover_warning {

  .slds-popover__header {
    border-radius: calc(#{$border-radius-medium} - 1px) calc(#{$border-radius-medium} - 1px) 0 0;
  }

  /**
   * @summary Applies scrollable styles for popovers
   * @selector .slds-popover__body_scrollable
   * @restrict .slds-popover_error .slds-popover__body, .slds-popover_warning .slds-popover__body
   */
  .slds-popover__body_scrollable {

    max-height: 150px;
    overflow-y: auto;
    border-bottom: $border-width-thin solid var(--slds-g-color-border-base-1, #{$color-border});

    + .slds-popover__footer {
      border-top: 0;
    }
  }
}
