<NME> materialnote.scss
<BEF> @import "variables.scss";
@import "elements.scss";

/* Theme Variables
------------------------------------------*/
%error-color {
    background-color: $error-color;
    color: $error-text-color;
}

%success-color {
    background-color: $success-color;
    color: $success-text-color;
}

%action-color {
    background-color: $action-color;
    color: $action-text-color;
}

%disabled-color {
    background-color: $disabled-color !important;
    color: $disabled-text-color !important;
}

%styled-scrollbars {
    &::-webkit-scrollbar {
        width: 17px;
    }
    &::-webkit-scrollbar-button {
        display: none !important;
    }

    &::-webkit-scrollbar-track {
        background-color: $scrollbar-background-color;
    }
    &::-webkit-scrollbar-thumb {
        background-color: $scrollbar-color;
    }
    &::-webkit-scrollbar-thumb:hover {
        background-color: $scrollbar-highlight-color;
    }
}

%link {
    &:link {
        color: $link-color;
    }
    &:hover {
        color: $link-hover-color;
    }
    &:visited {
        color: $link-visited-color;
    }
    &:active {
        color: $link-active-color;
    }
}


/* Layout
------------------------------------------*/
.note-editor, #note-card-modal {
    // color-palette
    .note-color-palette {
        line-height: 1;

        .note-color-row {
            line-height: 0;
        }

        div {
            .note-color-btn {
                width: 23px;
                height: 23px;
                padding: 0;
                margin: 0;
                border: none;
            }
            .note-color-btn:hover::after {
                position: absolute;
                width: 34px;
                height: 34px;
                content: "";
                background-color: inherit;
                margin-top: -17px;
                margin-left: -17px;
                border: solid 2px $toolbar-color;
            }
        }
    }
    .note-color {
        .note-current-color-button {
            width: 36px;

            &.disabled {
                .note-recent-color, .note-recent-color-back {
                    background-color: $disabled-color !important;
                    color: $disabled-text-color !important;
                }
            }

            .note-recent-color {
                z-index: 2;
                font-weight: 600;
                line-height: 2.2;
                position: absolute;
                left: 13px;
            }

            .note-recent-color-back {
                z-index: 1;
                height: 20px;
                width: 19.5px;
                background-color: $toolbar-overlay-color;
                position: absolute;
                bottom: 10px;
            }
        }
    }
}

#note-card-modal {
    top: 5% !important;
    height: 90%;
    max-height: 90%;
}

.note-editor {
    position: relative;

    .disabled {
        @extend %disabled-color;
    }

    .modal {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        outline-width: 0;
    }

    // modals
    .modal-content {
        @extend %styled-scrollbars;
        border-color: $toolbar-color !important;

        .card-color-wrapper {
            max-width: 420px;
            margin: auto;

            .tab {
                background-color: $toolbar-color-lighten;

                &:hover {
                    background-color: $action-color !important;
                    color: $action-text-color !important;
                }
            }
        }

        .selected-color {
            background-color: $toolbar-color-lighten;
            height: 40px;
            width: 40px;
            margin: auto;
            border: solid 2px lighten($toolbar-color-lighten, 10%);
        }

        .help-content {
            .help-container {
                margin-left: 5%;
                margin-right: 5%;
                //border: solid 1px $toolbar-color-lighten;
            }

            .note-help-row {
                margin-bottom: 3px;
                min-height: 36px;
                padding-top: 6px;

                &:nth-child(even) {
                    background-color: lighten($toolbar-color, 10%);
                }

                &:hover {
                    background-color: $action-color;

                    kbd {
                        background-color: $action-color2;
                        color: $action-text-color-2;
                    }
                }
            }

            label {
                position: relative;
                top: 0;

                kbd {
                    background-color: $action-color;
                    color: $action-text-color;
                    padding: 4px 5px 2px 5px;
                }
            }
        }
    }

    .modal-footer {
        a {
            @extend %link;
        }
    }

    // dropdowns
    .dropdown-content, .modal-content {
        min-width: 10px;
        background-color: $dropdown-color;
        border-left: solid 1px $toolbar-overlay-color;
        border-right: solid 1px $toolbar-overlay-color;
        border-bottom: solid 1px $toolbar-overlay-color;
        color: $dropdown-overlay-color;

        @extend %styled-scrollbars;

        .tabs {
            background-color: $toolbar-color;

            .tab.col {
                float: none;

                &:hover {
                    background-color: $dropdown-color;
                }

                a {
                    line-height: 48px;
                    color: $toolbar-overlay-color;
                }
            }

            .indicator {
                height: 5px;
                min-height: 0;
                background-color: $action-color;
                width: 50%;
            }
        }

        .row.noMargins {
            margin-left: auto;
            margin-right: auto;
        }

        .note-color-reset.btn {
            background-color: $toolbar-color-lighten;

            &:hover {
                background-color: $action-color;
                color: $action-text-color;
            }
        }

        .color-name {
            color: $action-color2;
            line-height: 36px;
            height: 36px;
            opacity: 0;
        }

        /* dropdown-menu right position */
        /* http://forrst.com/posts/Bootstrap_right_positioned_dropdown-2KB */
        &.right {
            right: 0;
            left: auto;
            &::before { right: 9px; left: auto !important;  }
            &::after { right: 10px; left: auto !important;  }
        }

        /* dropdown-menu for selectbox */
        &.note-check {
            li {
                list-style: none;

                &:hover {
                    background-color: $action-color;
                    color: $action-text-color;
                }

                a {
                    color: $toolbar-overlay-color;

                    i {
                        color: $toolbar-overlay-color !important;
                        visibility: hidden;
                    }
                }

                a.checked i {
                    visibility: visible;
                }
            }
        }
    }

    /* dropzone */
    $dropzone-color: lightskyblue;
    $dropzone-active-color: darken($dropzone-color, 30);
    .note-dropzone {
        position: absolute;
        display: none;
        z-index: 100;
        color: $dropzone-color;
        background-color: white;
        opacity: 0.95;

        .note-dropzone-message {
            display: table-cell;
            vertical-align: middle;
            text-align: center;
            font-size: 28px;
            font-weight: bold;
        }

        &.hover {
            color: $dropzone-active-color;
        }
    }

    &.dragover .note-dropzone {
        display: table;
    }

    .note-editing-area {
        position: relative;

        .note-editable {
            outline: none;
            @extend %styled-scrollbars;

            sup {
                vertical-align: super;
            }

            sub {
                vertical-align: sub;
            }
        }
    }

    /* Modals
    ------------------------------------------*/
    .modal {
        background-color: $modal-color;
        color: $modal-text-color;

        /*& > div {
            display: none; // BS2's hide pacth.
        }*/
        .form-group { /* overwrite BS's form-horizontal minus margins */
            margin-left: 0;
            margin-right: 0;
        }
        .note-modal-form {
            margin: 0; /* overwrite BS2's form margin bottom */
        }
        .note-image-dialog {
            .note-dropzone {
                min-height: 100px;
                font-size: 30px;
                line-height: 4; /* vertical-align */
                color: lightgray;
                text-align: center;
                border: 4px dashed lightgray;
                margin-bottom: 10px;
            }
        }

        .file-uploader-wrapper {
            @extend %action-color;
        }

        .modal-footer {
            background-color: $modal-color;

            .modal-close {
                @extend %error-color;
                margin-right: 7px;
            }

            .note-image-btn, .note-link-btn, .note-video-btn, .note-materialize-card-btn {
                @extend %success-color;
            }
        }
    }

    // form elements colors
    input:not([type]):focus:not([readonly])+label,
    input[type=text]:not(.browser-default):focus:not([readonly])+label,
    input[type=password]:not(.browser-default):focus:not([readonly])+label,
    input[type=email]:not(.browser-default):focus:not([readonly])+label,
    input[type=url]:not(.browser-default):focus:not([readonly])+label,
    input[type=time]:not(.browser-default):focus:not([readonly])+label,
    input[type=date]:not(.browser-default):focus:not([readonly])+label,
    input[type=datetime]:not(.browser-default):focus:not([readonly])+label,
    input[type=datetime-local]:not(.browser-default):focus:not([readonly])+label,
    input[type=tel]:not(.browser-default):focus:not([readonly])+label,
    input[type=number]:not(.browser-default):focus:not([readonly])+label,
    input[type=search]:not(.browser-default):focus:not([readonly])+label,
    textarea.materialize-textarea:focus:not([readonly])+label {
        color: $action-color2;
    }

    input:not([type]):focus:not([readonly]),
    input[type=text]:not(.browser-default):focus:not([readonly]),
    input[type=password]:not(.browser-default):focus:not([readonly]),
    input[type=email]:not(.browser-default):focus:not([readonly]),
    input[type=url]:not(.browser-default):focus:not([readonly]),
    input[type=time]:not(.browser-default):focus:not([readonly]),
    input[type=date]:not(.browser-default):focus:not([readonly]),
    input[type=datetime]:not(.browser-default):focus:not([readonly]),
    input[type=datetime-local]:not(.browser-default):focus:not([readonly]),
    input[type=tel]:not(.browser-default):focus:not([readonly]),
    input[type=number]:not(.browser-default):focus:not([readonly]),
    input[type=search]:not(.browser-default):focus:not([readonly]),
    textarea.materialize-textarea:focus:not([readonly]) {
        border-bottom: 1px solid $action-color2;
        -webkit-box-shadow: 0 1px 0 0 $action-color2;
        box-shadow: 0 1px 0 0 $action-color2;
    }

    [type="checkbox"]:checked+label:before {
        border-top: 2px solid transparent;
        border-left: 2px solid transparent;
        border-right: 2px solid $action-color2;
        border-bottom: 2px solid $action-color2;
    }
}

/* Frame mode layout
------------------------------------------*/
.note-editor.note-frame {
    border-left: 3px solid $border-color;
    border-right: 3px solid $border-color;

    /* codeview mode */
    &.codeview {
        .note-editing-area {
            .note-editable {
                display: none;
            }
            .note-codable {
                display: block;
            }
        }
    }

    .note-editing-area {
        overflow: hidden;

        /* editable */
        .note-editable {
            background-color: #fff;
            color: #000;
            padding: 10px;
            overflow: auto;

            &[contenteditable="false"] {
                background-color: #e5e5e5;
            }
        }

        /* codable */
        .note-codable {
            display: none;
            width: 100%;
            padding: 10px;
            border: none;
            box-shadow: none;
            font-family: roboto;
            font-size: 14px;
            color: $codable-overlay-color;
            background-color: $codable-color;
            resize: none;
            outline: none;

            /* override BS2 default style */
            @include box-sizing(border-box);
            @include rounded(0);
            margin-bottom: 0;
        }
    }

    /* fullscreen mode */
    &.fullscreen {
        position: fixed;
        top: 0;
        left: 0;
        width: 100% !important;
        z-index: 1050; /* materialize modal-backdrop: 1030, bs2: 1040 */
        .note-editable {
            background-color: white;
        }
        .note-resizebar {
            display: none;
        }
    }

    /* statusbar */
    .note-statusbar {
        background-color: $toolbar-color;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;

        .note-resizebar {
            padding-top: 1px;
            height: 17px;
            width: 100%;
            cursor: ns-resize;

            .note-icon-bar {
                width: 20px;
                margin: 2px auto;
                border-top: 2px solid $toolbar-overlay-color;
            }
        }
    }
    .note-placeholder {
        padding: 10px;
    }
}

/* Popover
------------------------------------------*/
.note-popover.popover {
    max-width: none;
    display: none;
    position: absolute;
    margin-top: 3px;

    .popover-content {
        background-color: $toolbar-color;

        a {
            display: inline-block;
            max-width: 200px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;    /* for FF */
            vertical-align: middle; /* for FF */
        }
    }

    .popover-link {
        margin-left: 7px;

        a:link, a:visited {
            color: $action-color;
        }

        a:hover, a:active {
            color: $action-color2;
        }
    }

    .arrow {
        width: 0;
        height: 0;
        border-style: solid;
        border-width: 0 11px 11px 11px;
        border-color: transparent transparent $toolbar-color transparent;
        margin-left: 7px;
    }
}

/* Popover and Toolbar (Button container)
------------------------------------------*/
.note-toolbar {
    z-index: 500;
    background-color: $toolbar-color;
    position: relative;
}

.note-popover .popover-content, .panel-heading.note-toolbar {
    margin: 0;
    padding: 0;

    & > .btn-group {
        margin-top: 0;
        margin-left: 0;
        margin-right: 5px;
    }

    .btn-group {
        display: inline-block;

        .note-table {
            width: 300px;
            padding: 5px;
            overflow: visible;

            .beforePicker {
                margin-left: 4px;
                margin-right: 4px;
            }

            .note-dimension-picker {
                font-size: 18px;
                margin-left: 14px;

                .note-dimension-picker-mousecatcher {
                    position: absolute !important;
                    z-index: 3;
                    width: 260px;
                    height: 260px;
                    cursor: pointer;
                }
                .note-dimension-picker-unhighlighted {
                    position: relative !important;
                    z-index: 1;
                    width: 260px;
                    height: 130px;
                    background-size: 26px 26px;
                    background-image: repeating-linear-gradient(0deg, $toolbar-color, $toolbar-color 4px, transparent 4px, transparent 26px), repeating-linear-gradient(-90deg, transparent, transparent 4px, #fff 4px, #fff 26px);
                }
                .note-dimension-picker-highlighted {
                    position: absolute !important;
                    z-index: 2;
                    width: 26px;
                    height: 26px;
                    background-size: 26px 26px;
                    background-image: repeating-linear-gradient(0deg, $toolbar-color, $toolbar-color 4px, transparent 4px, transparent 26px), repeating-linear-gradient(-90deg, transparent, transparent 4px, $action-color 4px, $action-color 26px);
                }
            }

            .note-dimension-display {
                margin-left: 14px;
            }
        }
    }

    .btn {
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 0 9px !important;
        background-color: $toolbar-btn-color;

        &:hover {
            background-color: $toolbar-color-lighten;
        }

        &.active {
            background-color: $action-color;
            color: $action-text-color;
        }
    }

    .note-style {
        h1, h2, h3, h4, h5, h6, blockquote {
            margin: 0;
        }
    }

    .note-para {
        .dropdown-menu {
            min-width: 216px;
            padding: 5px;
            &>div:first-child {
                margin-right: 5px;
            }
        }
    }

    .note-fontsize-10 {
        font-size: 10px;
    }
}

/* Placeholder
------------------------------------------*/
.note-placeholder {
    position: absolute;
    display: none;
    color: gray;
}

/* Handle
------------------------------------------*/
.note-handle {
    /* control selection */
    .note-control-selection {
        position: absolute;
        display: none;
        border: 3px solid $toolbar-color;

        & > div {
            position: absolute;
        }

        .note-control-selection-bg {
            width: 100%;
            height: 100%;
            background-color: $toolbar-color;
            @include opacity(0.3);
        }

        .note-control-handle {
            width: 7px;
            height: 7px;
            border: 1px solid black;
        }

        .note-control-holder {
            @extend .note-control-handle;
        }

        .note-control-sizing {
            @extend .note-control-handle;
        }

        .note-control-nw {
            top: -5px;
            left: -5px;
            width: 0;
            height: 0;
            border-style: solid;
            border-width: $selection-corner-size $selection-corner-size 0 0;
            border-color: $toolbar-color transparent transparent transparent
        }

        .note-control-ne {
            top: -5px;
            right: -5px;
            width: 0;
            height: 0;
            border-style: solid;
            border-width: 0 $selection-corner-size $selection-corner-size 0;
            border-color: transparent $toolbar-color transparent transparent;
        }

        .note-control-sw {
            bottom: -5px;
            left: -5px;
            width: 0;
            height: 0;
            border-style: solid;
            border-width: $selection-corner-size 0 0 $selection-corner-size;
            border-color: transparent transparent transparent $toolbar-color;

        }

        .note-control-se {
            right: -5px;
            bottom: -5px;
            width: 0;
            height: 0;
            border-style: solid;
            border-width: 0 0 $selection-corner-size $selection-corner-size;
            border-color: transparent transparent $toolbar-color transparent;
            cursor: se-resize;
            transition: all 0.5s;

            &:hover {
                right: -5px;
                bottom: -5px;
                width: 0;
                height: 0;
                border-style: solid;
                border-width: 0 0 ($selection-corner-size + 10px) ($selection-corner-size + 10px);
                border-color: transparent transparent $toolbar-color transparent;
                border-color: transparent transparent $action-color transparent;
            }
        }

        .note-control-se.note-control-holder {
            cursor: default;
            border-top: none;
            border-left: none;
        }

        .note-control-selection-info {
            right: 0;
            bottom: 0;
            padding: 5px;
            margin: 5px;
            color: $toolbar-overlay-color;
            background-color: $toolbar-color;
            font-size: 12px;
            @include rounded(5px);
            @include opacity(0.7);
        }
    }
}

.note-hint-popover {
    min-width: 100px;
    padding: 2px;

    .popover-content {
        padding: 3px;
        max-height: 150px;
        overflow: auto;

        .note-hint-group {
            .note-hint-item {
                display: block !important;
                padding: 3px;

                &.active, &:hover {
                    display: block;
                    clear: both;
                    font-weight: 400;
                    line-height: 1.4;
                    color: white;
                    white-space: nowrap;
                    text-decoration: none;
                    background-color: #428bca;
                    outline: 0;
                    cursor: pointer;
                }
            }
        }
    }
}

<MSG> fixed dropdown menus z-index bug

<DFF> @@ -582,6 +582,7 @@
     z-index: 500;
     background-color: $toolbar-color;
     position: relative;
+    display:table-row;
 }
 
 .note-popover .popover-content, .panel-heading.note-toolbar {

fixed dropdown menus z-index bug