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

import { CardWrapper, CardWrapperOuter } from '../MatchCard/styled'

export const Wrapper = styled.div`
  position: relative;
  overflow: hidden;
  padding-right: 5px;
`

export const Slides = styled.ul`
  display: flex;
  scroll-behavior: smooth;
  overflow-x: auto;
  gap: 0.9rem;
  padding: 10px 10px 10px 7px;

  &::-webkit-scrollbar {
    display: none;
  }
  scrollbar-width: none; 

  ${CardWrapperOuter} {
    padding-top: 0;
  }

  ${CardWrapper} {
    position: relative;
    height: 12.9rem;
    width: 12.9rem;
    
    &:hover {
      scale: 1.04;
    }

    @media screen and (min-width: 1920px) {
      height: 13.8rem;
      width: 13.8rem;
    }

    @media screen and (max-width: 1920px) {
      height: 13.4rem;
      width: 13.4rem;
    }

    @media screen and (max-width: 1600px) {
      height: 13rem;
      width: 13rem;
    }

    @media screen and (max-width: 1440px) {
      height: 12.8rem;
      width: 12.8rem;
    }

    @media screen and (max-width: 1280px) {
      height: 12.6rem;
      width: 12.6rem;
    }
  }
`

type ArrowProps = {
  direction: 'left' | 'right',
  disabled?: boolean,
}

export const Arrow = styled.span<ArrowProps>`
  width: 1rem;
  height: 1rem;
  position: absolute;
  border-left: 0.25rem solid #fff;
  border-bottom: 0.25rem solid #fff;
  top: 50%;
  left: 50%;
  border-radius: 3px;

  ${({ direction }) => (
    direction === 'left'
      ? 'transform: translate(-50%, -50%) rotate(45deg);'
      : 'transform: translate(-50%, -50%) rotate(225deg);'
  )}

  ${({ disabled }) => (disabled ? css`
    border-left: 0.25rem solid gray;
    border-bottom: 0.25rem solid gray;
  ` : '')}
`

export const ArrowButton = styled.button<ArrowProps>`
  border: none;
  outline: none;
  padding: 0;
  background-color: transparent;
  cursor: pointer;
  position: absolute;
  width: 2.28rem;
  height: 2.28rem;
  z-index: 3;
  top: 50%;
  transform: translate(-50%, -50%);
  left: ${({ direction }) => (direction === 'left' ? '1.6rem' : 'calc(100% - 1.6rem)')};

  &:hover {
    ${({ direction, disabled }) => (!disabled ? css`
      width: 3rem;
      height: 3rem;
      left: ${direction === 'left' ? '2rem' : 'calc(100% - 2rem)'};

      ${Arrow} {
        width: 1.5rem;
        height: 1.5rem;
      }
    ` : '')}
  }
`
