/**
 * YITH Plugin UI - Post Type Style
 */

@import "mixins/tables";

table.yith-plugin-fw__classic-table {
    @include classic-table;

    &.wp-list-table {
        @include wp-table-commons;
    }
}

table.yith-plugin-fw__boxed-table {
    @include boxed-table;

    &.wp-list-table {
        @include wp-table-commons;
    }
}

// WP List Tables
.yith-plugin-ui--classic-wp-list-style, .yith-plugin-ui #plugin-fw-wc .yith-plugin-ui--classic-wp-list-style {

    @include wp-list-table-views;

    table.wp-list-table {
        @include classic-table;

        @include wp-table-commons;
    }

    @include wp-list-table-navs;

    .yith-plugin-ui__wp-list-auto-h-scroll__wrapper {
        border: 2px solid var(--yith-table-border-light);

        table.wp-list-table {
            border: none;
            margin: 0 !important;
        }
    }
}

.yith-plugin-ui--boxed-wp-list-style, .yith-plugin-ui #plugin-fw-wc .yith-plugin-ui--boxed-wp-list-style {

    @include wp-list-table-views;

    table.wp-list-table {
        @include boxed-table;

        @include wp-table-commons;
    }

    @include wp-list-table-navs;

    .yith-plugin-ui__wp-list-auto-h-scroll__wrapper {
        @include boxed-table-h-scroll-wrapper("table.wp-list-table")
    }
}

.yith-plugin-ui--wp-list-auto-h-scroll table.wp-list-table,
table.yith-plugin-ui__wp-list-auto-h-scroll {
    & > thead, & > tbody, & > tfoot {
        & > tr > td,
        & > tr > th {
            opacity: 1;
            transition: opacity .2s ease-in-out;
        }
    }

    &:not(.yith-plugin-ui__wp-list-auto-h-scroll--initialized) {
        & > thead, & > tbody, & > tfoot {
            & > tr > td,
            & > tr > th {
                & > * {
                    height: 1.5em;
                }

                opacity: 0;
            }
        }

        &:not(.yith-plugin-ui__wp-list-auto-h-scroll--initializing) {
            text-indent: -999px;
        }
    }
}

.yith-plugin-ui__wp-list-auto-h-scroll__wrapper {
    width: 100%;
    overflow-x: auto;

    &.yith-plugin-ui__wp-list-auto-h-scroll__wrapper--classic {
        border: 2px solid var(--yith-table-border-light);

        table.yith-plugin-fw__classic-table {
            border: none;
            margin: 0 !important;
        }
    }

    &.yith-plugin-ui__wp-list-auto-h-scroll__wrapper--boxed {
        @include boxed-table-h-scroll-wrapper("table.yith-plugin-fw__boxed-table");
        table.yith-plugin-fw__boxed-table {
            & > thead > tr {
                & > th, & > td {
                    padding: 16px 0 16px 25px;
                    background: var(--yith-content-bg);
                }
            }
        }
    }

    @media screen and (min-width: 783px) {
        table.wp-list-table, table.yith-plugin-ui__wp-list-auto-h-scroll {
            table-layout: auto;

            & > thead, & > tbody, & > tfoot {
                & > tr > *:nth-child(1),
                & > tr > .check-column,
                & > tr > .check-column + * {
                    position: sticky;
                    left: 0;
                    background: inherit;
                    z-index: 10;
                }

                & > tr > .check-column {
                    width: 42px;
                    box-sizing: border-box;
                }

                & > tr > .check-column + * {
                    left: 42px;
                }
            }
        }

        &.yith-plugin-ui--has-scrolling {
            table.wp-list-table, table.yith-plugin-ui__wp-list-auto-h-scroll {
                & > thead, & > tbody, & > tfoot {
                    & > tr > *:nth-child(1),
                    & > tr > .check-column + *,
                    &#the-list > tr:last-child > *:nth-child(1),
                    &#the-list > tr:last-child > .check-column + * {
                        box-shadow: 0 0 10px 2px var(--yith-shadow);
                        clip-path: polygon(0 0, calc(100% + 10px) 0, calc(100% + 10px) 100%, 0 100%);
                    }
                }
            }
        }
    }

    @media screen and (max-width: 782px) {
        table.wp-list-table, table.yith-plugin-ui__wp-list-auto-h-scroll {
            table-layout: fixed;
            min-width: 0 !important;
        }
    }
}

// RTL
.rtl {
    .yith-plugin-ui--classic-wp-list-style,
    .yith-plugin-ui--boxed-wp-list-style,
    .yith-plugin-ui #plugin-fw-wc .yith-plugin-ui--classic-wp-list-style,
    .yith-plugin-ui #plugin-fw-wc .yith-plugin-ui--boxed-wp-list-style {
        .sorting-indicator:before {
            left: auto;
            right: 0;
        }

        table.wp-list-table {
            th.column-actions, td.column-actions {
                text-align: left;
            }
        }
    }

}