/* ===========================================================
 * trumbowyg.scss v1.0
 * Default stylesheet for Trumbowyg editor
 * http://alex-d.github.com/Trumbowyg
 * ===========================================================
 * Author : Alexandre Demode (Alex-D)
 *          Twitter : @AlexandreDemode
 *          Website : alex-d.fr
 */

@import "compass";

$btns: sprite-map("icons/*.png");
$btns2x: sprite-map("icons-2x/*.png");

$light-color: #ecf0f1;

@mixin sprite-pos($map, $_item, $retina: false){
    @if($retina == false){
        background-position: sprite-position($map, $_item, 5, 5);
    } @else {
        background-position: round(nth(sprite-position($map, $_item, 10, 10), 1)/ 2) round(nth(sprite-position($map, $_item, 10, 10), 2)/ 2);
    }
}


$default-transition-duration: .15s;


.trumbowyg-box,
.editor {
    display: block;
    position: relative;
    border: 1px solid #DDD;
    width: 96%;
    min-height: 300px;
    margin: 17px auto;
}
.trumbowyg-box .editor {
    margin: 0 auto;
    background: #FEFEFE;
}
.trumbowyg-box.trumbowyg-fullscreen {
    background: #FEFEFE;
}
.trumbowyg-editor,
.trumbowyg-textarea {
    position: relative;
    padding: 1% 2%;
    min-height: 300px;
    width: 96%;
    border-style: none;
    resize: none;
    outline: none;
}
.trumbowyg-box-blur .trumbowyg-editor {
    * {
        color: transparent !important;
        @include text-shadow(0 0 7px #333);
    }
    img {
        @include opacity(.2);
    }
}
.trumbowyg-textarea {
    position: relative;
    display: block;
    overflow: auto;
    border: none;
    white-space: normal;
}

.trumbowyg-button-pane {
    position: relative;
    width: 100%;
    background: $light-color;
    border-bottom: 1px solid darken($light-color, 7%);
    margin: 0;
    padding: 0;
    list-style-type: none;
    line-height: 10px;

    li {
        display: inline-block;
        text-align: center;
        overflow: hidden;

        &.trumbowyg-separator {
            width: 1px;
            background: darken($light-color, 7%);
            margin: 0 5px;
            height: 35px;
        }
    }

    &.trumbowyg-disable {
        li:not(.trumbowyg-not-disable) button {
            opacity: .2;
            cursor: default;
        }
        li.trumbowyg-separator {
            background: darken($light-color, 3%);
        }
    }

    li button {
        // At bottom of this stylesheet
    }

    &:not(.trumbowyg-disable) li button:hover,
    &:not(.trumbowyg-disable) li button:focus,
    li button.trumbowyg-active,
    li.trumbowyg-not-disable button:hover,
    li.trumbowyg-not-disable button:focus {
        background-color: #FFF;
        outline: none;
    }

    li .trumbowyg-open-dropdown:after {
        display: block;
        content: " ";
        position: absolute;
        top: 25px;
        right: 3px;
        height: 0;
        width: 0;
        border: 3px solid transparent;
        border-top-color: #555;
    }

    .trumbowyg-buttons-right {
        float: right;
        width: auto;

        button {
            float: left;
        }
    }
}

.trumbowyg-dropdown {
    width: 200px;
    border: 1px solid $light-color;
    padding: 5px 0;
    border-top: none;
    background: #FFF;
    margin-left: -1px;
    @include box-shadow(rgba(0, 0, 0, .1) 0 2px 3px);

    button {
        display: block;
        width: 100%;
        height: 35px;
        line-height: 35px;
        text-decoration: none;
        background: #FFF;
        padding: 0 14px;
        color: #333;
        border: none;
        cursor: pointer;
        text-align: left;
        font-size: 15px;
        @include transition;

        &:hover,
        &:focus {
            background: $light-color;
        }
    }
}


/* Modal box */
.trumbowyg-modal {
    position: absolute;
    top: 0;
    left: 50%;
    margin-left: -260px;
    width: 520px;
    height: 290px;
    overflow: hidden;
}
.trumbowyg-modal-box {
    position: absolute;
    top: 0;
    left: 50%;
    margin-left: -250px;
    width: 500px;
    height: 275px;
    z-index: 1;
    background-color: #FFF;
    text-align: center;
    @include box-shadow(rgba(0, 0, 0, .2) 0 2px 3px);

    .trumbowyg-modal-title {
        font-size: 24px;
        font-weight: bold;
        margin: 0 0 20px;
        padding: 15px 0 13px;
        display: block;
        border-bottom: 1px solid #EEE;
        color: #333;
        background: lighten($light-color, 5%);
    }

    .trumbowyg-progress {
        width: 100%;
        background: #F00;
        height: 3px;
        position: absolute;
        top: 58px;

        .trumbowyg-progress-bar {
            background: #2BC06A;
            height: 100%;
            @include transition(width .15s linear);
        }
    }

    label {
        display: block;
        position: relative;
        margin: 15px 12px;
        height: 27px;
        line-height: 27px;
        overflow: hidden;

        .trumbowyg-input-infos {
            display: block;
            text-align: left;
            height: 25px;
            line-height: 25px;
            @include transition;

            span {
                display: block;
                color: darken($light-color, 35%);
                background-color: lighten($light-color, 5%);
                border: 1px solid #DEDEDE;
                padding: 0 2%;
                width: 19.5%;
            }
            span.trumbowyg-msg-error {
                color: #e74c3c;
            }
        }

        &.trumbowyg-input-error {
            input,
            textarea {
                border: 1px solid #e74c3c;
            }

            .trumbowyg-input-infos {
                margin-top: -27px;
            }
        }

        input {
            position: absolute;
            top: 0;
            right: 0;
            height: 25px;
            line-height: 25px;
            border: 1px solid #DEDEDE;
            background: transparent;
            width: 72%;
            padding: 0 2%;
            margin: 0 0 0 23%;
            @include transition;

            &:hover,
            &:focus {
                outline: none;
                border: 1px solid #95a5a6;
            }
            &:focus {
                background: rgba(230, 230, 255, .1);
            }
        }
    }

    .error {
        margin-top: 25px;
        display: block;
        color: red;
    }

    .trumbowyg-modal-button {
        position: absolute;
        bottom: 10px;
        right: 0;
        text-decoration: none;
        color: #FFF;
        display: block;
        width: 100px;
        height: 35px;
        line-height: 33px;
        margin: 0 10px;
        background-color: #333;
        border: none;
        border-top: none;
        cursor: pointer;
        font-family: "Trebuchet MS", Helvetica, Verdana, sans-serif;
        font-size: 16px;
        @include transition;

        $modal-submit-color : #2ecc71;
        &.trumbowyg-modal-submit {
            right: 110px;
            background: darken($modal-submit-color, 3%);

            &:hover,
            &:focus {
                background: lighten($modal-submit-color, 5%);
                outline: none;
            }
            &:active {
                background: darken($modal-submit-color, 10%);
            }
        }

        $modal-reset-color : #c0392b;
        &.trumbowyg-modal-reset {
            background: darken($modal-reset-color, 3%);

            &:hover,
            &:focus {
                background: lighten($modal-reset-color, 5%);
                outline: none;
            }
            &:active {
                background: darken($modal-reset-color, 10%);
            }
        }
    }
}
.trumbowyg-overlay {
    position: absolute;
    background-color: rgba(255, 255, 255, .5);
    width: 100%;
    left: 0;
    display: none;
}


/**
 * Fullscreen
 */
.trumbowyg-fullscreen {
    &.trumbowyg-box,
    .editor {
        border: none;
    }
    .trumbowyg-overlay {
        height: 100% !important;
    }
}



/*
 * Reset for resetCss option
 */
.trumbowyg-editor {
    object,
    embed,
    video,
    img {
        width: auto;
        max-width: 100%;
    }
    video,
    img {
        height: auto;
    }
    img { cursor: move; }

    &.trumbowyg-reset-css {
        background: #FEFEFE !important;
        font-family: "Trebuchet MS", Helvetica, Verdana, sans-serif !important;
        font-size: 14px !important;
        line-height: 1.45em !important;    
        white-space: normal !important;
        color: #333;

        a {
            color: #15c !important;
            text-decoration: underline !important;
        }

        div,
        p,
        ul,
        ol,
        blockquote {
            box-shadow: none !important;
            background: none !important;
            margin: 0 !important;
            margin-bottom: 15px !important;
            line-height: 1.4em !important;
            font-family: "Trebuchet MS", Helvetica, Verdana, sans-serif !important;
            font-size: 14px !important;
            border: none;
        }
        iframe, 
        object,
        hr {
            margin-bottom: 15px !important;
        }
        blockquote {
            margin-left: 32px !important;
            font-style: italic !important;
            color: #555;
        }
        ul,
        ol {
            padding-left: 20px !important;
        }
        ul ul,
        ol ol,
        ul ol,
        ol ul {
            border: none;
            margin: 2px !important;
            padding: 0 !important;
            padding-left: 24px !important;
        }
        hr {
            display: block;
            height: 1px;
            border: none;
            border-top: 1px solid #CCC;
        }

        h1,
        h2,
        h3,
        h4 {
            color: #111;
            background: none;
            margin: 0 !important;
            padding: 0 !important;
            font-weight: bold;
        }

        h1 {
            font-size: 32px !important;
            line-height: 38px !important;
            margin-bottom: 20px !important;
        }
        h2 {
            font-size: 26px !important;
            line-height: 34px !important;
            margin-bottom: 15px !important;
        }
        h3 {
            font-size: 22px !important;
            line-height: 28px !important;
            margin-bottom: 7px !important;
        }
        h4 {
            font-size: 16px !important;
            line-height: 22px !important;
            margin-bottom: 7px !important;
        }
    }
}



/*
 * Buttons icons
 */
.trumbowyg-button-pane li button {
    display: block;
    position: relative;
    text-indent: -9999px;
    width: 35px;
    height: 35px;
    overflow: hidden;
    background: transparent $btns no-repeat;
    border: none;
    cursor: pointer;
    @include transition;
    transition: background-color .15s, background-image .15s, opacity .15s;

    &.trumbowyg-viewHTML-button { @include sprite-pos($btns, 'view-html'); }
    &.trumbowyg-formatting-button { @include sprite-pos($btns, 'formatting'); }

    /* English and others */
    &.trumbowyg-bold-button, &.trumbowyg-strong-button { @include sprite-pos($btns, 'bold'); }
    &.trumbowyg-italic-button, &.trumbowyg-em-button { @include sprite-pos($btns, 'italic'); }
    &.trumbowyg-underline-button { @include sprite-pos($btns, 'underline'); }
    &.trumbowyg-strikethrough-button, &.trumbowyg-del-button { @include sprite-pos($btns, 'strikethrough'); }

    &.trumbowyg-link-button { @include sprite-pos($btns, 'link'); }

    &.trumbowyg-insertImage-button { @include sprite-pos($btns, 'image'); }

    &.trumbowyg-justifyLeft-button { @include sprite-pos($btns, 'left-align'); }
    &.trumbowyg-justifyCenter-button { @include sprite-pos($btns, 'center-align'); }
    &.trumbowyg-justifyRight-button { @include sprite-pos($btns, 'right-align'); }
    &.trumbowyg-justifyFull-button { @include sprite-pos($btns, 'justify-align'); }

    &.trumbowyg-unorderedList-button { @include sprite-pos($btns, 'unordered-list'); }
    &.trumbowyg-orderedList-button { @include sprite-pos($btns, 'ordered-list'); }

    &.trumbowyg-horizontalRule-button { @include sprite-pos($btns, 'horizontal-rule'); }

    &.trumbowyg-fullscreen-button { @include sprite-pos($btns, 'fullscreen'); }
    &.trumbowyg-close-button { @include sprite-pos($btns, 'close'); }
}
.trumbowyg-fullscreen .trumbowyg-button-pane li button.trumbowyg-fullscreen-button { @include sprite-pos($btns, 'fullscreen-exit'); }
.trumbowyg-button-pane li {
    &:first-child button { margin-left: 6px; }
    &:last-child button { margin-right: 6px; }
}

/* French */
.trumbowyg-fr .trumbowyg-button-pane li button {
    &.trumbowyg-bold-button, &.trumbowyg-strong-button { @include sprite-pos($btns, 'gras'); }
    &.trumbowyg-underline-button { @include sprite-pos($btns, 'souligne'); }
    &.trumbowyg-strikethrough-button, &.trumbowyg-del-button { @include sprite-pos($btns, 'barre'); }
}





@media only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 4/3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx){ 
    .trumbowyg-button-pane li button {
        background-size: 72%;
        background-image: $btns2x;

        &.trumbowyg-viewHTML-button { @include sprite-pos($btns2x, 'view-html', true); }
        &.trumbowyg-formatting-button { @include sprite-pos($btns2x, 'formatting', true); }

        /* English and others */
        &.trumbowyg-bold-button, &.trumbowyg-strong-button { @include sprite-pos($btns2x, 'bold', true); }
        &.trumbowyg-italic-button, &.trumbowyg-em-button { @include sprite-pos($btns2x, 'italic', true); }
        &.trumbowyg-underline-button { @include sprite-pos($btns2x, 'underline', true); }
        &.trumbowyg-strikethrough-button, &.trumbowyg-del-button { @include sprite-pos($btns2x, 'strikethrough', true); }

        &.trumbowyg-link-button { @include sprite-pos($btns2x, 'link', true); }

        &.trumbowyg-insertImage-button { @include sprite-pos($btns2x, 'image', true); }

        &.trumbowyg-justifyLeft-button { @include sprite-pos($btns2x, 'left-align', true); }
        &.trumbowyg-justifyCenter-button { @include sprite-pos($btns2x, 'center-align', true); }
        &.trumbowyg-justifyRight-button { @include sprite-pos($btns2x, 'right-align', true); }
        &.trumbowyg-justifyFull-button { @include sprite-pos($btns2x, 'justify-align', true); }

        &.trumbowyg-unorderedList-button { @include sprite-pos($btns2x, 'unordered-list', true); }
        &.trumbowyg-orderedList-button { @include sprite-pos($btns2x, 'ordered-list', true); }

        &.trumbowyg-horizontalRule-button { @include sprite-pos($btns2x, 'horizontal-rule', true); }

        &.trumbowyg-fullscreen-button { @include sprite-pos($btns2x, 'fullscreen', true); }
        &.trumbowyg-close-button { @include sprite-pos($btns2x, 'close', true); }
    }
    .trumbowyg-fullscreen .trumbowyg-button-pane li a.trumbowyg-fullscreen-button { @include sprite-pos($btns2x, 'fullscreen-exit', true); }

    /* French */
    .trumbowyg-fr .trumbowyg-button-pane li button {
        &.trumbowyg-bold-button, &.trumbowyg-strong-button { @include sprite-pos($btns2x, 'gras', true); }
        &.trumbowyg-underline-button { @include sprite-pos($btns2x, 'souligne', true); }
        &.trumbowyg-strikethrough-button, &.trumbowyg-del-button { @include sprite-pos($btns2x, 'barre', true); }
    }
}