.file-uploader {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    &__file,
    &__sortable-placeholder,
    &__pickers {
        box-sizing: border-box;
        float: left;
        margin-bottom: 10px;
        padding-left: 10px;
        width: 120px;
    }

    &__file {

        &-progressbar {
            .border-radius(4px);
            z-index: 1;
            left: 10%;
            position: absolute;
            top: 50%;
            width: 80%;

            >.progress {

                .box-shadow(none);
                height: 4px;
                margin: 0;
                background: none;

                .bar {
                    .box-shadow(none);
                    background-color: fade(@linkColor, 30%);
                    background-image: linear-gradient(90deg, @linkColor 25%,transparent 25%,transparent 50%,@linkColor 50%,@linkColor 75%,transparent 75%,transparent);
                    animation-duration: 1s;
                }
            }
        }

        &-section {

            &_image {
                position: absolute;
            }

            &_under-image {
                .transition(opacity 0.1s ease-in-out);
                opacity: 0;
                padding: 0;
                position: absolute;
            }

            &_text-data {
                .border-radius(3px);
                background-color: #fff;
                bottom: 0;
                display: block;
                left: 0;
                margin: auto;
                max-height: 100%;
                max-width: 100%;
                position: absolute;
                right: 0;
                text-align: center;
                top: 0;
                z-index: 2;
                &:empty {
                    background-color: transparent;
                    display: none;
                }
            }

            &:nth-last-child {
                margin-bottom: 0;
            }
        }

        &-button {
            color: #fff;
            display: inline-block;
            height: 36px;
            opacity: 0.7;
            width: 36px;

            .cs-icon {
                font-size: 18px;
                line-height: 2;
            }

            &:hover {
                color: #fff;
                opacity: 1;
            }
        }

        &-square {
            .border-radius(4px);
            background-color: #fff;
            padding-bottom: 100%;
            position: relative;
            width: 100%;

            &:before {
                .border-radius(4px);
                border: 1px solid @tableBorder;
                bottom: 0;
                content: "";
                left: 0;
                position: absolute;
                right: 0;
                top: 0;
                z-index: 1;
            }
        }

        &-control-menu {
            height: 36px;
            text-align: center;
            bottom: 0;
            position: absolute;
            width: 100%;

            &--expanded {
                top: 0;
                left: 0;
                right: 0;
                height: auto;
            }

            &-buttons-wrapper {
                top: 0;
            }

            &--expanded &-buttons-wrapper {
                position: absolute;
                bottom: 0;
                left: 0;
                right: 0;
                top: auto;
                .cursor-grab();
            }
        }

        &-preview-image {
            .border-radius(4px);
            width: 100%;
        }

        & &-description-input {
            background: transparent;
            border: none;
            color: #fff;
            opacity: 0.5;
            outline: none;
            resize: none;
            width: 90%;
            width: ~"calc(100% - 10px)";
            height: 63%;
            height: ~"calc(100% - 44px)";
            overflow-y: hidden;

            &::placeholder {
                color: #fff;
            }

            &:hover,
            &:focus {
                box-shadow: none;
                opacity: 1;
                overflow: auto;
            }
        }

        &--removed {
            border: none;
        }

        &:first-child {
            width: 240px;

            .file-uploader__remove {

                &-text {
                    font-size: @baseFontSize;
                }

                &-button-recover {
                    padding: 4px 12px;
                    font-size: @baseFontSize;
                }
            }
        }
    }

    &__sortable-placeholder {
        background-color: @tableBackgroundHover;
        outline: 1px dashed @tableBorder;
        margin-left: 10px;
        width: 110px;
        height: 110px;

        &:first-child {
            height: 230px;
            width: 230px;
        }
    }

    &__files-container {
        min-height: 251px;
        margin-bottom: -10px;
        margin-left: -10px;

        overflow: auto;
        overflow-x: hidden;

        div&.clearfix:first-child {
            margin-top: 10px;
        }
    }

    &__remove {

        &-text {
            color: #868686;
            font-size: 11px;
            font-weight: bold;
            line-height: 1.2;
            text-shadow: 0 1px 1px #fff;
            margin-bottom: 10px;
            margin-left: 7px;
            margin-right: 7px;
        }

        &-button-recover {
            padding: 2px 10px;
            font-size: 11px;
        }

        &-overlay {
            background-color: fade(@tableBackgroundHover, 95%);
            .display-flex();
            .flex-dir-column();
            height: 100%;
            .flex-justify-content(center, center);
            left: 0;
            position: absolute;
            text-align: center;
            top: 0;
            width: 100%;
            z-index: 1;
            input[type="submit"].btn {
                height: auto;
            }
        }
    }

    &__pickers {
        text-align: center;

        .file-uploader__file-square {
            background-color: @tableBackgroundHover;
        }

        & &-icon {
            font-size: 16px;
            opacity: 0.4;
            line-height: 1;
            width: 16px;
        }

        &-text {
            color: #868686;
            text-shadow: 0 1px 1px #fff;
            font-size: 11px;
            margin-left: 5px;
            margin-right: 5px;
            line-height: 1.1;
            max-height: 4.5em;
            overflow: hidden;

            &--small {
                margin-left: 0;
                margin-right: 0;
                font-size: 11px;
                font-weight: normal;
                line-height: 1.3;
            }
        }

        &-content {
            position: absolute;
            .display-flex();
            .flex-dir-column();
            .flex-justify-content(center, center);
            align-items: center;
            height: 100%;
            width: 100%;
        }

        div& p&-text {
            margin-top: 0;
        }

        div& div.btn-group&-buttons {
            display: block;
            margin-top: 2px;
            z-index: 4;
            margin-bottom: 5px;
            padding-left: 5px;
            padding-right: 5px;
            max-width: 100%;
        }

        & &-buttons-select {
            padding: 2px 10px;
            font-size: 11px;
            max-width: ~"calc(100% - 26px)";
            overflow: hidden;
        }

        &-menu {

            @media (max-width: @TabletBreakpoint) {
                position: fixed;
                bottom: 0;
            }

            .dropup & {
                
                @media (max-width: @TabletBreakpoint) {
                    bottom: 0;
                }
            }
        }

        &--expanded {
            position: absolute;
            z-index: 1;
            width: 100%;
            height: 100%;
            height: ~"calc(100% - 10px)";

            .file-uploader {

                &__file-square {
                    height: 100%;
                    padding-bottom: 0;
                    padding-right: 10px;
                    background-color: fade(lighten(@linkColor, 57%), 95%);


                    &:before {
                        border-color: fade(lighten(@linkColor, 57%), 95%);
                    }
                }

                &__pickers {

                    &-content {
                        width: 100%;
                    }

                    &-icon {
                        font-size: @inputHeight;
                        width: @inputHeight;
                        color: @linkColor;
                        opacity: 1;
                    }

                    &-text {
                        font-size: @baseFontSize;
                        margin-top: 10px;
                        color: @linkColor;

                        &--small {
                            display: none;
                        }
                    }

                    &-buttons {
                        display: none;
                    }

                    &-content {
                        animation-duration: 1s;
                        animation-name: animation-pulse;
                        animation-iteration-count: infinite;
                        animation-direction: alternate;
                    }
                }
            }
        }

        &:only-child {
            width: 100%;
            position: absolute;

            .file-uploader {

                &__file-square {
                    height: 251px;
                    padding-bottom: 0;

                    // Disabling the display of the drop zone until the page is fully loaded,
                    // if some files had already been uploaded previously
                    &:not(.file-uploader__file-square--no-files) {
                        display: none;
                    }
                }

                &__pickers {

                    &-content {
                        width: 100%;
                    }

                    &-icon {
                        font-size: @inputHeight;
                        width: @inputHeight;
                    }

                    &-text {
                        font-size: @baseFontSize;
                        margin-top: 10px;

                        &--small {
                            display: block;
                            margin-top: 5px;
                            margin-bottom: 5px;
                        }
                    }

                    &-buttons-select {
                        padding: 4px 12px;
                        font-size: @baseFontSize;
                        max-width: none;
                        overflow: auto;
                    }
                }
            }
            &:before {
                content: '';
                display: block;
                margin-bottom: -10px;
            }
        }
    }
}

.file-uploader  {

    .dz-complete &__file-progressbar {
        display: none;
    }

    &__file:hover &__file-section_under-image {
        .border-radius(4px);
        background-color: fade(@grayDark, 75%);
        .cursor-grab();
        height: 100%;
        left: 0;
        opacity: 1;
        position: absolute;
        top: 0;
        width: 100%;
        z-index: 1;
    }
}

.collapse-visible {
    overflow: visible;
}

.collapsed + .collapse-visible {
    overflow: hidden;
}

@keyframes animation-pulse {
    from {
        opacity: 0.75;
    }
    to {
        opacity: 1;
    }
}
