import styled, { css } from 'styled-components/macro'

import { isMobileDevice } from 'config/userAgent'

import { ProfileLink } from 'features/ProfileLink'
import { Name as NameBase } from 'features/Name'

export const Wrapper = styled.ul`
  margin: 0;
  padding: 0;
  list-style-type: none;
`

export const Item = styled.li`
  :focus {
    background-color: #999;
  }

  ${isMobileDevice
    ? css`
        @media (max-width: 650px), (orientation: landscape) {
          &:not(:last-child) {
            margin-bottom: 10px;
          }
        }
      `
    : ''};
`

export const StyledLink = styled(ProfileLink)`
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  height: 2.28rem;

  :focus-within,
  :hover {
    background-color: #3b3b3b;
    outline: none;
  }
  ${isMobileDevice
    ? css`
        height: 33px;
      `
    : ''};
`

export const ItemInfo = styled.div`
  display: flex;
  align-items: center;
`

export const Name = styled(NameBase)`
  margin-bottom: 5px;
  display: block;
  font-weight: 600;
  font-size: 0.65rem;
  line-height: 0.95rem;
  letter-spacing: 0.1px;
  color: ${({ theme }) => theme.colors.white};
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  ${isMobileDevice
    ? css`
        font-size: 14px;
        line-height: 14px;
        margin-bottom: 2px;
      `
    : ''};
`

export const Flag = styled.img`
  width: 0.75rem;
  height: 0.75rem;
  margin: 0 0.19rem 0 0;
  object-fit: contain;
  object-position: center;
  ${isMobileDevice
    ? css`
        width: 12px;
        height: 10px;
        margin: 0 5px 0 5px;
      `
    : ''};
`

export const TeamOrCountry = styled(NameBase)`
  font-weight: normal;
  font-size: 0.625rem;
  line-height: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  ${isMobileDevice
    ? css`
        font-size: 10px;
        line-height: 14px;
      `
    : ''};
`
