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

@property --rdg-table-leagues-select {syntax: "<color>";inherits: true;initial-value: #0160ac;}
@property --rdg-table-leagues-select-class {syntax: "<color>";inherits: true;initial-value: #0160ac;}
@property --rdg-table-leagues-select-bg {syntax: "<color>";inherits: true;initial-value: #F1F1F1;}
@property --rdg-table-leagues-button-bg {syntax: "<color>";inherits: true;initial-value: #0160ac;}
@property --rdg-table-leagues-button {syntax: "<color>";inherits: true;initial-value: #ffffff;}
@property --color-table-leagues-item-border {syntax: "<color>";inherits: true;initial-value: #CCC;}
@property --color-table-leagues-team {syntax: "<color>";inherits: true;initial-value: #0160ac;}
@property --color-table-leagues-button {syntax: "<color>";inherits: true;initial-value: #56a213;}

.rdg-blocks .rdg-table-leagues {
    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;

        @include title;

        .table {
            .filter {
                width: 100%;
                display: flex;
                gap: 1.5rem;

                @media (max-width: $breakpoint-sm) {
                    & {
                        gap: 1rem;
                        flex-direction: column;
                    }
                }

                .select {
                    min-width: 20rem;
                    display: flex;
                    position: relative;
                    overflow: hidden;
                    min-height: 2rem;
                    border-bottom: 2px solid var(--rdg-table-leagues-select);

                    @media (max-width: $breakpoint-lg) {
                        & {
                            min-width: 16rem;
                        }
                    }

                    @media (max-width: $breakpoint-md) {
                        & {
                            min-width: 12rem;
                        }
                    }
            
                    &::after {
                        font-family: 'Font Awesome 5 Free';
                        content: '\f078';
                        display: flex;
                        position: absolute;
                        align-items: center;
                        justify-content: center;
                        top: 0;
                        right: 0;
                        width: 3rem;
                        height: calc(100% - .8rem);
                        color: var(--rdg-table-leagues-select);
                        pointer-events: none;
                        margin: .4rem;
                    }
            
                    select {
                        border: 0;
                        outline: 0;
                        appearance: none;
                        box-shadow: none;
                        flex: 1;
                        padding: 1rem;
                        cursor: pointer;
                        background-image: none;
                        color: var(--rdg-table-leagues-select);
                        background-color: var(--rdg-table-leagues-select-bg);
                        text-align: center;

                        @media (max-width: $breakpoint-md) {
                            & {
                                padding: .5rem;
                            }
                        }
                
                        /* Remove IE arrow */
                        &::-ms-expand {
                            display: none;
                        }
                    }
                }

                .button {
                    background-color: var(--rdg-table-leagues-button-bg);
                    color: var(--rdg-table-leagues-button);
                    padding: 1rem 2.5rem;

                    @media (max-width: $breakpoint-md) {
                        & {
                            padding: .5rem 1rem;
                        }
                    }

                    @media (max-width: $breakpoint-sm) {
                        & {
                            text-align: center;
                        }
                    }
                }
            }

            .items {
                width: 100%;
                display: flex;
                flex-direction: column;

                .item {
                    width: 100%;
                    display: flex;
                    flex-direction: row;
                    border-bottom: 1px solid var(--color-table-leagues-item-border);
                    padding: .8rem 0;

                    @media (max-width: $breakpoint-sm) {
                        & {
                            flex-direction: column;
                        }
                    }

                    &:last-of-type {
                        border-bottom: none;
                    }

                    .date {
                        width: 15%;
                        display: flex;
                        align-items: center;

                        @media (max-width: $breakpoint-md) {
                            & {
                                flex-direction: column;
                            }
                        }

                        @media (max-width: $breakpoint-sm) {
                            & {
                                width: 100%;
                                justify-content: center;
                                flex-direction: row;
                            }
                        }

                        .date {
                            width: auto;
                            margin-right: .5rem;
                        }

                        .type {
                            width: auto;
                        }
                    }

                    .teams {
                        width: 30%;
                        display: flex;
                        align-items: center;
                        justify-content: center;

                        @media (max-width: $breakpoint-md) {
                            & {
                                width: 25%;
                                flex-direction: column;
                            }
                        }

                        @media (max-width: $breakpoint-sm) {
                            & {
                                width: 100%;
                                justify-content: center;
                                flex-direction: row;
                            }
                        }

                        .team-home {
                            color: var(--color-table-leagues-team);
                        }

                        .team-vs {
                            margin: 0 .5rem;
                        }

                        .team-visitor {
                            color: var(--color-table-leagues-team);
                        }
                    }

                    .results {
                        width: 35%;
                        display: flex;
                        align-items: center;
                        justify-content: center;

                        @media (max-width: $breakpoint-md) {
                            & {
                                width: 25%;
                                flex-direction: column;
                            }
                        }

                        @media (max-width: $breakpoint-sm) {
                            & {
                                width: 100%;
                                justify-content: center;
                                flex-direction: row;
                            }
                        }

                        span {
                            margin: 0 1rem;

                            &:first-of-type {
                                margin-left: 0;
                            }

                            &:last-of-type {
                                margin-right: 0;
                            }

                            @media (max-width: $breakpoint-md) {
                                & {
                                    margin: 0;
                                }
                            }

                            @media (max-width: $breakpoint-sm) {
                                & {
                                    margin: 0 .3rem;

                                    &:first-of-type {
                                        margin-left: 0;
                                    }

                                    &:last-of-type {
                                        margin-right: 0;
                                    }
                                }
                            }
                        }
                    }

                    .units {
                        width: 10%;
                        display: flex;
                        align-items: center;
                        justify-content: center;

                        @media (max-width: $breakpoint-md) {
                            & {
                                width: 15%;
                            }
                        }

                        @media (max-width: $breakpoint-sm) {
                            & {
                                width: 100%;
                                justify-content: center;
                                flex-direction: row;
                            }
                        }
                    }

                    .status {
                        width: 10%;
                        display: flex;
                        justify-content: flex-end;
                        align-items: center;

                        @media (max-width: $breakpoint-md) {
                            & {
                                width: 20%;
                            }
                        }

                        @media (max-width: $breakpoint-sm) {
                            & {
                                width: 100%;
                                justify-content: center;
                                flex-direction: row;
                                padding-top: .5rem;
                            }
                        }

                        span {
                            border-radius: .2rem;
                            padding: .5rem 2rem;
                            background-color: var(--color-table-leagues-button);
                            color: var(--color-white);
                        }
                    }
                }
            }
        }
    }
}

.acf-block-preview {
    .rdg-table-leagues {
        width: 100%;
        left: 0;
        right: 0;
        margin-left: 0;
        margin-right: 0;
    }
}
