// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at

//     http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

$color_scarlet_approx: #ff3111;
$color_pippin_approx: #fbe3e4;
$color_your_pink_approx: #fbc2c4;
$color_falu_red_approx: #8a1f11;

%wizard_tabcontrol {
    display: block;
    width: 100%;
}

%extend_2 {
    list-style: none !important;
    padding: 0;
    margin: 0;
}

%extend_3 {
    display: block;
    width: auto;
    margin: 0 .5em .5em;
    padding: 1em;
    text-decoration: none;
    position: relative;
    border-radius: 5px;
}

%extend_4 {
    background: #f5f5f5;
    color: #bbb;
    cursor: default;
}

%extend_5 {
    background: $color_keppel_approx;
    color: $white;
    cursor: default;
}

%extend_befor_after {
    content: " ";
    display: block;
    width: 0;
    height: 0;
    border-top: 50px solid transparent;
    border-bottom: 50px solid transparent;
    position: absolute;
    top: 50%;
    margin-top: -50px;
    left: 100%;
}

.wizard {
    @extend %wizard_tabcontrol;

    a {
        outline: 0;
    }

    ul {
        @extend %extend_2;

        >li {
            display: block;
            padding: 0;
        }
    }

    > {
        .steps {
            position: relative;
            display: block;
            width: 100%;

            .current-info {
                position: absolute;
                left: -999em;
            }

            .number {
                font-size: 1.429em;
            }

            &>ul {
                position: relative;
                border: 0;
                padding: 0px;
                background: #f5f5f5;
                border-radius: 0;
                list-style: none;
                overflow: hidden;
                margin-bottom: 10px;

                >li {
                    width: 25%;
                    float: left;

                    &:first-child>a {
                        padding-left: 15px;
                    }

                    a {
                        @extend %extend_3;

                        &:hover {
                            cursor: pointer;
                        }

                        margin: 0;
                        border: none;
                        border-radius: 0;
                        padding: 10px 0 10px 45px;

                        &:before {
                            @extend %extend_befor_after;
                            border-left: 30px solid #ddd;
                            margin-left: 1px;
                            z-index: 1;
                        }

                        &:after {
                            @extend %extend_befor_after;
                            border-left: 30px solid #f5f5f5;
                            z-index: 2;
                        }
                    }

                    &.disabled a {
                        @extend %extend_4;
                    }

                    &.current a {
                        @extend %extend_5;

                        &:after {
                            border-left: 30px solid $color_keppel_approx;
                        }
                    }

                    &.done a {
                        background: #b4e5d9;
                        color: $white;

                        &:after {
                            border-left: 30px solid #b4e5d9;
                        }
                    }

                    &.error a {
                        background: $color_scarlet_approx;
                        color: $white;

                        &:after {
                            border-left: 30px solid $color_scarlet_approx;
                        }
                    }
                }
            }
        }

        .content {
            background: #f5f5f5;
            display: block;
            margin: .5em;
            position: relative;
            width: 100%; //Instead of the line below you could use @include border-radius($radius, $vertical-radius)
            border-radius: 5px;

            > {
                .title {
                    display: none;
                }

                .body {
                    float: left;
                    width: 100%;
                    height: 95%;
                    padding: 2.5%;

                    >ul {
                        list-style: disc !important;

                        >li {
                            display: list-item;
                        }
                    }
                }
            }
        }

        .actions {
            position: relative;
            display: block;
            text-align: right;
            width: 100%;

            ul[role="menu"] {
                li+li {
                    margin-left: 5px;
                }

                li.disabled {
                    a {
                        opacity: .65;
                    }
                }

                a {
                    padding: 10px 20px;
                    background-color: $color_keppel_approx;
                    color: $white;
                    margin-bottom: 10px;
                    border: 1px $color_keppel_approx solid;
                    border-radius: 4px;
                    transition: all .3s ease;
                    margin: 2px;
                }

                a[href="#cancel"] {
                    padding: 10px 20px;
                    background-color: transparent;
                    color: $color_keppel_approx;
                    margin-bottom: 10px;
                    border: 1px $color_keppel_approx solid;
                    border-radius: 4px;
                    transition: all .3s ease;
                    margin: 2px;
                }
            }

            >ul {
                display: inline-block;
                text-align: right;

                >li {
                    float: left;
                    margin: 0 .5em;
                }
            }
        }

        .loading .spinner {}
    }

    &.vertical> {
        .steps {
            display: inline;
            float: left;
            width: 30%;

            >ul>li {
                float: none;
                width: 100%;
            }
        }

        .content {
            display: inline;
            float: left;
            margin: 0 2.5% .5em 2.5%;
            width: 65%;
        }

        .actions {
            display: inline;
            float: right;
            margin: 0 2.5%;
            width: 95%;

            >ul>li {
                margin: 0 0 0 1em;
            }
        }
    }
}

.tabcontrol {
    @extend %wizard_tabcontrol;

    a {
        outline: 0;
    }

    ul {
        @extend %extend_2;

        >li {
            display: block;
            padding: 0;
        }
    }

    > {
        .steps .current-info {
            position: absolute;
            left: -999em;
        }

        .content>.title {
            display: none;
        }
    }
}

@media(max-width: 600px) {
    .wizard {
        >.steps {
            a {
                margin-top: .5em;

                &:hover {
                    margin-top: .5em;
                }

                &:active {
                    margin-top: .5em;
                }
            }

            >ul>li {
                width: 50%;
            }
        }

        &.vertical> {
            .steps {
                display: block;
                float: none;
                width: 100%;
            }

            .actions {
                display: block;
                float: none;
                width: 100%;
            }

            .content {
                display: block;
                float: none;
                margin: 0 .5em .5em;
                width: auto;
            }
        }
    }
}

@media(max-width: 480px) {
    .wizard>.steps>ul>li {
        width: 100%;
    }
}

.wizard-modal {
    .modal-body {
        overflow: hidden;
        max-height: none;
    }

    .wizard {
        position: relative;
        width: 100%;
        height: 100%;

        .content {
            max-height: 400px;
            overflow: auto;
            margin: 0px 0px 15px 0px;
        }

        .actions {
            >ul>li {
                margin: 0px;
            }
        }
    }
}