@import "../../../../assets/scss/abstracts/variables";
@import "../../../../assets/scss/abstracts/mixins";

@property --color-rdg-leader-board-table-menu-i {syntax: "<color>"; inherits: true; initial-value: #0160ac;}
@property --color-rdg-leader-board-table-menu-active {syntax: "<color>"; inherits: true; initial-value: #0160ac;}
@property --color-rdg-leader-board-table-menu-inactive {syntax: "<color>"; inherits: true; initial-value: #111111;}
@property --color-rdg-leader-board-table-filter {syntax: "<color>"; inherits: true; initial-value: #ffffff;}
@property --color-rdg-leader-board-table-filter-bg {syntax: "<color>"; inherits: true; initial-value: #0160ac;}
@property --color-rdg-leader-board-list-item-table-wrapper-border {syntax: "<color>"; inherits: true; initial-value: #cadae5;}
@property --color-rdg-leader-board-list-item-table-wrapper-scrollbar {syntax: "<color>"; inherits: true; initial-value: #dedede;}
@property --color-rdg-leader-board-list-item-table-wrapper-static-column {syntax: "<color>"; inherits: true; initial-value: #262626;}
@property --color-rdg-leader-board-sortable-th-before {syntax: "<color>"; inherits: true; initial-value: transparent;}
@property --color-rdg-leader-board-sortable-th-after {syntax: "<color>"; inherits: true; initial-value: #0160ac;}
@property --color-rdg-leader-board-sortable-th-hover-after {syntax: "<color>"; inherits: true; initial-value: #03467d;}
@property --color-rdg-leader-board-sortable-dir-d-after {syntax: "<color>"; inherits: true; initial-value: #0160ac;}
@property --color-rdg-leader-board-sortable-dir-u-after {syntax: "<color>"; inherits: true; initial-value: #0160ac;}
@property --color-rdg-leader-board-sortable-indicador-left-hover-before {syntax: "<color>"; inherits: true; initial-value: inherit;}
@property --color-rdg-leader-board-sortable-indicador-left-dir-d-before {syntax: "<color>"; inherits: true; initial-value: #0160ac;}
@property --color-rdg-leader-board-sortable-indicador-left-dir-u-before {syntax: "<color>"; inherits: true; initial-value: #0160ac;}
@property --color-rdg-leader-board-sortable-th {syntax: "<color>"; inherits: true; initial-value: #111111;}
@property --color-rdg-leader-board-sortable-th-bg {syntax: "<color>"; inherits: true; initial-value: #f8f8f8;}
@property --color-rdg-leader-board-sortable-td-bg {syntax: "<color>"; inherits: true; initial-value: #ffffff;}
@property --color-rdg-leader-board-sortable-td-name {syntax: "<color>"; inherits: true; initial-value: #111111;}

.rdg-blocks .rdg-leader-board {
    .preview-thumbs {
        background-image: url('../images/rdg-leader-board-template-preview.jpg');
    }

    width: calc(var(--vw, 1vw) * 100);
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    max-width: 99.55vw;

    .container.content {
        width: 100%;
        display: flex;
        flex-direction: column;
        padding-left: 20px;
        padding-right: 20px;

        #wait {
            display: none;
            position: fixed;
            z-index: 1000;
            top: 0;
            left: 0;
            height: 100%;
            width: 100%;
            background: rgba(255, 255, 255, 0.8) url("../../assets/images/spinner.gif") 50% 50% no-repeat;
        }

        @include title;

        .table {
            border-radius: 1rem;
            background-color: var(--color-white);

            .table-menu {
                display: flex;

                .menu {
                    padding: 1rem;
                    width: 100%;
                    margin: 0;
                    display: flex;
                    justify-content: space-between;

                    li {
                        text-align: center;
                        width: 100%;
                        list-style: none;

                        i {
                            color: var(--color-rdg-leader-board-table-menu-i);
                        }

                        .active {
                            color: var(--color-rdg-leader-board-table-menu-active);
                        }

                        .inactive {
                            color: var(--color-rdg-leader-board-table-menu-inactive);
                        }
                    }
                }
            }

            .table-filter {
                padding: 0.8rem;
                background-color: var(--color-rdg-leader-board-table-filter-bg);
                min-height: 3.5rem;

                .filter {
                    width: 100%;
                    margin: 0;
                    display: flex;
                    justify-content: space-between;
                    color: var(--color-rdg-leader-board-table-filter);

                    @media screen and (max-width: 48em) {
                        display: flex;
                        flex-direction: column;
                        flex-flow: row wrap;
                        gap: 10px;
                    }

                    .filter-option {
                        width: 100%;
                        display: flex;
                        align-items: center;
                        list-style: none;
                        font-weight: 600;

                        @media screen and (max-width: 48em) {
                            display: flex;
                            flex-direction: column;
                            width: 45%;
                            align-items: flex-start;
                            flex: auto;
                        }

                        span {
                            width: 45%;
                            text-align: right;
                            padding-right: 0.5rem;

                            @media screen and (max-width: 48em) {
                                width: 100%;
                                text-align: left;
                            }
                        }

                        span.init {
                            text-align: left;
                        }

                        select {
                            width: 55%;
                            margin-right: 0.5rem;

                            @media screen and (max-width: 48em) {
                                width: 100%;
                            }
                        }
                    }
                }
            }

            .list-items {
                @include message;

                .table-wrapper {
                    border: 2px solid var(--color-rdg-leader-board-list-item-table-wrapper-border);
                    border-bottom: none;
                    margin: auto;
                    max-width: 100%;
                    overflow-x: auto;
                    scrollbar-color: var(--color-rdg-leader-board-list-item-table-wrapper-scrollbar);
                    scrollbar-width: thin;

                    .static-column {
                        box-shadow: 0 0 13px var(--color-rdg-leader-board-list-item-table-wrapper-static-column);
                        --webkit-clip-path: inset(0 -15px 0 0);
                        clip-path: inset(0 -15px 0 0);
                        left: 0;
                        padding-right: 10px;
                        position: sticky;

                        @media screen and (min-width: 48em) {
                            box-shadow: none;
                            padding-right: 10px;
                        }
                    }
                }

                .table-wrapper::-webkit-scrollbar {
                    width: 5px;
                }

                .table-wrapper::-webkit-scrollbar-thumb {
                    background: var(--color-rdg-leader-board-list-item-table-wrapper-scrollbar);
                    border-radius: 10px;
                }

                .table-wrapper::-webkit-scrollbar-track {
                    border-radius: 10px;
                    box-shadow: inset 0 0 5px var(--color-rdg-leader-board-list-item-table-wrapper-scrollbar);
                }
            }
        }

        .sortable {
            border-spacing: 0;
            border: none;

            .list-pagination {
                td {
                    border-bottom: 0;

                    ul {
                        padding-top: 0;
                        margin-bottom: 0;
                    }

                    .pagination {
                        @media screen and (max-width: 48em) {
                            justify-content: flex-start;
                        }
                    }
                }
            }

            th {
                cursor: pointer;
                border: none;
                background: var(--color-rdg-leader-board-sortable-th-bg);
                color: var(--color-rdg-leader-board-sortable-th);
                text-align: center;
                vertical-align: baseline;
                white-space: nowrap;

                &.no-sort {
                    pointer-events: none;
                }

                &::before {
                    transition: color 0.1s ease-in-out;
                    color: var(--color-rdg-leader-board-sortable-th-before);
                }

                &::after {
                    margin-left: 3px;
                    content: "▸";
                    color: var(--color-rdg-leader-board-sortable-th-after);
                    transition: color 0.1s ease-in-out;
                }

                &:hover::after {
                    color: var(--color-rdg-leader-board-sortable-th-hover-after);
                }

                &.dir-d::after {
                    color: var(--color-rdg-leader-board-sortable-dir-d-after);
                    content: "▾";
                }

                &.dir-u::after {
                    color: var(--color-rdg-leader-board-sortable-dir-u-after);
                    content: "▴";
                }

                &.indicator-left::after {
                    content: "";
                }

                &.indicator-left::before {
                    margin-right: 3px;
                    content: "▸";
                }

                &.indicator-left:hover::before {
                    color: var(--color-rdg-leader-board-sortable-indicador-left-hover-before);
                }

                &.indicator-left.dir-d::before {
                    color: var(--color-rdg-leader-board-sortable-indicador-left-dir-d-before);
                    content: "▾";
                }

                &.indicator-left.dir-u::before {
                    color: var(--color-rdg-leader-board-sortable-indicador-left-dir-u-before);
                    content: "▴";
                }
            }

            td {
                background: var(--color-rdg-leader-board-sortable-td-bg);
            }

            td,
            th {
                padding: 0.8rem 0.3rem;
                border-left: none;
                border-right: none;
                border-top: none;
                text-align: center;
            }

            .w-1 {
                width: 7%;
            }

            .w-2 {
                width: 25%;
            }

            .w-3 {
                width: 10%;
            }

            td.name {
                color: var(--color-rdg-leader-board-sortable-td-name);
            }
        }
    }
}

.acf-block-preview {
    .rdg-leader-board {
        width: 100%;
        left: 0;
        right: 0;
        margin-left: 0;
        margin-right: 0;

        .table {
            .table-menu {
                a {
                    text-decoration: none;
                }
            }
        }
    }
}
