/**
 * Copyright 2024 Phenix Real Time Solutions, Inc. Confidential and Proprietary. All Rights Reserved.
 */
import * as styled from 'styled-components';
import Theme from 'theme';

const {colors, spacing, typography} = Theme;

export const TooltipContainer = styled.default.span`
  position: relative;
`;

export const TooltipBubble = styled.default.div<{width?: number}>`
  min-width: 120px;
  max-width: 600px;
  width: ${({width}) => width}px;
  word-wrap: break-word;
  position: absolute;
  z-index: 999;
  &::after {
    content: '';
    position: absolute;
  }
  &.tooltip-top {
    bottom: 100%;
    left: 50%;
    padding-bottom: ${spacing.small};
    transform: translateX(-50%);
    &::after {
      border-left: 9px solid transparent;
      border-right: 9px solid transparent;
      border-top: 9px solid rgba(0,0,0, .7);
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
    }
  }
  &.tooltip-bottom {
    top: 100%;
    left: 50%;
    padding-top: ${spacing.small};
    transform: translateX(-50%);
    &::after {
      border-left: 9px solid transparent;
      border-right: 9px solid transparent;
      border-bottom: 9px solid rgba(0,0,0, .7);
      top: 0;
      left: 50%;
      transform: translateX(-50%);
    }
  }
  &.tooltip-left {
    top: 50%;
    right: 100%;
    padding-right: ${spacing.small};
    transform: translateY(-50%);
    &::after {
      border-left: 9px solid rgba(0,0,0, .7);
      border-top: 9px solid transparent;
      border-bottom: 9px solid transparent;
      top: 50%;
      right: 0;
      transform: translateY(-50%);
    }
  }
  &.tooltip-right {
    top: 50%;
    left: 100%;
    padding-left: ${spacing.small};
    transform: translateY(-50%);
    &::after {
      border-right: 9px solid rgba(0,0,0, .7);
      border-top: 9px solid transparent;
      border-bottom: 9px solid transparent;
      top: 50%;
      left: 0;
      transform: translateY(-50%);
    }
  }
  .tooltip-message {
    background: rgba(0,0,0, .7);
    border-radius: 3px;
    color: ${colors.white};
    font-size: ${typography.fontSizeS};
    line-height: 1.4;
    padding: ${spacing.small};
    text-align: center;
  }
`;
