//
// Dependencies
// --------------------------------------------------

@import "global.less";
@import "icon.less";
@import "button.less";

//
// Toolbars
// --------------------------------------------------

.control-toolbar {
    font-size: 0; // Do not rely on the default spacing between inline-block elements
    padding: 0 0 20px 0;
    position: relative;
    .horizontal-scroll-indicators(@color-scroll-indicator);

    display: table;
    table-layout: fixed;
    width: 100%;

    &:before {
        left: -10px;
    }

    &:after {
        right: -8px;
    }

    .toolbar-item {
        position: relative;
        white-space: nowrap;
        display: table-cell;
        vertical-align: top;
        padding-right: 20px;

        &:last-child,
        &.last {
            padding-right: 0;
        }

        .horizontal-scroll-indicators(@color-scroll-indicator);

        &:before { left: -10px; }
        &:after { right: 6px; }

        .btn, .btn-group, .dropdown {
            white-space: nowrap;
            float: none;
            display: inline-block;
            margin-right: 10px;

            &:last-child {
                margin-right: 0;
            }

            &.standalone {
                margin-right: 15px;
            }
        }

        .dropdown > .btn {
            margin-right: 0;
        }

        .btn-group {
            > .btn, > .dropdown {
                margin-right: 0;
                display: inline-block;
                float: none;
            }

            .dropdown {
                > .btn {
                    margin-right: 0;
                    .border-right-radius(0);
                }

                &.last > .btn {
                    .border-right-radius(@border-radius-base) !important;
                }
            }
        }
    }

    input.form-control[type=text] {
        height: auto;
        padding: 6px 13px 6px;
    }

    &.toolbar-padded {
        padding: 20px;
    }
}

[data-control=toolbar] {
    white-space: nowrap;
    width: 100%;
    overflow: hidden;
}

html.mobile {
    [data-control=toolbar].is-native-drag {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.clear-input-text {
    padding: 0 5px;
    cursor: pointer;
    background: transparent;
    border: 0;
    -webkit-appearance: none;
    font-size: (@font-size-base * 1.5);
    font-weight: @close-font-weight;
    line-height: 1;
    color: @close-color;
    text-shadow: @close-text-shadow;
    font-family: sans-serif;
    display: inline-block;
    position: absolute;
    right: 3px;
    top: 0;
    bottom: 0;
    margin: auto;
    background-color: #fff;
    height: 28px;

    > i {
        .opacity(.2);
    }

    &:hover,
    &:focus {
        color: @close-color;
        text-decoration: none;
        cursor: pointer;
        > i {
            .opacity(.5);
        }
    }

    &:focus {
         outline: none;
    }
}

//
// Editor toolbar
// --------------------------------------------------

@toolbar-editor-btn-size: 38px;

.control-toolbar.editor-toolbar {
    padding: 0;
    background: @color-toolbar-editor-bg;
    .border-bottom-radius(0);
    border-bottom: 2px solid @color-toolbar-editor-border;

    .toolbar-item {
        .btn, .btn-group, .dropdown {
            margin: 0;
            padding: 0;
        }

        .btn {
            text-align: center;
            height: @toolbar-editor-btn-size;
            width: @toolbar-editor-btn-size;
            line-height: @toolbar-editor-btn-size;
            zoom: 1;
            color: @color-toolbar-editor-btn;
            background: transparent;
            .user-select(none);
            .box-shadow(none);
            text-shadow: none;
            border-radius: 0;
            font-size: 14px;

            > i  {
                opacity: 1;
            }

            &:hover {
                outline: none;
                background-color: @color-toolbar-editor-btn-bg-hover;
                color: @color-toolbar-editor-btn-hover;
            }
            &.active,
            &:active {
                outline: none;
                background-color: @color-toolbar-editor-btn-bg-active;
                color: @color-toolbar-editor-btn-hover;
            }
            &.disabled,
            &[disabled] {
                opacity: 1;
                color: #bdbdbd;
                cursor: default;
                background: transparent;
            }
        }

        .dropdown.open {
            .btn {
                background-color: @color-toolbar-editor-btn-bg-active;
                color: @color-toolbar-editor-btn-hover;
            }
        }

        .btn[class^="oc-icon-"],
        .btn[class*=" oc-icon-"] {
            &:before {
                opacity: 1;
                margin: 0;
            }
        }

        .btn.oc-autumn-button {
            color: #c03f31;

            &:hover {
                color: @color-toolbar-editor-btn-hover !important;
            }
        }
    }
}

/* Toolbar tweaks for the side panel */

#layout-side-panel,
.compact-toolbar {
    div.control-toolbar {
        &, &.toolbar-padded {
            padding: 0;
        }

        &.separator {
            border-bottom: 1px solid #ecf0f1;
        }

        .toolbar-item {
            padding-right: 0;
        }

        .btn {
            .border-radius(0)!important;
            padding-top: 12px;
            padding-bottom: 13px;
            margin-right: 0;
        }

        input.form-control {
            border: none;
            padding: 11px 13px 12px;
            height: auto;
            .border-radius(0) !important;
            .box-shadow(~"inset 0 1px 0 @{input-border}");

            &.icon.search {
                background-position: right -78px;
            }
        }

        div.loading-indicator-container.size-input-text {
            .loading-indicator {
                top: 6px;
            }
        }
    }
}
