//// Toolbar icons used with permission from Drew Wilson
//// http://pictos.drewwilson.com/
//// Pictos icons are (c) 2010 Drew Wilson

/**
 * @class Ext.Button
 */

$button-border-radius: 5px;

.x-button {
    height: 40px;
    padding: 0 3px;
    border-color: #CECACE;
    @include border-radius($button-border-radius);
    @include background(linear-gradient(color-stops(#C6C3C6, #E7E7E7)));
    position: relative;

    &:before {
        content: '';
        position: absolute;
        top: 1px;
        right: 1px;
        bottom: 1px;
        left: 1px;
        border: 1px solid #B9B7B9;
        @include border-radius(4px);
        @include background(linear-gradient(color-stops(#FFFFFF, #DEDFDE)));
    }

    .x-button-label {
        color: #252525;
    }
}

.x-button-pressing {
    border-color: #5E5E5E;
    @include background(linear-gradient(color-stops(#404040, #858585)));

    &:before {
        border-color: #565656;
        @include background(linear-gradient(color-stops(#2E85A1, #0C8AB2)));
    }

    .x-button-label {
        color: #FAFAFA;
    }
}

.x-button-round,
.x-button-decline-round,
.x-button-confirm-round {
    @include border-radius(20px);

    &:before {
        @include border-radius(19px);
    }
}

.x-button-label {
    position: relative;
    font-size: 14px;
    padding: 0 5px;
}

.x-badge {
    right: 5px;
}

// Toolbar buttons

.x-toolbar {
    .x-button {
        margin: 0 5px;
        padding: 0 10px;
        height: 33px;
    }
}

.x-toolbar-light {
    .x-button {
        border-color: #0A5A88;
        @include background(linear-gradient(color-stops(#05608F, #04557F)));
        @include box-shadow(0 0 0 1px #1C79AD);

        &:before {
            border-color: #10618A;
            @include background(linear-gradient(color-stops(#3498CB, #0974A8)));
            @include box-shadow(inset 0 1px 0 0 #55AAD5);
        }
    }

    .x-button-label {
        color: #fff;
    }

    .x-button-pressed,
    .x-button-pressing {
        border-color: #061C27;
        @include background(linear-gradient(color-stops(#020C10, #0A2B3B)));
        @include box-shadow(0 0 0 1px #3889B7);

        &:before {
            border-color: #0A2532;
            @include background(linear-gradient(color-stops(#122D3A, #0D4662)));
            @include box-shadow(inset 0 -1px 0 0 #1B4E64);
        }
    }
}

.x-toolbar-dark {
    .x-button,
    .x-button-pressing {
        border-color: #060606;
        @include background(linear-gradient(color-stops(#010101, #060606)));
        @include box-shadow(0 0 0 1px #393939);

        &:before {
            border-color: #010101;
            @include background(linear-gradient(color-stops(#404040, #262626)));
            @include box-shadow(inset 0 1px 0 0 #404040);
        }
    }

    .x-button-label {
        color: #fff;
    }

    .x-button-pressed,
    .x-button-pressing {
        &:before {
            @include background(linear-gradient(color-stops(#235F71, #0D6681)));
            @include box-shadow(inset 0 -1px 0 0 #176982);
        }
    }
}

.x-toolbar-plain,
.x-toolbar-neutral {
    .x-button-pressed,
    .x-button-pressing {
        .x-button-label {
            color: #fff;
        }

        &:before {
            @include background(linear-gradient(color-stops(#235F71, #0D6681)));
            @include box-shadow(inset 0 -1px 0 0 #176982);
        }
    }
}

// Back button

.x-toolbar .x-button-back,
.x-toolbar .x-button-forward {
    height: 45px !important;
    margin: 0 !important;
    border: 0;
    @include border-radius(0);
    @include box-shadow(none);
    background: transparent;
    background-image: none;
    @include st-box-orient(vertical);
    overflow: hidden;

    .x-button-icon {
        margin: 0 auto;
        display: block;

        &:before {
            font-family: "Chalkboard";
            font-size: 28px;
            content: '<';
            padding-left: 5px;
        }
    }

    .x-button-label {
        margin: 1px 0 3px;
        font-size: 9px;
        line-height: 12px;
    }

    &:before {
        background: transparent;
        background-image: none;
    }

    &.x-button-pressed,
    &.x-button-pressing {
        background: transparent;
        background-image: none;

        &:before {
            background: transparent;
            background-image: none;
        }
    }
}

.x-toolbar .x-button-back {
    padding-right: 15px;
    
    &:before {
        @include rotate(6deg);
        right: 5px;
        top: -5px;
        bottom: -5px;
        border-color: $base-color;
        border-width: 0 1px 0 0;
        @include border-radius(0);
    }
}

.x-toolbar .x-button-forward {
    padding-left: 15px;

    &:before {
        @include rotate(-6deg);
        left: 5px;
        top: -5px;
        bottom: -5px;
        border-color: $base-color;
        border-width: 0 0 0 1px;
        @include border-radius(0);
    }

    .x-button-icon {
        &:before {
            content: '>';
        }
    }
}

// Badges

.x-hasbadge {
    overflow: visible;
}

.x-badge {
    background-color: #0378B2;
    border: 1px solid #0796D0;
    @include border-radius(3px);
    color: #fff;
    padding: 1px 3px;
    right: -2px;
    top: -2px;
}

// Icons

.x-button-icon {
    width: 1.5em;
    height: 1.5em;

    &:before {
        color: #fff;
        font-size: 20px;
        line-height: 1.2em;
    }
}

@if $include-default-icons {
    @include icon('calendar');
    @include icon('action');
    @include icon('add');
    @include icon('arrow_down');
    @include icon('arrow_left');
    @include icon('arrow_right');
    @include icon('arrow_up');
    @include icon('compose');
    @include icon('delete');
    @include icon('organize');
    @include icon('refresh');
    @include icon('reply');
    @include icon('search');
    @include icon('settings');
    @include icon('star');
    @include icon('trash');
    @include icon('maps');
    @include icon('locate');
    @include icon('home');
    @include icon('bookmarks');
    @include icon('download');
    @include icon('favorites');
    @include icon('info');
    @include icon('more');
    @include icon('time');
    @include icon('user');
    @include icon('team');
    @include icon('list');
}

// Segmented Button

.x-segmentedbutton {
    padding: 0 2px;
    height: 33px;
    border: 1px solid;
    @include border-radius($button-border-radius);

    .x-button {
        border: 0;
        height: 27px;
        margin: 2px 1px 0 0;
        @include box-shadow(none);
        @include border-radius(0);

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

        &:before {
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            border: 0;
            @include border-radius(0);
        }
    }

    .x-first:before {
        @include border-top-left-radius(4px);
        @include border-bottom-left-radius(4px);
    }

    .x-last:before {
        @include border-top-right-radius(4px);
        @include border-bottom-right-radius(4px);
    }
}

.x-toolbar-dark {
    .x-segmentedbutton {
        border-color: #060606;
        @include background(linear-gradient(color-stops(#010101, #060606)));
        @include box-shadow(0 0 0 1px #393939);
    }
}

.x-toolbar-plain,
.x-toolbar-neutral,
.x-toolbar-light {
    .x-segmentedbutton {
        .x-button-pressing,
        .x-button-pressed {
            background-image: none;
        }
    }
}

.x-toolbar-light {
    .x-segmentedbutton {
        border-color: #0A5A88;
        @include background(linear-gradient(color-stops(#05608f, #04557f)));
        @include box-shadow(none);
    }
}

.x-toolbar-plain,
.x-toolbar-neutral {
    .x-segmentedbutton {
        border-color: #CECACE;
        @include background(linear-gradient(color-stops(#c6c3c6, #ccc)));
        @include box-shadow(none);

        .x-button {
            background-image: none;
        }
    }

    .x-button-icon:before {
        color: #000;
    }

    .x-button-pressing,
    .x-button-pressed {
        .x-button-icon:before {
            color: #fff;
        }
    }
}