@import '~@equitysim/react-uikit/dist/styles/styleguide';

@mixin padding {
    &:first-child {
        padding-left: v-space(8);
    }
    &:last-child {
        width: v-space(8);
    }
}

.c-portfolios-table {
    $transition: all $animation-duration $timing-function;

    width: 100%;
    border: none;
    border-collapse: collapse;
    background-color: $white;

    &__head {
        height: v-space(8);
        background-color: $seafoam-160;

        & > tr {
            padding: 0 v-space(8);
        }

        & > tr > th {
            @include padding;
            padding: 0 v-space(1);

            &:first-child {
                text-align: left;
            }
            &:nth-child(6) {
                text-align: right;
            }

            font-style: normal;
            font-weight: $font-weight-bold;
            font-size: 1.4rem;
            line-height: v-space(2);
            color: $grey-95;
        }
    }

    &__sort-icon {
        width: 1rem;
        vertical-align: middle;
        margin-left: 0.8rem;
    }

    &__subhead {
        height: v-space(4);
        background-color: $seafoam-180;

        & > tr {
            padding: 0 6.4rem;
        }

        & > tr > th {
            @include padding;

            font-style: normal;
            font-weight: $font-weight-bold;
            font-size: 1.4rem;
            line-height: v-space(2);
            text-transform: uppercase;
            color: $grey-97;
            text-align: left;
        }
    }

    &__row {
        height: v-space(8);
        border: 0.1rem solid $grey-92;

        & > td {
            @include padding;
            padding: 0 v-space(1);
            &:first-child {
                text-align: left;
            }
            &:last-child {
                text-align: right;
            }
        }

        &--isArchived {
            background-color: $grey-95;
        }
    }

    &__pending-trades {
        display: block;
        position: absolute;
        top: calc(50% - 0.4rem);
        right: calc(50% - 0.4rem);
        width: v-space(1);
        height: v-space(1);
        border-radius: 50%;
        background-color: $seafoam;
        animation-direction: alternate;
        animation-duration: 0.5s;
        animation-iteration-count: infinite;
        animation-name: active-animation;
        animation-timing-function: ease-in-out;
    }

    &__portfolio {
        display: grid;
        place-items: center stretch;
        grid-template-columns: 6.4rem auto;
        column-gap: v-space(2);
    }

    &__portfolio-name,
    &__portfolio-challenge {
        @extend %link;
        margin: 0;
        appearance: none;
        background: none;
        border: none;
        display: block;
        height: v-space(3);
    }

    &__portfolio-name {
        font-size: 1.4rem;
    }

    &__portfolio-challenge {
        font-size: 1.2rem;

        & > i {
            height: 1.6rem;
            width: auto;
            margin-right: 0.8rem;
        }
    }

    &__avatar {
        height: v-space(6);
        width: v-space(6);

        transition: $transition;

        &:not(&--disabled) {
            pointer-events: initial;
            cursor: pointer !important;
        }

        &--multiple {
            z-index: 10;
            background-color: white;
            border: 0.2rem solid $seafoam;
        }

        @media screen and (max-width: $screen-small) {
            vertical-align: 140%;
        }

        &:hover {
            color: $seafoam-120;
        }

        &--open:not(&--multiple) {
            &:hover {
                color: $white;
            }
        }
    }

    &__avatar-button {
        position: relative;
        display: inline-block;
        pointer-events: initial;
        background-color: transparent;
        border: 0;
        cursor: pointer;

        &--multiple {
            &::before,
            &::after {
                content: '';
                position: absolute;
                height: 3.6rem;
                width: 3.6rem;
                border-radius: 50%;
                border: 0.2rem solid $seafoam-60;
                z-index: 0;
                top: 0.2rem;
            }
            &::before {
                left: -0.8rem;
            }
            &::after {
                right: -0.8rem;
            }
        }
        &--open {
            &::before,
            &::after {
                background-color: $seafoam-20;
            }
        }
    }

    &__archived-label {
        font-weight: $font-weight-bold;
        font-size: 1.2rem;
        line-height: v-space(2);
        text-transform: uppercase;
        color: $tangerine;
    }

    &__drop-menu > button {
        color: $grey-80;
        &:hover {
            color: $grey-70;
        }
    }
}

@keyframes active-animation {
    from {
        background-color: $seafoam;
    }
    to {
        background-color: $seafoam-40;
    }
}
