/* 
   Copyright (C) 2016 Cuckoo Foundation.
   This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
   see the file 'docs/LICENSE' for copying permission.
 */

@keyframes indicatorBounce {
    0% { transform: translateY(100%); }
    50% { transform: translateY(75%); }
    100% { transform: translateY(100%); }
}

@-webkit-keyframes indicatorBounce {
    0% { transform: translateY(100%); }
    50% { transform: translateY(75%); }
    100% { transform: translateY(100%); }
}

.dndupload {

    margin: 0px auto;
    background-color: transparent;
    position: relative;
    padding: 10px;
    height: 100%;

    #uploader {
        height: 100%;
        padding: 50px 20px;
        outline-offset: -10px;
        outline: 1px dashed #92b0b3;
        -webkit-transition: outline-offset .1s ease-in-out, background-color .1s linear;
        transition: outline-offset .1s ease-in-out, background-color .1s linear;

        &.hover {
            outline-offset: -20px; 
        }
    }

    #container {
        position: relative;
        top: 50%;
        transform: translateY(-50%);
    }

    .holder_input {
        width: 0.1px;
        height: 0.1px;
        opacity: 0;
        overflow: hidden;
        position: absolute;
        z-index: -1;
    }

    .holder_button {
        display: none;
        // font-weight: 700;
        // color: #e5edf1;
        // background-color: #39bfd3;
        // padding: 8px 16px;
        // margin: 40px auto 0;
    }

    .fail {
        background: #c00; 
        padding: 2px; 
        color: #fff;
    }

    .hidden { display: none !important; }

    label {
        width: 100%;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
        overflow: hidden;
        text-align: center;
        color: #6e8e91;

        strong {
            color: #4e6658; 
            text-decoration: underline; 
            cursor: pointer;
        }
    }

    svg {
        width: 100%;
        fill: #cccccc;
        margin-bottom: 20px;
        display: block;
    }

    img { display: block; margin: 10px auto; }
    p { margin: 10px; font-size: 14px; }

    progress {

        background: #f3f3f3; 
        height: 20px; 
        margin: auto; 
        width: 50%; 
        display: inherit;

        &::-webkit-progress-bar { background: #f3f3f3; }

    }

    &__simple {

        @extend .dndupload;

        form#uploader {
            outline: 0;
            outline-offset: 0;
            padding-top: 55px;
            transition: padding 100ms ease-in;
        }

        // this field has to be clickable in its entirety
        .holder_input {
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            z-index: 5;

            &:hover {
                cursor: pointer;
            }
        }

        // progress bar styling
        progress#uploadprogress {
            -webkit-appearance: none;
            position: absolute;
            bottom: calc(10% + 5px);
            left: calc(5% + 5px);
            width: calc(90% - 10px);
            opacity: 0;
            transition: opacity 100ms ease-in;

            &::-webkit-progress-bar { 
                background: #f3f3f3; 
            }

            &::-webkit-progress-value {
                background: #71a1f9;
            }

        }

        &:before {
            content: "";
            display: block;
            position: absolute;
            width: 90%;
            height: 80%;
            left: 5%;
            top: 10%;
            border: 5px dashed #ccc;
            opacity: 0;
            transition: opacity 100ms ease-in,
                        border 100ms ease-in;
        }

        &.dragging,
        &.dropped {

            form#uploader {
                padding-top: 45px;
            }

            progress#uploadprogress {
                opacity: 1;
            }

            &:before {
                opacity: 1;
            }
        }

        &.dragging {

            .fa:before {
                content: "\f063";
            }

        }

        &.dropped {

            .fa:before {
                content: "\f00c";
            }

            &:before {
                border: 5px solid #71a1f9;
            }

        }

    }

    &__v2 {

        @extend .dndupload;

        margin-top: 65px;
        margin-bottom: 55px;

        border: 5px dashed #ccc;
        width: 335px;
        height: 335px;
        border-radius: 50%;
        padding: 0;
        overflow: hidden;
        -webkit-mask-image: -webkit-radial-gradient(circle, white, black);
        background-color: #fff;
        transition: border 300ms linear;

        .text-hovering,
        .text-dropped,
        .text-done,
        .text-error { display: none; }

        &.hover {
            border-color: #9F9F9F;

            .text-idle,
            .text-dropped,
            .text-done,
            .text-error { display: none; }

            .text-hovering { display: block; }

            .alternate-progress {
                -webkit-animation: indicatorBounce 1s 1;
            }
        }

        &.dropped {

            .text-idle,
            .text-hovering,
            .text-error,
            .text-done { display: none; }

            .text-dropped { display: block; }
        }

        &.done {

            border: 0;

            .text-idle,
            .text-hovering,
            .text-error,
            .text-dropped { display: none; }

            .text-done { display: block; }
        }

        &.error {

            border: 0;

            .text-idle,
            .text-hovering,
            .text-done,
            .text-dropped { display: none; }

            .text-error { display: block; }

            .alternate-progress {
                background-image: linear-gradient(-180deg, #FDA19C 0%, #F86262 100%);
            }

        }

        form#uploader {
            position: absolute;
            width: 100%;
            height: 100%;
            outline: 0;
            outline-offset: 0px;
            border-radius: 50%;
            padding: 0;
            z-index: 2;

            label {
                color: #6297F8;
                text-decoration: none;
                display: block;
                width: 100%;
                padding: 0 20px;
                white-space: normal;

                strong { 
                    color: inherit; 
                    text-decoration: none; 
                }

                small { 
                    font-weight: 400;
                    display: block; 
                    margin: 10px 0;
                }

                em {
                    font-style: normal;
                    text-decoration: underline;
                }

            }

        }

        &.progress-half form#uploader label {
            color: #fff;
        }

        progress {
            display: none;
        }

        .alternate-progress {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            background-image: linear-gradient(-180deg, #9CC8FD 0%, #6297F8 100%);
            transform: translateY(100%);
            transition: transform 300ms ease-out;

            @include cuckoo-theme('cyborg') {
                background-image: linear-gradient(-180deg, #0ce3ac 0%, #5fe6c4 100%);
            }

            @include cuckoo-theme('night') {
                background-image: linear-gradient(-180deg, #324456 0%, #242b38 100%);
            }

        }

        @include cuckoo-theme('cyborg') {
            background-color: transparent;
            border-color: $cyborg_border_color;

            form#uploader {
                label {
                    color: $cyborg_text_color;
                }
            }
        }

        @include cuckoo-theme('night') {
            border-color: $night_border_color;
        }

    }

}

// as an extension to the  current dnd uploader styles,
// this base class is used to style the custom inner elements
.upload-module {

    &__container {
        width: 325px;
    }

    &__body {

        width: 650px;
        margin-left: -160px;

        &--left {
            width: 335px;
            float: left;
        }

        &--right {
            float: right;
            margin-top: 131px;
        }

    }

    h3 {
        color: #B0B0B0;
        font-weight: 900;
        font-size: 18px;
        margin-bottom: 15px;
    }

    .allowed-file-types {

        width: 300px;
        padding-left: 30px;

        h4 {
            font-weight: 400;
            font-size: 22px;
            color: #b5b5b5;
            margin-bottom: 20px;
        }

        ul {
            display: flex;
            flex-wrap: wrap;
            list-style: none;
            padding: 0;

            li {
                position: relative;
                margin: 0 7px;
                padding: 5px 0;

                .fa {
                    font-size: 41px;
                    color: #B5B5B5;
                }

                span {
                    position: absolute;
                    left: 0;
                    width: 100%;
                    text-align: center;
                    bottom: 14px;
                    font-weight: 700;
                    font-size: 10px;
                    color: #B5B5B5;
                }

                &.footnote {
                    font-size: 12px;
                    align-self: flex-end;
                    color: #b5b5b5;
                }

            }
        }

    }

}

#tab-hash {

    textarea { 
        width: 700px;
        margin-left: -175px;
        margin-bottom: 20px; 
    }

}