/*************************************************
* --- Reset (used for all w2ui widgets)
* --- The reset is needed to coexist with other CSS
* --- on the same page (for example bootstrap)
*/

.w2ui-reset {
    .box-sizing;
    font-family: @main-font-family;
    font-size: 11px;
     * {
        color: default;
        line-height: 100%;
        .box-sizing();
        margin: 0px;
        padding: 0px;
        // do not include any font-* properties
    }
    table {
        max-width: none;
        background-color: transparent;
        border-collapse: separate;
        border-spacing: 0;
        border: none;
    }
    table tr th, table tr td {
        font-family: @main-font-family;
        font-size: 11px;
    }
    input:not([type=button]):not([type=submit]):not([type=checkbox]):not([type=radio]),
    select, textarea {
        display: inline-block;
        width: auto;
        height: auto;
        vertical-align: baseline;
        padding: 4px;
        margin: 0;
        font-size: 11px;
    }
    select {
        padding: 1px;
        height: 23px;
        font-size: 11px;
    }
}

.w2ui-centered {
    position: absolute;
    left: 0px;  // do not use left: 50% as IE has problems
    right: 0px;
    top: 50%;
    .transform(translateY(-50%));
    max-height: 100%;
    margin: 0px;
    padding: 0px 10px;
    text-align: center;
}

.w2ui-disabled, .w2ui-readonly {
    background-color: #f1f1f1 !important;
    color: #777 !important;
}

.w2ui-message { // slide down message
    font-size: 12px;
    position: absolute;
    z-index: 250;
    background-color: @message-background-color;
    border: @message-border;
    box-shadow: @message-shadow;
    .box-sizing;
    border-top: 0px;
    border-radius: 0px 0px 6px 6px;
    overflow: auto;

    .w2ui-message-body {
        position: absolute;
        top: 0px;
        bottom: 45px;
        left: 0px;
        right: 0px;
        overflow: auto;
        line-height: 1.5;
        font-size: 14px;
        & .w2ui-centered {
            line-height: 1.5
        }
    }

    .w2ui-message-buttons {
        position: absolute;
        height: 45px;
        bottom: 0px;
        left: 0px;
        right: 0px;
        border-top: 1px solid #e5e5e5;
        text-align: center;
        padding: 8px;
    }
}


/*************************************************
* ---- Input Controls ----
*/

input[type=button].w2ui-input {
    .sys-button;
    &:hover { .sys-button-hover; }
    &:active { .sys-button-active; }
}

input:not([type=button]):not([type=submit]).w2ui-input, textarea.w2ui-input {
    padding: 4px;
    border: @input-border;
    border-radius: 3px;
    color: @input-color;
    background-color: @input-background-color;
    line-height: normal;
    &:focus {
        outline-color: @input-focus-outline-color;
    }
    &:disabled, &[readonly] {
        background-color: #f1f1f1;
        color: #777;
    }
}

/* IE9-11 specific classes */

/* needs doblue :: */
input.w2ui-input::-ms-clear {
    display: none;
}

input.w2ui-input:-ms-input-placeholder {
    color: #aaa !important;
}

select.w2ui-input {
    color: @input-color;
    padding: 0px 15px 0px 7px;
    line-height: 1.8;
    border-radius: 3px;
    border: @input-border;
    -webkit-appearance: none;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAALCAQAAACnzwd+AAAAcklEQVR4AcXMsQFBQQDG4P9tAgC0gJYRQJZgKQMwCqCku6vVAAAA+NJHP4KHOk0aV2pRw61n4BBmyOxKQ8I4ehZeuhd3HTx6DQEGZ7sBfr2OOOOj3Yi43kMKs9sZknofOexqZ8npMygwWZTX51CipP+YA1OiZJbYYg9lAAAAAElFTkSuQmCC'),
                      -webkit-linear-gradient(to bottom,#FFF 20%,#f6f6f6 50%,#EEE 52%,#f4f4f4 100%);
    background-size: 17px 6px, 100% 100%;
    background-position: right center, left top;
    background-repeat: no-repeat, no-repeat;
}

.w2ui-icon-expand {
    &:before {
        position: relative;
        top: 1px;
        left: 1px;
        content: ' ';
        width: 6px;
        height: 6px;
        border: 2px solid rgba(150, 150, 150, 0.8);
        border-bottom: 0;
        border-left: 0;
        transform: rotateZ(45deg);
    }
}

.w2ui-icon-collapse {
    &:before {
        position: relative;
        top: -1px;
        left: 3px;
        content: ' ';
        width: 6px;
        height: 6px;
        border: 2px solid rgba(150, 150, 150, 0.8);
        border-bottom: 0;
        border-left: 0;
        transform: rotateZ(135deg);
    }
}

/* On/Off switch */

input[type="checkbox"].w2ui-toggle {
    position: absolute;
    opacity: 0;
    width: 46px;
    height: 22px;
    padding: 0px;
    margin: 0px;
    margin-left: 2px
}

/* Track */
input[type="checkbox"].w2ui-toggle + div {
    display: inline-block;
    width: 46px;
    height: 22px;
    border: 1px solid #bbb;
    border-radius: 30px;
    background-color: #eee;
    -webkit-transition-duration: .3s;
    -webkit-transition-property: background-color, box-shadow;
    -moz-transition-duration: .3s;
    -moz-transition-property: background-color, box-shadow;
    box-shadow: inset 0 0 0 0px rgba(0, 0, 0, 0.4);
    margin-left: 2px
}

input[type="checkbox"].w2ui-toggle:disabled + div {
    opacity: 0.3;
}

/* Knob */
input[type="checkbox"].w2ui-toggle + div > div {
    float: left;
    width: 22px;
    height: 22px;
    border-radius: inherit;
    background: #f5f5f5;
    -webkit-transition-duration: 0.3s;
    -webkit-transition-property: transform, background-color, box-shadow;
    -moz-transition-duration: 0.3s;
    -moz-transition-property: transform, background-color;
    box-shadow: 0px 0px 1px rgba(50, 50, 50, 1), 0 0 0 1px rgba(200, 200, 200, 0.6);
    pointer-events: none;
    margin-top: -1px;
    margin-left: -1px;
}

/* Default Green */
input[type="checkbox"].w2ui-toggle:checked + div {
    border: 1px solid rgba(0, 162, 63,1);
    box-shadow: inset 0 0 0 12px #54B350;
}

input[type="checkbox"].w2ui-toggle:checked + div > div {
    -webkit-transform: translate3d(24px, 0, 0);
    -moz-transform: translate3d(24px, 0, 0);
    background-color: #ffffff;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 162, 63, 1);
}

/* Blue */
input[type="checkbox"].w2ui-toggle.blue:checked + div {
    border: 1px solid #206FAD;
    box-shadow: inset 0 0 0 12px #35A6EB;
}

input[type="checkbox"].w2ui-toggle.blue:checked + div > div {
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3), 0px 0px 0 1px #206FAD;
}

input[type=checkbox].w2ui-toggle:focus {
    outline: none;
}

/*************************************************
* ---- Overlay and Bubble ----
*/

.w2ui-overlay {
    position: absolute;
    margin-top: 4px;
    margin-left: -17px;
    display: none;
    z-index: 1300;
    color: @overlay-color;
    background-color: @overlay-background-color;
    border-color: @overlay-background-color;
    box-shadow: @overlay-shadow;
    border-radius: 4px;
    text-align: left;

    & > div {
        border-radius: 4px;
        position: relative;
        border: @overlay-border-width solid @overlay-border-color;
    }

    table td {
        color: @overlay-color;
    }

    &:before {
        content: "";
        position: absolute;
        border-color: inherit;
    }

    &:after {
        content: "";
        position: absolute;
        border-color: inherit;
        bottom: 100%;
        left:@overlay-border-width + 1;
    }

    &.top-arrow {

        &:before {
            border-bottom: 12px solid darken(@overlay-border-color, 3%);
            border-right: 12px solid transparent;
            border-left: 12px solid transparent;
            bottom: 100%;
            margin-bottom: -@overlay-border-width;
        }

        &:after {
            border-bottom: (12px - @overlay-border-width - 1) solid black;
            border-bottom-color: inherit;
            border-right: (12px - @overlay-border-width - 1) solid transparent;
            border-left: (12px - @overlay-border-width - 1) solid transparent;
            bottom: 100%;
            margin-bottom: -@overlay-border-width;
        }
    }

    &.bottom-arrow {

        &:before {
            border-top: 12px solid darken(@overlay-border-color, 3%);
            border-right: 12px solid transparent;
            border-left: 12px solid transparent;
            top: 100%;
            margin-top: -@overlay-border-width;
        }

        &:after {
            border-top: (12px - @overlay-border-width - 1) solid black;
            border-top-color: inherit;
            border-right: (12px - @overlay-border-width - 1) solid transparent;
            border-left: (12px - @overlay-border-width - 1) solid transparent;
            top: 100%;
            margin-top: -@overlay-border-width;
        }
    }

    &.w2ui-overlay-popup {    // if it is inside popup
        z-index: 1700;
    }

    .w2ui-grid-searches {
        border-top: @overlay-border-width solid @overlay-border-color !important;
    }

    .no-color {
        border: 1px solid #eee;
        background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABlBMVEX/////TgCFoIUYAAAAGUlEQVR42uXHIQEAAACDsNO/NJ4Kn9uC8wsJkAARUrXAjwAAAABJRU5ErkJggg==');
        background-size: 15px 15px;
    }
}

.w2ui-tag {
    position: absolute;
    z-index: 1300;
    opacity: 0;
    .transition(opacity, 0.3s);

    .w2ui-tag-body {
        box-sizing: border-box;
        display: inline-block;
        position: absolute;
        border-radius: 3px;
        padding: 6px 10px;
        margin-left: 10px;
        margin-top: 0px;
        background-color: @bubble-tag-background-color;
        color: @bubble-tag-color !important;
        font-size: 11px;
        font-family: verdana;
        text-shadow: 1px 1px 3px #000; // for sharper text in a bubble
        line-height: 1.4;
        letter-spacing: 0.1px;

        &.w2ui-tag-right:before {
            content: "";
            position: absolute;
            width: 0;
            height: 0;
            border-top: 6px solid transparent;
            border-right: 6px solid @bubble-tag-background-color;
            border-bottom: 6px solid transparent;
            margin: 0px 0 0 -16px;
        }

        &.w2ui-tag-left:after {
            content: "";
            position: absolute;
            top: 5px;
            width: 0;
            height: 0;
            border-top: 6px solid transparent;
            border-left: 6px solid @bubble-tag-background-color;
            border-bottom: 6px solid transparent;
            margin: 0px 0 0 10px;
        }

        &.w2ui-tag-bottom:before {
            content: "";
            position: absolute;
            width: 0;
            height: 0;
            border-right: 6px solid transparent;
            border-left: 6px solid transparent;
            border-bottom: 6px solid @bubble-tag-background-color;
            margin: -12px 0 0 2px;
        }

        &.w2ui-tag-top:after {
            content: "";
            position: absolute;
            left: 12px;
            bottom: -6px;
            width: 0;
            height: 0;
            border-right: 6px solid transparent;
            border-left: 6px solid transparent;
            border-top: 6px solid @bubble-tag-background-color;
        }
    }
    &.w2ui-tag-popup {    // if it is inside popup
        z-index: 1700;
    }
}

/*
*    Drop down menu
*/

.w2ui-overlay table.w2ui-drop-menu {
    width: 100%;
    color: @drop-menu-color;
    background-color: @drop-menu-background-color;
    padding: 5px 0px;
    cursor: default;
    td {
        white-space: nowrap;
    }

    & .w2ui-item-even {
        color: @dropdown-item-even-color;
        background-color: @dropdown-item-even-background-color;
    }

    & .w2ui-item-odd {
        color: @dropdown-item-odd-color;
        background-color: @dropdown-item-odd-background-color;
    }

    & .w2ui-item-group {
        color: #444;
        font-weight: bold;
        background-color: #ECEDF0;
        border-bottom: 1px solid #D3D2D4;
    }
    // image
    td.menu-icon {
        padding: 3px 0px 4px 6px;
        width: 20px;
        > span {
            height: 20px;
            width: 18px;
        }
    }
    // caption
    td.menu-text {
        padding: 8px 10px 8px 5px;
        width: auto;
    }
    td.menu-count {
        text-align: right;
        & > span {
            border: @menu-node-count-border;
            border-radius: 20px;
            width: auto;
            height: 18px;
            padding: 2px 7px;
            margin: 3px 5px 0px 5px;
            background-color: @menu-node-count-background-color;
            color: @menu-node-count-color;
            box-shadow: @menu-node-count-shadow;
            text-shadow: @menu-node-count-text-shadow;
        }
        & > span.hotkey {
            border: none;
            border-radius: 0px;
            background-color: transparent !important;
            color: #888;
            box-shadow: none;
            text-shadow: none;
        }
    }

    tr:hover {
        color: @drop-menu-row-hover-color;
        background-color: @drop-menu-row-hover-background-color;
    }

    tr.w2ui-selected {
        background-color: @drop-menu-selected-background-color;
    }

    tr.w2ui-selected td {
        color: @drop-menu-selected-color;
    }

    tr.w2ui-disabled {
        opacity: 0.4;
        background-color: white !important;
    }

    .w2ui-icon {
        font-size: 14px;
        color: @drop-menu-image-color;
        display: inline-block;
        padding-top: 4px;
    }
}

/*************************************************
* ---- Common Classes ----
*/

.w2ui-marker {
    color: #444;
    background-color: rgba(252, 244, 161, 0.48);
}

.w2ui-spinner {
    display: inline-block;
    background-size: 100%;
    background-repeat: no-repeat;
    background-image: @image-spinner;
}

/* common icons */

.w2ui-icon {
    background-repeat: no-repeat;
    height: 16px;
    width: 16px;
    overflow: hidden;
    margin: 2px 2px;
    display: inline-block;

    &.icon-search, &.icon-search-down {
        .background-image(@image-search, no-repeat, center, ~"!important");
        background-size: 14px 12px !important;
        opacity: 0.9;
    }

    &.icon-folder {
        .background-image(@image-folder, no-repeat, center, ~"!important");
    }

    &.icon-page {
        .background-image(@image-page, no-repeat, center, ~"!important");
    }
}

/*************************************************
* ---- Locking portion of the screen (in grid, form, layout)
*/

.w2ui-lock {
    display: none;
    position: absolute;
    z-index: 1400;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    .opacity(0.15);
    background-color: @lock-background-color;
}

.w2ui-lock-msg {
    display: none;
    position: absolute;
    z-index: 1400;
    top: 45%;
    left: 50%;
    .transform(translateX(-50%) translateY(-50%));
    width: 200px;
    height: 80px;
    padding: 30px 8px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    font-size: 13px;
    font-family: @main-font-family;
    .opacity(0.8);
    background-color: @lock-msg-background-color;
    color: @lock-msg-color;
    text-align: center;
    border-radius: 5px;
    border: @lock-msg-border;
    .w2ui-spinner {
        display: inline-block;
        width: 24px;
        height: 24px;
        margin: -3px 8px -7px -10px;
    }
}

/*************************************************
* ---- Scroll contet, used in toolbar and tabs ----
*/

.w2ui-scroll-wrapper {
    overflow: hidden;
}

.w2ui-scroll-left,
.w2ui-scroll-right {
    top: 0;
    width: 18px;
    height: 100%;
    cursor: default !important;
    z-index: 10;
    display: none;
    position: absolute;

    &:hover {
        background-color: @overflow-hover-background-color;
    }
}

.w2ui-scroll-left {
    left: 0;
    box-shadow: 0px 0px 7px #5F5F5F;
    background: @overflow-background-color @image-less center center no-repeat;
    background-size: 15px 12px;
}

.w2ui-scroll-right {
    right: 0;
    box-shadow: 0px 0px 7px #5F5F5F;
    background: @overflow-background-color @image-more center center no-repeat;
    background-size: 15px 13px;
}
