import { breakpoints } from '../../utils/styledBreakpoints'
import styled from 'styled-components'

export const Container = styled.div`
  background-color: #fff;
  padding: 15px;
`

export const TableContainer = styled.div<{ $sticky?: boolean}>`
  overflow-x: ${(props) => (props.$sticky ? 'initial' : 'auto')};
  width: 100%;
`

export const Table = styled.table`
  display: table;
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  min-width: 650px;
  border: none;
`

const StickyStyles = (top: number) => `
  position: sticky;
  top: ${top}px;
  z-index: 1;
`

export const Thead = styled.thead<{ $sticky?: boolean; $stickyTopP?: number }>`
  display: table-header-group;
  background-color: #fafafa;
  ${(props) => props.$sticky && StickyStyles(props.$stickyTopP || 0)};
`

export const TableRow = styled.tr`
  color: inherit;
  display: table-row;
  vertical-align: middle;
  outline: 0;
`

export const Th = styled.th`
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.5rem;
  letter-spacing: 0.01071em;
  display: table-cell;
  vertical-align: inherit;
  border-bottom: 1px solid rgba(224, 224, 224, 1);
  text-align: left;
  padding: 16px 8px;
  ${breakpoints({
    cssProp: 'padding',
    cssPropUnits: 'px',
    values: [{ 1440: 8 }],
    mediaQueryType: 'max-width',
  })};
  color: rgba(0, 0, 0, 0.87);
  color: #666666;
  font-size: 0.875rem;
  font-weight: 700;
`

export const ColumnContent = styled.div`
  display: flex;
  align-items: center;
  gap: 5px;
`

export const TextColumn = styled.span<{ $size?: string }>`
  line-height: 1.3;
  ${(props) =>
    props.$size &&
    ` white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      width: ${props.$size};
    `}
`

export const IconFilterDialog = styled.div`
  height: 20px;
  width: 20px;
  min-width: 20px;
`

export const FilterDialog = styled.div`
  position: absolute;
  padding: 10px 0;
  margin: 6px 0px 0 0;
  width: max-content;
  background: #fff;
  box-shadow: 0px 3px 6px #00000029;
  border: 1px solid #e0e0e0;
  z-index: 99;
`

export const ListFilterDialog = styled.div`
  display: flex;
  flex-direction: column;
  .label {
    margin: 0 0 8px 0;
    color: #666666;
    font-size: 14px;
    font-weight: 400;
    text-align: left;
  }
  .select {
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
  }
`

export const OptionFilterDialog = styled.div`
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 6px 15px;
  cursor: pointer;
  &:hover {
    background: rgba(0, 0, 0, 0.04);
  }
  .icon {
    color: #666;
  }
  .rotate {
    rotate: 180deg;
  }
  div {
    width: 20px;
    height: 20px;
  }
  p {
    margin: 0;
    color: #666666;
    font-size: 16px;
    font-weight: 400;
  }
`
