// out: ../preview.css, compress: true, sourceMap: false
@bg: #fff;
@fg: #333;

.scrollbar-style {
    &::-webkit-scrollbar {
        width: 8px;
    }
    &::-webkit-scrollbar-track {
        // -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
        border-radius: 10px;
        background-color: transparent;
    }
    &::-webkit-scrollbar-thumb {
        border-radius: 5px; // -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
        background-color: rgba(150, 150, 150, .66);
        border: 4px solid rgba(150, 150, 150, .66);
        background-clip: content-box;
    }
}

.mume {
    .scrollbar-style();
}

// the preview
.preview-container {
    width: 100%;
    margin: 0;
    padding: 0;
    box-sizing: border-box;

    .btn {
        display: inline-block;
        color: #99aeb8;
        text-shadow: none;
        border: 1px solid #171e22;
        background-color: #32424a;
        background-image: linear-gradient(#364850, #32424a);
        height: auto;
        padding: 0 0.8em;
        font-size: 1em;
        line-height: 2em;
        margin-bottom: 0;
        font-weight: normal;
        text-align: center;
        vertical-align: middle;
        border: none;
        border-radius: 3px;
        white-space: nowrap;
        cursor: pointer;
        z-index: 0;
        user-select: none;
        box-sizing: border-box;
    }
    .refreshing-icon {
        display: none;
        position: fixed;
        bottom: 32px;
        left: 48px;
        width: 48px;
        height: 48px;
        background-image: url(octocat-spinner-128.gif);
        background-repeat: no-repeat;
        background-position: top center;
        background-size: cover;
        font-size: 24px;
        z-index: 999;
        color: black;
    }
    .context-menu-item {
        list-style: none;
    }
    #md-toolbar {
        position: fixed;
        top: 32px;
        right: 24px;
        opacity: 0;
        display: block;
        .back-to-top-btn,
        .refresh-btn,
        .sidebar-toc-btn {
            float: right;
            width: 38px;
            margin-right: 4px;
            opacity: 0.4;

            &:hover {
                opacity: 1.0;
            }
        }
    }
    &:hover {
        .back-to-top-btn,
        .refresh-btn,
        .sidebar-toc-btn {
            display: block;
        }
    }
    &.show-sidebar-toc {
        .md-sidebar-toc {
            font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
            position: fixed;
            top: 0;
            right: 0;
            width: 268px;
            height: 100%;
            padding: 32px 0 12px 0;
            overflow: auto;
            // background-color: @bg;
            // color: @fg;
            font-size: 14px;
            box-shadow: -4px 0px 12px rgba(150, 150, 150, .33);
            box-sizing: border-box;
            a {
                // color: @fg;
                text-decoration: none;
            }
            ul {
                padding: 0 1.6em;
                margin-top: 0.8em;
            }
            li {
                margin-bottom: 0.8em;
            }
            ul {
                list-style-type: none;
            }
        }
        #md-toolbar {
            right: 300px;
        }
        .mume {
            width: calc(~"100% - 268px");
        }
    }

    .mume[for="preview"] {
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        margin: 0; // z-index: 999;
        padding: 2em;
        overflow: auto;
        display: block;
        box-sizing: border-box;

        &[data-presentation-mode] {
            padding: 0;
        }

        &.hidden-preview {
            visibility: hidden;
        }

        // code chunk
        .code-chunk {
            position: relative;

            /*
            .output-div {
                overflow-x: auto;

                svg {
                    display: block;
                }
            }
            */

            pre {
                cursor: text;
            }

            .btn-group {
                position: absolute;
                right: 0;
                top: 0;
                display: none;

                .run-btn, .run-all-btn {
                    float: right;
                    margin-left: 4px;
                    border-radius: 3px;
                    font-size: 0.8em;
                    color: #eee;
                    background-color: #528bff;
                    background-image: none;
                    border: none;

                    &:hover {
                        background-color: #4b7fe8;
                        cursor: pointer;
                    }
                }
            }

            &:hover {
                .btn-group {
                display: block;
                }
            }

            .status {
                position: absolute;
                right: 0;
                top: 0;
                font-size: 0.85em;
                color: inherit;
                padding: 2px 6px;
                background-color: rgba(0, 0, 0, 0.04);
                display: none;
            }

            &.running {
                .btn-group {
                    display: none;
                }
                .status {
                    display: block;
                }
            }
        }
    }
}

// image helper 
#image-helper-view {
    @bg: #fff;
    @fg: #333;

    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    color: @fg;
    padding: 16px;
    box-sizing: border-box;

    h1, h2, h3, h4, h5, h6 {
        color: @fg;
    }

    .splitter {
        width: 100%;
        height: 1px;
        margin-bottom: 16px; // border-bottom-style: dotted;
        background-color: contrast(@bg, lighten(@bg, 4%), darken(@bg, 4%));
    }
    .url-editor {
        display: block;
        margin: 12px 0;
        padding: 8px;
        width: 100%;
        box-sizing: border-box;
    }
    .drop-area {
        margin-top: 12px;
        text-align: center;
        height: 64px;
        border-style: dashed;
        border-color: #999;
        cursor: pointer;
        margin-bottom: 32px;
        background-color: darken(@bg, 2%);
        &:hover {
            background-color: contrast(@bg, lighten(@bg, 4%), darken(@bg, 4%));
        }
        p {
            margin: 0;
            position: relative;
            top: 50%;
            transform: translateY(-50%);
        }
        &.uploader {
            margin-bottom: 12px;
        }
    }
    .uploader-choice {
        margin-bottom: 24px;
        select {
            background-color: darken(@bg, 4%);
            border-color: lighten(@bg, 10%);
            margin: 0 6px;
        }
    }
    #show-uploaded-image-history {
        font-size: 0.8em;
        cursor: pointer;
    }
    .close-btn,
    .add-btn {
        margin-right: 16px;
        width: 64px;
        text-align: center;
        padding: 0;
    }
}