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

import { isMobileDevice } from 'config/userAgent'

import { ButtonSolid as BaseButtonSolid } from 'features/Common/Button'
import { T9n } from 'features/T9n'

import { client } from 'features/AuthServiceApp/config/clients'

export const InputGroup = styled.div`
  width: 100%;
  box-shadow: ${({ theme }) => theme.colors.shadow};
  border-radius: 14px;
  overflow: hidden;

  ${client.styles.inputGroup}
`

export const CenterBlock = styled.div`
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  margin-top: 9.15rem;
  ${isMobileDevice
    ? css`
        margin-top: 107px;
        @media screen and (orientation: landscape) {
          width: 290px;
          margin: auto;
        }
      `
    : ''};
`

export const Form = styled.form`
  width: 100%;
  max-width: 493px;
  margin-top: 1.82rem;
  margin-bottom: 6.604rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  ${isMobileDevice
    ? css`
        width: 100%;
        margin-top: 78px;
        @media screen and (orientation: landscape){
          margin-bottom: 0;
          margin-top: 10px;
          padding: 0;
        }
      `
    : ''};
`

export const BlockTitle = styled(T9n)`
  display: block;
  font-style: normal;
  font-weight: bold;
  font-size: 24px;
  height: 24px;
  color: ${({ theme: { colors } }) => colors.text100};
  margin-bottom: 30px;
  ${isMobileDevice
    ? css`
        font-size: 20px;
        margin-bottom: 12px;
      `
    : ''};
`

type ButtonsBlockProps = {
  marginTop?: number,
}

export const ButtonsBlock = styled.div<ButtonsBlockProps>`
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: ${({ marginTop = 0 }) => marginTop}px;
`

type ButtonSolidProps = {
  width?: string,
}

export const ButtonSolid = styled(BaseButtonSolid)<ButtonSolidProps>`
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-weight: 600;
  font-size: 20px;
  ${isMobileDevice
    ? css`
        height: 44px;
        font-weight: 600;
        font-size: 17px;
        border-radius: 10px;
      `
    : ''};

  ${client.styles.submitButton}
`

export const Error = styled.span`
  align-self: flex-start;
  height: 20px;
  margin-left: 2px;
  color: ${({ theme }) => theme.colors.error};
  font-style: normal;
  font-weight: 500;
  font-size: 12px;
  line-height: 20px;
  letter-spacing: 0.1px;
`

export const LanguageSelectWrapper = styled.div`
  margin-top: 15px;
  align-self: flex-end;
`
