@import './_base_basic_antd.less';

.tinymce-imagelibrary-dialog {

    .tox-dialog__title {
        a {
            font-weight: 600;
            color: #1890ff;
            cursor: pointer;
        }
    }

    & :not(svg):not(rect) {
        background: initial;
        border: initial;
        float: initial;
        height: initial;
        margin: initial;
        max-width: initial;
        outline: initial;
        padding: initial;
        position: initial;
        width: initial;
    }

    /** layouting, force to have same height **/
    .tiny-imagelibs,
    .tinymce-imagelibrary-root,
    .tox-form__group,
    .tox-form {
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow: auto;
        width: 100%;
        height: 100%;
    }

    .tox-dialog__body-content,
    .tox-dialog__content-js {
        overflow: hidden;
    }

    .tox-form__group {
        position: relative !important;

        .tinymce-imagelibrary-root {
            .tiny-imagelibs {
                width: 100%;
                height: calc(100% - 60px);
                position: absolute;
                top: 60px;
                left: 0;
                right: 0;
                bottom: 0;
                overflow: hidden;

                .ant-message {
                    -webkit-box-sizing: border-box;
                    box-sizing: border-box;
                    margin: 0;
                    padding: 0;
                    color: rgba(0,0,0,.85);
                    font-size: 14px;
                    font-variant: tabular-nums;
                    line-height: 1.5715;
                    list-style: none;
                    -webkit-font-feature-settings: "tnum";
                    font-feature-settings: "tnum";
                    position: absolute;
                    top: auto;
                    bottom: 8px;
                    left: 0;
                    z-index: 1010;
                    width: 100%;
                    pointer-events: none;

                    .ant-message-notice {
                        padding: 8px;
                        text-align: center;
                    }

                    .ant-message-notice-content {
                        display: inline-block;
                        padding: 10px 16px;
                        background: #fff;
                        border-radius: 2px;
                        -webkit-box-shadow: 0 3px 6px -4px rgba(0,0,0,.12),0 6px 16px 0 rgba(0,0,0,.08),0 9px 28px 8px rgba(0,0,0,.05);
                        box-shadow: 0 3px 6px -4px rgba(0,0,0,.12),0 6px 16px 0 rgba(0,0,0,.08),0 9px 28px 8px rgba(0,0,0,.05);
                        pointer-events: all;
                    }
                }

                .ant-message-error .anticon {
                    color: #ff4d4f;
                    svg {
                        fill: #ff4d4f;
                    }
                }

                .ant-message-info .anticon {
                    color: #349ED8;
                    svg {
                        fill: #349ED8;
                    }
                }
      
                .ant-empty {
                    margin: 80px 8px 0;
                    text-align: center;
                }

                &.loading .ant-empty {
                    display: none;
                }

                .ant-spin-dot-item {
                    background: #1890ff !important;
                    width: 10px;
                    height: 10px;
                    position: absolute;
                }
                
                .ant-list-item {
                    position: relative;

                    &:hover {
                        & > .remove {
                            opacity: 1;
                        }
                    }
        
                    .remove {
                        position: absolute;
                        width: 40px;
                        height: 40px;
                        top: 0;
                        right: 0;
                        display: flex;
                        justify-content: center;
                        align-items: center;
                        background: #2074BB;
                        color: #fff;
                        border-radius: 5px;
                        opacity: 0;
                        transition: opacity ease-in 0.3s;
                        cursor: pointer;
                        z-index: 10;
                    }

                    .attribution {
                        position: absolute;
                        z-index: 3;
                        bottom: 0;
                        font-size: 12px;
                        width: 100%;
                        padding: 5px;
                        background: rgba(0,0,0,0.6);
                        color: #fff;
                        display: inline-flex;
                        justify-content: center;
                        align-items: center;
                        gap: 2px;
                
                        a {
                            color: #ccc;
                        }
                
                        .author {
                            max-width: 100px;
                            white-space: pre;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            display: inline-block;
                            vertical-align: middle;
                        }
                    }
                }

                .ant-input-group-addon {
                    padding: 0 11px;
                    background-color: #fafafa;
                    border: 1px solid #d9d9d9;
                    border-radius: 2px;

                    .ant-input-lg {
                        padding: 3px 11px;
                    }
                }

                .ant-input-search-button {
                    height: 32px;
                    background: none;
                    position: relative;
                    top: -2px;
                    cursor: pointer;
                    border: none;
                    outline: 0;
                    box-shadow: none;
                    color: inherit;

                    &:hover {
                        color: inherit;
                    }
                }

                .ant-btn, .ant-btn:active, .ant-btn:focus {
                    outline: 0;
                }

                .top-box {
                    width: 100%;
                    height: 60px;
                    display: flex;
                    gap: 10px;

                    .image-search {
                        flex-grow: 1;
                    }

                    .image-upload {
                    }
                }

                .content-box {
                    width: 100%;
                    height: ~"calc(100% - 60px)";
                    overflow-y: auto;
                    overflow-x: hidden;

                    .loading-container {
                        position: absolute;
                        bottom: 40px;
                        width: 100%;
                        text-align: center;
                    }
                
                    .images {
                        height: 200px;
                        object-fit: cover;
                        object-position: top center;
                        overflow: hidden;
                        display: flex;
                        justify-content: center;
                        align-items: center;
                        background: #f7f7f7;
                        border: 2px solid #f7f7f7;
                        cursor: pointer;
                        position: relative;
                
                        &:hover {
                            border: 2px solid #349ED8;
                        }
                
                        &.active {
                            border: 2px solid #2074BB;
                        }
    
                        &.deleting {
                            border: 2px solid #ce132d;
                        }
    
                        &.deleting:after {
                            position: absolute;
                            top: 0;
                            left: 0;
                            right: 0;
                            bottom: 0;
                            background: rgba(0,0,0,0.5);
                            content: '';
                            display: block;
                            z-index: 4;
                        }
                
                        & > .lazy-load-image-background {
                            display: flex;
                            justify-content: center;
                            align-items: center;
                            position: relative;
                            z-index: 2;
                            width: 100%;
                            height: 100%;
                        }
    
                        .image-placeholder {
                            position: absolute;
                            top: 0;
                            left: 0;
                            right: 0;
                            bottom: 0;
                            z-index: 1;
                            display: flex;
                            justify-content: center;
                            align-items: center;
    
                            svg {
                                width: 60px;
                                height: 60px;
                                fill: #cccccc;
                            }
                        }
    
                        .image-spinner {
                            position: absolute;
                            top: 0;
                            left: 0;
                            right: 0;
                            bottom: 0;
                            z-index: 5;
                            display: flex;
                            justify-content: center;
                            align-items: center;
                        }
    
                        .lazy-load-image-loaded ~ .image-placeholder {
                            display: none;
                        }
    
                        img {
                            min-width: 100%;
                            max-height: 100%;
                            object-fit: cover;
                        }
                    }
                }
            }
        }
    }
}