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 { ButtonSolid } from 'features/Common'
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){
        width: 100%;
        align-items: start;
        height: auto;
        margin: 45px 0 20px 0;
        left: 0;
        padding: 0 0 0 12px;
      }
    `
    : ''};
`

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: 15px;
        white-space: nowrap;
        margin-bottom: 0;
        text-overflow: ellipsis;
        overflow: hidden;
      }
    `
    : ''};
`

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: 40px;
        height: 40px;
      }
    `
    : ''};
`

export const Details = styled.div`
  display: flex;
  flex-direction: column;
  
  ${isMobileDevice
    ? css`
        padding-top: 8px;
        max-width: 200px;

        @media screen and (orientation: landscape) {
          max-width: 500px;
        }
    `
    : ''};
`

export const DetailsWrapper = styled.div`
  display: flex;
  flex-direction: column;
  
  ${isMobileDevice
    ? css`
        flex-direction: row;
        width: 100%;
    `
    : ''};
`

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){
        padding: 0 0.9rem 0 0.9rem;
        border: 0.8px solid #FFFFFF;
        border-radius: 8px;
        min-height: 17px;
        font-size: 10px;
      }
    `
    : ''};
`

export const InfoItems = styled.div`
  display: flex;
  align-items: center;
  margin-bottom: 1.04rem;
  flex-direction: row;
  ${isMobileDevice
    ? css`
      margin-bottom: 0;
        
      @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;
  }
`

export const SсBtnWrapper = styled.div`
  display: flex;
  flex-direction: row;

  ${isMobileDevice
    ? css`
      flex-direction: column;
      padding: 7px 10px 0 0;
      align-items: flex-end;
      width: 100%;
      `
    : ''};
`

export const SсGetHighlightBtn = styled(ButtonSolid)`
  background-color: white;
  color: #000000;
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  height: 1.95rem;
  border-radius: 13px;
  margin-left: 5px;
  width: auto;
  max-width: 272px;

  ${isMobileDevice
    ? css`
      min-height: 17px;
      font-size: 10px;
      border-radius: 7px;
      margin: 0;
      border: 0.7px solid #fff;
      line-height: 24px;
    `
    : ''};
`
