import styled from '@emotion/styled';

const ModalContainer = styled.div`
  /* position: absolute;
  z-index: 4; */
  /* top: 3rem;
  left: 0; */
  width: 50rem;
  height: ${({ height }) => height || '40rem'};
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  padding: 1.25rem;

  box-sizing: border-box;
  border: 0.06rem solid var(--Stroke, rgba(0, 0, 0, 0.1));
  border-radius: 1rem;
  box-shadow:
    0rem 2rem 4rem -2rem rgba(0, 0, 0, 0.1),
    0rem 4rem 6rem -1rem rgba(0, 0, 0, 0.1);
  background: var(--White, rgba(255, 255, 255, 1));

  overflow: hidden;
`;

const HeaderContainer = styled.div`
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  min-width: 100%;
`;

const ModalContent = styled.div`
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
`;

const CloseButton = styled.button``;

const ButtonTabs = styled.button`
  display: flex;
  height: 1.5rem;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 8;
  padding: var(--spacing-05, 0.13rem) var(--spacing-3, 0.75rem)
    var(--spacing-05, 0.13rem) var(--spacing-3, 0.75rem);
  background-color: inherit;
  &&.active {
    border-radius: var(--border-radius-rounded-md, 0.375rem);
    background: var(--White, rgba(255, 255, 255, 1));
  }
`;

const GroupForButtonTabs = styled.div`
  display: flex;
  flex-direction: row;
  height: 1.75rem;
  align-items: center;
  border-radius: var(--spacing-2, 0.5rem);
  background: var(--GreyLight, rgba(243, 243, 245, 1));
  overflow: hidden;
  max-width: max-content;
  padding: 0.13rem;
`;

const ContainerForButton = styled.div`
  display: flex;
  gap: 1rem;
  margin: 0.75rem;
  box-sizing: border-box;
`;

const SettingButton = styled.button`
  position: relative;
  padding: 0.5rem;
  box-sizing: border-box;
  border: 1px solid var(--Stroke, rgba(0, 0, 0, 0.1));
  border-radius: 0.5rem;
  background: var(--White, rgba(255, 255, 255, 1));
  display: flex;
  gap: 0.375rem;
  align-items: center;
  position: relative;
  width: max-content;

  &:hover {
    background-color: #eaeaea;
  }

  div {
    background-repeat: no-repeat;
    background-size: cover;
  }
`;

const TextCell = styled.div`
  min-width: 3.06rem;
  height: 1.25rem;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 0rem 0.25rem 0rem 0.25rem;
  box-sizing: border-box;
  border: 1px solid var(--Stroke, rgba(0, 0, 0, 0.1));
  border-radius: 0.5rem;
  background: var(--White, rgba(255, 255, 255, 1));
  span {
    color: var(--GreyDark, rgba(74, 85, 101, 1));
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 100%;
    letter-spacing: 0rem;
    text-align: left;
  }
`;
const HeaderAndTextCell = styled.div`
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  hr {
    margin-bottom: 1.22rem;
  }
`;
const TextCells = styled.div`
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  height: 1.25rem;
  overflow: scroll;
  row-gap: 0.5rem;
  box-sizing: border-box;
  margin-bottom: 1.225rem;
`;

const StageItem = styled.div`
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border: 1px solid var(--Stroke, rgba(0, 0, 0, 0.1));
  border-radius: 0.5rem;
  background: var(--White, rgba(255, 255, 255, 1));
`;

const StageName = styled.span`
  flex: 1;
  color: var(--GreyDark, rgba(74, 85, 101, 1));
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.25rem;
`;

const StageListContainer = styled.div`
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 1rem;
`;

const EditContainer = styled.div`
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.75rem 0;

  .checkGroup {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  h3 {
    color: rgba(31, 31, 31, 1);
    font-size: 0.88rem;
    font-weight: 400;
    line-height: 1.25rem;
    letter-spacing: 0rem;
    text-align: left;
    font-weight: bolder;
  }

  .stage-header {
    justify-content: space-between;
    align-items: center;
  }

  .stages-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 12rem;
    overflow-y: auto;
    padding-right: 0.25rem;
    height: max-content;
    max-height: 26rem;

    &::-webkit-scrollbar {
      width: 0.25rem;
    }

    &::-webkit-scrollbar-track {
      background: var(--GreyLight, rgba(243, 243, 245, 1));
      border-radius: 0.25rem;
    }

    &::-webkit-scrollbar-thumb {
      background: var(--GreyDark, rgba(74, 85, 101, 0.3));
      border-radius: 0.25rem;
    }

    &::-webkit-scrollbar-thumb:hover {
      background: var(--GreyDark, rgba(74, 85, 101, 0.5));
    }
  }

  .stage-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--Stroke, rgba(0, 0, 0, 0.1));
    border-radius: 0.5rem;
    background: var(--White, rgba(255, 255, 255, 1));
    min-height: 3.5rem;
  }

  .stage-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.25rem;
  }

  .stage-name {
    color: var(--GreyDark, rgba(74, 85, 101, 1));
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.125rem;
  }

  .stage-date {
    color: var(--Grey, rgba(128, 128, 128, 1));
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1rem;
  }

  .stage-actions {
    display: flex;
    gap: 0.5rem;
  }

  .stage-edit-button {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    background: var(--White, rgba(255, 255, 255, 1));
    border: 1px solid var(--Stroke, rgba(0, 0, 0, 0.1));
    border-radius: 0.375rem;
    white-space: nowrap;

    &:hover {
      background: var(--GreyLight, rgba(243, 243, 245, 1));
    }
  }

  .stage-delete-button {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    background: var(--White, rgba(255, 255, 255, 1));
    border: 1px solid var(--Error, rgba(211, 47, 47, 0.3));
    border-radius: 0.375rem;
    color: var(--Error, rgba(211, 47, 47, 1));
    white-space: nowrap;

    &:hover {
      background: rgba(211, 47, 47, 0.1);
    }
  }
`;

const ModalBackdrop = styled.div`
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.05);
  display: ${(props) => (props.isOpen ? 'flex' : 'none')};
  align-items: center;
  justify-content: center;
  z-index: 3;
`;

const ModalTitle = styled.h2`
  color: rgba(31, 31, 31, 1);
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
`;

export {
  ModalContainer,
  HeaderContainer,
  ModalContent,
  CloseButton,
  ButtonTabs,
  GroupForButtonTabs,
  ContainerForButton,
  SettingButton,
  TextCell,
  HeaderAndTextCell,
  TextCells,
  StageItem,
  StageName,
  StageListContainer,
  EditContainer,
  ModalBackdrop,
  ModalTitle
};
