//##############################################################################
// DRAG AND DROP

form .form-row {
    &[class*="file"],
    &[class*="img"],
    &[class*="image"],
    &[class*="visual"] {
        .related-widget-wrapper-link {
            display: none;
        }
    }
    .filer-dropzone {
        @include clearfix;
        position: relative;
        min-width: 215px;
        border: solid 1px $gray-lighter;
        border-radius: $border-radius-base;
        background-color: $gray-lightest;
        box-sizing: border-box !important;
        .z-index-fix {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
        }
        &.dz-drag-hover {
            padding-top: 19px;
            background-color: $color-primary-light;
            border: solid 2px $color-primary !important;
            .z-index-fix {
                z-index: 1;
            }
            .dz-message {
                opacity: 1;
                display: block !important;
                visibility: visible;
            }
            .filerFile {
                display: none;
            }
            .dz-message, .dz-message .icon {
                color: $color-primary !important;
            }
        }
        &.dz-started .fileUpload {
            display: none;
        }
        .dz-preview {
            width: 100%;
            min-height: auto;
            margin-right: 0;
            margin-bottom: 0;
            margin-left: 0;
            padding-bottom: 10px;
            border-bottom: solid 1px $gray-lighter;
            &.dz-error {
                position: relative;
                .dz-error-message {
                    display: none;
                }
                &:hover .dz-error-message {
                    display: block;
                }
            }
            .dz-details {
                min-width: calc(100% - 80px);
                max-width: calc(100% - 80px);
                margin-top: 7px;
                margin-left: 40px;
                padding: 0;
                opacity: 1;
                .dz-filename,
                .dz-filename:hover,
                .dz-size {
                    float: left;
                    text-align: left;
                    span {
                        color: $gray;
                        border: 0 !important;
                        background-color: transparent !important;
                    }
                }
            }
            .dz-remove {
                @include icon(trash-o);
                display: inline-block;
                position: absolute;
                top: 7px;
                right: 25px;
                font: 0/0 a;
                &:before {
                    color: $gray;
                    font-size: 18px;
                }
            }
            .dz-error-message {
                top: 65px;
                left: 0;
                width: 100%;
            }
            .dz-success-mark,
            .dz-error-mark {
                top: 5px;
                right: 0;
                left: auto;
                margin-top: 0;
                &:before {
                    color: $gray;
                }
                svg {
                    display: none;
                }
            }
            .dz-success-mark {
                @include icon(check);
                &:before {
                    color: $color-success;
                }
            }
            .dz-error-mark {
                @include icon(remove);
                &:before {
                    color: $color-danger;
                }
            }
            &.dz-image-preview,
            &.dz-file-preview {
                background-color: transparent;
                .dz-image {
                    overflow: hidden;
                    width: 36px;
                    height: 36px;
                    border: solid 1px $gray-lighter;
                    border-radius: 0;
                    img {
                        width: 100%;
                        height: auto;
                    }
                }
            }
            .dz-progress {
                top: 18px;
                left: 0;
                width: calc(100% - 40px);
                height: 10px;
                margin-left: 40px;
            }
        }
        .dz-message {
            float: right;
            color: $gray-dropzone;
            width: 100%;
            margin: 15px 0 0;
        }
        .icon {
            position: relative;
            top: 3px;
            color: $gray-dropzone;
            font-size: 24px;
            margin-right: 10px;
        }
        .filerFile .related-lookup {
            @include button-variant($btn-action-color, $btn-action-bgcolor, $btn-action-border, true);
            float: left !important;
            overflow: hidden;
            // makes true that button has correct height #668
            line-height: $font-size-normal;
            width: auto !important;
            height: auto !important;
            padding: 10px 20px !important;
            cursor: pointer;
            .fa {
                color: white;
                font-size: 17px;
                margin: 0 10px 0 0 !important;
                vertical-align: middle;
            }
            &:before {
                display: none;
            }
            .choose-file,
            .edit-file {
                color: white;
                margin: 0;
            }
            .edit-file {
                display: none;
            }
            &.related-lookup-change {
                @include button-variant($btn-default-color, white, $btn-default-border, true);
                float: right !important;
                padding: 5px 0 !important;
                width: 36px !important;
                height: 36px !important;
                &:focus {
                    background-color: white !important;
                }
                span {
                    text-align: center;
                    line-height: 24px;
                }
                .fa {
                    color: #999;
                    margin-right: 0 !important;
                }
                .choose-file {
                    display: none;
                }
                .edit-file {
                    display: block;
                }
            }
        }
        // makes sure that filer clear button has correct size #669
        .filerClearer {
            width: 36px !important;
            height: 36px !important;
        }
        .filerFile {
            position: absolute;
            top: 32px;
            // required for django CMS <= 3.1 #673
            left: 20px;
            width: calc(100% - 40px);
            img[src*=nofile] {
                background-color: $white;
            }
            // make sure that text crops if there is not enough space #670
            span:not(:empty):not('.choose-file'):not('.edit-file') {
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
                width: calc(100% - 150px);
            }
            // required for django CMS <= 3.1 #673
            img {
                width: 36px;
                height: 36px;
                margin-right: 10px;
                border: solid 1px $gray-lighter;
                border-radius: $border-radius-base;
                &[src*="nofile"] {
                    box-sizing: border-box;
                    margin-right: 0;
                    border: solid 1px $gray-lighter;
                    border-radius: $border-radius-base;
                }
            }
            // required for django CMS <= 3.1 #673
            img,
            .related-lookup {
                display: inline-block;
                text-align: center !important;
                vertical-align: top;
            }
            // required for django CMS <= 3.1
            a {
                box-sizing: border-box;
                padding-top: 10px !important;
            }
            // required for django CMS <= 3.1 #673
            span {
                display: inline-block;
                color: $gray;
                font-weight: normal;
                margin-top: 6px;
                margin-bottom: 6px;
                text-align: left;
                &:empty + .related-lookup {
                    float: none !important;
                    margin-left: 0 !important;
                }
            }
            // required for django CMS <= 3.1 #673
            .filerClearer {
                @include button-variant($btn-default-color, $btn-default-bgcolor, $btn-default-border, true);
                float: right;
                // make sure that clear button has correct size #272
                width: 10px;
                height: 10px;
                margin: 0 0 0 5px !important;
                padding: 12px !important;
                border: solid 1px $gray-lighter;
                border-radius: $border-radius-base;
                cursor: pointer;
                &:before {
                    color: $gray-light !important;
                    vertical-align: middle;
                    margin: 0;
                }
            }
        }
        &.filer-dropzone-mobile {
            .filerFile {
                top: 40px;
                text-align: center;
            }
            .dz-message {
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
                // make sure that drag and drop widget looks nice on mobile #670
                margin-top: 75px;
            }
            &.js-object-attached .filerFile {
                top: 32px;
                text-align: left;
                &.js-file-selector {
                    @media screen and (max-width: $screen-tablet-filer) {
                        .description_text {
                            text-overflow: ellipsis;
                            width: calc(100% - 150px);
                            overflow: hidden;
                            height: 20px;
                        }
                    }
                    span:not('.choose-file'):not('.edit-file'), .dz-name {
                        width: calc(100% - 145px);
                    }
                }
            }
        }
        &.filer-dropzone-folder .filerFile {
            top: 32px !important;
            #id_folder_description_txt {
                float: left;
            }
        }
        @media screen and (max-width: $screen-tablet-filer) {
            .filerFile {
                top: 40px !important;
                text-align: center;
            }
            .dz-message {
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
                // make sure that drag and drop widget looks nice on mobile #670
                margin-top: 75px !important;
            }
            &.js-object-attached .filerFile {
                top: 62px !important;
            }
            &.filer-dropzone-folder .filerFile {
                top: 62px !important;
            }
        }
    }
}

.filer-dropzone {
    min-height: 100px !important;
    @media screen and (max-width: $screen-tablet-filer) {
        min-height: 150px !important;
    }
    .dz-upload {
        height: 5px;
        background-color: #0bf;
    }
    .dz-name {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        max-width: calc(100% - 145px);
    }
    .dz-thumbnail {
        display: inline-block;
        overflow: hidden;
        vertical-align: top;
        width: 36px;
        height: 36px;
        margin-right: 10px;
        border: solid 1px #ddd;
        border-radius: 3px;
        background: #fff url("../icons/nofile_48x48.png");
        background-size: cover;
        img {
            background: #fff;
            &[src=""],
            &:not([src]) {
                width: 104%;
                height: 104%;
                margin: -2%;
            }
        }
    }
}

.filer-dropzone-info-message {
    position: fixed;
    bottom: 35px;
    left: 50%;
    z-index: 2;
    text-align: center;
    width: 270px;
    max-height: 300px;
    overflow-y: auto;
    margin: -50px 0 0 -150px;
    padding: 15px 15px 0;
    border-radius: $border-radius-base;
    background: $white;
    box-shadow: $base-box-shadow;
    .icon {
        font-size: 35px;
        color: $color-primary;
    }
    .text {
        margin: 5px 0 10px;
    }
}
.filer-dropzone-upload-info {
    margin-top: 10px;
    // make sure that file name on upload progress is cut #675
    .filer-dropzone-file-name {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    &:empty {
        margin-top: 0;
    }
}
.filer-dropzone-progress {
    height: 5px;
    margin-top: 5px;
    background-color: #0bf;
}

.filer-dropzone-upload-welcome .folder {
    color: $color-primary;
    padding: 10px 0 0;
    margin: 0 -15px;
    border-top: solid 1px $gray-lighter;
    img,
    span {
        vertical-align: middle;
    }
    img {
        margin-right: 5px;
    }
    .folder-inner {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        padding: 0 10px;
    }
}

.filer-dropzone-cancel {
    padding-top: 10px;
    border-top: solid 1px $gray-lighter;
    margin: 15px -15px 10px;
    a {
        font-size: $font-size-small;
        color: $gray !important;
    }
}
.filer-dropzone-upload-success,
.filer-dropzone-upload-canceled {
    margin: 0 -15px 10px;
}

.filer-dropzone-upload-count {
    padding-bottom: 10px;
    margin: 10px -15px;
    border-bottom: solid 1px $gray-lighter;
}
