import styled from 'styled-components/macro'

import {
  Combobox,
  ComboboxInput,
  ComboboxList,
  ComboboxOption,
  ComboboxPopover,
} from '@reach/combobox'

import { wrapperStyles, inputStyles } from 'features/Common/Input/styled'
import { сustomScrollbar, customStylesMixin } from 'features/Common'

export const ComboboxStyled = styled(Combobox)`
  ${wrapperStyles}
  position: relative;
`

export const ComboboxInputStyled = styled(ComboboxInput)`
  ${inputStyles}
  padding-right: 24px;
`

export const ComboboxPopoverStyled = styled(ComboboxPopover)`
  border: none;
`

export const ComboboxListStyled = styled(ComboboxList)`
  background: #666;
  min-width: 544px;
  max-height: 336px;
  height: auto;
  border-radius: 2px;
  box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3);
  position: absolute;
  top: 9px;
  left: -164px;
  overflow: auto;

 ${сustomScrollbar}
 ${customStylesMixin}
`

export const ComboboxOptionStyled = styled(ComboboxOption)`
  width: 100%;
  height: 48px;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  padding-left: 24px;
  color: #ccc;
  background: transparent;

  &[aria-selected="true"] {
    background: #999;
    color: #fff;
  }

  &:hover {
    background: #999;
    color: #fff;
  }
`
