import styled, { css, keyframes } from 'styled-components'


export const EventListContainer = styled.ol`
  position: relative;
  list-style: none;
  margin: 0;
  height: 100%;
  overflow: auto;
`

export const EventTypeLabel = styled.span`
  text-transform: capitalize;
  padding: 4px 6px;
  background: #e5e5e5;
  border-radius: 1em;
  transition: 0.1s background ease-in, 0.1s color ease-in;
`

export const EventTime = styled.span``

const fadeIn = keyframes`
  100% {
    opacity: 1;
  }
`

export const EventListItem = styled.li<{ selected: boolean }>`
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin: 4px 8px 0 8px;
  padding: 6px 8px;
  display: flex;
  align-items: start;
  column-gap: 6px;
  border-radius: 10px;
  user-select: none;
  cursor: pointer;
  opacity: 0;
  animation: ${fadeIn} 0.3s ease-in 0.2s forwards;
  transition: 0.1s box-shadow ease-in, 0.1s background ease-in, transform 0.3s cubic-bezier(0.36, 1, 0.49, 1.16);

  &:not(:last-child)::after {
    content: '';
    display: block;
    position: absolute;
    height: 1px;
    left: 40px;
    right: 12px;
    bottom: 0;
    background: #e5e5e5;
  }

  ${({ selected }) =>
    selected &&
    css`
      z-index: 1;
      box-shadow: 0px 0px 0px 2px #00a874;
      background: #ecfff8;

      ${EventTypeLabel} {
        background: #00a874;
        color: #fff;
      }

      &::before {
        visibility: hidden;
      }
    `}
`

export const EventSummary = styled.div`
  display: flex;
  flex-direction: column;
  flex: 1;
  row-gap: 4px;
  overflow: hidden;
`

export const EventAttributes = styled.div`
  display: flex;
  justify-content: space-between;
  align-items: center;
  column-gap: 16px;
`

export const EventMeta = styled.div`
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #7e7e7e;
`
