/*
 * Copyright (c) 2016-2018 the original author or authors.
 *
 * Licensed under the MIT License (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.opensource.org/licenses/mit-license.php
 *
 * 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. 
 */

@import "../common/variables.less";

&.has-sidebar {
    /* Add a special margin on the left side of the dashboard for the sidebar */
    margin-left: @sidebar-expander-width;
}

.dashboard-sidebar {
    width: @sidebar-width;
    border-right: @sidebar-expander-width solid @sidebar-outline-color;
    transition: margin-left @sidebar-transition-duration, border-right @sidebar-transition-duration;

    &.collapsed {
        margin-left: -@sidebar-width;
    }

    .sidebar-expander-hitbox {
        position: absolute;
        top: 0;
        right: 0;
        height: 100%;
        width: @sidebar-expander-width * 1.5;
        margin-right: -@sidebar-expander-width * 1.5;
        z-index: 9020;
        cursor: pointer;
    }

    .sidebar-expander {
        position: absolute;
        top: 50%;
        left: 0;
        margin-top: -@sidebar-expander-height/2;
        height: @sidebar-expander-height;
        width: @sidebar-expander-width;
        color: @sidebar-expander-color;
        line-height: @sidebar-expander-height;
        text-align: center;
        font-size: @sidebar-expander-height;
    }

    .sidebar-header {
        display: block;
        width: 100%;
        border-bottom: 1px solid @sidebar-outline-color;

        color: @sidebar-header-color;
        background-color: @sidebar-header-background-color;

        h1 {
            font-size: @sidebar-header-font-size;
            margin-bottom: 0.5rem;
            padding: 1rem;
        }

        table.iconbar {
            border-top: 1px solid @sidebar-outline-color;
            width: 100%;
            color: @sidebar-iconbar-color;
            background-color: @sidebar-iconbar-background-color;
            td {
                text-align: center;
                padding: 10px 15px 5px 15px;
                a {
                    .unlink();
                    color: @sidebar-iconbar-color;
                }
                i.fa {
                    font-size: 2rem;
                }
            }
        }
    }

    .sidebar-accordion {
        display: block;
        width: 100%;

        .panel-group {
            margin-bottom: 0;
            height: 100%;
        }

        .panel-body {
            .box-sizing(border-box);
            overflow-y: auto;
        }

        .panel-group .panel-heading+.panel-collapse .panel-body {
            border-top: 0;
        }

        .panel {
            border: 0;
            color: @sidebar-panel-color;
            background-color: @sidebar-panel-background-color;
        }

        .panel-group .panel {
            margin-bottom: 0;
            border-radius: 0;
        }

        .panel-group .panel+.panel {
            margin-top: 0;
        }

        .panel-heading {
            cursor: pointer;
            padding: 10px 15px;
            border-bottom: @sidebar-heading-border-bottom;
            border-top-right-radius: 0;
            border-top-left-radius: 0;
            color: @sidebar-heading-color;
            background-color: @sidebar-heading-background-color;

            .panel-title {
                font-size: @sidebar-heading-font-size;
            }
        }

        .show-hide-widgets {
            p.centered {
                margin-bottom: 1rem;
            }

            .widget-list {
                position: relative;
                padding-left: 0;
                list-style: none; 
                li {
                    display: flex;
                    align-items: center;
                    flex-direction: row;

                    position: relative;
                    min-height: 50px;
                    padding-left: 0;
                    list-style: none; 
                    border-bottom: 1px solid #ddd;


                    > span.icon {
                        display: inline-block;
                        min-width: 30px;
                        color: @lighterText;
                        cursor: move;
                    }

                    > span.title {
                        flex-grow: 1;
                    }

                    > span.swtch {
                        display: inline-block;
                    }
                }

                .dndDraggingSource {
                    display: none;
                }
                .dndPlaceholder {
                    display: block;
                    background-color: #ddd;
                    min-height: 50px;
                }

                &.final {
                    margin-top: 1rem;
                    border-top: 1px solid #ddd;
                }
            }
        }
    }

    .sidebar-footer {
        .box-sizing(border-box);
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: @sidebar-footer-height;
        padding: 1rem;
        border-top: 1px solid @sidebar-outline-color;
        color: @sidebar-footer-color;
        background-color: @sidebar-footer-background-color;

        .logos {
            .user-select(none);
            text-align: center;

            a {
                .unlink();
            }

            img {
                height: 32px;
                vertical-align: top;
                margin-right: .4rem;
                cursor: pointer;
            }
        }
    }
}
