import styled from "styled-components";
import { gray, primary } from "../../../core/colors/colors";
import { fonts } from "../../../styles/fonts";
import { InputXButton } from "../../Input/Input.styled";

export const DropdownInput = styled.div`
  width: 400px;

  display: flex;
  align-items: center;

  position: relative;

  & > input {
    height: 40px;

    cursor: pointer;

    ${fonts["body-r"]}

    &:disabled {
      cursor: inherit;
    }
  }

  & > input::placeholder {
    color: ${gray[400]};

    ${fonts["body-r"]}
  }
`;

export const DropdownButtonContainer = styled.div`
  display: flex;
  gap: 8px;

  position: absolute;
  right: 16px;

  & > button {
    border: 0;

    display: flex;
    align-items: center;

    background-color: #fff;

    svg {
      width: 16px;
      height: 16px;

      stroke: ${gray[400]};

      cursor: pointer;
    }

    &:disabled {
      background-color: ${gray[50]};

      svg {
        cursor: inherit;
      }
    }
  }
`;

export const DropdownOptions = styled.div`
  width: 400px;
  max-height: 400px;

  margin-top: 8px;

  padding: 8px 0;

  border: 1px solid ${gray[300]};
  border-radius: 8px;

  position: absolute;

  overflow-y: auto;
  overflow-x: hidden;

  &::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  &::-webkit-scrollbar-thumb {
    background: ${gray[400]};
    border-radius: 10px;
  }

  &::-webkit-scrollbar-track {
    background: ${gray[300]};
    border-radius: 10px;
  }

  .jsx_element {
    & > button {
      display: flex;
      justify-content: space-between;
    }
  }

  .empty {
    width: 100%;
    height: 40px;

    padding: 8px 16px;

    display: flex;
    align-items: center;

    color: ${gray[800]};
  }
`;

export const DropdownSearchInput = styled.div`
  width: 400px;

  margin-top: 8px;

  padding: 8px;

  border: 1px solid ${gray[300]};
  border-bottom: 0;
  border-top-right-radius: 8px;
  border-top-left-radius: 8px;

  background-color: #fff;

  position: relative;

  display: flex;
  align-items: center;

  z-index: 10;

  .dropdown_search_input {
    width: 100%;
    height: 40px;

    padding: 0 16px 0 48px;

    border: 1px solid;
    border-radius: 40px;

    outline: 0;

    &::placeholder {
      color: ${gray[300]};
    }

    &[placeholder] {
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }

  & > svg {
    width: 16px;
    height: 16px;

    stroke: ${primary[500]};

    position: absolute;
    left: 24px;
  }
`;

export const XButton = styled(InputXButton)`
  position: absolute;
  right: 24px;
`;

export const OptionContainer = styled.section`
  .selected {
    background-color: ${primary[500]};

    & > p {
      color: #fff;
    }

    & > span {
      color: #fff;
    }
  }

  span {
    ${fonts["caption-b"]}
  }

  & > button {
    width: 100%;
    height: 40px;

    padding: 8px 16px;

    border: 0;

    display: flex;
    align-items: center;
    gap: 24px;

    background-color: #fff;

    white-space: nowrap;

    cursor: pointer;

    .checkbox_button {
      width: 16px;
      height: 16px;

      border: 0;
      border-radius: 4px;

      background-color: rgba(0, 0, 0, 0);

      & > label {
        width: 100%;
        height: 100%;

        gap: 0;
      }
    }

    &:not(.selected):not(div):hover {
      background-color: ${primary[100]};
    }

    & > p {
      color: ${gray[800]};

      overflow: hidden;
      text-overflow: ellipsis;
    }
  }
`;
