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

@property --color-posts-ajax-select-after {syntax: "<color>";inherits: true;initial-value: #ffffff;}
@property --color-posts-ajax-select-after-bg {syntax: "<color>";inherits: true;initial-value: #0160ac;}
@property --color-posts-ajax-select {syntax: "<color>";inherits: true;initial-value: #3a96e0;}
@property --color-posts-ajax-select-bg {syntax: "<color>";inherits: true;initial-value: #ffffff;}
@property --color-posts-ajax-message-bg {syntax: "<color>";inherits: true;initial-value: #f79e9e;}
@property --color-posts-ajax-message-border {syntax: "<color>";inherits: true;initial-value: #891010;}
@property --color-posts-ajax-message-span {syntax: "<color>";inherits: true;initial-value: #891010;}
@property --color-posts-ajax-footer-hover {syntax: "<color>";inherits: true;initial-value: #0160ac;}
@property --color-posts-ajax-item-meta {syntax: "<color>";inherits: true;initial-value: #b2b2be;}
@property --color-posts-ajax-item-description {syntax: "<color>";inherits: true;initial-value: #111111;}

.rdg-blocks .rdg-posts-ajax {
    .preview-thumbs {
        background-image: url('../images/rdg-posts-ajax-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: $color-wait url('../../assets/images/spinner.gif') 50% 50% no-repeat;
        }
        
        .filter {
            gap: 1rem;
            display: flex;
            padding-bottom: 2rem;

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

            .categories {
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: center;

                @media (max-width: $breakpoint-md) {
                    & {
                        flex-direction: column;
                    }
                }
                    
                .select {
                    @media (max-width: $breakpoint-md) {
                        & {
                            width: 80% !important;
                        }
                    }

                    @media (max-width: $breakpoint-sm) {
                        & {
                            width: 100% !important;
                        }
                    }
                }

                .select {
                    width: 40%;
                    display: flex;
                    position: relative;
                    border-radius: .5rem;
                    overflow: hidden;
                    box-shadow: 1px 5px 14px 0px rgb(0 0 0 / 15%);
                    min-height: 2rem;

                    &:first-of-type {
                        margin-right: 2rem;

                        @media (max-width: $breakpoint-md) {
                            & {
                                margin-right: 0;
                                margin-bottom: 1rem;
                            }
                        }
                    }
            
                    &::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(--color-posts-ajax-select-after);
                        background-color: var(--color-posts-ajax-select-after-bg);
                        pointer-events: none;
                        margin: .4rem;
                        border-radius: .5rem;
                    }
            
                    select {
                        border: 0;
                        outline: 0;
                        appearance: none;
                        box-shadow: none;
                        flex: 1;
                        padding: 14px;
                        cursor: pointer;
                        background-image: none;
                        color: var(--color-posts-ajax-select);
                        background-color: var(--color-posts-ajax-select-bg);
                
                        /* Remove IE arrow */
                        &::-ms-expand {
                            display: none;
                        }
                    }
                }
            }
        }

        @include title;

        .posts {
            .message {
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: center;
                padding: 1.5rem;
                border-radius: .5rem;
                background-color: var(--color-posts-ajax-message-bg);
                border: 1px solid var(--color-posts-ajax-message-border);

                span {
                    text-align: center;
                    color: var(--color-posts-ajax-message-span);
                }
            }
    
            .items {
                width: 100%;
                display: flex;
                gap: 1.5rem;
                flex-wrap: wrap;
                justify-content: space-evenly;
    
                .message {
                    width: 100%;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    padding: 1.5rem;
                    border-radius: .5rem;
                    background-color: var(--color-posts-ajax-message-bg);
                    border: 1px solid var(--ccolor-posts-ajax-message-border);
    
                    span {
                        text-align: center;
                        color: var(--color-posts-ajax-message-span);
                    }
                }
    
                .item {
                    width: 25rem;

                    @media (max-width: 1300px) {
                        & {
                            width: 35rem;
                        }
                    }

                    @media (max-width: 1200px) {
                        & {
                            width: 31rem;
                        }
                    }

                    @media (max-width: 1100px) {
                        & {
                            width: 28rem;
                        }
                    }

                    @media (max-width: 965px) {
                        & {
                            width: 25rem;
                        }
                    }

                    @media (max-width: 910px) {
                        & {
                            width: 21rem;
                        }
                    }

                    @media (max-width: $breakpoint-md) {
                        & {
                            width: 100%;
                        }
                    }
    
                    .image {
                        display: flex;
                        flex-direction: column;
                        justify-content: flex-end;
                        height: 16rem;
                        max-height: 16rem;
                        background-size: cover;
                        background-position: center top;
                        background-repeat: no-repeat;
    
                        @media (max-width: $breakpoint-md) {
                            & {
                                height: 16rem;
                                max-height: 16rem;
                            }
                        }
    
                        @media (max-width: $breakpoint-sm) {
                            & {
                                height: 14rem;
                                max-height: 14rem;
                            }
                        }
                    }
    
                    footer {
                        display: flex;
                        flex-direction: column;
                        margin-top: .5rem;

                        @include link-style;

                        a:hover {
                            color: var(--color-posts-ajax-footer-hover) !important;
                        }

                        .footer-title {
                            line-height: 28px;
                            display: -webkit-box;
                            -webkit-line-clamp: 3;
                            -webkit-box-orient: vertical;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            margin-bottom: .3rem;
    
                            @media (max-width: $breakpoint-md) {
                                & {
                                    -webkit-line-clamp: 4;
                                }
                            }
                        }

                        .meta {
                            color: var(--color-posts-ajax-item-meta);
                        }
    
                        .footer-description {
                            margin-top: .5rem;
                            color: var(--color-posts-ajax-item-description);
    
                            display: -webkit-box;
                            -webkit-line-clamp: 3;
                            -webkit-box-orient: vertical;
                            overflow: hidden;
                            text-overflow: ellipsis;
    
                            @media (max-width: $breakpoint-md) {
                                & {
                                    -webkit-line-clamp: 4;
                                }
                            }
                        }
    
                        a {
                            margin-top: .8rem;
                        }
                    }
                }
            }
        }
    }
}

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