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

import includes from 'lodash/includes'

import { isMobileDevice } from 'config'

import { T9n } from 'features/T9n'

import { Steps } from '../../config'

const NavButton = styled.button`
  padding: 0;
  border: none;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-transform: uppercase;
  text-decoration: none;
  background: none;
  cursor: pointer;

  ${isMobileDevice
    ? css`
        font-size: 15px;
      `
    : ''}
`

type PrevButtonProps = {
  isLastStep?: boolean,
}

export const PrevButton = styled(NavButton)<PrevButtonProps>`
  color: rgba(0, 0, 0, 0.5);
`

export const NextButton = styled(NavButton)`
  color: #294FC3;
`

export const SkipTour = styled.button`
  margin-top: -2px;
  padding: 0;
  border: none;
  font-weight: 400;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.5);
  text-decoration: underline;
  text-transform: uppercase;
  cursor: pointer;
  background: none;

  ${isMobileDevice
    ? css`
        font-size: 15px;
      `
    : ''}
`

export const Counter = styled.div`
  color: rgba(0, 0, 0, 0.5);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;

  ${isMobileDevice
    ? css`
        font-size: 15px;
      `
    : ''}
`

type TitleProps = {
  alignLeft?: boolean,
}

export const Title = styled(T9n)<TitleProps>`
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
  line-height: 17px;

  ${isMobileDevice
    ? css`
        flex: 1;
        display: flex;
        justify-content: center;
        flex-direction: column;
        padding: 0 3%;
        line-height: 20px;
        font-size: 16px;
      `
    : ''}

  ${({ alignLeft }) => (alignLeft
    ? css`
        padding: 0;
      `
    : '')}
`

export const Body = styled.div`  
  margin-bottom: 15px;
`

export const BodyText = styled(T9n)`
  font-size: 14px;
  line-height: 17px;

  ${isMobileDevice
    ? css`
        line-height: 20px;
        font-size: 16px;
      `
    : ''}
`

type ActionButtonsContainerProps = {
  step: Steps,
}

export const ActionButtonsContainer = styled.div<ActionButtonsContainerProps>`
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 0;
  justify-content: space-between;

  ${isMobileDevice
    ? css`
        padding: 0 5%;
        margin: auto;
        gap: 20px;
        justify-content: center;
      `
    : ''}

${({ step }) => (isMobileDevice && step === Steps.Start
    ? css`
        justify-content: space-between;
        padding: 0;
      `
    : '')}

  ${({ step }) => (isMobileDevice && (includes([Steps.FinalStats, Steps.Welcome], step))
    ? css`
        padding: 0 20%;
      `
    : '')}
`

export const ArrowWrapper = styled.svg`
  position: absolute;
  top: 24px;
  right: 15px;
`
