import { globalColor } from "@/utils/colorBuilder"
import { SerializedStyles, css } from "@emotion/react"
import { Theme } from "@mui/material"

export const actionIconContainer = css`
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
`

export const actionItemDotStyle = css`
  flex-shrink: 0;
  width: 8px;
  margin-left: 9px;
  height: 8px;
  margin-right: 9px;
  box-sizing: border-box;
  border-radius: 50%;
  background: ${globalColor(`blue-03`)};
`

export function applyActionItemTitleStyle(error: boolean, theme: Theme): SerializedStyles {
  return css`
    flex-shrink: 1; 
    font-weight: 500;
    margin-left: 8px;
    overflow: hidden;
    color: ${error
      ? globalColor(`red-03`)
      : theme.palette.text.secondary};
    text-overflow: ellipsis;
    white-space: nowrap;
    &:hover {
    color:${theme.palette.text.primary}
    } `
}

export const timeStyle = css`
  color: ${globalColor(`grayBlue-04`)};
`

export const warningCircleStyle = css`
  position: absolute;
  color: ${globalColor(`red-03`)};
  font-size: 8px;
  bottom: 0;
  right: 0;
`

export function applyActionItemContainerStyle(
  selected: boolean, theme: Theme
): SerializedStyles {
  return css` 
    background: ${selected
      ? theme.palette.background.default
      : "transparent"};
   
    width: 100%;
    align-items: center;
    display: flex;
    flex-direction: row;
    padding-left: 16px;
    padding-right: 16px;
    height: 40px;
    font-size: 14px;
    color:${theme.palette.text.secondary};
    &:hover {
      background: ${theme.palette.background.default};
      color: ${theme.palette.text.primary
    } 
    }
  `
}

export const actionItemLeftStyle = css`
  color: ${globalColor(`grayBlue-02`)};
  display: flex;
  overflow: hidden;
  flex-direction: row;
  align-items: center;
  flex-grow: 1;
`

export const runningTimeStyle = (theme: Theme) => css`
  font-size: 12px;
  font-weight: 400;
  color: ${theme.palette.text.secondary};
`
