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

import { isMobileDevice } from 'config/userAgent'
import { BaseButton } from '../DateFilter/styled'

export const Wrapper = styled.div`
  position: absolute;
  top: 3.5rem;
  right: 12rem;
  z-index: 10;
  ${isMobileDevice
    ? css`
      top: 45px;
      right: -10%;
      width: 100%;

      @media screen and (orientation: landscape){
        right: -24%;
      }
    `
    : ''};

  .react-datepicker {
    margin: 0;
    border: none;
    width: 13.6rem;
    background-color: #333333;
    box-shadow: 0px 2px 2.32rem #000000;
    border-radius: 2px;
    font-family: inherit;
    color: #fff;
    ${isMobileDevice
    ? css`
      width: 80vw;
      height: auto;
      padding: 0 10px 15px;

      @media screen and (orientation: landscape){
        width: 50vw;
      }
    `
    : ''};
  }

  .react-datepicker__header {
    border: none;
    border-radius: 2;
    padding-top: 0.567rem;
    background-color: #333333;
  }

  .react-datepicker__month-container {
    width: 100%;
    ${isMobileDevice
    ? css`
      padding: 15px 0 0;
    `
    : ''};
  }

  .react-datepicker__day-names {
    margin-top: 1.14rem;
    margin-bottom: 0.567rem;
    display: flex;
    justify-content: space-around;
    text-transform: capitalize;
    ${isMobileDevice
    ? css`
      padding-bottom: 15px;
      font-weight: 600;
    `
    : ''};
  }

  .react-datepicker__day-name {
    margin: 0;
    width: 1.4rem;
    color: inherit;
    font-size: 0.75rem;
    line-height: 0.75rem;
    text-align: center;
    letter-spacing: 0.1px;
    ${isMobileDevice
    ? css`
      font-size: 16px;
      line-height: 16px;
      letter-spacing: 0.1px;
      font-weight: 500;
    `
    : ''};
  }

  .react-datepicker__month {
    margin: 0;
  }

  .react-datepicker__week {
    margin: 0.38rem 0;
    display: flex;
    justify-content: space-around;
    ${isMobileDevice
    ? css`
      height: 32px;
    `
    : ''};
  }

  .react-datepicker__day {
    margin: 0;
    border: none;
    outline: none;
    width: 1.4rem;
    height: 1.4rem;
    color: inherit;
    opacity: 0.6;
    font-weight: normal;
    font-size: 0.71rem;
    line-height: 1.4rem;
    border-radius: 50%;
    ${isMobileDevice
    ? css`
      font-size: 16px;
      line-height: 28px;
      letter-spacing: 0.1px;
      font-weight: 500;
      width: 28px;
      height: 28px;
      text-align: center;
    `
    : ''};

    :hover {
      font-weight: 600;
      color: #000000;
      background-color: rgba(255, 255, 255, 0.4);
      border-radius: 50%;
    }
  }

  .react-datepicker__day--selected {
    font-weight: 600;
    color: ${({ theme }) => theme.colors.button};
    background-color: #ffffff;
    opacity: 1;
  }

  .react-datepicker__day--keyboard-selected {
    color: inherit;
    background-color: transparent;
  }

  .react-datepicker__day--outside-month {
    opacity: 0.2
  }

  .react-datepicker-popper {
    transform: translate(0, 0) !important;
  }

  .react-datepicker-popper[data-placement^="bottom"] {
    margin-top: 0px;
  }

  .react-datepicker__input-container,
  .react-datepicker__triangle {
    display: none;
  }
`

export const MonthsWrapper = styled.div`
  width: 100%;
  height: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 0.75rem;
  text-align: center;
  letter-spacing: 0.1px;
  text-transform: capitalize;
  ${isMobileDevice
    ? css`
      font-size: 16px;
      line-height: 16px;
      letter-spacing: 0.1px;
      height: auto;
      padding-bottom: 20px;
    `
    : ''};
`

export const CurrentMonth = styled.span`
  min-width: 4.65rem;
  height: 100%;
  padding: 0 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
`

export const MonthButton = styled(BaseButton)`
  position: relative;
  width: 1.89rem;
  height: 1.89rem;
`
