@import '../colors';

.popover {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1060;
  max-width: 276px;
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
    Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji,
    Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
  font-style: normal;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  text-align: start;
  text-decoration: none;
  text-shadow: none;
  text-transform: none;
  letter-spacing: normal;
  word-break: normal;
  word-spacing: normal;
  white-space: normal;
  line-break: auto;
  font-size: 0.875rem;
  word-wrap: break-word;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0.3rem;

  .arrow {
    position: absolute;
    display: block;
    width: 1rem;
    height: 0.5rem;
    margin: 0 0.3rem;

    &:before,
    &:after {
      position: absolute;
      display: block;
      content: '';
      border-color: transparent;
      border-style: solid;
    }
  }
}

.popover-auto[x-placement^='right'],
.popover-right {
  & > .arrow {
    left: calc(-0.5rem + -1px);
    width: 0.5rem;
    height: 1rem;
    margin: 0.3rem 0;

    &:before {
      left: 0;
      border-width: 0.5rem 0.5rem 0.5rem 0;
      border-right-color: rgba(0, 0, 0, 0.25);
    }

    &:after {
      left: 1px;
      border-width: 0.5rem 0.5rem 0.5rem 0;
      border-right-color: #fff;
    }
  }
}

.popover-auto[x-placement^='left'],
.popover-left {
  & > .arrow {
    right: calc(-0.5rem + -1px);
    width: 0.5rem;
    height: 1rem;
    margin: 0.3rem 0;

    &:before {
      right: 0;
      border-width: 0.5rem 0 0.5rem 0.5rem;
      border-left-color: rgba(0, 0, 0, 0.25);
    }

    &:after {
      right: 1px;
      border-width: 0.5rem 0 0.5rem 0.5rem;
      border-left-color: #fff;
    }
  }
}

.popover-auto[x-placement^='top'],
.popover-top {
  & > .arrow {
    bottom: calc(-0.5rem + -1px);

    &:before {
      bottom: 0;
      border-width: 0.5rem 0.5rem 0;
      border-top-color: rgba(0, 0, 0, 0.25);
    }

    &:after {
      bottom: 1px;
      border-width: 0.5rem 0.5rem 0;
      border-top-color: #fff;
    }
  }
}

.popover-auto[x-placement^='bottom'],
.popover-bottom {
  & > .arrow {
    left: calc(-0.5rem + -1px);
    width: 0.5rem;
    height: 1rem;
    margin: 0.3rem 0;

    &:before {
      left: 0;
      border-width: 0.5rem 0.5rem 0.5rem 0;
      border-right-color: rgba(0, 0, 0, 0.25);
    }

    &:after {
      left: 1px;
      border-width: 0.5rem 0.5rem 0.5rem 0;
      border-right-color: #fff;
    }
  }
}

.popover-header {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0;
  font-size: 1rem;
  background-color: #f7f7f7;
  border-bottom: 1px solid #ebebeb;
  border-top-left-radius: calc(0.3rem - 1px);
  border-top-right-radius: calc(0.3rem - 1px);
}

.popover-body {
  padding: 0.5rem 0.75rem;
}
