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

import { ProfileTypes } from 'config'
import { isMobileDevice } from 'config/userAgent'

import { ProfileLogo } from 'features/ProfileLogo'
import { ProfileLink } from 'features/ProfileLink'
import { Name } from 'features/Name'

export const Wrapper = styled.div`
  display: flex;
  align-items: flex-end;
  height: 100%;
  position: absolute;
  left: 40.3%;

  ${isMobileDevice
    ? css`
      @media (max-width: 650px),(orientation: landscape){
        left: 50%;
        transform: translateX(-50%);
        height: auto;
        bottom: 0;
      }
    `
    : ''};
`

export const ProfileName = styled.h1`
  font-weight: 600;
  font-size: 1.18rem;
  line-height: 1.18rem;
  letter-spacing: 0.2px;
  color: #fff;
  margin-bottom: 0.12rem;

  ${isMobileDevice
    ? css`
      @media (max-width: 650px),(orientation: landscape){
        font-size: 14px;
        line-height: 19px;
        white-space: nowrap;
        margin-bottom: 0;
      }
    `
    : ''};
`

export const Logo = styled(ProfileLogo)`
  width: 6.604rem;
  height: 6.604rem;
  align-self: flex-end;
  margin-right: 1.274rem;
  object-fit: contain;

  padding: ${({ profileType }) => (
    profileType === ProfileTypes.PLAYERS ? '0' : '0.19rem 0 0.75rem 0'
  )};

  ${isMobileDevice
    ? css`
      @media (max-width: 650px),(orientation: landscape){
        width: 81px;
        height: 81px;
      }
    `
    : ''};
`

export const Details = styled.div`
  display: flex;
  flex-direction: column;
`

type FavoriteButtonProps = {
  isFavorite: boolean,
}

export const FavoriteButton = styled.button<FavoriteButtonProps>`
  outline: none;
  background-color: transparent;
  width: fit-content;
  height: 1.95rem;
  margin-bottom: 1.04rem;
  padding: 0 0.567rem 0 0.472rem;
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #fff;
  border: 1.4px solid #FFFFFF;
  border-radius: 13px;
  cursor: pointer;

  ${({ isFavorite }) => (
    isFavorite
      ? 'opacity: 1'
      : 'opacity: 0.5'
  )};

${isMobileDevice
    ? css`
      @media (max-width: 650px),(orientation: landscape){
        width: 100px;
        height: 22px;
        font-size: 10px;
        border-radius: 7px;
        border: 0.7px solid #fff;
      }
    `
    : ''};
`

export const InfoItems = styled.div`
  display: flex;
  align-items: center;
  margin-bottom: 1.04rem;
  ${isMobileDevice
    ? css`
      @media (orientation: landscape){
        margin-bottom: 5px;
      }
    `
    : ''};
`

export const InfoFlag = styled.img`
  width: 1.04rem;
  height: 1.04rem;
  margin-right: 0.3rem;
  object-fit: contain;
  object-position: center;

  ${isMobileDevice
    ? css`
      @media (max-width: 650px),(orientation: landscape){
        width: 12px;
        height: 8px;
      }
    `
    : ''};
`

export const InfoName = styled(Name)`
  font-size: 0.9rem;
  line-height: 1.18rem;
  color: rgba(255, 255, 255, 0.7);

  ${isMobileDevice
    ? css`
      @media (max-width: 650px),(orientation: landscape){
        font-size: 10px;
        line-height: 19px;
        white-space: nowrap;
      }
    `
    : ''};
`

export const StyledLink = styled(ProfileLink)`
  display: flex;
  align-items: center;
  color: white;

  &:hover {
    text-decoration: underline;
  }
`
