// module buttons
%btn-template {
    border: 1px solid transparent;
    display: inline-block;
    font-size: 16px;
    height: 32px;
    line-height: 30px;
    padding: 0 18px;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;

    &:active,
    &:focus {
        box-shadow: none;
        outline: none;
    }
}

$btn-ghost-radius: $border-radius;

.btn-primary {
    @extend %btn-template;
    background-color: $color-blue;
    border-radius: 20px;
    color: $color-white;
    @include transition(all .3s ease);

    &:hover {
        background-color: transparent;
        border: 1px solid $color-blue;
        color: $color-blue;
    }
}

.btn-secondary {
    @extend %btn-template;
    background-color: transparent;
    border: {
        color: $color-blue;
        width: 2px;
    }
    border-radius: 20px;
    color: $color-blue;
    line-height: 28px;
}

.btn-menu {
    @include transition(all .3s);
    @include transform(rotate(0deg));
    background: transparent;
    border: 2px solid $color-blue;
    border-radius: 50%;
    box-sizing: border-box;
    height: 32px;
    margin-left: 20px;
    position: relative;
    vertical-align: middle;
    width: 32px;

    span {
        @include position(absolute, 0 7px 0);
        @include transition(background .2s ease);
        background: $color-blue;
        display: block;
        font-size: 0;
        height: 1px;
        margin: auto;

        &:before,
        &:after {
            @include position(absolute, null 0 null);
            @include transition(top, transform .3s ease);
            background: $color-blue;
            content: '';
            height: 1px;
            width: 100%;
        }

        &:before {
            top: -4px;
        }

        &:after {
            bottom: -4px;
        }
    }

    &:hover {
        background: rgba($color-blue, 0.2);
    }

    &.active {
        span {
            background: none;

            &:before,
            &:after {
                @include transition-delay(0s, .1s);
            }

            &:before {
                @include transform(rotate(45deg));
                top: 0;
            }

            &:after {
                @include transform(rotate(-45deg));
                bottom: 0;
            }
        }
    }

    &:active,
    &:focus {
        box-shadow: none;
        outline: none;
    }
}

.btn-dropdown {
    background: transparent;
    border: none;
    box-sizing: border-box;
    font-size: 16px;
    height: 32px;
    line-height: 30px;
    padding: 0 10px;
    position: relative;
    vertical-align: middle;
    @include transition(all 0.3s);

    &:after {
        background: sassvg('angle-arrow-down', $color-white) center/contain no-repeat;
        content: '';
        display: inline-block;
        margin-left: 10px;
        width: 12px;
        height: 32px;
        vertical-align: middle;
        @include transition(all 0.15s);
        @include transform(scaleY(1));
    }

    &.active {

        &:after {
            @include transform(scaleY(-1));
        }
    }

    &:active,
    &:focus {
        box-shadow: none;
        outline: none;
    }
}

.btn-blank {
    @extend %btn-template;
    background-color: transparent;
    color: $color-blue;
    position: relative;

    &:before {
        background-color: $color-blue;
        @include position(absolute, null 18px 4px 18px);
        content: '';
        height: 1px;
        visibility: hidden;
        @include transform(scaleX(0));
        @include transition(.15s linear);
    }

    &:hover {
        &:before {
            visibility: visible;
            @include transform(scaleX(1));
        }
    }
}

//module Tooltip
.tooltip-wrapper {
    label {
        display: inline-block;
    }

    .tooltip {
        margin-left: 15px;
    }
}

.tooltip-pos-right {
    label {
        display: inline-block;
    }

    .tooltip {
        float: right;
    }
}

.tooltip {
    border: 1px solid #989898;
    border-radius: 50%;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-block;
    height: 18px;
    line-height: .8;
    margin-left: 15px;
    position: relative;
    text-decoration: none;
    width: 18px;

    &:before {
        background: sassvg('question', #989898) center/contain no-repeat;
        content: '';
        display: inline-block;
        width: 12px;
        height: 12px;
        margin-top: 2px;
        margin-left: 2px;
    }

    &:hover {
        background-color: #989898;

        &:before {
            background: sassvg('question', $color-white) center/contain no-repeat;
        }

        .tooltip-text {
            opacity: 1;
            visibility: visible;
            @include transform(translateY(-12px));
        }
    }

    &.pos-right {
        &:before {
            margin-left: -1px;
        }

        .tooltip-text {
            left: auto;
            margin: 0;
            right: 6px;

            &:after {
                border-bottom: 8px solid transparent;
                border-left: 0;
                border-right-color: $color-grey-dark;
                border-top: 0;
                left: auto;
                margin: 0;
                right: 0;
            }
        }
    }

    &-text {
        @include position(absolute, null null 100% 50%);
        background-color: $color-grey-dark;
        box-sizing: border-box;
        color: $color-white;
        display: block;
        font-size: 12px;
        line-height: 1.4;
        margin-left: -110px;
        opacity: 0;
        padding: 8px 10px;
        text-align: left;
        visibility: hidden;
        width: 220px;
        @include transition(opacity 0.2s ease-in-out, visibility 0.2s ease-in-out, transform 0.2s cubic-bezier(.71, 1.7, .77, 1.24));
        @include transform(translate3d(0, 0, 0));

        &:after {
            content: '';
            @include position(absolute, null 0 -8px 0);
            margin: 0 auto;
            @include triangle(20px 8px, $color-grey-dark, down);
        }
    }
}

// module Intro header
.sg-intro {
    &-container {
        background: $color-grey;
        display: none;
        padding: 70px 0 55px;
    }

    &-row {
        display: table;
        table-layout: fixed;
        width: 100%;
    }

    &-box {
        display: table-cell;
        vertical-align: middle;
        width: 50%;

        figure {
            float: right;
            margin: 0;
            width: 200px;

            img {
                width: 100%;
            }
        }

        &:last-child {
            text-align: right;
        }
    }

    &-title {
        display: block;
        font: {
            size: 48px;
            weight: $weight-bold;
        }
        line-height: 1.2;
        padding-bottom: 15px;
    }

    &-description {
        color: $color-grey-dark;
        font: {
            size: 24px;
            weight: $weight-light;
        }
        line-height: 1.2;

        a {
            color: $color-black;
            font: {
                weight: $weight-bold;
                style: italic;
            }
            position: relative;
            text-decoration: none;

            &:after {
                background-color: #666666;
                @include position(absolute, null 0 -2px 0);
                content: '';
                height: 1px;
                @include transform(scaleX(1));
                @include transition(.15s linear);
            }

            &:hover {
                &:after {
                    @include transform(scaleX(0));
                }
            }
        }
    }
}

// module Home secondary navigation
.sg-home-navigation {
    padding-top: 80px;

    ul {
        list-style: none;
        margin: 0;
        padding: 0;
        text-align: center;
    }

    li {
        display: inline-block;
        margin-bottom: 15px;

        button {
            @include transition(all .3s ease);
            background: none;
            border: 2px solid $color-grey;
            border-radius: 50px;
            color: $color-black;
            font: {
                size: 18px;
                weight: $weight-bold;
            }
            height: 34px;
            line-height: 30px;
            padding: 0 15px;
            text-decoration: none;
            text-transform: capitalize;

            &:hover,
            &.active {
                border-color: $color-black;
            }
        }

        + li {
            padding-left: 30px;
        }
    }
}

//module notification
.sg-notification {
    @include position(fixed, 60px 0 null);
    box-sizing: border-box;
    max-height: 123px;
    overflow-y: auto;
    text-align: center;
    z-index: 999;
    background: #754A4A;
    //@include transition(opacity .3s);
    //opacity: 0;

    &.show {
        //opacity: 1;
    }

    &.removing-10 {
        //@include transition-duration(10s);
    }

    &.removing-5 {
        //@include transition-duration(5s);
    }

    &.quick-opacity {
        //@include transition-duration(.5s);
    }

    .sg-notification-item {
        background: #319fa3;
        padding: 5px 60px 10px;
        position: relative;
        z-index: 4;
        animation: show-notification 3s normal forwards ease-in-out;

        .sg-notification-item-text {
            color: #ddd;
            display: inline-block;
            max-height: 200px;
            max-width: 100%;
            overflow-y: auto;
            vertical-align: middle;
        }

        .sg-notification-item-highlight {
            color: $color-white;
        }

        + .sg-notification-item {
            background: #0e687a;
            z-index: 3;

            + .sg-notification-item {
                background: #c8cc2b;
                z-index: 2;

                + .sg-notification-item {
                    background: #cc6726;
                    z-index: 1;
                }
            }
        }

        code {
            background: tint($color-blue, 20%);
            box-sizing: border-box;
            display: block;
            max-height: 4.9em; // 3 * 1.5 + 0.2 * 2 == 3 lines * 1.5 line-height + 0.2 vertical padding * 2
            max-width: 100%;
            overflow: hidden;
            padding: .2em;
            text-align: left;
            white-space: pre;

            &.extra-lines {
                &:after {
                    @include transform(translateX(-50%));
                    bottom: 0;
                    content: '...';
                    font-size: 16px;
                    left: 50%;
                    line-height: 1;
                    position: absolute;
                }
            }
        }
    }

    @keyframes show-notification {
        0%      {margin-top: -41px;}
        15%     {margin-top: 0;}
        85%     {margin-top: 0;}
        100%    {margin-top: -41px;}
    }

    .sg-notifications-x {
        background: none;
        border: 0;
        height: 30px;
        line-height: 30px;
        padding: 0;
        position: absolute;
        right: 10px;
        text-align: center;
        top: 4px;
        width: 30px;

        &:before {
            @include transition(.2s);
            color: $color-white;
            content: '\00D7';
            font-size: 30px;
            line-height: 1;
        }

        &:hover {
            &:before {
                color: $color-grey;
            }
        }
    }
}

//module spinner
.spinner-wrapper {
    @include position(absolute, 2px 0 1px 0);
    background: $color-white;
}

.spinner {
    @include animation(sk-scaleout 1s infinite ease-in-out);
    @include position(absolute, 50% null null 50%);
    background-color: $color-blue;
    border-radius: 100%;
    height: 60px;
    margin: -30px 0 0 -30px;
    width: 60px;
}

@include keyframes(sk-scaleout) {
    0% {
        @include transform(scale(0));
    }

    100% {
        @include transform(scale(1));
        opacity: 0;
    }
}

//module modal success message
.sg-success-message {
    text-align: center;

    .sg-check-symbol {
        display: inline-block;
        height: 32px;
        margin-top: 15px;
        position: relative;
        width: 32px;

        &:before,
        &:after {
            background: $color-blue;
            border-radius: 3px;
            content: '';
            height: 8px;
            position: absolute;
        }

        &:before {
            @include transform(rotate(45deg));
            left: -1px;
            top: 17px;
            width: 16px;
        }

        &:after {
            @include transform(rotate(-45deg));
            left: 6px;
            top: 16px;
            width: 30px;
        }
    }
}

.sg-missing {
    margin: 0 auto;
    position: relative;
    width: 960px;

    &-title {
        font: {
            size: 24px;
            weight: $weight-light;
        }
        margin: 80px 0;
        text-align: center;
    }

    &-list {
        counter-reset: steps-counter;
        list-style: none;
        margin: 0;
        padding: 0;

        &-item {
            padding: 5px 0 5px 40px;
            position: relative;

            &::before {
                color: #000;
                content: '#' counter(steps-counter);
                counter-increment: steps-counter;
                font: {
                    size: 24px;
                    weight: $weight-bold;
                }
                left: 0;
                position: absolute;
                top: 0;
            }
        }

        &-child {
            display: block;
            padding: 10px 0;
        }

        // TODO Update button class to remove these properties and layout it by wrapper element
        .btn-new {
            float: none;
            margin-left: 0;
        }
    }
}

.sg-sample-code {
    color: #808080;
    display: block;

    &-comment {
        background-color: #000;
        color: #fff;
    }

    & + & {
        margin-top: 25px;
    }
}
