// COMPONENT : Uploader

/*@import '../global/tools';*/

uniform-uploader {
    font-size: 16px;
    color: #888;

    .dropzone,
    .loadingzone {
        @include flexbox;
        @include align-content(center);
        @include justify-content(center);
        @include flex-wrap(wrap);

        height: 10em;
        border: 2px dashed #ccc;
        border-radius: 0.24063em;
        margin-bottom: 1em;
        text-align: center;
    }

    .dropzone {
        padding: 0 1em;
    }

    .dropzone.dragover {
        background-color: #e4f4fc;
        border-color: #2ca9e1;

        span,
        .type.file-icon {
            display: none;
        }
    }

    .dropzone span,
    .dropzone svg,
    .loadingzone .progress,
    .loadingzone .cancel {
        @include align-self(center);
    }

    .dropzone {
        span {
            font-weight: bold;
        }

        header a {
            color: #29abe2;
            text-decoration: none;
        }

        svg.type.file-icon {
            @include flex(1, 1, 100%);
            height: 3em !important;
            fill: #ccc !important;
            margin-bottom: 1em;
        }

        .dropdown {
            position: relative;
            cursor: pointer;
            display: inline-block;
            margin-bottom: 0;
        }


        .dropdown .file-icon {
            vertical-align: middle;
            width: 1.382em;
            height: 1.382em;
            margin-right: 1em;
        }

        .dropdown .menu {
            @include flex-direction(column);

            font-weight: normal;
            position: absolute;
            top: 0;
            display: none;
            opacity: 0;
            transition: all 0.3s;
            min-width: 15em;
            background-color: #fff;
            border: 1px solid #ccc;
            border-radius: 3px;

            &.open {
                @include flexbox;
                top: 2em;
                visibility: visible;
                opacity: 1;
                height: auto;
                z-index: 101;

                a {
                    @include flex(1, 0, auto);
                    @include align-items(center);
                    line-height: 3em;
                    padding: 0 1.382em 0 1em;
                    color: #888888;
                    text-decoration: none;
                }
            }
        }

        .dropdown .menu a:hover {
            background-color: #eee;
            text-decoration: none;
        }

        .dropdown a:not(:last-child) {
            border-bottom: 1px solid #ccc;
        }
    }

    .loadingzone {
        padding: 1em;

        .progress {
            @include flex(1);
            @include flexbox;
            height: 40px;
            margin: 1em;
            background-color: #f4f4f4;
            color: #2ca9e1;
            border-radius: 2px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) inset;
        }
        .progress .progress-bar {
            @include flexbox;
            @include justify-content(flex-end);
            @include align-items(center);
            @include transition(width, 0.3s, ease-in-out);

            background-color: #3BA16A;
            height: 100%;
            color: #fff;
            padding-right: 1em;

            &.indeterminate {
                position: relative;
                overflow: hidden;
            }
            &.indeterminate:before{
                display: block;
                position: absolute;
                content: "";
                top: 0;
                left: -200px;
                width: 30%;
                height: 100%;
                background-color: rgba(0,0,0,0.3);
                @include animation(loading 2s linear infinite);
            }

            @include keyframes(loading) {
                from {left: -200px; width: 30%;}
                50% {width: 30%;}
                70% {width: 70%;}
                80% {left: 50%;}
                95% {left: 120%;}
                to {left: 100%;}
            }
        }

        .cancel {
            color: #e07c3a;
            cursor: pointer;

            &:hover {
                text-decoration: none;
            }
            &:active {
                color: #ff6500;
            }
        }

        .status {
            @include flex(1, 1, 100%);
            text-align: center;
        }
    }

    .files {
        @include flexbox;
        @include flex-wrap(wrap);

        margin-bottom: 2em;
        margin-top: .382em;

        .file {
            @include flexbox;
            @include flex-direction(column);

            width: 12em;
            height: 6.667em;
            padding: .3em;
            border: 1px solid rgb(204,204,204);
            margin: .382em;
        }

        .file .icons {
            @include flexbox;
            @include flex-direction(row);
            @include justify-content(space-between);
            @include align-items(center);

            a {
                padding: .2em;
                box-shadow: 0 0px 1px rgba(0,0,0,.6);
                border-radius: 2px;

                &:hover {
                    pointer-events: all;
                    cursor: pointer;

                    .icon {
                        fill: rgb(41,171,226);
                    }
                }
            }
        }

        .file .name {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            color: rgb(136,136,136);
            text-align: center;
            margin-top: .618em;
        }
    }

    .row,
    .dropzone .menu a {
        @include flexbox;
    }

    .hidden {
        display: none;
    }

    .errors {
        color: #e07c3a;
        font-weight: bold;

        div {
            margin-bottom: 0.3em;
        }

        .hint {
            color: #888;
            font-weight: normal;
        }
    }

    /* for Blazer global style overwrite woot woot */
    section {
        margin-bottom: 0 !important;
        vertical-align: middle !important;
    }

    .mobile-only {
        display: none;
    }

    @include max-screen-size(small) {
        .dropzone {
            height: 5em;
        }

        .dropzone svg.type.file-icon {
            display: none;
        }

        .dropzone .mobile-only {
            display: block;
        }

        .dropzone .desktop-only {
            display: none;
        }
    }
}
