/*!
 * 
 * Copyright (c) 2019-2023 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA,
 * and/or its subsidiaries and/or its affiliates and/or their licensors.
 *     
 */

@import "../variables";
@import "../mixins";
@import "../variables/appswitchers_vars";

// misc vars
$grid-breakpoint: 992px;

.dlt-app-switcher {
    @include component-vars(app-switchers); //Mixin to define all the root variables
    display: inline-block;
    position: relative;

    .dlt-icon-app-switcher{
        color: $app-switchers-color-icon-interactive-secondary;
    }

    &.dlt-open .dlt-app-switcher-draw {
        display: block;
    }
}

.dlt-app-switcher-draw {
    width: 392px;
    height: auto;
    padding: 0;
    position: absolute;
    @include box-shadow($app-switchers-box-shadow);
    background: $app-switchers-color-background;
    border-radius: $app-switchers-border-radii;
    @include box-shadow($app-switchers-box-shadow);
    left: auto !important;
    right: 4px;
    top: 140%;
    display: none;
    z-index: $app-switchers-z-index;

    &:after,
    &:before {
        bottom: 100%;
        border: $app-switchers-after-border-style transparent;
        content: $app-switchers-after-content;
        height: 0;
        width: 0;
        position: $app-switchers-after-position;
        pointer-events: none;
    }

    &:after {
        border-color: $app-switchers-after-border-color;
        border-width: $app-switchers-after-border-width;
        left: $app-switchers-after-border-pos-left;
        right: $app-switchers-after-border-pos-right;
        -webkit-filter: $app-switchers-after-webkit-filter;
        -moz-filter: $app-switchers-after-webkit-filter;
        filter: $app-switchers-after-filter;
    }

    &:before {
        border-color: rgba(113, 158, 206, 0);
        border-width: 20px;
        left: 50%;
        margin-left: -20px;
    }

    .dlt-app-switcher-wrap {
        height: auto;
        width: 100%;
        padding: $app-switchers-space-top 0 $app-switchers-space-bottom 0;
        min-height: 260px;
        max-height: 564px;
        overflow-y: scroll;
    }

    .apps-list {
        margin: 0;
        padding: 0 0 0 $app-switchers-space-left;
        list-style: none;
        display: flex;
        flex-flow: row wrap;
        justify-content: stretch;

        >a {
            padding: 0 2px;
            width: 104px;
            height: 104px;
            text-align: center;
            display: flex;
            flex-flow: column nowrap;
            align-items: stretch;
            line-height: $app-switchers-text-line-height;
            color: $app-switchers-color-text;
            border: $app-switchers-border-width-hover $app-switchers-border-style-hover transparent;
            font-size: $app-switchers-item-font-size;
            font-weight: $app-switchers-item-font-weight;
            margin: $app-switchers-space-top $app-switchers-space-right 0 0;

            &:nth-child(-n+3) {
                margin-top: 0;
            }

            &:nth-child(3n+3) {
                margin-right: 0;
            }

            &:hover,
            &:focus,
            &:active {
                text-decoration: none;
                border: $app-switchers-border-width-hover $app-switchers-border-style-hover $app-switchers-color-primary;
            }

            &:active {
                background-color: $app-switchers-color-primary-light;
            }

        }

        svg,
        i {
            display: block;
            margin: 10px auto 8px;

            width: 40px;
            height: 40px;
            font-size: 40px;
            line-height: 1;
            color: $app-switchers-color-icon-interactive-secondary;
            fill: $app-switchers-color-icon-interactive-secondary;

            @media(min-width: $grid-breakpoint) {
                width: 40px;
                height: 40px;
                font-size: 40px;
                padding: 0 1px;
            }
        }

        i {

            @media(min-width: $grid-breakpoint) {
                padding: 0;
            }
        }

        +.apps-list {
            margin-top: calc($app-switchers-space-top - 1px);
            position: relative;

            h6 {
                display: flex;
                flex: 0 100%;
                color: $app-switchers-color-title;
                font-size: $app-switchers-title-font-size;
                font-weight: $app-switchers-title-font-weight;
                margin-bottom: 1rem;
                margin-top: 0;
            }

            >a {
                &:nth-child(-n+3) {
                    margin-top: 0;
                }

                &:nth-child(3n+3) {
                    margin-right: $app-switchers-space-right;
                }

                &:nth-child(-n+4) {
                    margin-top: 0;
                }

                &:nth-child(3n+4) {
                    margin-right: 0;
                }
            }

            &:before {
                content: '';
                display: block;
                border-top: $app-switchers-border-width $app-switchers-border-style $app-switchers-color-border;
                width: calc(100% - 16px);
                margin-bottom: $app-switchers-space-bottom;
            }
        }
    }

}

.dlt-app-switcher .mCSB_inside>.mCSB_container {
    margin-right: 0;
}

.dlt-app-switcher .mCSB_scrollTools {
    width: .25rem;
    right: 8px;
    border-radius: $app-switchers-border-radii;
    background: $app-switchers-color-scrollbar-track;
}

.dlt-app-switcher.mCSB_draggerContainer {
    right: 0 !important;
}

.dlt-app-switcher .mCSB_dragger_bar {
    border-radius: $app-switchers-border-radii!important;
    background-color: $app-switchers-color-scrollbar-thumb!important;
}

.dlt-app-switcher .mCSB_draggerRail {
    opacity: 0;
    border-radius: $app-switchers-border-radii;
}