/**********
 * button *
 **********/

button,
button:hover,
toolbar button.raised,
toolbar .raised button,
toolbar button.raised:hover,
toolbar .raised button:hover,
toolbar.primary-toolbar button.raised,
toolbar.primary-toolbar button.raised,
toolbar.primary-toolbar button.raised:hover,
toolbar.primary-toolbar button.raised:hover,
toolbar combobox button.combo,
toolbar combobox button.combo:hover,
spinbutton.vertical button,
spinbutton.vertical button:hover,
switch slider,
switch slider:active {
    background-color: @theme_bg_color;
    border-radius: 0;
    border-style: solid;
    border-width: 1px;
    box-shadow: inset 0 -2px shade(@theme_bg_color, 0.65),
                inset -2px 0 shade(@theme_bg_color, 0.65),
                inset 0 1px white,
                inset 1px 0 white;
    border-color: gray;
}

button:active,
button:active:hover,
toolbar button.raised:active,
toolbar .raised button:active,
toolbar button.raised:active:hover,
toolbar .raised button:active:hover,
toolbar.primary-toolbar button.raised:active,
toolbar.primary-toolbar button.raised:active:hover,
.primary-toolbar .raised button:active,
.primary-toolbar .raised button:active:hover,
toolbar combobox button.combo:active,
toolbar combobox button.combo:active:hover,
spinbutton.vertical button:active,
spinbutton.vertical button:active:hover,
switchtrough,
switchtrough:active,
button.flat.link.text-button:active,
button.flat.link.text-button:active:hover,
scaleButtonbutton:active,
scaleButtonbutton:active:hover,
notebook tab button:active,
notebook tab button:active:hover,
.floating-bar button:active,
.floating-bar button:active:hover,
#gtk-scalebutton-popup-window button:active,
#gtk-scalebutton-popup-window button:active:hover {
    border-radius: 0;
    border-style: solid;
    border-width: 1px;
    box-shadow: inset 0 2px shade(@theme_bg_color, 0.65),
                inset 2px 0 shade(@theme_bg_color, 0.65),
                inset 0 -1px white,
                inset -1px 0 white;
    border-color: gray;
}

button:disabled,
button:disabled:active,
toolbar button.raised:disabled,
toolbar button.raised:disabled:active,
toolbar .raised button:disabled,
toolbar .raised button:disabled:active,
toolbar combobox button.combo:disabled,
toolbar combobox button.combo:disabled:active,
spinbutton.vertical button:disabled,
spinbutton.vertical button:disabled:active,
switchtrough:disabled,
switchtrough:disabled:active,
switch slider:disabled,
switch slider:disabled:active,
button.flat.link.text-button:disabled,
button.flat.link.text-button:disabled:active,
scaleButtonbutton:disabled,
scaleButtonbutton:disabled:active,
notebook tab button:disabled,
notebook tab button:disabled:active,
.floating-bar button:disabled,
.floating-bar button:disabled:active,
#gtk-scalebutton-popup-window button:disabled,
#gtk-scalebutton-popup-window button:disabled:active {
    background-color: @insensitive_inner_box;
    background-image: none;
}

/***********
* Toolbars *
************/

.inline-toolbartoolbar,
.inline-toolbar toolbar {

    border: 1px solid @borders_color;
    border-radius: 0;
    box-shadow: inset 0px 2px 3px -1px mix(gray, @theme_bg_color, 0.6);
    background-color: transparent;
    background-image: linear-gradient(to bottom, @theme_bg_color);
}

.inline-toolbartoolbar:last-child,
.inline-toolbar toolbar:last-child {
    border-width: 0 1px 1px;
}

.inline-toolbartoolbar.vertical:last-child,
.inline-toolbar toolbar.vertical:last-child {
    border-width: 1px 1px 1px 0;
}

headerbar.titlebar,
.header-bar,
.cs-header,
.primary-toolbar toolbar,
.primary-toolbartoolbar {
    border-radius: 0;
    border-style: solid;
    border-width: 0;
    box-shadow: inset 0 -2px shade(@theme_bg_color, 0.65),
                inset -2px 0 shade(@theme_bg_color, 0.65),
                inset 0 1px white,
                inset 1px 0 white;
    border-color: gray;
    background-color: @theme_bg_color;
    background: linear-gradient(to bottom,
                                @theme_bg_color, 1.1) 1px,
                                @theme_bg_color 2px,
                                @theme_bg_color 3px,
                                shade(@theme_bg_color, 0.5)
                                );
}

/**************************
* Primary toolbar buttons *
**************************/
toolbar.primary-toolbar button,
toolbar.primary-toolbar button:disabled,
toolbar.primary-toolbar button:disabled:active,
GtkHandleBox.dock toolbar button,
GtkHandleBox.dock toolbar button:disabled,
GtkHandleBox.dock toolbar button:disabled:active {
    background-color: transparent;
    background-image: none;
}

toolbar.primary-toolbar button:hover,
GtkHandleBox.dock combobox button.combo:hover {
    border-radius: 0;
    border-style: solid;
    border-width: 1px;
    box-shadow: inset 0 -2px shade(@theme_bg_color, 0.65),
                inset -2px 0 shade(@theme_bg_color, 0.65),
                inset 0 1px white,
                inset 1px 0 white;
    border-color: gray;
}

toolbar.primary-toolbar button:active,
toolbar.primary-toolbar button:active:hover,
GtkHandleBox.dock combobox button.combo:checked,
GtkHandleBox.dock combobox button.combo:checked:hover {
    border-radius: 0;
    border-style: solid;
    border-width: 1px;
    box-shadow: inset 0 2px shade(@theme_bg_color, 0.65),
                inset 2px 0 shade(@theme_bg_color, 0.65),
                inset 0 -1px white,
                inset -1px 0 white;
    border-color: gray;
}

/****************
 * Flat Buttons *
 ****************/
button.flat.link.text-button,
scaleButtonbutton,
notebook tab button,
.floating-bar button,
#gtk-scalebutton-popup-window button {
    background: none;
}

button.flat.link.text-button:hover,
scaleButtonbutton:hover,
notebook tab button:hover,
.floating-bar button:hover,
#gtk-scalebutton-popup-window button:hover {
    background-image: linear-gradient(to bottom, alpha(@button_bg, 0.7));
    background-clip: padding-box;
}


/*****************
 * column-header *
 *****************/

treeview header button,
treeview header button,
treeview header button:disabled,
treeview header button:disabled {
    background-color: @theme_bg_color;
    background-image: none;
}

treeview header button:hover,
treeview header button:hover {
    background-color: @theme_bg_color;
    background-image: none;
}

treeview header button:active,
treeview header button:active,
treeview header button:active:hover,
treeview header button:active:hover {
    background-color: @theme_bg_color;
    background-image: none;
}

/*********
 * entry *
 *********/

entry,
spinbutton.verticalentry {
    background-color: @theme_base_color;
    background-image: none;
}

entry:disabled,
spinbutton.verticalentry:disabled {
    background-color: @theme_bg_color;
    box-shadow: inset 0px 0px 0px 2px @insensitive_inner_box;
    background-image: none;
}

/************
 * notebook *
 ************/

notebook tab {
    background-clip: padding-box;
    background-color: @theme_bg_color;
}

notebook tab:active {
    background-color: @notebook_bg;
    background-image: none;
}

/***************
 * progressbar *
 ***************/

progressbar.horizontal trough,
progressbar.horizontal progress {
    min-height: 10px;
}

progressbar.vertical trough,
progressbar.vertical progress {
    min-width: 10px; }

progressbar.vertical progress {
    background-color: @theme_selected_bg_color;
}

progressbar.vertical {
    background-color: @theme_selected_bg_color;
}

progressbar.vertical progress row,
progressbar.vertical progress row {
    background-color: @theme_bg_color;
}

progressbar.vertical progress row:selected,
progressbar.vertical progress row:selected:focus {
    background-color: @theme_bg_color;
}

trough,
trough.vertical {
    background-color: @theme_base_color;
    border: 1px solid gray;
    border-radius: 0;
    box-shadow: none;
}

trough row {
    background-color: white;
}

trough row:selected,
trough row:selected:focus {
    background-color: alpha(@theme_selected_fg_color, 0.3);
}

/*************
 * scrollbar *
 *************/

scrollbar slider,
scrollbar slider,
scrollbar slider,
scrollbar slider:hover,
scrollbar slider,
scrollbar slider:active,
    background-color: #c0c0c0;
}
/*******************************************
 * Linked Button Backgrounds - Nomal/Hover *
 *******************************************/
 
.linked button:last-child,
.linked button:last-child:hover,

toolbar button.raised.linked:last-child,
toolbar .raised.linked button:last-child,
toolbar button.raised.linked:last-child:hover,
toolbar .raised.linked button:last-child:hover,

.primary-toolbar .linked button:last-child,
.primary-toolbar .linked button:last-child:hover,

.primary-toolbar .raised .linked button:last-child,
.primary-toolbar .raised .linked button:last-child:hover,

toolbar.primary-toolbar button.raised.linked:last-child,
toolbar.primary-toolbar .raised.linked button:last-child,
toolbar.primary-toolbar button.raised.linked:last-child:hover,
toolbar.primary-toolbar .raised.linked button:last-child:hover,

toolbar.inline-toolbar button:last-child,
toolbar.inline-toolbar button:hover:last-child,

.inline-toolbartoolbar toolbutton:last-child > button,
.inline-toolbartoolbar toolbutton:last-child > button:hover {
    background-image: linear-gradient(to left,
                                      rgba(0, 0, 0, 0.045) 2px,
                                      rgba(0, 0, 0, 0.006) 3px,
                                      transparent 4px
                                      ),
                      linear-gradient(to top,
                                      rgba(0, 0, 0, 0.13) 1px,
                                      transparent 4px
                                      ),
                      linear-gradient(to bottom,
                                      shade(@button_bg, 1.15) 1px,
                                      shade(@button_bg, 1.035) 4px,
                                      shade(@button_bg, 1.01) 8px,
                                      @button_bg 50%,
                                      shade(@button_bg, 1.02)
                                      );
}

.linked button,
.linked button:hover,
.linked button:first-child,
.linked button:first-child:hover,

toolbar button.raised.linked,
toolbar .raised.linked button,
toolbar button.raised.linked:hover,
toolbar .raised.linked button:hover,
toolbar button.raised.linked:first-child,
toolbar .raised.linked button:first-child,
toolbar button.raised.linked:first-child:hover,
toolbar .raised.linked button:first-child:hover,

.primary-toolbar .linked button,
.primary-toolbar .linked button:hover,
.primary-toolbar .linked button:first-child,
.primary-toolbar .linked button:first-child:hover,

.primary-toolbar .raised .linked button,
.primary-toolbar .raised .linked button:hover,
.primary-toolbar .raised .linked button:first-child,
.primary-toolbar .raised .linked button:first-child:hover,

toolbar.primary-toolbar button.raised.linked,
toolbar.primary-toolbar .raised.linked button,
toolbar.primary-toolbar button.raised.linked:hover,
toolbar.primary-toolbar .raised.linked button:hover,
toolbar.primary-toolbar button.raised.linked:first-child,
toolbar.primary-toolbar .raised.linked button:first-child,
toolbar.primary-toolbar button.raised.linked:first-child:hover,
toolbar.primary-toolbar .raised.linked button:first-child:hover,

toolbar.inline-toolbar button,
toolbar.inline-toolbar button:hover,
toolbar.inline-toolbar button:first-child,
toolbar.inline-toolbar button:hover:first-child,

.inline-toolbartoolbar toolbutton > button,
.inline-toolbartoolbar toolbutton > button:hover,
.inline-toolbartoolbar toolbutton:first-child > button,
.inline-toolbartoolbar toolbutton:first-child > button:hover {
    background-image: linear-gradient(to top,
                                      rgba(0, 0, 0, 0.13) 1px,
                                      transparent 4px
                                      ),
                      linear-gradient(to bottom,
                                      shade(@button_bg, 1.15) 1px,
                                      shade(@button_bg, 1.035) 4px,
                                      shade(@button_bg, 1.01) 8px,
                                      @button_bg 50%,
                                      shade(@button_bg, 1.02)
                                      );
}

/*************************************
* Linked Button Backgrounds - Active *
**************************************/

.linked button:last-child:active,
.linked button:last-child:active:hover,

toolbar button.raised.linked:last-child:active,
toolbar .raised.linked button:last-child:active,
toolbar button.raised.linked:last-child:active:hover,
toolbar .raised.linked button:last-child:active:hover,

.primary-toolbar .linked button:last-child:active,
.primary-toolbar .linked button:last-child:active:hover,

.primary-toolbar .raised .linked button:last-child:active,
.primary-toolbar .raised .linked button:last-child:active:hover,

toolbar.primary-toolbar button.raised.linked:last-child:active,
toolbar.primary-toolbar .raised.linked button:last-child:active,
toolbar.primary-toolbar button.raised.linked:last-child:active:hover,
toolbar.primary-toolbar .raised.linked button:last-child:active:hover,

toolbar.inline-toolbar button:last-child:active,
toolbar.inline-toolbar button:last-child:active:hover,

.inline-toolbartoolbar toolbutton:last-child > button:active,
.inline-toolbartoolbar toolbutton:last-child > button:active:hover {
    background-image: linear-gradient(to left,
                                      alpha(white, 0.2) 2px,
                                      alpha(white, 0.05) 3px,
                                      transparent 3px
                                      ),
                      linear-gradient(to bottom,
                                      alpha(gray, 0.15) 1px,
                                      transparent 3px
                                      ),
                      linear-gradient(to top,
                                      shade(@button_bg, 1.01) 1px,
                                      shade(@button_bg, 0.96) 3px,
                                      shade(@button_bg, 0.94)
                                      );
}

.linked button:active,
.linked button:active:hover,
.linked button:first-child:active,
.linked button:first-child:active:hover,

toolbar button.raised.linked:active,
toolbar .raised.linked button:active,
toolbar button.raised.linked:active:hover,
toolbar .raised.linked button:active:hover,
toolbar button.raised.linked:first-child:active,
toolbar .raised.linked button:first-child:active,
toolbar button.raised.linked:first-child:active:hover,
toolbar .raised.linked button:first-child:active:hover,

.primary-toolbar .linked button:active,
.primary-toolbar .linked button:active:hover,
.primary-toolbar .linked button:first-child:active,
.primary-toolbar .linked button:first-child:active:hover,

.primary-toolbar .raised .linked button:active,
.primary-toolbar .raised .linked button:active:hover,
.primary-toolbar .raised .linked button:first-child:active,
.primary-toolbar .raised .linked button:first-child:active:hover,

toolbar.primary-toolbar button.raised.linked:active,
.primary-toolbar .raised.linked button:active,
toolbar.primary-toolbar button.raised.linked:active:hover,
.primary-toolbar .raised.linked button:active:hover,
toolbar.primary-toolbar button.raised.linked:first-child:active,
toolbar.primary-toolbar .raised.linked button:first-child:active,
toolbar.primary-toolbar button.raised.linked:first-child:active:hover,
toolbar.primary-toolbar .raised.linked button:first-child:active:hover,

toolbar.inline-toolbar button:active,
toolbar.inline-toolbar button:active:hover,
toolbar.inline-toolbar button:first-child:active,
toolbar.inline-toolbar button:first-child:active:hover,

.inline-toolbartoolbar toolbutton > button:active,
.inline-toolbartoolbar toolbutton > button:active:hover,
.inline-toolbartoolbar toolbutton:first-child > button:active,
.inline-toolbartoolbar toolbutton:first-child > button:active:hover {
    background-image: linear-gradient(to bottom,
                                      alpha(gray, 0.15) 1px,
                                      transparent 3px
                                      ),
                      linear-gradient(to top,
                                      shade(@button_bg, 1.01) 1px,
                                      shade(@button_bg, 0.96) 3px,
                                      shade(@button_bg, 0.94)
                                      );
}

/*******************************************
 * Linked Button Backgrounds - Insensitive *
 *******************************************/

.linked button:disabled,
.linked button:disabled:hover,
.linked button:first-child:disabled,
.linked button:first-child:disabled:hover,
.linked button:last-child:disabled,
.linked button:last-child:disabled:hover,

toolbar button.raised.linked:disabled,
toolbar .raised.linked button:disabled,
toolbar button.raised.linked:disabled:hover,
toolbar .raised.linked button:disabled:hover,
toolbar button.raised.linked:first-child:disabled,
toolbar .raised.linked button:first-child:disabled,
toolbar button.raised.linked:first-child:disabled:hover,
toolbar .raised.linked button:first-child:disabled:hover,
toolbar button.raised.linked:last-child:disabled,
toolbar .raised.linked button:last-child:disabled,
toolbar button.raised.linked:last-child:disabled:hover,
toolbar .raised.linked button:last-child:disabled:hover,

.primary-toolbar .linked button:disabled,
.primary-toolbar .linked button:disabled:hover,
.primary-toolbar .linked button:first-child:disabled,
.primary-toolbar .linked button:first-child:disabled:hover,
.primary-toolbar .linked button:last-child:disabled,
.primary-toolbar .linked button:last-child:disabled:hover,

.primary-toolbar .raised .linked button:disabled,
.primary-toolbar .raised .linked button:disabled:hover,
.primary-toolbar .raised .linked button:first-child:disabled,
.primary-toolbar .raised .linked button:first-child:disabled:hover,
.primary-toolbar .raised .linked button:last-child:disabled,
.primary-toolbar .raised .linked button:last-child:disabled:hover,

toolbar.primary-toolbar button.raised.linked:disabled,
toolbar.primary-toolbar .raised.linked button:disabled,
toolbar.primary-toolbar button.raised.linked:disabled:hover,
toolbar.primary-toolbar .raised.linked button:disabled:hover,
toolbar.primary-toolbar button.raised.linked:first-child:disabled,
toolbar.primary-toolbar .raised.linked button:first-child:disabled,
toolbar.primary-toolbar button.raised.linked:first-child:disabled:hover,
toolbar.primary-toolbar .raised.linked button:first-child:disabled:hover,
toolbar.primary-toolbar button.raised.linked:last-child:disabled,
toolbar.primary-toolbar .raised.linked button:last-child:disabled,
toolbar.primary-toolbar button.raised.linked:last-child:disabled:hover,
toolbar.primary-toolbar .raised.linked button:last-child:disabled:hover,

toolbar.inline-toolbar button:disabled,
toolbar.inline-toolbar button:disabled:hover,
toolbar.inline-toolbar button:first-child:disabled,
toolbar.inline-toolbar button:first-child:disabled:hover,
toolbar.inline-toolbar button:last-child:disabled,
toolbar.inline-toolbar button:last-child:disabled:hover,

.inline-toolbartoolbar toolbutton > button:disabled,
.inline-toolbartoolbar toolbutton > button:disabled:hover,
.inline-toolbartoolbar toolbutton:first-child > button:disabled,
.inline-toolbartoolbar toolbutton:first-child > button:disabled:hover,
.inline-toolbartoolbar toolbutton:last-child > button:disabled,
.inline-toolbartoolbar toolbutton:last-child > button:disabled:hover {
    background-color: @insensitive_inner_box;
    background-image: none;
}

/* and this is why scss exists :( */
