import {styled} from '@mui/material/styles';
import {TypographyComponent as Typography} from '../..';
import {IVerticalStep} from '.';
import Tick from 'herein-icon/check';

const Container = styled('div')<IVerticalStep>`
    display: flex;
    align-items: stretch;
    gap: 12px;

    &.md,
    &.lg {
        gap: 16px;
    }

    & .line {
        &.active {
            background-color: ${({theme, color}) =>
                theme.palette[color || 'primary'][600]};
        }
    }

    & .status.focus {
        border-color: ${({theme, color}) =>
            theme.palette[color || 'primary'][600]};
        background-color: ${({theme, color}) =>
            theme.palette[color || 'primary'][50]};

        &.disable {
            border-color: ${({theme}) => theme.palette.border[200]};
            background-color: ${({theme}) => theme.palette.border[100]};
        }
    }

    & .status.active {
        border-color: ${({theme, color}) =>
            theme.palette[color || 'primary'][600]};
        background-color: ${({theme, color}) =>
            theme.palette[color || 'primary'][600]};

        &.disable {
            border-color: ${({theme}) => theme.palette.border[300]};
            background-color: ${({theme}) => theme.palette.border[300]};
        }
    }

    & .title.focus {
        color: ${({theme, color}) => theme.palette[color || 'primary'][700]};
    }

    & .subtitle.focus {
        color: ${({theme, color}) => theme.palette[color || 'primary'][600]};
    }
`;

const Content = styled('div')`
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
`;

const StatusBox = styled('div')`
    display: flex;
    flex-direction: column;
    justify-content: stretch;
    align-items: center;
`;

const Status = styled('div')`
    width: 24px;
    height: 24px;
    border-radius: 100%;
    border: 2px solid ${({theme}) => theme.palette.border[300]};
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    align-items: center;
    cursor: pointer;

    &.md {
        width: 32px;
        height: 32px;
        border-width: 3px;
    }

    &.lg {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }

    &.disable {
        border-color: ${({theme}) => theme.palette.border[100]};
        background-color: ${({theme}) => theme.palette.border[50]};
        cursor: default;
    }
`;

const Line = styled('div')`
    width: 1.5px;
    height: 100%;
    border-radius: 100px;
    margin: 4px 0;
    background-color: ${({theme}) => theme.palette.border[300]};

    &.disable {
        background-color: ${({theme}) => theme.palette.border[100]};
    }

    &.disappear {
        opacity: 0;
    }
`;

const Icon = styled(Tick)`
    color: ${({theme}) => theme.palette.white};
`;

const Header = styled('div')`
    display: flex;
    flex-direction: column;
    padding-top: 2px;
    cursor: pointer;

    &.md {
        padding-top: 4px;
    }

    &.lg {
        padding-top: 6px;
    }

    &.md,
    &.lg {
        margin-bottom: 32px;
        gap: 2px;
    }

    &.disable {
        cursor: default;
    }
`;

const Title = styled(Typography)`
    display: block;
    font-size: 0.875rem;
    color: ${({theme}) => theme.palette.typography[700]};
    line-height: 1.25rem;

    &.md,
    &.lg {
        font-size: 1rem;
        line-height: 1.5rem;
    }

    &.disable {
        color: ${({theme}) => theme.palette.typography[400]};
    }
`;

const Subtitle = styled(Typography)`
    display: block;
    font-size: 0.875rem;
    color: ${({theme}) => theme.palette.typography[600]};
    line-height: 1.25rem;

    &.md,
    &.lg {
        font-size: 1rem;
        line-height: 1.5rem;
    }

    &.disable {
        color: ${({theme}) => theme.palette.typography[300]};
    }
`;

export const VerticalStepStyle = {
    Container,
    Content,
    StatusBox,
    Status,
    Line,
    Icon,
    Title,
    Subtitle,
    Header,
};
