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

@property --color-rdg-handicappers-hub-header {syntax: "<color>";inherits: true;initial-value: #03467d;}
@property --color-rdg-handicappers-hub-header-hover {syntax: "<color>";inherits: true;initial-value: #e11414;}
@property --color-rdg-handicappers-hub-bg {syntax: "<color>";inherits: true;initial-value: #ffffff;}
@property --color-rdg-handicappers-hub-border {syntax: "<color>";inherits: true;initial-value: #EEF4FC;}
@property --color-rdg-handicappers-hub-shadow {syntax: "<color>";inherits: true;initial-value: #F3F3F3;}
@property --color-rdg-handicappers-hub-line {syntax: "<color>";inherits: true;initial-value: #67748e66;}
@property --color-rdg-handicappers-hub-stats {syntax: "<color>";inherits: true;initial-value: #878787;}
@property --color-rdg-handicappers-hub-btn {syntax: "<color>";inherits: true;initial-value: #03467d;}
@property --color-rdg-handicappers-hub-btn-hover {syntax: "<color>";inherits: true;initial-value: #3a96e0;}
@property --color-rdg-handicappers-hub-btn-default {syntax: "<color>";inherits: true;initial-value: #E9ECEF;}
@property --color-rdg-handicappers-hub-scrollbar-track {syntax: "<color>";inherits: true;initial-value: #f1f1f1;}
@property --color-rdg-handicappers-hub-scrollbar-thumb {syntax: "<color>";inherits: true;initial-value: #888;}
@property --color-rdg-handicappers-hub-scrollbar-hover {syntax: "<color>";inherits: true;initial-value: #555;}
@property --color-rdg-handicappers-hub-filter-sport {syntax: "<color>";inherits: true;initial-value: #878787;}
@property --color-rdg-handicappers-hub-filter-sport-hover {syntax: "<color>";inherits: true;initial-value: #e9ecef;}
@property --color-rdg-handicappers-hub-filter-border {syntax: "<color>";inherits: true;initial-value: #E9ECEF;}
@property --color-rdg-handicappers-hub-filter-bg {syntax: "<color>";inherits: true;initial-value: #ffffff;}
@property --color-rdg-handicappers-hub-filter-package {syntax: "<color>";inherits: true;initial-value: #EEF4FC;}
@property --color-rdg-handicappers-hub-filter-package-bg {syntax: "<color>";inherits: true;initial-value: #ffffff;}

.rdg-blocks .rdg-handicappers-hub {
    width: calc(var(--vw, 1vw) * 100);
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    max-width: 99.55vw;

    .preview-thumbs {
        background-image: url('../images/rdg-handicappers-hub-preview.jpg');
    }

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

        @include title;
        --gap: 20px;

        .handicappers-body {
            display: flex;
            flex-direction: column;
            position: relative;
            border-radius: 16px;
            container-type: inline-size;
            background-color: var(--color-rdg-handicappers-hub-bg);
            border: 1px solid var(--color-rdg-handicappers-hub-border);
            box-shadow: 0px 20px 50px 0px var(--color-rdg-handicappers-hub-shadow);

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

            .filters {
                .filter-sport {
                    display: flex;
                    padding: 0 .7rem 0 1rem;
                    justify-content: space-between;

                    @container (max-width: 810px) {
                        & {
                            padding: 0 .7rem;
                            flex-direction: column;
                        }
                    }

                    .default-sports {
                        width: 100%;
                        display: flex;
                        justify-content: space-evenly;
                        overflow-x: auto;

                        &::-webkit-scrollbar {
                            width: 6px;
                            height: 6px;
                        }

                        &::-webkit-scrollbar-track {
                            border-radius: 3px;
                            background: var(--color-rdg-handicappers-hub-scrollbar-track);
                        }

                        &::-webkit-scrollbar-thumb {
                            border-radius: 3px;
                            background: var(--color-rdg-handicappers-hub-scrollbar-thumb);
                        }

                        &::-webkit-scrollbar-thumb:hover {
                            background: var(--color-rdg-handicappers-hub-scrollbar-hover);
                        }

                        .sport {
                            display: flex;
                            align-items: center;
                            justify-content: center;
                            padding: 1rem 2rem;
                            text-align: center;
                            white-space: nowrap;
                            box-sizing: border-box;
                            border-bottom: 3px solid transparent;
                            color: var(--color-rdg-handicappers-hub-filter-sport);

                            &.active {
                                color: var(--color-rdg-handicappers-hub-btn);
                                border-bottom: 3px solid var(--color-rdg-handicappers-hub-btn);
                            }

                            &:hover {
                                transition: all 200ms linear;
                                border-bottom: 3px solid var(--color-rdg-handicappers-hub-btn-hover);
                            }
                        }
                    }
                    
                    .sports-list {
                        padding: .7rem 0 .7rem .7rem;

                        @container (max-width: 810px) {
                            & {
                                padding: .7rem 0;
                            }
                        }

                        .dropdown-container {
                            position: relative;
                            max-width: 100%;
                            text-align: center;
                            z-index: 200;
                        }

                        [type="checkbox"]:checked, [type="checkbox"]:not(:checked) {
                            position: absolute;
                            left: -9999px;
                            opacity: 0;
                            pointer-events: none;
                        }

                        .dropdown:checked + label, .dropdown:not(:checked) + label {
                            position: relative;
                            width: 220px;
                            height: 50px;
                            padding: 0 1rem;
                            border-radius: 4px;
                            transition: all 200ms linear;
                            justify-content: space-between !important;

                            cursor: pointer;
                            text-align: center;
                            color: var(--color-rdg-handicappers-hub-filter-sport);
                            border: 1px solid var(--color-rdg-handicappers-hub-filter-border);
                            background-color: var(--color-rdg-handicappers-hub-filter-bg);
                            box-shadow: 0 12px 35px 0 rgba(255,235,167,.15);
                            
                            display: flex;
                            display: -webkit-inline-flex;
                            display: -ms-inline-flexbox;
                            align-items: center;
                            justify-content: center;

                            -webkit-align-items: center;
                            -moz-align-items: center;
                            -ms-align-items: center;
                            -webkit-justify-content: center;
                            -moz-justify-content: center;
                            -ms-justify-content: center;
                            -ms-flex-pack: center;

                            @container (max-width: 810px) {
                                & {
                                    width: 100%;
                                }
                            }
                        }

                        .dropdown:checked + label:before, .dropdown:not(:checked) + label:before {
                            position: fixed;
                            top: 0;
                            left: 0;
                            content: '';
                            width: 100%;
                            height: 100%;
                            z-index: -1;
                            cursor: auto;
                            pointer-events: none;
                        }

                        .dropdown:checked + label:before {
                            pointer-events: auto;
                        }

                        .dropdown:not(:checked) + label .uil {
                            margin-left: 10px;
                            transition: transform 200ms linear;
                        }

                        .dropdown:checked + label .uil {
                            transform: rotate(180deg);
                            margin-left: 10px;
                            transition: transform 200ms linear;
                        }

                        .section-dropdown {
                            position: absolute;
                            display: block;
                            width: 100%;
                            left: 0;
                            top: 60px;
                            z-index: 2;
                            padding: 5px;
                            border-radius: 4px;
                            opacity: 0;
                            overflow-y: auto;
                            max-height: 380px;
                            pointer-events: none;
                            transform: translateY(20px);
                            transition: all 200ms linear;
                            background-color: var(--color-rdg-handicappers-hub-filter-bg);
                            box-shadow: 0 14px 35px 0 rgba(9,9,12,0.4);

                            &::-webkit-scrollbar {
                                width: 6px;
                                height: 6px;
                            }

                            &::-webkit-scrollbar-track {
                                border-radius: 3px;
                                background: var(--color-rdg-handicappers-hub-scrollbar-track);
                            }

                            &::-webkit-scrollbar-thumb {
                                border-radius: 3px;
                                background: var(--color-rdg-handicappers-hub-scrollbar-thumb);
                            }

                            &::-webkit-scrollbar-thumb:hover {
                                background: var(--color-rdg-handicappers-hub-scrollbar-hover);
                            }
                        }

                        .dropdown:checked ~ .section-dropdown {
                            opacity: 1;
                            pointer-events: auto;
                            transform: translateY(0);
                        }

                        a {
                            position: relative;
                            white-space: nowrap;
                            border-radius: 2px;
                            padding: 5px 0;
                            padding-left: 20px;
                            padding-right: 15px;
                            margin: 2px 0;
                            text-align: left;
                            display: -ms-flexbox;
                            display: flex;
                            align-items: center;
                            justify-content: space-between;
                            transition: all 200ms linear;
                            color: var(--color-rdg-handicappers-hub-filter-sport);

                            -webkit-align-items: center;
                            -moz-align-items: center;
                            -ms-align-items: center;
                            -ms-flex-pack: distribute;
                        }

                        a:hover {
                            color: var(--color-rdg-handicappers-hub-btn);
                            background-color: var(--color-rdg-handicappers-hub-filter-sport-hover);
                        }
                    }
                }

                .filter-packages {
                    width: 100%;
                    display: flex;
                    gap: 1rem;
                    justify-content: center;
                    padding: .7rem 1rem;
                    overflow-x: auto;
                    color: var(--color-rdg-handicappers-hub-btn);
                    background-color: var(--color-rdg-handicappers-hub-filter-package);

                    @container (max-width: 1112px) {
                        & {
                            justify-content: normal;
                        }
                    }

                    &::-webkit-scrollbar {
                        width: 6px;
                        height: 6px;
                    }

                    &::-webkit-scrollbar-track {
                        border-radius: 3px;
                        background: var(--color-rdg-handicappers-hub-scrollbar-track);
                    }

                    &::-webkit-scrollbar-thumb {
                        border-radius: 3px;
                        background: var(--color-rdg-handicappers-hub-scrollbar-thumb);
                    }

                    &::-webkit-scrollbar-thumb:hover {
                        background: var(--color-rdg-handicappers-hub-scrollbar-hover);
                    }

                    .package {
                        display: flex;
                        justify-content: center;
                        align-items: center;
                        text-align: center;
                        padding: 1rem 2rem;
                        border-radius: .5rem;
                        white-space: nowrap;
                        background-color: var(--color-rdg-handicappers-hub-filter-package-bg);

                        &.active {
                            color: var(--color-rdg-handicappers-hub-filter-package-bg);
                            background-color: var(--color-rdg-handicappers-hub-btn);

                            &:hover {
                                background-color: var(--color-rdg-handicappers-hub-btn);
                            }
                        }

                        &:hover {
                            color: var(--color-rdg-handicappers-hub-filter-package-bg);
                            background-color: var(--color-rdg-handicappers-hub-btn-hover);
                        }
                    }
                }
            }

            .handicappers {
                display: flex;
                flex-wrap: wrap;
                padding: 20px;
                gap: var(--gap);

                .handicapper {
                    --columns: 4;
                    width: calc((100% - (var(--columns) - 1) * var(--gap)) / var(--columns));
                    display: flex;
                    border-radius: 1rem;
                    flex-direction: column;
                    background-color: var(--color-rdg-handicappers-hub-bg);
                    border: 1px solid var(--color-rdg-handicappers-hub-border);
                    box-shadow: 0px 20px 50px 0px var(--color-rdg-handicappers-hub-shadow);

                    @container (max-width: 1280px) {
                        & {
                            --columns: 3;
                        }
                    }

                    @container (max-width: 950px) {
                        & {
                            --columns: 2;
                        }
                    }

                    @container (max-width: 600px) {
                        & {
                            --columns: 1;
                        }
                    }

                    .handicapper-header {
                        display: flex;
                        min-height: 6rem;
                        padding: 1rem;
                        gap: .9rem;
                        border-bottom: 2px solid var(--color-rdg-handicappers-hub-line);

                        @container (max-width: 720px) {
                            & {
                                align-items: center;
                                flex-direction: column;
                            }
                        }

                        .header-image {
                            display: flex;
                            max-width: 60px;
                            max-height: 60px;

                            @container (max-width: 720px) {
                                & {
                                    width: 100px;
                                    height: 100px;
                                }
                            }
                            
                            img {
                                border-radius: 50%;
                                object-fit: cover;
                            }
                        }

                        .header-content {
                            color: var(--color-rdg-handicappers-hub-header);

                            @container (max-width: 720px) {
                                & {
                                    text-align: center;
                                    min-height: 3.6rem;
                                }
                            }

                            .header-name {
                                a {
                                    &:hover {
                                        color: var(--color-rdg-handicappers-hub-header-hover);
                                    }
                                }
                            }

                            .header-package {
                                a {
                                    &:hover {
                                        color: var(--color-rdg-handicappers-hub-header-hover);
                                    }
                                }
                            }
                            
                            .header-stats {
                                color: var(--color-rdg-handicappers-hub-stats);

                                .success {
                                    color: var(--color-success);
                                }

                                .danger {
                                    color: var(--color-danger);
                                }
                            }
                        }
                    }

                    .handicapper-body {
                        padding: 1rem;
                        max-height: 6.5rem;
                        min-height: 6.4rem;
                        border-bottom: 1px solid var(--color-rdg-handicappers-hub-line);

                        .body-content {
                            overflow: hidden;
                            display: -webkit-box;
                            -webkit-line-clamp: 3;
                            -webkit-box-orient: vertical;
                        }
                    }

                    .handicapper-footer {
                        display: flex;
                        padding: 1rem;

                        .footer-content {
                            width: 100%;
                            display: flex;
                            flex-direction: column;
                            gap: 1rem;

                            .footer-button {
                                display: flex;
                                flex-direction: column;
                                justify-content: center;
                                align-items: center;
                                padding: .3rem 1rem;
                                border-radius: .5rem;
                                color: var(--color-rdg-handicappers-hub-btn);
                                background-color: var(--color-rdg-handicappers-hub-bg);
                                border: 1px solid var(--color-rdg-handicappers-hub-btn-default);

                                &:hover {
                                    background-color: var(--color-rdg-handicappers-hub-btn-default);
                                }

                                &.primary {
                                    display: flex;
                                    justify-content: center;
                                    align-items: center;
                                    padding: .7rem 1rem;
                                    border-radius: .5rem;
                                    color: var(--color-rdg-handicappers-hub-bg);
                                    background-color: var(--color-rdg-handicappers-hub-btn);

                                    &:hover {
                                        background-color: var(--color-rdg-handicappers-hub-btn-hover);
                                    }
                                }
                            }
                        }
                    }
                }

                @include message;
            }
        }
    }
}

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