@import "compass/css3";
@import "variables";
@import "image";
@import "text-complete";

.#{$css-prefix} {
    &, & * {
        @include box-sizing(border-box);
    }

    &, &.form-control {
        display: block;
        position: relative !important;
        width: 100%;
        height: auto;
        padding: 0;
        font-size: $font-size;
        border: 0;
        background-color: $bg-color;
        border: 1px solid $border-color;
        @include border-radius($border-radius);
        @include box-shadow($box-shadow-inset);
           -moz-transition: border-color 0.15s ease-in-out,    -moz-box-shadow 0.15s ease-in-out;
             -o-transition: border-color 0.15s ease-in-out,         box-shadow 0.15s ease-in-out;
        -webkit-transition: border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;
                transition: border-color 0.15s ease-in-out,         box-shadow 0.15s ease-in-out;
    }

    &.focused {
        border-color: $border-color-focused;
        outline: 0;
        @include box-shadow($box-shadow-inset, $box-shadow-focused);
    }

    .#{$css-prefix}-editor {
        display: block;
        height: auto;
        min-height: 8em;
        max-height: 15em;
        overflow: auto;
        padding: 6px 24px 6px 12px;
        line-height: 1.42857143;
        font-size: inherit;
        color: $text-color;
        background-color: transparent;
        border: 0;
        cursor: text;
        margin-right: 1px;
        @include border-radius(0);
        @include box-shadow(none);

        &:empty:before {
            content: attr(placeholder);
            display: block;
            color: $placeholder-color;
        }

        &:focus {
            border: 0;
            outline: 0;
            @include box-shadow(none);
        }

        [class*=emojione-], .emojioneemoji {
            font-size: inherit;
            height: 2ex;
            width: 2.1ex;
            min-height: 20px;
            min-width: 20px;
            display: inline-block;
            margin: -.2ex .15em .2ex;
            line-height: normal;
            vertical-align: middle;
            max-width: 100%;
            top: 0;
        }
    }

    &.#{$css-prefix}-inline {
        height: $inline-height;

        > .#{$css-prefix}-editor {
            height: $inline-height - 2;
            min-height: 20px;
            overflow: hidden;
            white-space: nowrap;
            position: absolute;
            top: 0;
            left: 12px;
            right: 24px;
            padding: 6px 0;
        }
        > .#{$css-prefix}-button {
            top: 4px;
        }
    }

    .#{$css-prefix}-button {
        z-index: 5;
        position: absolute;
        right: 3px;
        top: 3px;
        width: 24px;
        height: 24px;
        opacity: 0.6;
        cursor: pointer;
        @include transition(opacity 300ms ease-in-out);

        &:hover {
            opacity: 1;
        }

        > div {
            display: block;
            width: 24px;
            height: 24px;
            position: absolute;
            @include transition(all 400ms ease-in-out);
            $_hack: inline-image-store(background, $sprite);

            &.#{$css-prefix}-button-open {
                background-position: 0 -24px;
                @include opacity(1);
            }

            &.#{$css-prefix}-button-close {
                background-position: 0 0;
                -webkit-transform: rotate(-45deg);
                -o-transform: rotate(-45deg);
                transform: rotate(-45deg);
                @include opacity(0);
            }
        }
        &.active {
            > div {
                &.#{$css-prefix}-button-open {
                    -webkit-transform: rotate(45deg);
                    -o-transform: rotate(45deg);
                    transform: rotate(45deg);
                    @include opacity(0);
                }

                &.#{$css-prefix}-button-close {
                    -webkit-transform: rotate(0deg);
                    -o-transform: rotate(0deg);
                    transform: rotate(0deg);
                    @include opacity(1);
                }
            }
        }
    }

    .#{$css-prefix}-picker {
        background: $picker-bg;
        position: absolute;
        @include box-shadow(0 1px 5px rgba(0, 0, 0, 0.32));
        @include border-radius($picker-border-radius);
        height: $picker-height;
        width: $picker-width;
        top: -15px;
        right: -15px;
        z-index: $z-index;
        @include transition(all ease-in-out .25s);
        @include opacity(0);
        @include user-select(none);

        &.hidden {
            display: none;
        }

        .#{$css-prefix}-wrapper {
            position: relative;
            height: $picker-height;
            width: $picker-width;

            &:after {
                content: "";
                display: block;
                position: absolute;
                $_hack: inline-image-store(background, $sprite);
                background-repeat: no-repeat;
                z-index: $z-index + 1;
            }
        }

        .#{$css-prefix}-filters {
            width: 100%;
            position: absolute;
            background: #F5F7F9;
            padding: 0 0 0 7px;
            height: $filters-height;
            z-index: $z-index + 5;

            .#{$css-prefix}-filter {
                display: block;
                float: left;
                height: $filters-height;
                width: 32px;
                filter: inherit;
                padding: 7px 1px 0;
                cursor: pointer;
                @include filter(grayscale(1));

                &.active {
                    background: #fff;
                }

                &.active, &:hover {
                    @include filter(grayscale(0));
                }

                > i {
                    width: 24px;
                    height: 24px;
                    top: 0;
                }

                > img {
                    width: 24px;
                    height: 24px;
                    margin: 0 3px;
                }
            }
        }

        .#{$css-prefix}-scroll-area {
            height: $picker-height - $filters-height;
            overflow: auto;
            overflow-x: hidden;
            width: 100%;
            position: absolute;
            padding: 0 0 5px;

            .#{$css-prefix}-emojis-list {
                z-index: 1;
            }

            .#{$css-prefix}-tones {
                position: absolute;
                top: 6px;
                right: 10px;
                //width: 130px;
                height: 22px;
                z-index: 2;

                > .btn-tone {
                    display: inline-block;
                    padding: 0;
                    border: 0;
                    vertical-align: middle;
                    outline: none;
                    background: transparent;
                    cursor: pointer;
                    position: relative;

                    &.btn-tone-0 {
                        &, &:after {
                            background-color: #ffcf3e;
                        }
                    }
                    &.btn-tone-1 {
                        &, &:after {
                            background-color: #fae3c5;
                        }
                    }
                    &.btn-tone-2 {
                        &, &:after {
                            background-color: #e2cfa5;
                        }
                    }
                    &.btn-tone-3 {
                        &, &:after {
                            background-color: #daa478;
                        }
                    }
                    &.btn-tone-4 {
                        &, &:after {
                            background-color: #a78058;
                        }
                    }
                    &.btn-tone-5 {
                        &, &:after {
                            background-color: #5e4d43;
                        }
                    }
                }

                &.#{$css-prefix}-tones-bullet,
                &.#{$css-prefix}-tones-square {
                    > .btn-tone {
                        width: 20px;
                        height: 20px;
                        margin: 0;
                        background-color: transparent;
                        &:after {
                            content: "";
                            position: absolute;
                            display: block;
                            top: 4px;
                            left: 4px;
                            width: 12px;
                            height: 12px;
                        }
                        &.active:after {
                            top: 0;
                            left: 0;
                            width: 20px;
                            height: 20px;

                        }
                    }
                }

                &.#{$css-prefix}-tones-radio,
                &.#{$css-prefix}-tones-checkbox{
                    > .btn-tone {
                        width: 16px;
                        height: 16px;
                        margin: 0px 2px;
                        &.active {
                            &:after {
                                content: "";
                                position: absolute;
                                display: block;
                                background-color: transparent;
                                border: 2px solid #fff;
                                width: 8px;
                                height: 8px;
                                top: 2px;
                                left: 2px;
                            }
                        }
                    }
                }

                &.#{$css-prefix}-tones-bullet,
                &.#{$css-prefix}-tones-radio {
                    > .btn-tone {
                        &, &:after {
                            @include border-radius(100%);
                        }
                    }
                }

                &.#{$css-prefix}-tones-square,
                &.#{$css-prefix}-tones-checkbox {
                    > .btn-tone {
                        &, &:after {
                            @include border-radius(1px);
                        }
                    }
                }
            }

            h1 {
                display: block;
                font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
                font-size: 13px;
                font-weight: normal;
                color: #b2b2b2;
                background: $picker-bg;
                line-height: 20px;
                margin: 0;
                padding: 7px 0 5px 6px;

                &:after, &:before {
                    content: " ";
                    display: block;
                    clear: both;
                }
            }

            .#{$css-prefix}-category {
                padding: 0 0 0 7px;

                &:after, &:before {
                    content: " ";
                    display: block;
                    clear: both;
                }
            }

            [class*=emojione-] {
                @include box-sizing(content-box);
                margin: 0;
                width: 24px;
                height: 24px;
                top: 0;
            }

            .emojibtn {
                @include box-sizing(content-box);
                width: 24px;
                height: 24px;
                float: left;
                display: block;
                margin: 1px;
                padding: 3px;

                &:hover {
                    @include border-radius(4px);
                    background-color: #e4e4e4;
                    cursor: pointer;
                }

                i, img {
                    float: left;
                    display: block;
                    width: 24px;
                    height: 24px;
                }

                img.lazy-emoji {
                    @include opacity(0);
                }
            }
        }

        &.#{$css-prefix}-filters-position-top {
            .#{$css-prefix}-filters {
                top: 0;
                @include border-top-left-radius($picker-border-radius);
                @include border-top-right-radius($picker-border-radius);
            }
            .#{$css-prefix}-scroll-area {
                bottom: 0;
            }
        }

        &.#{$css-prefix}-filters-position-bottom {
            .#{$css-prefix}-filters {
                bottom: 0;
                @include border-bottom-left-radius($picker-border-radius);
                @include border-bottom-right-radius($picker-border-radius);
            }
            .#{$css-prefix}-scroll-area {
                top: 0;
            }
        }

        &.#{$css-prefix}-picker-position-top {
            margin-top: - $picker-height - 10;
            right: -14px;

            .#{$css-prefix}-wrapper:after {
                width: 19px;
                height: 10px;
                background-position: -2px -49px;
                bottom: -10px;
                right: 20px;
            }

            &.#{$css-prefix}-filters-position-bottom {
                .#{$css-prefix}-wrapper:after {
                    background-position: -2px -80px;
                }
            }
        }

        &.#{$css-prefix}-picker-position-left,
        &.#{$css-prefix}-picker-position-right {
            margin-right: - $picker-width - 10;
            top: -8px;

            .#{$css-prefix}-wrapper:after {
                width: 10px;
                height: 19px;
                background-position: 0px -60px;
                top: 13px;
                left: -10px;
            }

            &.#{$css-prefix}-filters-position-bottom {
                .#{$css-prefix}-wrapper:after {
                    background-position: right -60px;
                }
            }
        }

        &.#{$css-prefix}-picker-position-bottom {
            margin-top: 10px;
            right: -14px;
            top: $inline-height - 2 + 15px;

            .#{$css-prefix}-wrapper:after {
                width: 19px;
                height: 10px;
                background-position: -2px -100px;
                top: -10px;
                right: 20px;
            }

            &.#{$css-prefix}-filters-position-bottom {
                .#{$css-prefix}-wrapper:after {
                    background-position: -2px -90px;
                }
            }
        }
    }

    .#{$css-prefix}-button.active + .#{$css-prefix}-picker {
        @include opacity(1);
    }

    .#{$css-prefix}-button.active + .#{$css-prefix}-picker-position-top {
        margin-top: - $picker-height + 7;
    }

    .#{$css-prefix}-button.active + .#{$css-prefix}-picker-position-left,
    .#{$css-prefix}-button.active + .#{$css-prefix}-picker-position-right {
        margin-right: - $picker-width + 7;
    }

    .#{$css-prefix}-button.active + .#{$css-prefix}-picker-position-bottom {
        margin-top: - 7px;
    }
}

@include inline-images-flash;