@import "../../styles/index";
@transition: .18s;
.dnn-file-upload {
    float: left;
    width: 304px;
    height: 162px;
    background: var(--dnn-color-surface, @alabaster);
    border: 12px solid var(--dnn-color-background, white);
    outline: 1px solid var(--dnn-color-foreground-light, @mountainMist);
    position: relative;
    border-radius: var(--dnn-controls-radius, 0);
    .overlay {        
        position: absolute;
        top: -12px;
        bottom: -12px;
        left: -12px;
        right: -12px;
        text-align: center;
        transition: @transition;
        z-index: 1;
        &.hover {
            background: rgba(
                var(--dnn-color-primary-r, 30),
                var(--dnn-color-primary-g, 136),
                var(--dnn-color-primary-b, 195),
                0.6);
            * {
                pointer-events: none;
            }
            span {
                color: var(--dnn-color-background, white);
            }
            .buttons {
                .button.upload {
                    color: var(--dnn-color-background, white);
                }
            }
        }
        &.has-image {
            opacity: 0;
            &:hover, &.hover {
                opacity: 1;
            }
        }
        &:hover {
            background: rgba(
                var(--dnn-color-primary-r, 30),
                var(--dnn-color-primary-g, 136),
                var(--dnn-color-primary-b, 195),
                0.6);
            span {
                color: var(--dnn-color-background, white);
            }
            .buttons {
                &:hover {
                    .button {
                        color: @alto;
                        &:hover {
                            color: var(--dnn-color-background, white);
                        }
                    }
                }
                .button {
                    color: var(--dnn-color-background, white);
                }
            }
        }
        span {
            margin: 25px 100px;
            float: left;
            width: 128px;
            box-sizing: border-box;
            color: var(--dnn-color-surface-contrast, @rollingStone);
            transition: @transition;
        }
        .buttons {
            margin: auto;
            height: 32px;
            margin-top: 50px;
            width: 201px;
            transition: @transition;
            .button {
                box-sizing: content-box;
                float: left;
                width: 32px;
                height: 32px;
                padding: 0 17.5px;
                color: var(--dnn-color-foreground, @alto);
                cursor: pointer;
                position: relative;
                overflow: hidden;
                background: transparent !important;
                input[type="file"] {
                    position: absolute;
                    top: -100px;
                    bottom: -100px;
                    left: -100px;
                    right: -100px;
                    opacity: 0;
                    cursor: pointer;
                    width: auto;
                    height: 162px;
                }
                svg {
                    width: 32px;
                    height: 32px;
                }
                &:first-of-type {
                    margin-left: 0px;
                }
            }
        }
    }
    .file-upload-container {
        position: absolute;
        top: -12px;
        bottom: -12px;
        left: -12px;
        right: -12px;
        background: var(--dnn-color-background, white);
        padding: 14px 22px;
        z-index: 2;
        h4 {
            margin-bottom: 8px;
            color: var(--dnn-color-foreground, @bulgarianRose);
        }
        .textarea-container {
            float: left;
            width: 100%;
            height: 90px;
            border: 1px solid var(--dnn-color-foreground, @mountainMist);
            position: relative;
            textarea {
                resize: none;
                width: 100%;
                height: 64px;
                border: none;
                outline: none !important;
                padding: 10px;
                box-sizing: border-box;
                color: var(--dnn-color-foreground, @bulgarianRose);
            }
        }
        span {
            float: right;
            margin-right: 10px;
            color: var(--dnn-color-primary, @curiousBlue);
        }
        .drop-down {
            width: 100%;
            float: left;
            height: 30px;
            border: 1px solid var(--dnn-color-foreground, @mountainMist);
            margin-bottom: 16px;
            position: relative;
            &:after {
                content: "";
                position: absolute;
                right: 8px;
                top: 12px;
                width: 0;
                height: 0;
                pointer-events: none;
                border-left: 6px solid transparent;
                border-right: 6px solid transparent;
                border-top: 6px solid var(--dnn-color-foreground, @rollingStone);
            }
        }
    }
    .image-container {
        position: absolute;
        top: 0px;
        left: 0px;
        right: 0px;
        bottom: 0px;
        overflow: hidden;
        z-index: 0;
        img {
            position: absolute;
            width: auto;
            height: 100%;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            overflow: hidden;
            z-index: 0;
        }
    }
}

.dnn-file-upload .dnn-file-upload-file-name {
    position: absolute;
    bottom: 0;
    text-align: center;
    width: 100%;

    & > span {
        background-color: @alabaster;
        padding: 3px 10px;
        border-radius: 3px;
        border: solid 1px var(--dnn-color-background, lightgray);
        opacity: 0.8;
    }
}

.dnn-file-upload .file-upload-container {
    
    &.dnn-upload-bar {
        padding: 12px;
        transition: opacity .4s .6s;
        &.complete {
            opacity: 0;
        }
        .upload-bar-container {
            color: var(--dnn-color-primary, @curiousBlue);
            float: left;
            width: 100%;
            height: 100%;
            border: 1px solid var(--dnn-color-primary, @curiousBlue);
            background: var(--dnn-color-background, #f4f6f7);
            padding: 5px 20px;
            box-sizing: border-box;
            .upload-file-name {
                margin-bottom: 10px;
                word-wrap: break-word;
                max-height: 16px;
            }
            .upload-icon {
                width: 42px;
                height: 42px;
                margin: auto;
            }
            h4 {
                color: var(--dnn-color-primary, @curiousBlue);
                margin: auto;
                text-align: center;
                font-size: 14px;
                margin: 10px;
            }
            .upload-bar-box {
                position: relative;
                float: left;
                width: 100%;
                height: 4px;
                background: var(--dnn-color-background, @alto);
                margin-top: 5px;
                .upload-bar {
                    width: 0;
                    float: left;
                    background: var(--dnn-color-primary, @curiousBlue);
                    height: 100%;
                    left: 0px;
                    transition: .1s;
                }
            }
        }
    }
    &.upload-error {
        .upload-bar-container {
            border: 1px solid var(--dnn-color-danger, @alizarinCrimson);
            color: var(--dnn-color-danger, @alizarinCrimson);
            h4 {
                color: var(--dnn-color-danger, @alizarinCrimson);
            }
            .upload-bar-box {
                background: var(--dnn-color-danger, @alizarinCrimson);
            }
        }
    }
}