import styled from 'styled-components/macro'

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

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

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

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

export const Arrow = styled.div`
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background-image: url(/images/arrowDown.svg);
  background-position: center;
  background-repeat: no-repeat;
`

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: 0;
  left: 0;
  transform: translate(-126px, 9px);
  overflow: auto;

  ::-webkit-scrollbar {
    width: 8px;
  }
  
  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background: #3F3F3F;
    border-radius: 6px;
  }
`

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;
  }
`
