@import './theme';

@table-border-radius: 8px;

.fixed-left-shadow(){
    &::after{
        box-shadow: 10px 0px 8px -8px rgba(0,0,0,.15) inset;
    }
}

.fixed-right-shadow(){
    &::after{
        box-shadow: -10px 0px 8px -8px rgba(0,0,0,.15) inset;
    }
}

.fixed-left-cell-item(){
    overflow: visible;

    &::after{
        content: '';
        position: absolute;
        top: 0px;
        right: 0px;
        bottom: -1px;
        width: 30px;
        transition: box-shadow 0.3s ease 0s;
        transform: translateX(100%);
        pointer-events: none;
    }
}

.fixed-right-cell-item(){
    overflow: visible;

    &::after{
        content: '';
        position: absolute;
        top: 0px;
        left: 0px;
        bottom: -1px;
        width: 30px;
        transition: box-shadow 0.3s ease 0s;
        transform: translateX(-100%);
        pointer-events: none;
    }
}

.mc-table{
    position: relative;
    font-size: var(--mc-small-size);
    border: 1px solid var(--mc-border-color);
    border-bottom: none;
    border-radius: @table-border-radius;

    *{
        font-size: var(--mc-small-size);
    }

    table{
        border-collapse: separate;
    }

    &__panel{
        position: relative;

        &.table-header-shadow{
            z-index: 52;
            box-shadow: 0 3px 8px -3px rgba(0,0,0,.2);
        }

        &--empty{
            display: flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            min-height: 200px;
            color: #999;
            background: #fff;
        }

        &--header{
            border-radius: @table-border-radius @table-border-radius 0 0;
            overflow: hidden;
        }

        &--body{
            overflow: hidden;

            &--scroll{
                width: 100%;
                height: 100%;
                overflow: auto;

                &::-webkit-scrollbar{
                    display: none;
                }
            }
        }

        &__setting{
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: center;
            position: absolute;
            top: 0;
            right: 0;
            z-index: 100;
            width: 40px;
            height: 40px;
            background: #EDF3FB;
            box-shadow: 1px 0px 6px 0px rgba(163, 174, 188, 0.16) inset;
            border-radius: 0 8px 0 0;
            cursor: pointer;
        }
    }

    &__th, &__td{
        display: table-cell;
        padding: 0 13px;
        height: 40px;
        line-height: 20px;
        border-bottom: 1px solid var(--mc-border-color);
        box-sizing: border-box;

        &--inner{
            display: block;
            width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        &.mc-table--fixed-left-last{
            .fixed-left-cell-item()
        }

        &.mc-table--fixed-right-last{
            .fixed-right-cell-item()
        }

        &.mc-table--cell-shadow-left{
            .fixed-left-shadow();
        }

        &.mc-table--cell-shadow-right{
            .fixed-right-shadow();
        }
    }

    &__th{
        font-weight: bold;
        background: #EDF3FB;

        &--even{
            background: #E7E1FB;
        }

        &--odd{
            background: #E1ECFB;
        }

        &--fixed{
            position: sticky;
            z-index: 11;
        }
    }

    &__td{
        &--fixed{
            position: sticky;
            z-index: 10;
        }
    }

    tr.hover-row{
        & > td{
            transition: background-color 300ms;
            background: #f1fcff;
        }
    }
    tr.disabled-row span{
        color: #999999;
        cursor: not-allowed;
    }

    td{
        background: #fff;
    }

    &__scrollbar{

        &__horizontal{
            position: absolute;
            left: 0;
            bottom: 0;
            z-index: 110;
            pointer-events: auto;
            user-select: none;
        }

        &__vertical{
            position: absolute;
            top: 0;
            right: 0;
            z-index: 110;
            pointer-events: auto;
            user-select: none;
        }


        &--thumb{
            display: block;
            position: absolute;
            height: 100%;
            border-radius: 4px;
            background: #DCE4ED;
            cursor: pointer;
        }
    }
}

.mc-table-column{
    &__checkbox{
        position: sticky;
        left: 0;
        z-index: 10;
    }
}

.mc-fade-enter-active {
    opacity: 1;
    transition: all .3s ease;
}
.mc-fade-leave-active {
    opacity: 0;
    transition: all .3s ease;
}
