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

import { isMobileDevice } from 'config/userAgent'

import { ButtonSolid } from 'features/Common'
import { Logo } from 'features/Logo'
import { T9n } from 'features/T9n'

type ButtonProps = {
  buttonColor?: string,
}

type SliderSwitchProps = {
  slideOpacity: boolean,
}

type SliderImgProps = {
  isAnimatedImg: boolean,
}

export const Wrapper = styled.div`
  width: 100vw;
  height: 100vh;
  color: white;
  display: flex;
  flex-direction: column;
`

export const HeaderWrapper = styled.div`
  background-color: rgba(19, 21, 27, 0.7);
  padding: 20px 0;
  padding-left: 15%;
  
  ${isMobileDevice
    ? css`
      background-color: black;
      height: 40px;
      padding-left: 25px;
      display: flex;
      align-items: center;
    `
    : ''};
`

export const InsportsLogo = styled(Logo)`
  height: 26px;
  width: 80px;
  cursor: pointer;

  ${isMobileDevice
    ? css`
      width: 57px;
      height: 18px;
    `
    : ''};
`

export const MainInfoContainer = styled.div`
  height: 100%;

  ${isMobileDevice
    ? css`
      overflow: scroll;
      position: relative;
    `
    : ''};
`

export const BlockWrapper = styled.div`
  height: 100%;
  display: flex;
  align-items: center;
  
  ${isMobileDevice
    ? css`
      display: block;
      @media screen and (orientation: landscape){
        height: auto;
      }
    `
    : ''};
`

export const SliderWrapper = styled.div`
  position: relative;
  width: 50%;
  margin-right: 1%;
  height: 100%;
  
  ${isMobileDevice
    ? css`
      height: 55%;
      width: 100%;
    `
    : ''};
`

export const MainLogoWrapper = styled.div`
  display: flex;
  justify-content: center;
  width: 50%;
  position: relative;
  align-items: center;

  ${isMobileDevice
    ? css`
      height: 55%;
      width: 100%;
      align-items: flex-start;
      padding-top: 25px;
    `
    : ''};
`

export const MainLogoImg = styled.img`
  width: 35%;
  height: 35%;
  position: relative;

  ${isMobileDevice
    ? css`
      height: 160px;
      width: 160px;
    `
    : ''};
`

export const LogoBackground = styled.div`
  background: #294FC4;
  width: 65%;
  opacity: 0.7;
  filter: blur(104.135px);
  height: 50%;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);

  ${isMobileDevice
    ? css`
      opacity: 0.8;
      filter: blur(44.1346px);
      width: 100%;
      height: 35%;
      top: 10%;
    `
    : ''};
`

export const SliderContainer = styled.div`
  height: 100%;
  position: relative;
  overflow: hidden;
`

export const SliderImg = styled.img<SliderImgProps>`
  height: 100%;
  width: 100%;
  opacity: ${({ isAnimatedImg }) => (isAnimatedImg ? '1' : '0')};
  position: absolute;
  animation-name: ${({ isAnimatedImg }) => (isAnimatedImg ? 'sliderAnimation' : '')};
  animation-iteration-count: 1;
  animation-timing-function: ease-out;
  animation-duration: 5s;
  object-fit: cover;
  -webkit-mask: ${(
    isMobileDevice
      ? 'linear-gradient(0deg, rgba(0, 0, 0, 0) 6.27%, rgba(0, 0, 0, 0.27) 15.48%, #000000 24.97%)'
      : 'linear-gradient(90deg, #000000 79.51%, rgba(0, 0, 0, 0) 95.58%)'
  )};

  @keyframes sliderAnimation {
    0% {
      transform: scale(1);
    }
    100% {
      transform: scale(1.1);
    }
`

export const SliderSwitch = styled.div`
  position: absolute;
  display: flex;
  justify-content: center;
  left: 50%;
  top: 90%;
  width: 100%;
  transform: translateX(-50%);

  ${isMobileDevice
    ? css`
      display: none;
    `
    : ''};
`

export const SliderSwitchItem = styled.div<SliderSwitchProps>`
  width: 10%;
  height: 4px;
  border-radius: 2px;
  background-color: white;
  opacity: ${({ slideOpacity }) => (slideOpacity ? '1' : '.3')};;
  margin-right: 10px;
  cursor: pointer;
  transition: .7s;
`

export const TournamentInfoContainer = styled.div`
  width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;

  ${isMobileDevice
    ? css`
      position: absolute;
      width: 100%;
      top: 40%;
      padding: 0 25px;
      z-index: 100;

      @media screen and (orientation: landscape){
        padding-top: 0;
      }
    `
    : css`
      height: 100%;
    `};
`

export const TournamentInfo = styled.div`
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-top: ${(isMobileDevice ? 'none' : '90px')};
`

export const DateInfo = styled(T9n)`
  text-transform: uppercase;
  background-color: rgba(0, 0, 0, 0.4);
  padding: 8px 25px;
  color: #B9B9B9;
  width: fit-content;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  
  ${isMobileDevice
    ? css`
      font-size: 10px;
      border-radius: 3px;
      background-color: rgba(0, 0, 0, 0.7);
      padding: 5px 10px;`
    : ''};
`

export const TournamentTitle = styled(T9n)`
  font-weight: 700;
  font-size: 50px;
  margin-top: 50px;
  
  ${isMobileDevice
    ? css`
      font-size: 24px;
      margin: 8px 0 0;
    `
    : css` 
      width: 50%;
    `};
`

export const TournamentButton = styled(ButtonSolid)<ButtonProps>`
  width: 320px;
  height: fit-content;
  font-size: 24px;
  font-weight: 600;
  border-radius: 5px;
  margin-bottom: 90px;
  padding: 20px 0;
  background-color: ${({ buttonColor }) => (buttonColor ? `${buttonColor}` : '#294FC3')};

  ${isMobileDevice
    ? css`
      width: 100%;
      font-size: 17px;
      padding: 10px 0;
      margin-bottom: 0;
    `
    : ''};
`

export const TournamentDescription = styled(T9n)`
  max-width: 400px;
  margin: 50px 0;
  font-size: 17px;
  
  ${isMobileDevice
    ? css`
      font-size: 12px;
      line-height: 150%;
      letter-spacing: 0.1px;
      margin: 25px 0 30px;
    `
    : ''};
`

export const TournamentMedia = styled.div`
  display: flex;
  align-items: center;
  height: 130px;
  margin-bottom: 25px;

  ${isMobileDevice
    ? css`
      display: none;
    `
    : ''};
`

export const TournamentLogo = styled.img`
  ${isMobileDevice
    ? css`
      margin-right: 10px;
      height: 26px;
    `
    : css`
      margin-right: 50px;
      height: 100%;
    `};
`

export const TeamsLogo = styled.div`
  width: 400px;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
`

export const InsportsImg = styled.img`
  height: 200px;
  width: 200px;
`

export const Footer = styled.div`
  font-size: 14px;
  background-color: black;
  padding: 16px 0;
  padding-left: 15%;
  opacity: .5;

  ${isMobileDevice
    ? css`
      display: none;
    `
    : ''};
`
