@import "functions";
@import "button";

@mixin toolbar($bg, $fg) {
    @include linear-gradient($bg);
    @include border($bg);

    padding: $spacing;
    color: $fg;

    &:insensitive {
        @include linear-gradient(darken($bg, 10%));

        color: mix($fg, $bg, .5);
    }

    .title {
        font: bold;
        padding: 0 12px;
    }

    .subtitle {
        font: smaller;
        padding: 0 12px;
    }

    .button { @include button($bg, $fg); }

    GtkComboBox, .button {
        padding: 2px;

        &.text-button { padding:  4px; }

        &.image-button { padding: $spacing ($spacing - 1px) ($spacing - 1px) $spacing; }
    }

    GtkSeparatorToolItem, .separator, .separator:insensitive {
        color: border_normal($bg);
        border-color: currentColor;

        -GtkWidget-window-dragging: true;
    }

    .menubar { -GtkToolbar-button-relief: normal; }
}

.toolbar {
    @include toolbar($bg_color, $fg_color);

    border-style: none;
}

.header-bar {
    @include toolbar($titlebar_bg_color, $titlebar_fg_color);

    border-width: 0 0 1px 0;
    border-style: solid;
}

.titlebar {
    @include linear-gradient($titlebar_bg_color);

    border-radius: $roundness $roundness 0 0;
    color: mix($titlebar_fg_color, $titlebar_bg_color, .1);

    &:backdrop {
        @include linear-gradient($titlebar_bg_color);

        color: mix($titlebar_fg_color, $titlebar_bg_color, .6);
        text-shadow: none;
    }

    &.default-decoration {
        border: none;
        box-shadow: none;
    }

    .tiled &, .maximized & { border-radius: 0; }

    .title { font: bold; }

    .titlebutton {
        padding: $spacing;
        border: none;
        background: none;
        color: mix($titlebar_fg_color, $titlebar_bg_color, 0.90);

        &:hover, &:hover:focus {
            background: none;
            color: $selected_bg_color;
        }

        &:active, &:active:hover {
            background: none;
            color: darken($selected_bg_color, 10%);
            box-shadow: none;
        }

        &:backdrop {
            background-image: none;
            color: mix($titlebar_fg_color, $titlebar_bg_color, 0.60);
            icon-shadow: none;
        }
    }
}