@import 'variables';

.ra-popup {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  display: -webkit-flex;
  display: flex;
  will-change: transform;
  pointer-events: none;
  &.ra-popup-hide {
    display: none;
  }

  .ra-popup-content {
    position: relative;
    padding: 16px;
    font-size: 14px;
    background: #fff;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);

    .ra-popup-content__title {
      margin-bottom: 8px;
      font-weight: bold;
    }

    .ra-popup-close-button,
    .ra-popup-content__title,
    .ra-popup-content__panel {
      white-space: normal;
      user-select: text;
      pointer-events: initial;
    }

    .ra-popup-close-button {
      position: absolute;
      top: 0;
      right: 0;
      width: 18px;
      height: 18px;
      padding: 0;
      font-size: 14px;
      line-height: 18px;
      text-align: center;
      background-color: transparent;
      border: 0;
      border-radius: 0 3px 0 0;
      cursor: pointer;
    }
  }

  .ra-popup-tip {
    position: relative;
    z-index: 1;
    width: 0;
    height: 0;
    border: 10px solid transparent;
  }

  &.ra-popup-anchor-bottom,
  &.ra-popup-anchor-bottom-left,
  &.ra-popup-anchor-bottom-right {
    -webkit-flex-direction: column-reverse;
    flex-direction: column-reverse;
    .ra-popup-tip {
      bottom: 1px;
    }
  }

  &.ra-popup-anchor-top,
  &.ra-popup-anchor-top-left,
  &.ra-popup-anchor-top-right {
    -webkit-flex-direction: column;
    flex-direction: column;
    .ra-popup-tip {
      top: 1px;
    }
  }

  &.ra-popup-anchor-left {
    -webkit-flex-direction: row;
    flex-direction: row;
  }

  &.ra-popup-anchor-right {
    -webkit-flex-direction: row-reverse;
    flex-direction: row-reverse;
  }
}

.ra-popup-anchor-top .ra-popup-tip {
  position: relative;
  -webkit-align-self: center;
  align-self: center;
  border-top: none;
  border-bottom-color: #fff;
}

.ra-popup-anchor-top-left .ra-popup-tip {
  -webkit-align-self: flex-start;
  align-self: flex-start;
  border-top: none;
  border-bottom-color: #fff;
  border-left: none;
}

.ra-popup-anchor-top-right .ra-popup-tip {
  -webkit-align-self: flex-end;
  align-self: flex-end;
  border-top: none;
  border-right: none;
  border-bottom-color: #fff;
}

.ra-popup-anchor-bottom .ra-popup-tip {
  -webkit-align-self: center;
  align-self: center;
  border-top-color: #fff;
  border-bottom: none;
}

.ra-popup-anchor-bottom-left .ra-popup-tip {
  -webkit-align-self: flex-start;
  align-self: flex-start;
  border-top-color: #fff;
  border-bottom: none;
  border-left: none;
}

.ra-popup-anchor-bottom-right .ra-popup-tip {
  -webkit-align-self: flex-end;
  align-self: flex-end;
  border-top-color: #fff;
  border-right: none;
  border-bottom: none;
}

.ra-popup-anchor-left .ra-popup-tip {
  -webkit-align-self: center;
  align-self: center;
  border-right-color: #fff;
  border-left: none;
}

.ra-popup-anchor-right .ra-popup-tip {
  right: 1px;
  -webkit-align-self: center;
  align-self: center;
  border-right: none;
  border-left-color: #fff;
}

.ra-popup-anchor-top-left .ra-popup-content {
  border-top-left-radius: 0;
}

.ra-popup-anchor-top-right .ra-popup-content {
  border-top-right-radius: 0;
}

.ra-popup-anchor-bottom-left .ra-popup-content {
  border-bottom-left-radius: 0;
}

.ra-popup-anchor-bottom-right .ra-popup-content {
  border-bottom-right-radius: 0;
}

.ra-popup-track-pointer {
  display: none;
  * {
    user-select: none;
    pointer-events: none;
  }
}

.ra-map:hover .ra-popup-track-pointer {
  display: flex;
}

.ra-map:active .ra-popup-track-pointer {
  display: none;
}
