/* ======================================================================== */
/* Page Interface Structures */

/*
 * The following variables and classes all relate to various page
 * interfaces, such as the proofreading interfaces (standard and
 * enhanced), WordCheck, the proofreading toolbox, code point
 * validator, display image interface, etc.
 */

/* variables */

/* Base layer for page interface */
@page-interface-background: #CDCDC1;
@page-interface-text: black;

/* Text pane */
@text-pane-background: #FFF8DC;
@text-pane-text: black;

/* Control panes */
@control-pane-background: #CDC0B0;
@control-pane-text: black;
@control-pane-menu: Bisque;

/* Links */
@page-interface-link-color: #0000ff;
@page-interface-visited-color: #990099;
@page-interface-active-color: #ff0000;

/* WordCheck*/
@preWC: #c2c2c2;
@noWC: #ffb321;
@WC: #97fc9e;

/* Other colors */
@pi-text-link-disabled: #666666;

/* Classes*/

.page-interface {
    background-color: @page-interface-background;
    color: @page-interface-text;
    a:link {
        color: @page-interface-link-color;
    }
    a:visited {
        color: @page-interface-visited-color;
    }
    a:active {
        color: @page-interface-active-color;
    }

    .text-pane {
        background-color: @text-pane-background;
        color: @text-pane-text;
    }

    .control-pane {
        background-color: @control-pane-background;
        color: @control-pane-text;

        input, select, button {
            background-color: @text-pane-background;
            color: @text-pane-text;
            .solid-border;
        }

        input[type=submit]:disabled, input[type=button]:disabled, button:disabled {
            background-color: shade(@text-pane-background, 30%);
        }

        button, input[type=submit], input[type=button] {
            box-shadow: 1px 1px grey;
            border-radius: 3px;
        }

        input[type=image] {
            border: none;
        }

        .menu {
            background-color: @control-pane-menu;
        }
    }
}

/* ------------------------------------------------------------------------ */
/* Standard Editing Interface */

#standard_interface_image {
    .no-padding;
    .no-margin;
    .page-interface;

    #imagedisplay {
        .center-align;
    }
}

#standard_interface_text {
    .no-margin;
    background-color: white;
    color: black;
    #editform {
        input {
            background-color: white;
            color: black;
            border: thin solid black;
        }
        button, input[type=submit], input[type=button] {
            background-color: #efefef;
            box-shadow: 1px 1px grey;
            border-radius: 3px;
            margin: 2px;
        }
    }
    a:link {
        color: @page-interface-link-color;
    }
    a:visited {
        color: @page-interface-visited-color;
    }
    a:active {
        color: @page-interface-active-color;
    }
    .text-link-disabled {
        color: #666666;  // will need to be themed
    }
}

#text_data, #text_data:focus {
    background-color: white;
    color: black;
    outline: none;
    padding-left: 0.5em;
}

/* ------------------------------------------------------------------------ */
/* Enhanced Editing Interface */

#enhanced_interface {
    .center-align;
    overflow: hidden;
    .page-interface;

    #tbtext {
        margin-left: auto;
        margin-right: auto;
        border-collapse: collapse;
        overflow: auto;
        .solid-border;
    }
    #tdtop {
        .middle-align;
        padding: 2px;
        .solid-border;
        .page-interface .control-pane;
    }
    #tdtext, #tdbottom {
        .top-align;
        .solid-border;
        padding: 2px;
    }
    #tdtext {
        .page-interface;
    }
    #tdbottom {
        background-color: @control-pane-background;
        .text-link-disabled {
            color: @pi-text-link-disabled;
        }
    }
    #text_data, #text_data:focus {
        padding: 2px;
        outline: none;
        .page-interface .text-pane;
    }
    .dropsmall {
        font-size: 75%;
    }
}

/* ------------------------------------------------------------------------ */
/* WordCheck Interface */

#wordcheck_interface {
    .center-align;
    overflow: auto;
    .page-interface;

    #tbtext {
        margin-left: auto;
        margin-right: auto;
        padding: 10px;
        .solid-border;
    }
    #tdtop {
        padding: 2px;
        .solid-border;
        .page-interface .control-pane;
    }
    #tdtext {
        .top-align;
        .left-align;
        padding: 0.5em;
        .solid-border;
        .page-interface .text-pane;
        .proofingfont {
            input {
                background-color: white;
                color: black;
                padding: 3px;
                text-indent: 0.5em;
                .solid-border(@border-color-base-highc);
            }
        }
    }
    // for initial rollout of dark theme, background-color and
    // color need to be explicitly 'white' and 'black'.
    // Probably need to create color names, because we will
    // be aiming to separate PI theme completely from the site
    // themes.

    #wc_header {
        input, select {
            .page-interface .text-pane;
        }
        button, input[type=submit], input[type=button] {
            .button;
        }
        .dict-selection {
            margin: 5px;
            .dict-section {
                margin: 5px;
                .dict-section-title {
                    padding: 3px 4px;
                    display: inline;
                }
                .remove-language {
                    .page-interface .text-pane;
                    .solid-border;
                    border-radius: 5px;
                    font-size: 0.9em;
                    display: inline;
                    padding: 3px 4px 3px 0;
                    margin: 2px;
                    input {
                        border: none;
                        background: none;
                        outline: none;
                        box-shadow: none;
                        color: red;
                    }
                }
            }
        }
    }

}

.preWC {
    background-color: @preWC;
}
.noWC {
    background-color: @noWC;
    .bold;
}
.WC {
    background-color: @WC;
}

/* ------------------------------------------------------------------------ */
/* Format Preview */

#format_preview {
    .page-interface;
}

.ilb {
   .solid-border(#404040);
    border-radius: 2px;
    .page-interface .control-pane;
}

/* ------------------------------------------------------------------------ */
/* Codepoint Validator */

.flex_container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.fixedbox {
    flex: 0 0 auto;
    padding: 2px;
    .page-interface .control-pane;
}

.stretchbox {
    flex: auto;
    min-height: 10px;
    overflow: auto;
    .page-interface .text-pane;
}

.ws-pre {
    white-space: pre;
    padding-left: 0.5em;
    text-align: left;
    font-family: monospace;
}

.bad-char {
    background: #ff99cc;
}

/* ------------------------------------------------------------------------ */
/* Proofreading control frame */
.control-frame {
    padding: 0;
    margin: 0;
    .page-interface .control-pane;
}

/* ------------------------------------------------------------------------ */
/* Proofreading Toolbox */

#toolbox {
    padding: 2px;
    .sans-serif;
    .page-interface .control-pane;

    .selector_button {
        .page-interface .control-pane .menu;
        margin-top: 1px;
        font-size: 1em;
        padding: 0.1em 0.15em 0 0.15em;
        margin-right: 2px;
        min-width: 1em;
    }

    .selected-tab {
        .bold;
        background-color: @text-pane-background;
        box-shadow: -1px -1px grey;
    }

    .proofbutton {
        padding: 1px 6px;
        margin: 1px 0px;
        cursor: pointer;
        font-size: 0.9em;
        min-width: 2em;
    }

    .key-block {
        display: none;
    }

    .show {
        display: table;
    }

    .table-row {
        display: table-row;
    }

    .table-cell {
        display: table-cell;
    }

    .char_box {
        padding-top: 1px;
    }

    .big_text, .picker {
        font-family: DejaVu Sans Mono;
        vertical-align: middle;
        text-align: center;
        width: 1.1em;
    }

    .big_text {
        font-size: 300%;
        margin: 2px;
    }

    .picker {
        font-size: 1em;
        margin-top: 1px;
        padding: 0;
    }

    #hide-picker {
        box-shadow: -1px -1px grey;
    }

    /* adjust so tools do not jump around with different character pickers */
    #char-selector {
        min-width: 225px;
    }

    #char-picker {
        display: inherit;
    }

    .hide-picker-button {
        font-size: 2em;
        height: 2.5em;
        padding: 0;
        background: transparent;
    }

    #tools {
        margin-left: 2px;
        margin-right: 0.5em;
        text-align: right;
        width: 100%;

        a:link {
            color: @page-interface-link-color;
        }
        a:visited {
            color: @page-interface-visited-color;
        }
        a:active {
            color: @page-interface-active-color;
        }
    }
}

/* ------------------------------------------------------------------------ */
/* Page Browser */

#page-browser {
    height: 100%;
    display: flex;
    flex-direction: column;
    .fixed-box {
        flex:0 0 auto;
    }
    .stretch-box {
        flex: 1 1 100%;
        min-height: 10px;
    }
    .page-interface;

    .control-pane {
        padding: 0 1em;
        overflow: auto;
        .solid-border-bottom(#999);
        p {
            margin: 0.2em 0;
        }
        input {
            margin: 1px 0.2em;
        }
        select {
            margin-right: 0.4em;
        }
        input[type=checkbox] {
            vertical-align: middle;
        }
        input[type=number] {
            width: 5em;
        }
        a {
            margin-right: 0.4em;
            margin-left: 0.4em;
        }
        button {
            box-shadow: 1px 1px grey;
            border-radius: 3px;
            width: 1.7em;
            background-repeat: no-repeat;
            background-position: center;
            background-size: 1.4em;
        }
    }

    .text-pane {
        width: 100%;
        box-sizing: border-box;
        padding-left: .5em;
        resize: none;
        border: 0;
        margin: 0;
        display: block;
    }
}

/* ------------------------------------------------------------------------ */
/* Control Bar */

.control-bar {
    padding: 0.1em;
    flex: 0 0 auto;
    display: flex;
    background-color: @control-pane-background;
    color: @control-pane-text;
    border-style: solid;
    border-color: gray;
    overflow: auto;

    input, select, button {
        background-color: @text-pane-background;
        color: @text-pane-text;
        .solid-border;
    }

    input[type=number] {
        width: 1.9rem;
        text-align: right;
        -moz-appearance: textfield;
    }

    input::-webkit-outer-spin-button, input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    input[type=submit]:disabled, input[type=button]:disabled, button:disabled {
        background-color: shade(@text-pane-background, 30%);
    }

    button, input[type=submit], input[type=button] {
        box-shadow: 1px 1px grey;
        border-radius: 3px;
        width: 1.7em;
        height: 1.7em;
        padding: 0;
    }

    input[type=checkbox] {
        width: 1em;
        height: 1em;
    }
}

.control-bar-menu {
    position: absolute;
    padding: 0.2em;
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.5);
    border-radius: 0.3em;
    background-color: @control-pane-background;
    border: 1px solid gray;
    display: none;
    z-index: 1;

    td {
        padding: 0.2em 0.2em;
    }
}
