import styled, { css } from 'styled-components/macro'
import { isMobileDevice } from 'config/userAgent'
import { Combobox } from 'features/Combobox'
import { PopOver } from 'features/Combobox/styled'
import {
  InputStyled,
  InputWrapper,
  LabelTitle,
} from 'features/Common/Input/styled'

type ButtonsBlockTypes = {
  isUserAccountPage?: boolean,
}

export const Form = styled.form``

export const Column = styled.div`
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 8px;
`

export const ButtonsBlock = styled.div<ButtonsBlockTypes>`
  display: flex;
  flex-direction: column;
  align-items: ${({ isUserAccountPage }) => (isUserAccountPage ? 'start' : 'center')};
  margin-top: 15px;
`

export const Input = styled.input`
  color: #fff;
  font-family: Montserrat, Tahoma, sans-serif;
  font-size: 20px;
  font-weight: bold;
  line-height: 48px;
  background-color: transparent;
  border: none;
  outline: none;
  width: 100%;
  padding: 0;
  margin: 0;

  :-webkit-autofill,
  :-webkit-autofill:hover,
  :-webkit-autofill:focus,
  :-webkit-autofill:active {
    box-shadow: 0 0 0 30px #3f3f3f inset;
    caret-color: ${({ theme: { colors } }) => colors.white};
    -webkit-text-fill-color: ${({ theme: { colors } }) => colors.white};
  }
  ${isMobileDevice
    ? css`
      line-height: 16px;
      font-size: 12px;
      max-height: 12px;
      height: auto;
    `
    : ''};
`

export const Errors = styled.span`
  margin-bottom: 40px;
  font-size: 16px;
  line-height: 16px;
  color: red;
  ${isMobileDevice
    ? css`
      margin-bottom: 10px;
      font-size: 12px;
    `
    : ''};
`

export const SectionTitle = styled.span`
  display: inline-block;
  font-weight: 600;
  font-size: 12px;
  line-height: 18px;
  text-transform: uppercase;
  color: ${({ theme }) => theme.colors.white50};
  margin-bottom: 8px;
  ${isMobileDevice
    ? css`
      margin-bottom: 25px;
      font-size: 10px;
      @media (orientation: landscape){
        margin-bottom: 10px;
      }
    `
    : ''};

`

export const CountryWrapper = styled.div`
  width: 275px;
`

export const CustomCombobox = styled(Combobox)`
  ${InputWrapper}{
    height: 50px;
    margin-top: 0;
  }
  ${LabelTitle}{
    line-height:45px;
    font-size: 16px;
  }
  ${InputStyled}{
    height: 50px;
    margin-left: 0;
  }
  ${PopOver}{
    top: 55px;
    max-height: 300px;
  }
` as typeof Combobox
